Commit Graph

23 Commits

Author SHA1 Message Date
Douwe Maan 267a909600 Remove edit_note and update_note abilities in favor of admin_note 2018-04-10 15:46:20 +02:00
Bob Van Landuyt 148816cd67 Port `read_cross_project` ability from EE 2018-02-22 17:11:36 +01:00
blackst0ne 27c95364b5 Replace '.team << [user, role]' with 'add_role(user)' in specs 2017-12-22 19:18:28 +11:00
Robert Speicher 72a7b30c9f Change all `:empty_project` to `:project` 2017-08-02 17:47:31 -04:00
Rémy Coutable cddc5cacfb Use described_class when possible
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Sean McGivern ccac2abeba Don't treat anonymous users as owners when group has pending invites
The `members` table can have entries where `user_id: nil`, because people can
invite group members by email. We never want to include those as members,
because it might cause confusion with the anonymous (logged out) user.
2017-07-24 16:58:04 +01:00
http://jneen.net/ 963b374dc7 update the specs to not require a set to be returned 2017-06-27 12:41:54 -07:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
http://jneen.net/ f1d3a92bd6 spec the behavior of nil subjects 2017-03-09 11:49:53 -08:00
Semyon Pupkov 3deb66ea56 Add traits for ProjectFeatures to Project factory
https://gitlab.com/gitlab-org/gitlab-ce/issues/24007
2017-02-05 13:11:45 +05:00
Robert Speicher fcb37542e7 Use `:empty_project` where possible in model specs 2017-01-26 17:44:59 -05:00
Jarka Kadlecova 0c350b7939 address comments 2017-01-25 10:10:05 +01:00
Jarka Kadlecova d6b11dafd3 Support notes without project 2017-01-18 18:38:17 -05:00
Felipe Artur 892dea6771 Project tools visibility level 2016-09-01 11:47:59 -03:00
http://jneen.net/ 78eabebedc don't use a deprecated api in ability_spec 2016-08-30 12:34:28 -07:00
http://jneen.net/ 29b1623a36 add project_policy_spec to replace .project_abilities spec 2016-08-30 11:35:06 -07:00
Alejandro Rodríguez 6686084c65 Fix "Wiki" link not appearing in navigation for projects with external wiki 2016-08-26 17:20:00 -03:00
Stan Hu 1954bb17ec Make Ability#project_abilities return unique values and fix counts 2016-08-20 06:53:14 -07:00
Stan Hu be95e03a56 Add spec for Ability.project_abilities 2016-08-20 06:53:14 -07:00
Yorick Peterse 002ad21581
Method for returning issues readable by a user
The method Ability.issues_readable_by_user takes a list of users and an
optional user and returns an Array of issues readable by said user. This
method in turn is used by
Banzai::ReferenceParser::IssueParser#nodes_visible_to_user so this
method no longer needs to get all the available abilities just to check
if a user has the "read_issue" ability.

To test this I benchmarked an issue with 222 comments on my development
environment. Using these changes the time spent in nodes_visible_to_user
was reduced from around 120 ms to around 40 ms.
2016-07-29 12:51:18 +02:00
Stan Hu d1ea2bca61 Optimize maximum user access level lookup in loading of notes
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.
2016-07-26 15:33:05 -07:00
Yorick Peterse 580d250166
Refactor Participable
There are several changes to this module:

1. The use of an explicit stack in Participable#participants
2. Proc behaviour has been changed
3. Batch permissions checking

== Explicit Stack

Participable#participants no longer uses recursion to process "self" and
all child objects, instead it uses an Array and processes objects in
breadth-first order. This allows us to for example create a single
Gitlab::ReferenceExtractor instance and pass this to any Procs. Re-using
a ReferenceExtractor removes the need for running potentially many SQL
queries every time a Proc is called on a new object.

== Proc Behaviour Changed

Previously a Proc in Participable was expected to return an Array of
User instances. This has been changed and instead it's now expected that
a Proc modifies the Gitlab::ReferenceExtractor passed to it. The return
value of the Proc is ignored.

== Permissions Checking

The method Participable#participants uses
Ability.users_that_can_read_project to check if the returned users have
access to the project of "self" _without_ running multiple SQL queries
for every user.
2016-06-01 16:22:35 +02:00