Commit Graph
107 Commits
Author SHA1 Message Date
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
Stan Hu 30aa64202b Fix note validation spec failures 2016-06-01 10:31:46 -07: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
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
Robert Speicher f36e7ff2f9 Shut up, RuboCop
❤️
2016-05-29 23:12:19 -04:00
Grzegorz BizonandRobert Speicher fc57d36018 Minor changes in note validation specs 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher e558edd1ce Update specs to carry out changes in note factory 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher 0e613db76d Add more validation tests for note model 2016-05-29 15:03:00 -04:00
Grzegorz BizonandRobert Speicher bf0b51d252 Update note factory to include noteable association 2016-05-29 15:03:00 -04:00
ZJ van de Weg 6523002267 Remove old tests, and use right factories 2016-05-25 15:43:07 +02: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
Douwe Maan c452fa8124 Update specs 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 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
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 508b6b46fe Use ILIKE/LIKE for searching notes 2016-03-11 15:25:21 -05:00
Robert Speicher 56c4f22c80 Remove redundant integration tests
These three tests were essentially checking that adding a note to
something updated its `noteable`'s `updated_at` attribute.

This is well-tested Rails behavior and we shouldn't feel the need to
write an integration test to verify it. At most we should be ensuring
that the association definition adds the `touch: true` option, which we
now do in Note's unit test.
2016-03-07 15:33:26 -05: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
Rémy Coutable e918493f55 Fix specs and rubocop warnings 2016-01-14 10:04:48 +01:00
Rémy Coutable 1f0b8c32e7 Add spec for Note#cross_reference_not_visible_for? 2016-01-13 18:18:59 +01:00
Douwe Maan 18b17072c6 Add regression test. 2016-01-06 13:33:47 +01:00
Valery SizovandValery Sizov a1b63e1252 revert back vote buttons to issue and MR pages 2015-12-25 14:11:19 +02:00
Valery Sizov 09c5968fa3 fix spec 2015-12-24 12:14:46 +02:00
Valery Sizov 72b7d1f59d emoji aliases problem 2015-12-11 13:17:12 +02:00
Valery Sizov e3ee46a13b Don't allow to edit award emoji comments 2015-12-10 14:39:37 +02:00
Douwe Maan 1e8d703a85 Tag model specs 2015-12-09 10:50:51 +01:00
Stan Hu 9dbc768db8 Update annotations 2015-12-08 21:00:01 -08:00
Valery Sizov 22bbb379ae fox tests 2015-11-19 23:00:30 +02:00
Valery Sizov 671a49cfd5 added specs 2015-11-19 14:41:05 +02:00
Valery Sizov 23c5473cc0 added spinach tests 2015-11-19 13:20:09 +02:00
Douwe Maan 6f35614852 Fix mentionable specs 2015-10-12 16:23:15 +02:00
Stan Hu d7812a95cf Re-annotate models 2015-09-06 07:48:48 -07:00
Dmitriy Zaporozhets b7e6ae03dc Case-insensetive search for comments
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-19 15:59:48 +02:00
Valery Sizov 6353ca9ae8 Revert "Update noteable after a new note is added"
This reverts commit fbdaf0e2a5.
2015-08-05 12:00:12 +03:00
Dmitriy Zaporozhets 342d553709 Rename abilities to correspond contoller/model action names
write_ was renamed to create_
modify_  was renamed to update_

So now in update action we have next code

def create
  can?(current_user, :create_issue, @issue)
end

def update
  can?(current_user, :update_issue, @issue)
end

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 15:55:56 +02:00
Jeroen van Baarsen fbdaf0e2a5 Update noteable after a new note is added
**What does this do?**
It makes sure that whenever a new note is added to an noteable item, the
updated_at of that item is also updated.

**Why is this needed?**
At this moment when you post a comment on an issue or add a label to an issue,
the updated_at is not changed. Because of this the filtering for least recently
updated is not really useful (since it only takes in account the original text
from the noteable).

Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-06-05 15:22:55 +02:00
Robert Speicher 19142f4079 Simplify Note model specs 2015-05-11 00:01:16 -04:00