Skip to content

Commit

Permalink
Allow non-admin users to delete review requests (#29057)
Browse files Browse the repository at this point in the history
Fix #14459

The following users can add/remove review requests of a PR
- the poster of the PR
- the owner or collaborators of the repository
- members with read permission on the pull requests unit
  • Loading branch information
Zettat123 authored Feb 24, 2024
1 parent 267dbb4 commit c42083a
Show file tree
Hide file tree
Showing 33 changed files with 656 additions and 103 deletions.
24 changes: 24 additions & 0 deletions models/fixtures/access.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,27 @@
user_id: 31
repo_id: 28
mode: 4

-
id: 24
user_id: 38
repo_id: 60
mode: 2

-
id: 25
user_id: 38
repo_id: 61
mode: 1

-
id: 26
user_id: 39
repo_id: 61
mode: 1

-
id: 27
user_id: 40
repo_id: 61
mode: 4
6 changes: 6 additions & 0 deletions models/fixtures/collaboration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@
repo_id: 22
user_id: 18
mode: 2 # write

-
id: 9
repo_id: 60
user_id: 38
mode: 2 # write
24 changes: 24 additions & 0 deletions models/fixtures/email_address.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,27 @@
lower_email: user37@example.com
is_activated: true
is_primary: true

-
id: 38
uid: 38
email: user38@example.com
lower_email: user38@example.com
is_activated: true
is_primary: true

-
id: 39
uid: 39
email: user39@example.com
lower_email: user39@example.com
is_activated: true
is_primary: true

-
id: 40
uid: 40
email: user40@example.com
lower_email: user40@example.com
is_activated: true
is_primary: true
34 changes: 34 additions & 0 deletions models/fixtures/issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,37 @@
created_unix: 978307210
updated_unix: 978307210
is_locked: false

-
id: 21
repo_id: 60
index: 1
poster_id: 39
original_author_id: 0
name: repo60 pull1
content: content for the 1st issue
milestone_id: 0
priority: 0
is_closed: false
is_pull: true
num_comments: 0
created_unix: 1707270422
updated_unix: 1707270422
is_locked: false

-
id: 22
repo_id: 61
index: 1
poster_id: 40
original_author_id: 0
name: repo61 pull1
content: content for the 1st issue
milestone_id: 0
priority: 0
is_closed: false
is_pull: true
num_comments: 0
created_unix: 1707270422
updated_unix: 1707270422
is_locked: false
18 changes: 18 additions & 0 deletions models/fixtures/org_user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,21 @@
uid: 5
org_id: 36
is_public: true

-
id: 18
uid: 38
org_id: 41
is_public: true

-
id: 19
uid: 39
org_id: 41
is_public: true

-
id: 20
uid: 40
org_id: 41
is_public: true
18 changes: 18 additions & 0 deletions models/fixtures/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,21 @@
index: 1
head_repo_id: 23
base_repo_id: 23

-
id: 9
type: 0 # gitea pull request
status: 2 # mergable
issue_id: 21
index: 1
head_repo_id: 60
base_repo_id: 60

-
id: 10
type: 0 # gitea pull request
status: 2 # mergable
issue_id: 22
index: 1
head_repo_id: 61
base_repo_id: 61
42 changes: 42 additions & 0 deletions models/fixtures/repo_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -676,3 +676,45 @@
type: 1
config: "{}"
created_unix: 946684810

-
id: 102
repo_id: 60
type: 1
config: "{}"
created_unix: 946684810

-
id: 103
repo_id: 60
type: 2
config: "{\"EnableTimetracker\":true,\"AllowOnlyContributorsToTrackTime\":true}"
created_unix: 946684810

-
id: 104
repo_id: 60
type: 3
config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}"
created_unix: 946684810

-
id: 105
repo_id: 61
type: 1
config: "{}"
created_unix: 946684810

-
id: 106
repo_id: 61
type: 2
config: "{\"EnableTimetracker\":true,\"AllowOnlyContributorsToTrackTime\":true}"
created_unix: 946684810

-
id: 107
repo_id: 61
type: 3
config: "{\"IgnoreWhitespaceConflicts\":false,\"AllowMerge\":true,\"AllowRebase\":true,\"AllowRebaseMerge\":true,\"AllowSquash\":true}"
created_unix: 946684810
62 changes: 62 additions & 0 deletions models/fixtures/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1706,3 +1706,65 @@
is_private: true
status: 0
num_issues: 0

-
id: 60
owner_id: 40
owner_name: user40
lower_name: repo60
name: repo60
default_branch: main
num_watches: 0
num_stars: 0
num_forks: 0
num_issues: 0
num_closed_issues: 0
num_pulls: 1
num_closed_pulls: 0
num_milestones: 0
num_closed_milestones: 0
num_projects: 0
num_closed_projects: 0
is_private: false
is_empty: false
is_archived: false
is_mirror: false
status: 0
is_fork: false
fork_id: 0
is_template: false
template_id: 0
size: 0
is_fsck_enabled: true
close_issues_via_commit_in_any_branch: false

-
id: 61
owner_id: 41
owner_name: org41
lower_name: repo61
name: repo61
default_branch: main
num_watches: 0
num_stars: 0
num_forks: 0
num_issues: 0
num_closed_issues: 0
num_pulls: 1
num_closed_pulls: 0
num_milestones: 0
num_closed_milestones: 0
num_projects: 0
num_closed_projects: 0
is_private: false
is_empty: false
is_archived: false
is_mirror: false
status: 0
is_fork: false
fork_id: 0
is_template: false
template_id: 0
size: 0
is_fsck_enabled: true
close_issues_via_commit_in_any_branch: false
22 changes: 22 additions & 0 deletions models/fixtures/team.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,25 @@
num_members: 1
includes_all_repositories: false
can_create_org_repo: true

-
id: 21
org_id: 41
lower_name: owners
name: Owners
authorize: 4 # owner
num_repos: 1
num_members: 1
includes_all_repositories: true
can_create_org_repo: true

-
id: 22
org_id: 41
lower_name: team1
name: Team1
authorize: 1 # read
num_repos: 1
num_members: 2
includes_all_repositories: false
can_create_org_repo: false
12 changes: 12 additions & 0 deletions models/fixtures/team_repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@
org_id: 17
team_id: 9
repo_id: 24

-
id: 12
org_id: 41
team_id: 21
repo_id: 61

-
id: 13
org_id: 41
team_id: 22
repo_id: 61
36 changes: 36 additions & 0 deletions models/fixtures/team_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,39 @@
team_id: 2
type: 8
access_mode: 2

-
id: 49
team_id: 21
type: 1
access_mode: 4

-
id: 50
team_id: 21
type: 2
access_mode: 4

-
id: 51
team_id: 21
type: 3
access_mode: 4

-
id: 52
team_id: 22
type: 1
access_mode: 1

-
id: 53
team_id: 22
type: 2
access_mode: 1

-
id: 54
team_id: 22
type: 3
access_mode: 1
18 changes: 18 additions & 0 deletions models/fixtures/team_user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,21 @@
org_id: 17
team_id: 9
uid: 15

-
id: 23
org_id: 41
team_id: 21
uid: 40

-
id: 24
org_id: 41
team_id: 22
uid: 38

-
id: 25
org_id: 41
team_id: 22
uid: 39
Loading

0 comments on commit c42083a

Please sign in to comment.