summaryrefslogtreecommitdiff
path: root/app/models/project_team.rb
Commit message (Collapse)AuthorAgeFilesLines
* Bring changes from EEunify-some-modelsLin Jen-Shin2018-06-261-1/+1
|
* Backport relevant changes from EE ↵backport-ee-3892-to-ceTiago Botelho2018-03-071-0/+9
| | | | https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4827 to CE
* Replace '.team << [user, role]' with 'add_role(user)' in specs36782-replace-team-user-role-with-add_role-user-in-specsblackst0ne2017-12-221-20/+8
|
* Resolve "Display member role per project"Mike Greiling2017-12-071-29/+8
|
* Eliminate N+1 queries in loading discussions.json endpointsh-optimize-discussion-jsonStan Hu2017-09-181-1/+1
| | | | | | | | | | | | | | 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
* WIP: refactor the first-contributor to Issuablemicael.bergeron2017-09-061-1/+1
| | | | | | | 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
* Enable Style/DotPosition Rubocop :cop:Grzegorz Bizon2017-06-211-4/+4
|
* Fix N+1 queries for non-members in comment threadsfix-n-plus-one-queries-for-user-accessSean McGivern2017-06-011-1/+8
| | | | | | | | 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!
* Refactor add_users method for project and groupdz-cleanup-add-usersDmitriy Zaporozhets2017-04-211-2/+2
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Eliminate unnecessary queries that add ~500 ms of load time for a large issueStan Hu2017-03-301-0/+3
| | | | | | | | 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]] ```
* Update ProjectTeam#fetch_members to use project authorizationsfix/drop-project-authorized-for-userAhmad Sherif2016-11-231-53/+7
|
* Update ProjectTeam#max_member_access_for_user_ids to use project authorizationsAhmad Sherif2016-11-231-43/+6
|
* Drop Project#authorized_for_user? in favor of ProjectTeam#member?Ahmad Sherif2016-11-231-2/+6
| | | | Closes #23938
* Add shortcuts for adding users to a project team with a specific rolers-project-team-helpersRobert Speicher2016-11-181-0/+16
| | | | | | | | | | 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
* Fix project member access for group linksSean McGivern2016-10-281-8/+2
| | | | | | | | | | | | | | | | `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.
* Allow Member.add_user to handle access requestersRémy Coutable2016-09-281-4/+10
| | | | | | | | | | | | | | | | | | | | | 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>
* Simplify invited_group_members filter-by-levelRobert Speicher2016-09-211-6/+6
|
* Use `public_send` over `send` in ProjectTeamRobert Speicher2016-09-211-3/+3
|
* Improve clarity of variable names in ProjectTeam#fetch_invited_membersrs-simplify-fetch_membersRobert Speicher2016-09-201-14/+12
|
* Fix a logic error in ProjectTeam#fetch_invited_membersRobert Speicher2016-09-201-2/+2
| | | | | | We were calling `.where` and `.send` on the relation, but never doing anything with the return value, resulting in proper access-level filtering never being of any consequence.
* Simplify ProjectTeam#fetch_members to satisfy flogRobert Speicher2016-09-201-30/+40
|
* Add expiration date to group membershipsSean McGivern2016-08-181-3/+3
|
* Merge branch 'master' into expiration-date-on-membershipsSean McGivern2016-08-181-3/+8
|\
| * Fix Rename `add_users_into_project` and `projects_ids`Herminio Torres2016-08-041-1/+1
| | | | | | | | | | | | We never add things `into` projects, we just add them `to` projects. So how about we rename this to `add_users_to_project`. Rename `projects_ids` to `project_ids` by following the convention of rails.
| * Only use RequestStore in ProjectTeam#max_member_access_for_user if it is activeStan Hu2016-08-011-2/+7
| |
* | Replace optional parameters with keyword arguments.Adam Niedzielski2016-08-021-5/+5
| |
* | WIPAdam Niedzielski2016-08-011-2/+3
|/
* Fix typo in commentStan Hu2016-07-261-1/+1
|
* Optimize the invited group link access level checkStan Hu2016-07-261-17/+21
|
* Incorporate review commentsStan Hu2016-07-261-4/+4
|
* Optimize maximum user access level lookup in loading of notesStan Hu2016-07-261-11/+35
| | | | | | | | NotesHelper#note_editable? and ProjectTeam#human_max_access currently take about 16% of the load time of an issue page. This MR preloads the maximum access level of users for all notes in issues and merge requests with several queries instead of one per user and caches the result in RequestStore.
* Load project invited groups and members eagerly in ProjectTeam#fetch_membersfix/load-project-invited-groups-and-members-eagerlyAhmad Sherif2016-07-221-1/+1
|
* Exclude requesters from Project#members, Group#members and User#membersexplicit-requesters-scopeRémy Coutable2016-07-011-7/+7
| | | | | | And create new Project#requesters, Group#requesters scopes. Signed-off-by: Rémy Coutable <remy@rymai.me>
* Reduce overhead and optimize ProjectTeam#max_member_access performanceStan Hu2016-06-291-12/+2
| | | | | | | | | | | The previous implementation would load the entire team member list and their respective attributes. Now we only search for the user's specific access level. In gitlab-com/operations#42, this reduces the overall overhead of rendering the issue from 28% to 20%. First step of optimizing #19273
* UI and copywriting improvements13948-access-request-to-projects-and-groupsRémy Coutable2016-06-141-7/+11
| | | | | | | | | + Move 'Edit Project/Group' out of membership-related partial + Show the access request buttons only to logged-in users + Put the request access buttons out of in a more visible button + Improve the copy in the #remove_member_message helper Signed-off-by: Rémy Coutable <remy@rymai.me>
* Add request access for groupsRémy Coutable2016-06-141-26/+2
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Initial implementation of user access request to projectsDavid Alexander2016-06-141-0/+6
|
* Project members with guest role can't access confidential issuesDouglas Barbosa Alexandre2016-06-131-2/+8
|
* Allow users to access project shared with their groupDmitriy Zaporozhets2016-03-111-1/+51
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Allow `ProjectTeam#human_max_access` to return "Owner"rs-show-owner-labelRobert Speicher2016-02-181-1/+1
|
* Improve ProjectTeam#max_member_access performanceYorick Peterse2015-10-151-3/+16
| | | | | | | | | | | | | | | By comparing objects in Ruby we can greatly improve the performance of this method. In the worst case (should no data be eager loaded) this will run the same amount of queries as before, in the best case (when data _is_ eager loadeD) it requires no queries at all. The added benchmark used to produce around 273 iterations per second. With this commit this has been increased to almost 40 000 iterations per second: a speedup of roughly 145 times. Combined with eager loading Note associations this results in about 30 queries less when viewing a single issue, this in turn cuts down the loading time by 30-40%.
* Wrong access level badge on MR commentsaccess_level_badge_bugValery Sizov2015-10-021-0/+4
|
* Correctly import invited members.Douwe Maan2015-04-141-1/+1
|
* Track who created a group or project member.Douwe Maan2015-04-141-15/+13
|
* Use `member` instead of `tm`.Douwe Maan2015-03-151-21/+21
|
* Append in place for strings and arraysCiro Santilli2015-01-011-1/+1
|
* Snippets: public/internal/privateValery Sizov2014-10-091-0/+4
|
* Add parenthesis to function def with arguments.Ciro Santilli2014-10-031-1/+1
|
* Fix project member managementDmitriy Zaporozhets2014-09-151-1/+1
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Huge replace of old users_project and users_group referencesDmitriy Zaporozhets2014-09-141-11/+11
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>