summaryrefslogtreecommitdiff
path: root/spec/models/member_spec.rb
Commit message (Collapse)AuthorAgeFilesLines
* Optimize SQL queries used in Groups::GroupMembersController#create27374-groups-groupmemberscontroller-create-is-slow-due-to-sqlRubén Dávila2017-09-051-0/+9
| | | | | | | | | | | The following optimizations were performed: - Add new association to GroupMember and ProjectMember This new association will allow us to check if a user is a member of a Project or Group through a single query instead of two. - Optimize retrieving of Members when adding multiple Users
* Change all `:empty_project` to `:project`rs-empty_project-defaultRobert Speicher2017-08-021-2/+2
|
* Use described_class when possibleRémy Coutable2017-07-271-1/+1
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Remove superfluous lib: true, type: redis, service: true, models: true, ↵Rémy Coutable2017-07-271-1/+1
| | | | | | services: true, no_db: true, api: true Signed-off-by: Rémy Coutable <remy@rymai.me>
* Enable Style/DotPosition Rubocop :cop:Grzegorz Bizon2017-06-211-4/+4
|
* Collect all users by single query when using Member#add_usersdz-improve-add-users-methodDmitriy Zaporozhets2017-04-281-2/+4
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Refactor add_users method for project and groupdz-cleanup-add-usersDmitriy Zaporozhets2017-04-211-0/+25
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Show parent group members for nested groupdz-nested-groups-members-pageDmitriy Zaporozhets2017-02-101-0/+8
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Use `:empty_project` where possible in model specsrs-empty_project-modelsRobert Speicher2017-01-261-1/+1
|
* Precalculate user's authorized projects in databaseAhmad Sherif2016-11-181-0/+22
| | | | Closes #23150
* Make access request specs explicitly enable or disable access requests as ↵Nick Thomas2016-11-111-2/+2
| | | | required
* Members::RequestAccessService is tricter on permissionsRémy Coutable2016-10-031-1/+1
| | | | | | Fortunately, only specs needed to be fixed, so that's good! Signed-off-by: Rémy Coutable <remy@rymai.me>
* Merge branch ↵Robert Speicher2016-10-021-39/+204
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '21983-member-add_user-doesn-t-detect-existing-members-that-have-requested-access' into 'master' Resolve "`Member.add_user`doesn't detect existing members that have requested access" ## What does this MR do? This merge request handle the case when an access requester is added to a group or project (via the members page or the API). In `Member.add_user`, if an access requester already exists, we simply accept their request (and set the `created_by`, `access_level` and `expires_at` attributes if given). ## Are there points in the code the reviewer needs to double check? I've taken the opportunity to cleanup the whole `{Group,Project}Member.add_user*` methods since it was quite a mess. ## What are the relevant issue numbers? Closes #21983 See merge request !6393
| * Allow Member.add_user to handle access requestersRémy Coutable2016-09-281-39/+204
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix specs that requires an access requestRémy Coutable2016-09-221-1/+1
|/ | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Exclude some pending or inactivated rows in Member scopesNick Thomas2016-09-081-3/+39
| | | | | | | | | An unapproved access request should not give access rights, and blocked users should not be considered members of anything. One visible outcome of this behaviour is that owners and masters of a group or project may be blocked, yet still receive notification emails for access requests. This commit prevents this from happening.
* Merge branch 'master' into expiration-date-on-membershipsSean McGivern2016-08-181-1/+1
|\
| * New AccessRequests API endpoints for Group & ProjectRémy Coutable2016-08-101-1/+1
| | | | | | | | | | | | | | | | Also, mutualize AccessRequests and Members endpoints for Group & Project. New API documentation for the AccessRequests endpoints. Signed-off-by: Rémy Coutable <remy@rymai.me>
* | Replace optional parameters with keyword arguments.Adam Niedzielski2016-08-021-2/+12
|/
* Add a spec for access_for_user_idsStan Hu2016-07-261-0/+12
|
* Exclude requesters from Project#members, Group#members and User#membersexplicit-requesters-scopeRémy Coutable2016-07-011-18/+2
| | | | | | And create new Project#requesters, Group#requesters scopes. Signed-off-by: Rémy Coutable <remy@rymai.me>
* New Members::DestroyServiceRémy Coutable2016-06-181-12/+0
| | | | | | | This is to ensure we don't send unwanted notifications when deleting a project. In other words, stop abusing AR callbacks and use services. Signed-off-by: Rémy Coutable <remy@rymai.me>
* UI and copywriting improvements13948-access-request-to-projects-and-groupsRémy Coutable2016-06-141-34/+69
| | | | | | | | | + 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-0/+89
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Remove the annotate gem and delete old annotationsJeroen van Baarsen2016-05-091-19/+0
| | | | | | | | | In 8278b763d96ef10c6494409b18b7eb541463af29 the default behaviour of annotation has changes, which was causing a lot of noise in diffs. We decided in #17382 that it is better to get rid of the whole annotate gem, and instead let people look at schema.rb for the columns in a table. Fixes: #17382
* Validate email addresses using Devise.email_regexpRémy Coutable2016-02-091-1/+5
| | | | | | | Also: - Get rid of legacy :strict_mode - Get rid of custom :email validator - Add some shared examples to spec emails validation
* Tag model specsDouwe Maan2015-12-091-1/+1
|
* Re-annotate modelsStan Hu2015-05-031-0/+19
|
* Follow newline guidelines.Douwe Maan2015-04-141-3/+0
|
* Remove duplication between Group and ProjectMember.Douwe Maan2015-04-141-0/+151