summaryrefslogtreecommitdiff
path: root/app/models/note.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add Discussion model to represent MR/diff discussiondiscussion-modelDouwe Maan2016-07-201-3/+4
|
* Fix not normalized emoji pathsdixpac2016-07-141-2/+1
| | | | | | * There where path where +1 was stored as +1 not as thumbsup that was causing problems such as showing thumbsup icon 2 time. I fixed this to always normalize and store +1 as tumbsup
* Optimize system note visibility checking by hiding notes thatStan Hu2016-07-111-1/+13
| | | | | | | | | | | | | have been fully redacted and contain cross-project references. The previous implementation relied on Note#cross_reference_not_visible_for?, which essentially tries to render all the Markdown references in a system note and only displays the note if the user can see the referring project. But this duplicated the work that Banzai::NotesRenderer was doing already. Instead, for each note we render, we memoize the number of visible user references and use it later if it is available. Improves #19273
* Add DiffNote modelDouwe Maan2016-07-061-2/+6
|
* Extract parts of LegacyDiffNote into DiffOnNote concern and move part of ↵Douwe Maan2016-07-061-2/+2
| | | | responsibility to other classes
* Don't garbage collect commits that have related DB records like commentsDouwe Maan2016-07-041-0/+7
|
* use has_many relationship with eventsJames Lopez2016-07-011-1/+1
|
* fixing events for import/exportJames Lopez2016-06-291-0/+1
|
* Support for rendering/redacting multiple documentsYorick Peterse2016-06-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the way certain documents are rendered (currently only Notes) and how documents are redacted. Previously both rendering and redacting would run on a per document basis. The result of this was that for every document we'd have to run countless queries just to figure out if we could display a set of links or not. This commit changes things around so that redacting Markdown documents is no longer tied into the html-pipeline Gem. This in turn allows it to redact multiple documents in a single pass, thus reducing the number of queries needed. In turn rendering issue/merge request notes has been adjusted to take advantage of this new setup. Instead of rendering Markdown somewhere deep down in a view the Markdown is rendered and redacted in the controller (taking the current user and all that into account). This has been done in such a way that the "markdown()" helper method can still be used on its own. This particular commit also paves the way for caching rendered HTML on object level. Right now there's an accessor method Note#note_html which is used for setting/getting the rendered HTML. Once we cache HTML on row level we can simply change this field to be a column and call a "save" whenever needed and we're pretty much done.
* Preload notes/discussions associations (award_emoji: :user)optimize-award-emojiPaco Guzman2016-06-231-1/+3
|
* Eager load award emoji on notesZ.J. van de Weg2016-06-231-1/+1
| | | | | | | | | | This commit eager loads the award emoji on both the issues and the MRs. When loading an issue with 108 comments this reduces the query count by 327 queries. On a merge request with the same amount of comments this saves 148 queries. The large difference is not clear to me at this point and the total query count is still huge with 387 and 1034 respectively. The biggest problem however, remains the calculation of participants.
* fixed merge conflictsJames Lopez2016-06-161-16/+7
|\
| * Award Emoji can't be awarded on system notes backendzj-system-notes-not-awardableZ.J. van de Weg2016-06-151-0/+4
| |
| * Use Issue.visible_to_user in Notes.search to avoid query duplicationDouglas Barbosa Alexandre2016-06-131-16/+3
| |
| * Project members with guest role can't access confidential issuesDouglas Barbosa Alexandre2016-06-131-1/+1
| |
* | fixed specs and refactored a few things due to recent model changes and ↵James Lopez2016-06-131-2/+3
|/ | | | merge conflicts
* Backend awardables on commentsZJ van de Weg2016-06-061-0/+1
|
* Merge branch 'master' into awardablesawardablesZ.J. van de Weg2016-06-031-4/+20
|\
| * Merge branch 'separate-banzai-references' into 'master' Douwe Maan2016-06-011-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * Refactor ParticipableYorick Peterse2016-06-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * | Merge branch 'data_leak' into 'master' Robert Speicher2016-05-311-3/+19
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | Confidential notes data leak Fixes part of https://gitlab.com/gitlab-org/gitlab-ee/issues/575 See merge request !1967
| | * | Confidential notes data leakValery Sizov2016-05-311-3/+19
| | |/
* | | Incorportate feedbackZ.J. van de Weg2016-06-011-14/+2
| | |
* | | Merge branch 'master' into awardablesZJ van de Weg2016-05-301-2/+9
|\ \ \ | |/ /
| * | Validate presence of noteable_type in note modelGrzegorz Bizon2016-05-291-0/+1
| | |
| * | Do not override foreign attributes in note factoryGrzegorz Bizon2016-05-291-1/+1
| | |
| * | Remove redundant `with_options` from note validatorsGrzegorz Bizon2016-05-291-5/+3
| | |
| * | Improve note validation for project mismatchGrzegorz Bizon2016-05-291-5/+7
| | |
| * | Make note invalid if noteable project is differentGrzegorz Bizon2016-05-291-0/+6
| |/ | | | | | | Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/15577
* | Fix backend merge mistakesZJ van de Weg2016-05-191-1/+1
| | | | | | | | [ci skip]
* | Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into awardablesFatih Acet2016-05-181-172/+31
|\ \ | |/ | | | | | | | | | | | | # Conflicts: # app/controllers/projects/merge_requests_controller.rb # app/models/note.rb # db/schema.rb # spec/models/note_spec.rb
| * Add an Event's target's title to its reference linkRobert Speicher2016-05-161-0/+1
| | | | | | | | | | | | | | | | 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.
| * Clean up LegacyDiffNote somewhatDouwe Maan2016-05-131-0/+4
| |
| * Extract LegacyDiffNote out of NoteDouwe Maan2016-05-131-184/+30
| |
* | Fix tests and wrong choices during mergeZeger-Jan van de Weg2016-05-121-1/+1
| |
* | Incorporate feedbackZeger-Jan van de Weg2016-05-111-4/+0
| |
* | Merge branch 'master' into awardablesZeger-Jan van de Weg2016-05-111-22/+1
|\ \ | |/
| * Remove the annotate gem and delete old annotationsJeroen van Baarsen2016-05-091-21/+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-4/+4
| |
| * Remove useless require 'file_size_validator' causing warningsRémy Coutable2016-04-191-1/+0
| | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | Create table for award emojiZeger-Jan van de Weg2016-05-061-42/+11
|/
* Rename Note#for_project_snippet? to #for_snippet?Rémy Coutable2016-03-311-1/+1
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Merge branch 'rs-note-active-spec' into 'master'Robert Speicher2016-03-141-12/+21
|\ | | | | | | | | | | Add unit specs for `Note#active?` See merge request !3133
| * Add unit specs for `Note#active?`rs-note-active-specRobert Speicher2016-03-111-12/+21
| |
* | Disallow blank (non-null) values for a Note's `line_code` attributers-disallow-blank-line-codeRobert Speicher2016-03-111-1/+6
|/ | | | | | | | | | | | | 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.
* 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 notesYorick Peterse2016-03-111-1/+11
|
* Merge branch 'rs-note-delegates-mentionable'Douwe Maan2016-03-071-10/+1
|\ | | | | | | | | # Conflicts: # app/models/note.rb
| * Delegate a Note's Mentionable methods to its noteable objectrs-note-delegates-mentionableRobert Speicher2016-03-051-10/+1
| |
* | Merge branch 'rs-note-reuse-for-methods' into 'master' Douwe Maan2016-03-071-2/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | 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