Commit graph

14 commits

Author SHA1 Message Date
Paco Guzman
4ff345c488 Simplify Mentionable concern instance methods
We remove some arguments that are rarely used or 
used just to simplify setups on specs.

Modified Mentionable#create_new_cross_references method 
we don’t need to calculate previous references to avoid the 
duplication because we do that at database level when 
creating references extracted from the current entity state.

MergeRequests won’t create cross_references for commits that are included so we change a spec to use a different merge request to make references to commits to other branches
2016-10-04 10:45:48 +02: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
Robert Speicher
adc6ec4a9c Avoid describe-ing symbols in specs 2016-07-12 10:27:58 -05:00
Sean McGivern
db0d3fc3e9 Ensure logged-out users can't see private refs 2016-06-30 16:36:10 +01:00
Douglas Barbosa Alexandre
43d8bdb4f0 Restrict access to references for confidential issues 2016-03-17 20:55:59 -03:00
Douwe Maan
396c5c97dd Fix specs 2015-12-24 20:34:13 +01:00
Drew Blessing
f177aaa5fa Backport JIRA service 2015-12-18 14:19:48 -06:00
Douwe Maan
b0164771ec Simplify code around (cross)-references 2015-10-12 11:54:46 +02:00
Robert Speicher
f3d4767d0c Rename notice_added_references to create_new_cross_references! 2015-07-13 21:31:16 -04:00
Robert Speicher
e4c698fd5c Refactor Mentionable#notice_added_references
It now accounts for models that have changed but have already been
persisted, such as when called from an UpdateService.

Closes #1773
2015-07-13 21:31:00 -04:00
Robert Speicher
2120e2dd95 Replace remaining references to Note.create_cross_reference_note 2015-06-22 12:13:46 +02:00
Robert Speicher
23954b0f77 Correctly remove already-mentioned commits for cross references
Fixes #1778
2015-06-08 18:13:14 -04:00
Jeroen van Baarsen
0c4a70a306 Updated rspec to rspec 3.x syntax
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-12 19:17:35 +01:00
Dmitriy Zaporozhets
fd17ba9ffc Mentioned users are not limited by project scope any more
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-10-30 13:26:45 +02:00