Douwe Maan
2d084dd848
Merge branch 'separate-banzai-references' into 'master'
...
Separate reference gathering from rendering
This is a required step to allow batch processing when gathering references. This in turn would allow grabbing (for example) all mentioned users of an issue/merge request using a single query.
cc @rspeicher @DouweM
See merge request !3969
2016-06-01 15:51:59 +00: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
Robert Speicher
613bcdc626
Merge branch 'data_leak' into 'master'
...
Confidential notes data leak
Fixes part of https://gitlab.com/gitlab-org/gitlab-ee/issues/575
See merge request !1967
2016-05-31 19:35:13 +00:00
Valery Sizov
9154586ce5
Confidential notes data leak
2016-05-31 21:32:53 +03:00
Grzegorz Bizon and Robert Speicher
99ef3a84b5
Validate presence of noteable_type in note model
2016-05-29 15:03:00 -04:00
Grzegorz Bizon and Robert Speicher
21d0cddd45
Do not override foreign attributes in note factory
2016-05-29 15:03:00 -04:00
Grzegorz Bizon and Robert Speicher
57b551a19f
Remove redundant with_options from note validators
2016-05-29 15:03:00 -04:00
Grzegorz Bizon and Robert Speicher
87c44b0e91
Improve note validation for project mismatch
2016-05-29 15:03:00 -04:00
Grzegorz Bizon and Robert Speicher
c31a296c94
Make note invalid if noteable project is different
...
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/15577
2016-05-29 15:03:00 -04:00
Robert Speicher
6286b28bbc
Add an Event's target's title to its reference link
...
Given an activity feed entry like:
> Douwe Maan commented on [issue #123 ] at [gitlab-org/gitlab-ce]
...the `issue #123` link will now have a `title` attribute.
2016-05-16 14:52:02 -05:00
Douwe Maan
7848d54f5b
Clean up LegacyDiffNote somewhat
2016-05-13 17:31:58 -05:00
Douwe Maan
99d3e21f19
Extract LegacyDiffNote out of Note
2016-05-13 17:31:43 -05:00
Jeroen van Baarsen
f1479b56b7
Remove the annotate gem and delete old annotations
...
In 8278b763d9 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
2016-05-09 18:00:28 +02:00
Zeger-Jan van de Weg
47da013cf8
Annotate the models
2016-05-06 08:27:46 +02:00
Rémy Coutable
1fbea7cec9
Remove useless require 'file_size_validator' causing warnings
...
Signed-off-by: Rémy Coutable <remy@rymai.me >
2016-04-19 11:40:16 +02:00
Rémy Coutable
091b8a6ede
Rename Note#for_project_snippet? to #for_snippet?
...
Signed-off-by: Rémy Coutable <remy@rymai.me >
2016-03-31 09:20:27 +02:00
Robert Speicher
b782e7c973
Merge branch 'rs-note-active-spec' into 'master'
...
Add unit specs for `Note#active?`
See merge request !3133
2016-03-14 12:53:15 -04:00
Robert Speicher
a63eba9a2b
Add unit specs for Note#active?
2016-03-11 18:16:34 -05:00
Robert Speicher
01f6db4f64
Disallow blank (non-null) values for a Note's line_code attribute
...
It's unclear how these blank values got added, but GitLab.com had a few:
```
irb(main):002:0> Note.where("line_code IS NOT NULL AND line_code = ''").count
=> 439
```
We've added a migration to convert any existing records to use a NULL
value when blank, and updated Note to set blank values to nil before
validation.
2016-03-11 17:46:50 -05:00
Yorick Peterse and Robert Speicher
d7d5937531
Removed arel_table receiver from search methods
...
We can just use "arel_table" in these cases instead of
"SomeClass.arel_table".
2016-03-11 15:25:23 -05:00
Yorick Peterse and Robert Speicher
508b6b46fe
Use ILIKE/LIKE for searching notes
2016-03-11 15:25:21 -05:00
Douwe Maan
be1ae2d660
Merge branch 'rs-note-delegates-mentionable'
...
# Conflicts:
# app/models/note.rb
2016-03-07 09:38:16 +01:00
Douwe Maan
de872f2668
Merge branch 'rs-note-reuse-for-methods' into 'master'
...
Make better use of the `Note#for_*?` methods
We've got all these polymorphic type-checking methods, might as well use
'em everywhere it makes sense.
See merge request !3106
2016-03-07 08:32:49 +00:00
Robert Speicher
84dab62c18
Delegate a Note's Mentionable methods to its noteable object
2016-03-05 20:45:05 -05:00
Robert Speicher
dcbf7d13c4
Make better use of the Note#for_*? methods
...
We've got all these polymorphic type-checking methods, might as well use
'em everywhere it makes sense.
2016-03-05 20:19:01 -05:00
Robert Speicher
1b27c3c5f8
Remove Note#system? "override"
...
This method was duplicating default Rails behavior.
2016-03-05 17:32:37 -05:00
Robert Speicher
eb3ca32813
Remove Note#noteable_type_name
...
This method was added in Dec 2012, its single use was removed two days
later, and it's been there ever since.
2016-03-05 17:32:08 -05:00
Jacob Vosmaer
1764e1b7cb
Use Gitlab::Git::DiffCollections
2016-03-03 18:38:44 +01:00
Douglas Barbosa Alexandre
3d52e139b1
Rename Tasks to Todos
2016-02-20 12:39:27 -02:00
Douglas Barbosa Alexandre
a74a69db68
Use destroy, in case we ever have before_destroy callbacks on Task
2016-02-20 12:12:05 -02:00
Douglas Barbosa Alexandre
1d476b0656
Create a pending task when a user is mentioned on a note
2016-02-20 12:12:05 -02:00
Zeger-Jan van de Weg
aba1aa49a9
Improve #set_award! on the Note model
2016-02-19 10:10:55 +01:00
Zeger-Jan van de Weg
11ed1cbbb7
Emoji reponses on diffs aren't award emoji
2016-02-19 10:04:38 +01:00
Douwe Maan
150b4f66e6
Make sure non-highlighted diffs are still escaped
2016-01-22 01:47:17 +01:00
Rubén Dávila
35a776754c
Update Issue/MR everytime a Note is saved/destroyed.
2016-01-19 15:02:26 -05:00
Rémy Coutable
5efbfa14d4
Move complex view condition to a model method
...
This is moved to a model method rather than an helper method because the
API will need it too.
2016-01-13 16:37:17 +01:00
Valery Sizov
d3807328d8
note votes methids implementation
2015-12-29 10:11:20 +02:00
Valery Sizov
83d42c1518
Revert upvotes and downvotes params to MR API
2015-12-28 11:41:16 +02:00
Valery Sizov and Valery Sizov
a1b63e1252
revert back vote buttons to issue and MR pages
2015-12-25 14:11:19 +02:00
Douwe Maan
48b3ad6d37
Banzai::XFilter -> Banzai::Filter::XFilter
2015-12-15 16:10:32 +01:00
Douwe Maan
7781bda9bd
Move Markdown/reference logic from Gitlab::Markdown to Banzai
2015-12-15 15:51:16 +01:00
Valery Sizov
72b7d1f59d
emoji aliases problem
2015-12-11 13:17:12 +02:00
Dmitriy Zaporozhets
b20f677baa
Merge remote-tracking branch 'origin/emoji_edit_disallow'
2015-12-10 19:40:18 +01:00
Douwe Maan
10387f6b8a
Merge branch 'master' into tmp-reference-pipeline-and-caching
...
# Conflicts:
# spec/lib/gitlab/markdown/autolink_filter_spec.rb
# spec/lib/gitlab/markdown/commit_range_reference_filter_spec.rb
# spec/lib/gitlab/markdown/commit_reference_filter_spec.rb
# spec/lib/gitlab/markdown/cross_project_reference_spec.rb
# spec/lib/gitlab/markdown/emoji_filter_spec.rb
# spec/lib/gitlab/markdown/external_issue_reference_filter_spec.rb
# spec/lib/gitlab/markdown/external_link_filter_spec.rb
# spec/lib/gitlab/markdown/issue_reference_filter_spec.rb
# spec/lib/gitlab/markdown/label_reference_filter_spec.rb
# spec/lib/gitlab/markdown/merge_request_reference_filter_spec.rb
# spec/lib/gitlab/markdown/redactor_filter_spec.rb
# spec/lib/gitlab/markdown/reference_gatherer_filter_spec.rb
# spec/lib/gitlab/markdown/relative_link_filter_spec.rb
# spec/lib/gitlab/markdown/sanitization_filter_spec.rb
# spec/lib/gitlab/markdown/snippet_reference_filter_spec.rb
# spec/lib/gitlab/markdown/syntax_highlight_filter_spec.rb
# spec/lib/gitlab/markdown/table_of_contents_filter_spec.rb
# spec/lib/gitlab/markdown/task_list_filter_spec.rb
# spec/lib/gitlab/markdown/upload_link_filter_spec.rb
# spec/lib/gitlab/markdown/user_reference_filter_spec.rb
2015-12-10 14:04:34 +01:00
Valery Sizov
e3ee46a13b
Don't allow to edit award emoji comments
2015-12-10 14:39:37 +02:00
Stan Hu
9dbc768db8
Update annotations
2015-12-08 21:00:01 -08:00
Douwe Maan
926c3bef9f
Merge branch 'master' into reference-pipeline-and-caching
2015-12-08 13:40:32 +01:00
Robert Speicher
ad6a771dc6
Add custom LineCodeValidator
2015-12-07 16:57:26 -05:00
Douwe Maan
d611a38798
Merge branch 'master' into reference-pipeline-and-caching
2015-12-07 14:48:53 +01:00
Grzegorz Bizon
893d08c0dc
Simplify contains_emoji_only? method in Note
2015-12-07 11:00:03 +01:00