Commit Graph
240 Commits
Author SHA1 Message Date
Z.J. van de Weg 31944179aa Award Emoji can't be awarded on system notes backend 2016-06-15 15:06:34 +02:00
Douglas Barbosa Alexandre 1491767583 Use Issue.visible_to_user in Notes.search to avoid query duplication 2016-06-13 19:32:00 -03:00
Douglas Barbosa Alexandre b56c456750 Project members with guest role can't access confidential issues 2016-06-13 19:32:00 -03:00
ZJ van de Weg 2f9c2149a3 Backend awardables on comments 2016-06-06 11:03:39 +02:00
Z.J. van de Weg 9d491712cf Merge branch 'master' into awardables 2016-06-03 15:20:11 +02:00
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
Z.J. van de Weg 91a7b9333b Incorportate feedback 2016-06-01 12:10:08 +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
ZJ van de Weg cbd7801b3d Merge branch 'master' into awardables 2016-05-30 18:54:08 +02:00
Grzegorz BizonandRobert Speicher 99ef3a84b5 Validate presence of noteable_type in note model 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher 21d0cddd45 Do not override foreign attributes in note factory 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher 57b551a19f Remove redundant with_options from note validators 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher 87c44b0e91 Improve note validation for project mismatch 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert 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
ZJ van de Weg 4d6c51e228 Fix backend merge mistakes
[ci skip]
2016-05-19 15:00:50 -05:00
Fatih Acet bb883387f9 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into awardables
# Conflicts:
#	app/controllers/projects/merge_requests_controller.rb
#	app/models/note.rb
#	db/schema.rb
#	spec/models/note_spec.rb
2016-05-18 13:05:53 -05: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
Zeger-Jan van de Weg 7a4e7ad04e Fix tests and wrong choices during merge 2016-05-12 09:23:21 +02:00
Zeger-Jan van de Weg 4558b5b9fe Incorporate feedback 2016-05-11 22:43:58 +02:00
Zeger-Jan van de Weg 7e6dcf9cd0 Merge branch 'master' into awardables 2016-05-11 08:47:04 +02: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 3bdc57f0a7 Create table for award emoji 2016-05-06 10:47:11 +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 PeterseandRobert 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 PeterseandRobert 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