[PR #4533] [MERGED] Don't fail silently if trying to add a collaborator twice #17415

Closed
opened 2025-11-02 13:15:45 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/4533
Author: @adelowo
Created: 7/28/2018
Status: Merged
Merged: 8/7/2018
Merged by: @lunny

Base: masterHead: fail_if_collaborator_already_exists


📝 Commits (7)

  • d3d6096 don't fail silently if trying to add a collaborator twice
  • b3448f9 fix translation text
  • 6d36ff7 added collaborator test
  • 61cb9b9 improvee testcases
  • 618dabd Added tests to make sure a collaborator cannot be added twice
  • b174273 Merge remote-tracking branch 'origin/master' into fail_if_collaborator_already_exists
  • 3b9c163 Merge branch 'master' into fail_if_collaborator_already_exists

📊 Changes

3 files changed (+109 additions, -0 deletions)

View changed files

📝 options/locale/locale_en-US.ini (+1 -0)
📝 routers/repo/setting.go (+6 -0)
📝 routers/repo/settings_test.go (+102 -0)

📄 Description

While wanting to work on #4507, I noticed that adding a collaborator twice leads to a success message saying collaborator has been added when the collaborator wasn't infact added again, I think that is the way xorm's InsertOne works ( correct me if wrong).. This PR makes sure to check if the user is already a collaborator thus returning early ....


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/4533 **Author:** [@adelowo](https://github.com/adelowo) **Created:** 7/28/2018 **Status:** ✅ Merged **Merged:** 8/7/2018 **Merged by:** [@lunny](https://github.com/lunny) **Base:** `master` ← **Head:** `fail_if_collaborator_already_exists` --- ### 📝 Commits (7) - [`d3d6096`](https://github.com/go-gitea/gitea/commit/d3d6096a3ade335ea2c46bd07c526fab00bc3d05) don't fail silently if trying to add a collaborator twice - [`b3448f9`](https://github.com/go-gitea/gitea/commit/b3448f9516464691fe23725e983c098e7623689b) fix translation text - [`6d36ff7`](https://github.com/go-gitea/gitea/commit/6d36ff70bfa470d80e7b5a3e36a6de20ecd59914) added collaborator test - [`61cb9b9`](https://github.com/go-gitea/gitea/commit/61cb9b90a74a8de828c1bd4c92c255bf3e6bb41f) improvee testcases - [`618dabd`](https://github.com/go-gitea/gitea/commit/618dabdd39ba5a3d306e56e2ae19f119af5dbc01) Added tests to make sure a collaborator cannot be added twice - [`b174273`](https://github.com/go-gitea/gitea/commit/b174273957baacbe14a9ee30fe5f6a2741a9e33c) Merge remote-tracking branch 'origin/master' into fail_if_collaborator_already_exists - [`3b9c163`](https://github.com/go-gitea/gitea/commit/3b9c163e3e026a00bc047d5416625d95d396e886) Merge branch 'master' into fail_if_collaborator_already_exists ### 📊 Changes **3 files changed** (+109 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `options/locale/locale_en-US.ini` (+1 -0) 📝 `routers/repo/setting.go` (+6 -0) 📝 `routers/repo/settings_test.go` (+102 -0) </details> ### 📄 Description While wanting to work on #4507, I noticed that adding a collaborator twice leads to a ___success message___ saying **collaborator has been added** when the collaborator wasn't infact added again, I think that is the way xorm's `InsertOne` works ( correct me if wrong).. This PR makes sure to check if the user is already a collaborator thus returning early .... --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 13:15:45 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17415