summaryrefslogtreecommitdiff
path: root/app/models/snippet.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'feature/custom-highlighting' into 'master' Rémy Coutable2016-06-281-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add custom highlighting via .gitattributes ## What does this MR do? Allows user control of language selection via a `gitlab-language` entry in `.gitattributes` ## Are there points in the code the reviewer needs to double check? (paired with @stanhu) ## Why was this MR needed? Guessing languages by filename is fraught and often wrong. In one project, `foo.pl` may be perl, and in another it may be prolog. Users might have a Thingfile that needs ruby highlighting, or depend on things that can't work in general, like `*.C` (capitalized) mapping to C++ instead of C. This allows the user to override language choice so they never have to look at a mis-highlighted file. ## What are the relevant issue numbers? https://github.com/jneen/rouge/issues/494 https://gitlab.com/gitlab-org/gitlab-ce/issues/13818 (*.tpl can't in general map to Smarty) https://gitlab.com/gitlab-org/gitlab-ce/issues/13615 (in cases we don't have a language and mis-identify it, users could map to 'text' to turn off highlighting) ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [x] API support added (N/A) - [x] Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) See merge request !4606
| * move the path alias to a more appropriate locationhttp://jneen.net/2016-06-271-5/+5
| |
| * add an alias for Snippet#pathhttp://jneen.net/2016-06-271-0/+6
| |
* | Fix visibility of private project snippets for members when searchingDouglas Barbosa Alexandre2016-06-221-4/+10
| |
* | Fix internal snippets can be searched by anyoneDouglas Barbosa Alexandre2016-06-221-1/+4
|/
* Remove `projects` inclusion in `notes_with_associations` to skip some ↵Alejandro Rodríguez2016-06-081-1/+1
| | | | | | | | | | | | | | unnecessary queries `notes_with_associations` are used for `participant` declarations, but `Participable` only really cares about the target entity project, and not the participants projects. `notes_with_associations` are also used in `Commit::has_been_reverted?` which employs the reference extractor of the commit, so no references to the notes projects are made there (`Mentionable::all_references` cares only about the `author` and other `attr_mentionable`). A paralel situation occurs on `Issue::referenced_merge_requests`.
* Refactor ParticipableYorick Peterse2016-06-011-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove the annotate gem and delete old annotationsJeroen van Baarsen2016-05-091-16/+0
| | | | | | | | | In 8278b763d96ef10c6494409b18b7eb541463af29 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
* Annotate the modelsZeger-Jan van de Weg2016-05-061-3/+3
|
* Properly handle bigger filesZeger-Jan van de Weg2016-04-281-0/+4
|
* Memoize reference_pattern/link_reference_patternmemoize-pattern-methodsYorick Peterse2016-04-011-2/+2
| | | | | These methods are called quite often in loops so by memoizing their output we can reduce timings a bit.
* Removed arel_table receiver from search methodsYorick Peterse2016-03-111-1/+1
| | | | | We can just use "arel_table" in these cases instead of "SomeClass.arel_table".
* Use ILIKE/LIKE for searching snippetsYorick Peterse2016-03-111-2/+22
| | | | | | 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.
* Remove `Snippet#expires_at`rs-snippets-dont-expireRobert Speicher2016-03-051-7/+0
| | | | | | This was removed from the interface in https://github.com/gitlabhq/gitlabhq/pull/6027 but its implementation lingered around for two years.
* Autolink first so we don't pick up numeric anchors as issue references.Douwe Maan2015-12-011-5/+2
|
* Recognize issue/MR/snippet/commit links as references.Douwe Maan2015-11-301-2/+9
|
* Make snippet filename optional.Nicolas2015-06-201-1/+0
| | | | Fixes #2384.
* Surround Project.reference_pattern in parenthesis inside other patternsRobert Speicher2015-05-261-1/+1
|
* Add `reference_pattern` to Referable modelsRobert Speicher2015-05-261-0/+10
|
* Minor model spec cleanupsRobert Speicher2015-05-261-1/+2
| | | | Snippet model was missing project association
* Add `to_reference` for models that support referencesRobert Speicher2015-05-261-2/+17
| | | | | Now there is a single source of information for which attribute a model uses to be referenced, and its special character.
* Move participants method to shared Participable concern.Douwe Maan2015-04-241-12/+3
|
* Clean up code somewhat.better-commit-mentionsDouwe Maan2015-04-171-4/+2
|
* Fix Snippet#participants.Douwe Maan2015-04-151-0/+2
|
* Include snippet author in recipients of snippet note notification.Douwe Maan2015-04-151-0/+12
|
* Use more specific regexes.Douwe Maan2015-03-271-2/+2
|
* Added comment notification events to HipChat and Slack services.Stan Hu2015-03-061-0/+4
| | | | | | | | | Supports four different event types all bundled under the "note" event type: - comments on a commit - comments on an issue - comments on a merge request - comments on a code snippet
* Explicitly define ordering in models using default_scopeDmitriy Zaporozhets2015-02-051-0/+1
|
* Rubocop: Style/AlignHash enabledDmitriy Zaporozhets2015-02-021-3/+5
|
* Sanitize snippet file name in raw headersDmitriy Zaporozhets2014-12-121-0/+4
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Add strict validation to snippet file namesDmitriy Zaporozhets2014-12-121-2/+4
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* annotateValery Sizov2014-10-091-11/+11
|
* Snippets: public/internal/privateValery Sizov2014-10-091-4/+12
|
* Snippets: rename public to internalValery Sizov2014-10-071-1/+1
|
* Adding in snippet search functionalityCharles Bushong2014-08-291-0/+14
| | | | http://feedback.gitlab.com/forums/176466-general/suggestions/5529795-search-though-snippets
* Project hook, milestone, snippet strong paramsDmitriy Zaporozhets2014-06-261-2/+0
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* User model to strong params. Comment other attr_accessible to let tests runDmitriy Zaporozhets2014-06-261-1/+1
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Rename snippets scopes to plural names.Marin Jankovski2014-06-041-2/+2
|
* Replace now forbidden keywords public and private for snippets scopeMarin Jankovski2014-06-031-2/+2
|
* Re-annotate modelsDmitriy Zaporozhets2014-04-091-3/+3
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Default value for Snippet#privateDmitriy Zaporozhets2014-03-171-0/+2
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* ReannotateDmitriy Zaporozhets2013-08-211-3/+3
|
* AnnotatedDmitriy Zaporozhets2013-06-191-4/+5
|
* Notes fixedAndrew8xx82013-03-251-0/+1
|
* It's better to use STI insteadAndrew8xx82013-03-251-1/+0
|
* Additional scopes addedAndrew8xx82013-03-251-2/+5
|
* Private added to attr_accessibleAndrew8xx82013-03-251-1/+1
|
* Project snippet moved to separate modelAndrew8xx82013-03-241-3/+2
|
* All scopes must be in lambdasAndrew8xx82013-02-121-3/+3
|
* remove length of snippet contentValeriy Sizov2013-01-221-1/+1
|