Commit graph

18 commits

Author SHA1 Message Date
Douglas Barbosa Alexandre
16c9abf1ee Use cattr_accessor instead duplicating code on NoteOnDiff concern 2016-07-15 13:49:16 -03:00
Paco Guzman
bfce7349ea Cache Participable#participants in instance variable 2016-06-21 12:54:12 +02: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
Douwe Maan
5ef2048f65 Fix issue related cross-project MRs 2015-12-21 15:36:08 +01:00
Douwe Maan
7781bda9bd Move Markdown/reference logic from Gitlab::Markdown to Banzai 2015-12-15 15:51:16 +01:00
Douwe Maan
95f0440a78 Merge branch 'master' into rs-redactor-filter 2015-10-15 11:26:58 +02:00
Douwe Maan
4a5b77188e Participable doesn't need to know about Mentionable 2015-10-14 16:20:11 +02:00
Douwe Maan
d6fb96b927 Have Issue#participants load all users mentioned in notes using a single query 2015-10-14 09:17:05 +02:00
Douwe Maan
7a0cc665ff Remove useless assignment 2015-10-12 15:34:08 +02:00
Douwe Maan
41075bad8d Chaining ftw 2015-10-12 14:39:33 +02:00
Douwe Maan
b0164771ec Simplify code around (cross)-references 2015-10-12 11:54:46 +02:00
Dmitriy Zaporozhets
a5f23435f7
Improve performance for issue#show page
* store @participants in variable
* store result of subscribed? call into variable

In total it reduce amount of SQL queries for issue with 10 comments/participants twice.

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-24 12:49:34 +02:00
Douwe Maan
0b7c4fe048 Don't include users without project access in participants. 2015-05-15 12:46:52 +02:00
Douwe Maan
77dc71d550 Fix mentioning of private groups. 2015-05-14 13:15:13 +02:00
Douwe Maan
04020d5e20 Explain purpose and usage. 2015-04-24 12:31:16 +02:00
Douwe Maan
6f8ff08c65 Fix behavior for Enumerable-like ActiveRecord relations. 2015-04-24 12:31:16 +02:00
Douwe Maan
0db79443ee Satisfy Rubocop. 2015-04-24 12:30:37 +02:00
Douwe Maan
e739eb036d Move participants method to shared Participable concern. 2015-04-24 12:30:36 +02:00