Commit Graph

101 Commits

Author SHA1 Message Date
GitLab Bot 4ecd816dcb Add latest changes from gitlab-org/gitlab@master 2023-12-21 09:17:08 +00:00
GitLab Bot 45465a1f21 Add latest changes from gitlab-org/gitlab@master 2023-12-15 00:12:58 +00:00
GitLab Bot ce79b3dd66 Add latest changes from gitlab-org/gitlab@master 2023-10-13 09:12:02 +00:00
GitLab Bot b27ec7e464 Add latest changes from gitlab-org/gitlab@master 2023-09-28 21:10:21 +00:00
GitLab Bot 9a4a8e6be7 Add latest changes from gitlab-org/gitlab@master 2023-08-28 21:10:41 +00:00
GitLab Bot 0624f8b515 Add latest changes from gitlab-org/gitlab@master 2023-07-20 03:08:56 +00:00
GitLab Bot bdad4dd5da Add latest changes from gitlab-org/gitlab@master 2023-06-06 00:08:24 +00:00
GitLab Bot 3ca896b640 Add latest changes from gitlab-org/gitlab@master 2023-05-23 18:08:27 +00:00
GitLab Bot 66d107f939 Add latest changes from gitlab-org/gitlab@master 2023-03-28 06:15:42 +00:00
GitLab Bot e129eff883 Add latest changes from gitlab-org/gitlab@master 2022-07-05 18:08:43 +00:00
GitLab Bot b7b44de429 Add latest changes from gitlab-org/gitlab@master 2022-06-16 09:09:15 +00:00
GitLab Bot 48d9e7ff8d Add latest changes from gitlab-org/gitlab@master 2022-05-12 03:08:58 +00:00
GitLab Bot 6a9ab27963 Add latest changes from gitlab-org/gitlab@master 2022-03-15 12:07:44 +00:00
GitLab Bot fbf2955cfc Add latest changes from gitlab-org/gitlab@master 2022-03-14 18:07:46 +00:00
GitLab Bot bf1a77ead7 Add latest changes from gitlab-org/gitlab@master 2022-02-23 06:18:49 +00:00
GitLab Bot 78cfc7cf4a Add latest changes from gitlab-org/gitlab@master 2022-02-15 15:15:04 +00:00
GitLab Bot e7e44c0e4c Add latest changes from gitlab-org/gitlab@master 2022-02-15 09:17:01 +00:00
GitLab Bot 6b5937e93e Add latest changes from gitlab-org/gitlab@master 2022-01-20 09:11:11 +00:00
GitLab Bot 6a5b78ac69 Add latest changes from gitlab-org/gitlab@master 2021-12-07 03:12:22 +00:00
GitLab Bot e5d3d8c323 Add latest changes from gitlab-org/gitlab@master 2021-10-25 12:10:19 +00:00
GitLab Bot 0356944a05 Add latest changes from gitlab-org/gitlab@master 2021-09-01 09:10:58 +00:00
GitLab Bot b487021bd3 Add latest changes from gitlab-org/gitlab@master 2021-08-17 12:08:42 +00:00
GitLab Bot 7134e029c5 Add latest changes from gitlab-org/gitlab@master 2021-08-13 15:11:15 +00:00
GitLab Bot e4632f4c63 Add latest changes from gitlab-org/gitlab@master 2021-06-28 18:08:39 +00:00
GitLab Bot 0ae8428c8e Add latest changes from gitlab-org/gitlab@master 2021-05-11 21:10:21 +00:00
GitLab Bot e5e0589e09 Add latest changes from gitlab-org/gitlab@master 2021-04-26 12:09:44 +00:00
GitLab Bot a5605d87fb Add latest changes from gitlab-org/gitlab@master 2021-04-13 18:11:28 +00:00
GitLab Bot 6de7d2c195 Add latest changes from gitlab-org/gitlab@master 2020-09-16 15:09:32 +00:00
GitLab Bot 8f9beefac3 Add latest changes from gitlab-org/gitlab@master 2020-03-23 12:09:47 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Jan Provaznik 4d7fa59af2
Sent notification only to authorized users
When moving a project, it's possible that some users who had
access to the project in old path can not access the project
in the new path.

