Commit graph

29 commits

Author SHA1 Message Date
Douglas Barbosa Alexandre
256cd8e498 Fix visibility of private project snippets for members when searching 2016-06-22 20:09:19 -03:00
Douglas Barbosa Alexandre
8f9b64c720 Fix internal snippets can be searched by anyone 2016-06-22 17:44:24 -03: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
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
Yorick Peterse
1f5284e5dd Use ILIKE/LIKE for searching snippets
Previously this used a regular LIKE which is case-sensitive on
PostgreSQL. This ensures that for both PostgreSQL and MySQL the
searching is case-insensitive similar to searching for projects.
2016-03-11 15:25:21 -05:00
Robert Speicher
836d593033 Remove Snippet#expires_at
This was removed from the interface in
https://github.com/gitlabhq/gitlabhq/pull/6027 but its implementation
lingered around for two years.
2016-03-05 18:12:17 -05:00
Douwe Maan
1e8d703a85 Tag model specs 2015-12-09 10:50:51 +01:00
Nicolas
aecc989154 Make snippet filename optional.
Fixes #2384.
2015-06-20 01:06:57 +02:00
Robert Speicher
47251b85e0 ensure_length_of -> validate_length_of 2015-06-10 01:31:26 -04:00
Robert Speicher
8773f339a3 Minor model spec cleanups
Snippet model was missing project association
2015-05-26 15:48:30 -04:00
Robert Speicher
c0faf91ff2 Add to_reference for models that support references
Now there is a single source of information for which attribute a model
uses to be referenced, and its special character.
2015-05-26 15:48:30 -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
Valery Sizov
82c938ad75 annotate 2014-10-09 18:22:20 +03:00
Dmitriy Zaporozhets
0f550aa386
Remove mass assgnment specs
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-26 23:57:55 +03:00
Dmitriy Zaporozhets
36f861f1b1
Re-annotate models
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-09 15:05:03 +03:00
Dmitriy Zaporozhets
8dd37afe34 Reannotate 2013-08-21 12:34:02 +03:00
Dmitriy Zaporozhets
6e35aceff2 Annotated 2013-06-19 15:40:33 +03:00
Andrew8xx8
bc7c5f87bb Project snippet moved to separate model 2013-03-24 19:26:49 +04:00
Valeriy Sizov
e982a9512e fix tests 2013-01-22 17:25:35 +02:00
Dmitriy Zaporozhets
95c23b2f97 Annotated. schema updated 2012-11-19 21:24:05 +03:00
Dmitriy Zaporozhets
41e53eb980 Annotated 2012-10-09 11:14:17 +03:00
Andrey Kumanyaev
a4cd738686 tests fix 2012-10-09 04:10:16 +04:00
Nihad Abbasov
83efcabc82 set activerecord whitelist_attributes to true 2012-09-26 11:18:35 -07:00
Robert Speicher
97423a0bed Add more coverage for model validations and associations 2012-08-29 11:36:02 -04:00
Robert Speicher
9e7d77cece Remove annotations from specs 2012-08-29 10:44:34 -04:00
randx
6abc649590 Reannotated 2012-06-26 21:23:09 +03:00
Nihad Abbasov
b6cdd1c819 test expired snippets 2011-10-28 00:25:50 +05:00
gitlabhq
d03f2687c5 annotated 2011-10-17 18:31:21 +03:00
gitlabhq
9265de3d25 snippets are ready 2011-10-17 00:07:10 +03:00