Because `project_authorizations` records are updated asynchronously,
when we send the notification about moved project the list of project
team members contains old project members, we want to notify all these
members except the old users who can not access the new location.
2019-01-31 16:52:49 +01:00
gfyoung 50abbd3e53 Enable frozen string in app/models/*.rb
Partially addresses #47424.
2018-07-26 16:55:41 -07:00
Mark Chao a63bce1a4b Resolve "Rename the `Master` role to `Maintainer`" Backend 2018-07-11 14:36:08 +00:00
Lin Jen-Shin 2024522b51 Bring changes from EE 2018-06-26 02:58:41 +08:00
Tiago Botelho deb4bfa468 Backport relevant changes from EE https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4827 to CE 2018-03-07 17:01:32 +00:00
blackst0ne 27c95364b5 Replace '.team << [user, role]' with 'add_role(user)' in specs 2017-12-22 19:18:28 +11:00
Mike Greiling 2c569be63b Resolve "Display member role per project" 2017-12-07 09:11:41 +00:00
Stan Hu 8690ca5c28 Eliminate N+1 queries in loading discussions.json endpoint
In #37955,we see that the profile had a number of N+1 queries from repeated
access to `cross_reference_not_visible_for?`. This was optimized in previous
versions of GitLab by rendering all notes at once, counting the number of
visible references, and then using that number to check whether a system note
should be fully redacted.

There was also another N+1 query calling `ProjectTeam#member?`, which did not
take advantage of an optimization in prepare_notes_for_rendering that would
preload the maximum access level per project.

Closes #37955
2017-09-18 06:53:33 -07:00
micael.bergeron 966b1128d8 WIP: refactor the first-contributor to Issuable
this will remove the need make N queries (per-note) at the
cost of having to mark notes with an attribute

this opens up the possibility for other special roles for notes
2017-09-06 09:00:57 -04:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Sean McGivern 7f73f440f9 Fix N+1 queries for non-members in comment threads
When getting the max member access for a group of users, we stored the results
in RequestStore. However, this will only return results for project members, so
anyone who wasn't a member of the project would be checked once at the start,
and then once for each comment they made. These queries are generally quite
fast, but no query is faster!
2017-06-01 10:21:26 +01:00
Dmitriy Zaporozhets c6960ded8a
Refactor add_users method for project and group
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-04-21 18:38:10 +03:00
Stan Hu ced1bbab0c Eliminate unnecessary queries that add ~500 ms of load time for a large issue
Looking at the SQL log, we see useless queries such as:

```
D, [2017-03-22T03:25:00.726710 #2629] DEBUG -- :    (235.9ms)  SELECT MAX("project_authorizations"."access_level") AS maximum_access_level, "project_authorizations"."user_id" AS project_authorizations_user_id FROM "project_authorizations" WHERE "project_authorizations"."project_id" = 13083 AND 1=0 GROUP BY "project_authorizations"."user_id"  [["project_id", 13083]]
```
2017-03-30 23:00:00 -07:00
Ahmad Sherif 2ea5ef0ba4 Update ProjectTeam#fetch_members to use project authorizations 2016-11-23 12:59:13 +02:00
Ahmad Sherif 747959a832 Update ProjectTeam#max_member_access_for_user_ids to use project authorizations 2016-11-23 12:59:13 +02:00
Ahmad Sherif 916332815e Drop Project#authorized_for_user? in favor of ProjectTeam#member?
Closes #23938
2016-11-23 12:57:58 +02:00
Robert Speicher eef3609123 Add shortcuts for adding users to a project team with a specific role
This also updates _some_ specs to use these new methods, just to serve
as an example for others going forward, but by no means is this
exhaustive.

Original implementations at !5992 and !6012.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/20944
2016-11-18 14:55:04 +02:00
Sean McGivern db9979bcad Fix project member access for group links
`ProjectTeam#find_member` doesn't take group links into account. It was
used in two places:

1. An admin view - it can stay here.
2. `ProjectTeam#member?`, which is often used to decide if a user has
   access to view something.

This second part broke confidential issues viewing. `IssuesFinder` ends
up delegating to `Project#authorized_for_user?`, which does consider
group links, so users with access to the project via a group link could
see confidential issues on the index page. However, `IssuesPolicy` used
`ProjectTeam#member?`, so the same user couldn't view the issue when
going to it directly.
2016-10-28 09:20:55 +01:00
Rémy Coutable ec0061a95c Allow Member.add_user to handle access requesters
Changes include:

- Ensure Member.add_user is not called directly when not necessary
- New GroupMember.add_users_to_group to have the same abstraction level as for Project
- Refactor Member.add_user to take a source instead of an array of members
- Fix Rubocop offenses
- Always use Project#add_user instead of project.team.add_user
- Factorize users addition as members in Member.add_users_to_source
- Make access_level a keyword argument in GroupMember.add_users_to_group and ProjectMember.add_users_to_projects
- Destroy any requester before adding them as a member
- Improve the way we handle access requesters in Member.add_user
  Instead of removing the requester and creating a new member,
  we now simply accepts their access request. This way, they will
  receive a "access request granted" email.
- Fix error that was previously silently ignored
- Stop raising when access level is invalid in Member, let Rails validation do their work

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-28 09:43:00 +02:00
Robert Speicher e2c2bd69f2 Simplify invited_group_members filter-by-level 2016-09-21 15:28:26 +03:00