Commit Graph

523 Commits

Author SHA1 Message Date
GitLab Bot 7892ed2e23 Add latest changes from gitlab-org/gitlab@master 2020-05-27 09:08:30 +00:00
GitLab Bot 5c763ac4c6 Add latest changes from gitlab-org/gitlab@master 2020-05-27 06:08:13 +00:00
GitLab Bot 6ee98e1273 Add latest changes from gitlab-org/gitlab@master 2020-05-26 18:08:20 +00:00
GitLab Bot e689e858ed Add latest changes from gitlab-org/gitlab@master 2020-05-13 18:08:47 +00:00
GitLab Bot 2fa68d3a97 Add latest changes from gitlab-org/gitlab@master 2020-05-04 06:10:10 +00:00
GitLab Bot 09093c1278 Add latest changes from gitlab-org/gitlab@master 2020-04-15 18:09:36 +00:00
GitLab Bot b7c735c8ac Add latest changes from gitlab-org/gitlab@master 2020-04-15 12:09:18 +00:00
GitLab Bot d43aaf286f Add latest changes from gitlab-org/gitlab@master 2020-03-17 00:09:12 +00:00
GitLab Bot 5781a49660 Add latest changes from gitlab-org/gitlab@master 2020-03-12 00:09:34 +00:00
GitLab Bot 07d0374b20 Add latest changes from gitlab-org/gitlab@master 2020-02-24 03:09:05 +00:00
GitLab Bot e144369009 Add latest changes from gitlab-org/gitlab@master 2020-02-14 00:09:07 +00:00
GitLab Bot c8f773a859 Add latest changes from gitlab-org/gitlab@master 2020-01-30 21:08:47 +00:00
GitLab Bot 5ad0cf2655 Add latest changes from gitlab-org/gitlab@master 2020-01-23 12:08:38 +00:00
GitLab Bot d91f521169 Add latest changes from gitlab-org/gitlab@master 2020-01-21 18:07:31 +00:00
GitLab Bot 9f2d4a6490 Add latest changes from gitlab-org/gitlab@master 2019-12-23 18:07:33 +00:00
GitLab Bot 27d91a6299 Add latest changes from gitlab-org/gitlab@master 2019-12-10 15:07:52 +00:00
GitLab Bot 8d3aee3636 Add latest changes from gitlab-org/gitlab@master 2019-12-04 15:11:23 +00:00
GitLab Release Tools Bot 17bf8a8f9d Merge branch 'security-filter-related-branches-from-activity-feed' into 'master'
Related Branches Visible to Guests in Issue Activity

See merge request gitlab/gitlabhq!3537
2019-11-26 17:02:28 +00:00
GitLab Bot a048261403 Add latest changes from gitlab-org/gitlab@master 2019-11-21 09:06:16 +00:00
Kerri Miller 527723c37b Restrict branches visible to guests in Issue feed
Notes related to branch creation should not be shown in an issue's
activity feed when the user doesn't have access to :download_code.
2019-11-20 06:58:47 -08:00
Dylan Griffith 0df265b660 Change Note#to_ability_name to 'note'
This is to be more consistent as there is already a :read_note policy in
NotePolicy. To keep other behaviour the same we've introduced a
Note#noteable_ability_name that is used anywhere this was expected.
2019-10-23 11:29:13 +11:00
GitLab Bot 6b75320f52 Add latest changes from gitlab-org/gitlab@master 2019-10-17 12:07:33 +00:00
GitLab Bot 00c78fb814 Add latest changes from gitlab-org/gitlab@master 2019-10-16 15:06:17 +00:00
GitLab Bot f155cc9034 Add latest changes from gitlab-org/gitlab@master 2019-10-16 03:06:12 +00:00
GitLab Bot ac062237da Add latest changes from gitlab-org/gitlab@master 2019-10-11 21:05:59 +00:00
GitLab Bot 308146dc39 Add latest changes from gitlab-org/gitlab@master 2019-10-10 00:06:44 +00:00
GitLab Bot a712542edb Add latest changes from gitlab-org/gitlab@master 2019-10-08 15:06:04 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Dmitriy Zaporozhets 00e19736f9
Remove ignore_column occurence in CE code
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2019-09-10 17:54:43 +02:00
Jan Provaznik f2754e416e Use delete_all for deleting events
Because we don't have any destroy callbacks (or other logic
triggered on event destroy), there is no reason for deleting events
inefficiently one by one, instead we can use :delete_all.
2019-09-07 06:43:17 +02:00
Jan Provaznik 243bd0202f Create an event on epic actions
Creates new event when an epic is created, closed, reopened or
commented.
2019-09-03 21:29:55 +00:00
Michael Kozono 88c6423e4a Merge branch 'remove-ignorable-column-concern' into 'master'
Remove dependency on IgnorableColumn concern

Closes #66746

See merge request gitlab-org/gitlab-ce!32427
2019-08-30 21:59:31 +00:00
Stan Hu d93b985df0 Use self.ignored_columns += instead of =
This is to accomodate prepended modules.
2019-08-30 13:15:34 -07:00
GitLab Release Tools Bot 5a008d1368 Merge branch 'security-epic-notes-api-reveals-historical-info-ce-master' into 'master'
Filter out old system notes for epics in notes api endpoint response

See merge request gitlab/gitlabhq!3224
2019-08-29 21:34:24 +00:00
dineshpanda fa6f19d1f8 Remove dependency on IgnorableColumn concern 2019-08-30 02:09:13 +05:30
Patrick Derichs c9b4dc677a Filter out old system notes for epics 2019-08-28 15:04:23 +02:00
Alexandru Croitor 5af535d919 Limit the size of issuable description and comments
Limiting the size of issuable description and comments to 1_000_000,
which is close to ~1MB of ASCII characters, which represents 99.9% of
all descriptions and comments we have in DB at the moment. This should
help prevent DoS attacks when comments contain refference strings.

Also this change updates regexp matching the namespaces paths by
limiting the namespaces paths to Namespace::NUMBER_OF_ANCESTORS_ALLOWED,
as we allow 20 levels deep groups.

see https://gitlab.com/gitlab-org/gitlab-ce/issues/61974#note_191274234
2019-08-22 10:43:13 +03:00
Stan Hu 3d9c28af93 Fix first-time contributor notes not rendering
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31117 enabled the
HashInefficientHash Rubocop rule that was fooled by the special
implementation of `SpecialRole`. We fix this by introducing a
`value?` method and adding unit tests.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/65383
2019-07-31 06:52:11 -07:00
Stan Hu 3e001d29cc Enable Rubocop Performance/InefficientHashSearch
When used with a Hash, `.keys.include?` is bad because:

1. It performs a O(n) search instead of the efficient `.has_key?`
2. It clones all keys into separate array.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64975
2019-07-24 11:47:58 -07:00
Luke Duncalfe 073c8b25ea GraphQL support for Notes created in discussions
A new `discussion_id` argument on the `createNote` mutation allows
people to create a note within that discussion.

The ability to lazy-load Discussions has been added, so
GraphQL.object_from_id can treat Discussions the same as AR objects and
batch load them.

https://gitlab.com/gitlab-org/gitlab-ce/issues/62826
https://gitlab.com/gitlab-org/gitlab-ee/issues/9489
2019-07-10 12:13:48 +12:00
Takuya Noguchi 7d76128de9 Fix typo in code comments about Elasticsearch
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2019-06-28 20:01:15 +09:00
Mario de la Ossa 35a39c1d34
Do not rewrite relative links for system notes 2019-06-20 10:15:59 -06:00
Bob Van Landuyt b6ff5f1e14 Expose comments on Noteables in GraphQL
This exposes `Note`s on Issues & MergeRequests using a
`Types::Notes::NoteableType` in GraphQL.

Exposing notes on a new type can be done by implementing the
`NoteableType` interface on the type. The presented object should
be a `Noteable`.
2019-06-14 12:36:27 +02:00
Nick Thomas 013f7cd24c
Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
Heinrich Lee Yu f5f243a036 Hide "Edited" when note is transformed or resolved
Makes `Note#edited?` return `false` when the note body was not edited
2019-03-14 12:46:23 +08:00
Jarka Košanová c4d18b0584 Use parent instead of project
Add support for group entities to quick actions
2019-01-08 02:30:37 +08:00
Oswaldo Ferreira ed3034bbb7 Allow suggesting single line changes in diffs 2018-12-13 19:17:19 +00:00
Gabriel Mazetto 4f5abe4327 Reduce N+1 from Activity Dashboard and Banzai
There is a combination of few strategies implemented here:

1. Few relations were eager loaded
2. Changed few polymorphic routes to specific ones so we don't have to
   use `#becomes(Namespace)` which doesn't preserve association cache
2018-12-10 21:34:33 +01:00
Cindy Pallares e122e14ac6
Merge branch 'security-guest-comments' into 'master'
[master]Fixed ability to comment on and edit/delete comments on locked or confidential issues

See merge request gitlab/gitlabhq!2612
2018-11-28 19:11:56 -05:00
Felipe Artur b4d005eb7b Add 'only history' option to notes filter 2018-11-05 12:30:14 +00:00
Jan Provaznik 5b0b73d922 Merge branch 'security-redact-links' into 'master'
[master] Redact unsubscribe links in issuable texts

See merge request gitlab/gitlabhq!2528
2018-10-29 16:10:32 +00:00
Jan Provaznik c1c1496405 Redact unsubscribe links in issuable texts
It's possible that user pastes accidentally also unsubscribe link
which is included in footer of notification emails. This unsubscribe
link contains personal token which attacker then use to act as the
original user (e.g. for sending comments under his/her identity).
2018-10-23 21:20:20 +02:00
Oswaldo Ferreira 86ead874e2 Resolve "Filter discussion (tab) by comments or activity in issues and merge requests" 2018-10-23 09:49:45 +00:00
Stan Hu 32eebfcfe1 Fix comments in app/models/note.rb
This resolves a conflict and inconsistency with the EE version of
app/models/note.rb.
2018-10-06 05:47:30 -07:00
Brett Walker 9ba554c8a0 Filter system notes with public and private cross references 2018-10-02 17:01:49 -05:00
Yorick Peterse 8a72f5c427
Added FromUnion to easily select from a UNION
This commit adds the module `FromUnion`, which provides the class method
`from_union`. This simplifies the process of selecting data from the
result of a UNION, and reduces the likelihood of making mistakes. As a
result, instead of this:

    union = Gitlab::SQL::Union.new([foo, bar])

    Foo.from("(#{union.to_sql}) #{Foo.table_name}")

We can now write this instead:

    Foo.from_union([foo, bar])

This commit also includes some changes to make this new setup work
properly. For example, a bug in Rails 4
(https://github.com/rails/rails/issues/24193) would break the use of
`from("sub-query-here").includes(:relation)` in certain cases. There was
also a CI query which appeared to repeat a lot of conditions from an
outer query on an inner query, which isn't necessary.

Finally, we include a RuboCop cop to ensure developers use this new
module, instead of using Gitlab::SQL::Union directly.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/51307
2018-09-17 12:39:43 +02:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
Jan Provaznik d95c1f0335 Use ResourceLabelEvent for tracking label changes 2018-09-07 13:39:20 +00:00
Sean McGivern b3deca7a26 Merge branch 'group-todos' into 'master'
Group todos

See merge request gitlab-org/gitlab-ce!20675
2018-08-07 12:35:32 +00:00
Rémy Coutable f20a40f4a1 Merge branch 'frozen-string-enable-app-models' into 'master'
Enable frozen string in app/models/*.rb

See merge request gitlab-org/gitlab-ce!20851
2018-08-02 09:11:52 +00:00
Jarka Kadlecová 15179878d5 Revert "Revert "Merge branch 'ee-5481-epic-todos' into 'master'""
This reverts commit 8717c7dad9.
2018-08-02 10:42:45 +02:00
Bob Van Landuyt f1d3ea63cf Show the status of a user in interactions
The status is shown for
- The author of a commit when viewing a commit
- Notes on a commit (regular/diff)
- The user that triggered a pipeline when viewing a pipeline
- The author of a merge request when viewing a merge request
- The author of notes on a merge request (regular/diff)
- The author of an issue when viewing an issue
- The author of notes on an issue
- The author of a snippet when viewing a snippet
- The author of notes on a snippet
- A user's profile page
- The list of members of a group/user
2018-07-30 15:01:26 +02:00
gfyoung 50abbd3e53 Enable frozen string in app/models/*.rb
Partially addresses #47424.
2018-07-26 16:55:41 -07:00
Douwe Maan 10bd800297 Merge branch 'satishperala/gitlab-ce-20720_webhooks_full_image_url' into 'master'
Include full image URL in webhooks for uploaded images

Closes #20720

See merge request gitlab-org/gitlab-ce!18109
2018-07-17 15:57:10 +00:00
Jarka Kadlecová 8717c7dad9 Revert "Merge branch 'ee-5481-epic-todos' into 'master'"
This reverts commit 4d9a3f42f1, reversing
changes made to ecf9c145f6.
2018-07-11 18:33:24 +02:00
Sean McGivern 827712e78e Merge branch 'master' into satishperala/gitlab-ce-20720_webhooks_full_image_url 2018-07-06 11:41:03 +01:00
Jarka Kadlecová c9d561b1c2 Use for_issuable? instead of for_issuable_with_ability? 2018-07-03 09:34:44 +02:00
Jan Provaznik 7458ca8ebb [backend] Addressed review comments
* Group filtering now includes also issues/MRs from
subgroups/subprojects
* fixed due_date
* Also DRYed todo controller specs
2018-07-03 09:34:44 +02:00
Felipe Artur 3e66795ef1 Changes tab VUE refactoring 2018-06-21 12:22:40 +00:00
Sean McGivern 7ff24772b6 Add base class for hook builders, and use it for notes and wikis 2018-06-20 15:52:16 +01:00
Satish Perala 9170aab92e Passing absolute image urls in the markdown content in the webhooks 2018-06-20 14:13:23 +01:00
Sean McGivern 6ecf819f73 Fix an N+1 in avatar URLs
This is tricky: the query was being run in
`ObjectStorage::Extension::RecordsUploads#retrieve_from_store!`, but we can't
just add batch loading there, because the `#upload=` method there would use the
result immediately, making the batch only have one item.

Instead, we can pre-emptively add an item to the batch whenever an avatarable
object is initialized, and then reuse that batch item in
`#retrieve_from_store!`. However, this also has problems:

1. There is a lot of logic in `Avatarable#retrieve_upload_from_batch`.
2. Some of that logic constructs a 'fake' model for the batch key. This should
   be fine, because of ActiveRecord's override of `#==`, but it relies on that
   staying the same.
2018-06-05 14:57:19 +01:00
Oswaldo Ferreira bb8f2520b4 Persist truncated note diffs on a new table
We request Gitaly in a N+1 manner to build discussion diffs. Once the diffs are from different revisions, it's hard to make a single request to the service in order to build the whole response.
With this change we solve this problem and simplify a lot fetching this piece of info.
2018-05-24 15:34:43 -03:00
Mario de la Ossa 02741ca4c5
Backport 5480-epic-notifications from EE 2018-05-07 12:58:47 -06:00
Sean McGivern 63a1a57024 Merge branch 'jprovazn-comment-refs' into 'master'
Better group support in notes-related code

See merge request gitlab-org/gitlab-ce!18150
2018-04-05 12:41:01 +00:00
Jan Provaznik c194636470 Better group support notes-related code
Updates notes-related services and rendering so this code can be
easily used for group-scoped resources (specifically Epics).

Related to gitlab-ee!5205
2018-04-05 13:29:57 +02:00
Douwe Maan 52967b107b
Merge branch 'jej/mattermost-notification-confidentiality-10-6' into 'security-10-6'
[10.6] Prevent notes on confidential issues from being sent to chat

See merge request gitlab/gitlabhq!2366
# Conflicts:
#	app/helpers/services_helper.rb
2018-04-05 08:41:56 +02:00
Jan Provaznik 65664c2eae Refactor discussions/notes code 2018-04-03 16:03:00 +00:00
Jan Provaznik dcdfa04b32 Add discussion API
* adds basic discussions API for issues and snippets
* reorganizes notes specs (so same tests can be used for all noteable types - issues, MRs, snippets)
2018-03-07 12:27:50 +01:00
Fatih Acet 059ab73b8e Render MR Notes with Vue with behind a cookie 2018-02-28 00:10:43 +00:00
Andreas Brandl d07addbf6e Add foreign keys to todos table.
Fixes #32282.
2018-02-05 16:16:57 +01:00
Mario de la Ossa eaada9d706 use Gitlab::UserSettings directly as a singleton instead of including/extending it 2018-02-02 18:39:55 +00:00
Micaël Bergeron 2057a6acde port of 594e6a0a625^..f74c90f68c6 2018-02-01 12:14:46 -05:00
Toon Claes f55aaca561 Make discussion mail References all notes in the discussion
When a note is part of a discussion, the email sent out will be
`In-Reply-To` the previous note in that discussion. It also
`References` all the previous notes in that discussion, and the
original issue.

Closes gitlab-org/gitlab-ce#36054.
2017-12-13 21:26:01 +01:00
Toon Claes 2acf3a564c Make mail notifications of discussion notes In-Reply-To of each other
When a note is part of a discussion, the email sent out should be
`In-Reply-To` the previous note in that discussion.

Closes gitlab-org/gitlab-ce#36054
2017-12-13 21:26:01 +01:00
Yorick Peterse d79e82c9dd
Return the noteable in Note#touch_noteable
This allows EE to re-use the object, making it easier to trigger
indexing of the noteable.
2017-12-12 21:34:21 +01:00
micael.bergeron 17075a0bdc cache the Note#commit method 2017-12-07 09:02:55 -05:00
micael.bergeron 3d8fbd12b8 add support for commit (in mr) to reference filter 2017-12-07 09:01:27 -05:00
Douwe Maan e4eba908cd Allow commenting on individual commits inside an MR 2017-12-07 09:01:19 -05:00
Yorick Peterse 856447ccd3
Throttle the number of UPDATEs triggered by touch
This throttles the number of UPDATE queries that can be triggered by
calling "touch" on a Note, Issue, or MergeRequest. For Note objects we
also take care of updating the associated "noteable" relation in a
smarter way than Rails does by default.
2017-12-06 15:59:37 +01:00
Douwe Maan da42dfb3cf Use fuzzy search with minimum length of 3 characters where appropriate 2017-11-27 11:29:40 +01:00
Douwe Maan aedd2cfa5b Use Gitlab::SQL::Pattern where appropriate 2017-11-24 17:28:50 +01:00
micael.bergeron c900c21eef add `#with_metadata` scope to remove a N+1 from the notes' API 2017-11-21 08:31:23 -05:00
micael.bergeron 71b2cc1dd8 reverting to the simpler approach 2017-11-16 09:23:32 -05:00
Jarka Kadlecova 064c8949bd CE port of code changed for epics 2017-11-02 07:14:35 +01:00
Jen-Shin Lin bd46c8abfd Merge branch 'security-10-1' into '10-1-stable'
Security fixes for 10.1 RC

See merge request gitlab/gitlabhq!2209
2017-10-17 15:58:58 -07:00
Felipe Artur b54203f0ad Commenting on image diffs 2017-10-07 04:25:17 +00:00
micael.bergeron 65bcd141c8 add controller spec
also fix some code styling issues
2017-09-06 09:00:57 -04:00
micael.bergeron b44a1bcd0b rework the contributor badge
- only show in merge-requests
 - show as a little glyph
2017-09-06 09:00:57 -04:00
micael.bergeron 45b83ed99a round of fixes after code review 2017-09-06 09:00:57 -04:00
micael.bergeron 966b1128d8 WIP: refactor the first-contributor to Issuable
this will remove the need make N queries (per-note) at the
cost of having to mark notes with an attribute

this opens up the possibility for other special roles for notes
2017-09-06 09:00:57 -04:00
Douwe Maan a540f55c6e Fix specs 2017-08-30 10:43:10 +02:00
Douwe Maan 5f758aff57 Prefer polymorphism over `is_a?` 2017-08-17 19:26:45 +02:00
Filipa Lacerda fbf241e8ae Merge branch 'master' into issue-discussions-refactor
* master: (42 commits)
  alternative route for download archive
  Add missing command to compile GetText files
  Prevent user from changing username with container registry tags
  Rename RPC 'Exists' to 'RepositoryExists'
  Fix the sticky changes bar on commits page
  Fix ee_compat_check when EE branch uses a prefix
  Removed display styles when hiding the fly out navigation
  Explain why we use select all for project_url_constrainer.rb
  Fix pikaday being undefined
  Add a helper to stub storage settings with defaults
  Enable the Layout/SpaceBeforeBlockBraces cop
  update Install from Source instructions
  Translations can be picked without asking for exceptions
  Ask for exceptions in advance
  Don't require stackprof in Gemfile
  Synchronous Korean translation in zanata
  Use full path of user's avatar in webhooks
  Update icon color on hover
  Align all nav items in sidebar
  Fix height of collapsed sidebar items
  ...
2017-08-10 11:12:22 +01:00
Rémy Coutable c946ee1282
Enable the Layout/SpaceBeforeBlockBraces cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-08-09 11:52:22 +02:00
Sean McGivern db0b7fb39e Expire ETag cache on note when award emoji changes 2017-07-21 22:35:26 +03:00
Lin Jen-Shin 042cf15b6f Cache Note#notable for commits and fix tests 2017-07-18 03:26:41 +08:00
Yorick Peterse 8fbbf41e29
Added Cop to blacklist the use of `dependent:`
This is allowed for existing instances so we don't end up 76 offenses
right away, but for new code one should _only_ use this if they _have_
to remove non database data. Even then it's usually better to do this in
a service class as this gives you more control over how to remove the
data (e.g. in bulk).
2017-07-06 12:01:36 +02:00
Douwe Maan fe13f11041 Create and use project path helpers that only need a project, no namespace 2017-07-05 11:11:59 -05:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Eric Eastwood ea090291bb Rename "Slash commands" to "Quick actions"
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/27070

Deprecate "chat commands" in favor of "slash commands"

We looked for things like:

 - `slash commmand`
 - `slash_command`
 - `slash-command`
 - `SlashCommand`
2017-06-15 09:01:56 -05:00
Yorick Peterse 5819ca1a24
Added Cop to blacklist polymorphic associations
One should really use a separate table instead of using polymorphic
associations.

See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/11168 for
more information.
2017-06-07 17:36:55 +02:00
Luke "Jared" Bennett 5a4a082490
Merge remote-tracking branch 'origin/master' into fix-realtime-edited-text-for-issues-9-3 2017-06-02 17:17:54 +01:00
Douwe Maan 78207b95ca Move includes call to scope 2017-05-31 14:00:30 -05:00
Luke "Jared" Bennett 07c984d81c
Port fix-realtime-edited-text-for-issues 9-2-stable fix to master. 2017-05-31 11:35:05 +01:00
Douwe Maan 0bf339f0ed Address review 2017-05-24 10:10:10 -05:00
Douwe Maan 6e698b254e Fix specs 2017-05-23 16:27:30 -05:00
Douwe Maan ab91f76e8b Add system note with link to diff comparison when MR discussion becomes outdated 2017-05-23 16:27:30 -05:00
blackst0ne aaa70a62b0 Add comment to notes aliases 2017-05-04 12:58:41 +11:00
blackst0ne 62be3355b1 Add alias_attributes for notes 2017-05-04 12:58:41 +11:00
blackst0ne 7ad5a1b371 Add last_edited_at and last_edited_by attributes 2017-05-04 12:58:41 +11:00
Douwe Maan f8fabfcc6f Allow commenting on older versions of the diff and comparisons between diff versions 2017-05-03 14:47:21 -05:00
Adam Niedzielski de71a46594 Display issuable state only in notes and issuable description
Closes #30964
2017-04-19 16:38:46 +02:00
Sean McGivern 3842b65403 Merge branch '30457-expire-note-destroy' into 'master'
Fix issue's note cache expiration after delete

Closes #30457

See merge request !10461
2017-04-12 09:02:56 +00:00
mhasbini f1f9578f1c Fix issue's note cache expiration after delete 2017-04-11 15:20:25 +03:00
Douwe Maan b202b42cfe Link to outdated diff in older MR version from outdated diff discussion 2017-04-08 14:37:46 -05:00
Douwe Maan 8c161d7bbe Fix bug where commit comment would not show up in the right discussion on the MR page 2017-04-07 11:29:29 -05:00
Douwe Maan cc656a1199 Refactor resolvability checks based on type 2017-04-06 10:51:45 -05:00
Alfredo Sumaran 46f3e37ddf Customize Start discussion message according to if the noteable can be resolvable 2017-04-05 23:01:43 -05:00
Douwe Maan 63c7801e45
Remove and ignore notes.original_discussion_id column 2017-04-05 17:44:14 +01:00
Douwe Maan c319f21141
Address review comments 2017-04-05 17:44:14 +01:00
Douwe Maan 21e10888c3
Address review comments 2017-04-05 17:44:14 +01:00
Douwe Maan fe26b8af94
Correctly display multiple separate discussions on the same diff line 2017-04-05 17:44:14 +01:00
Douwe Maan bb8cc94668
Don't use original_discussion_id 2017-04-05 17:44:14 +01:00
Douwe Maan 2058e71e63
Extract commonalities between DiffDiscussion and LegacyDiffDiscussion 2017-04-05 17:44:14 +01:00
Douwe Maan 79889a6aa3
Add specs 2017-04-05 17:44:14 +01:00
Douwe Maan f6f6aaf593
Better notification emails for notes and (diff) discussions 2017-04-05 17:44:14 +01:00
Douwe Maan 08bbb9fce6
Add option to start a new discussion on an MR 2017-04-05 17:44:14 +01:00
Jarka Kadlecova c729d9dae7 Create metadata when creating system notes 2017-03-28 15:16:41 +02:00
Jarka Kadlecova 1c3c7fb25d Add system_note_metadata model 2017-03-28 13:58:35 +02:00
Adam Niedzielski c661df3561 Invalidate ETag cache when note changes 2017-03-01 16:48:02 +01:00
mhasbini 9f949d4e24 add /award slash command
add /award slash command; Allow posting of just an emoji in comment
2017-02-28 22:38:19 +02:00
Douwe Maan 1fe7501b49 Revert "Prefer leading style for Style/DotPosition"
This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
2017-02-23 09:33:05 -06:00
Douwe Maan 7d4b52b27d Enable Style/WordArray 2017-02-23 09:32:41 -06:00
Douwe Maan 206953a430 Prefer leading style for Style/DotPosition 2017-02-23 09:32:22 -06:00
Felipe Artur 0b14b654b6 Gather issuable metadata to avoid n+ queries on index view 2017-02-09 17:40:37 -02:00
Jarka Kadlecova 0c350b7939 address comments 2017-01-25 10:10:05 +01:00
Jarka Kadlecova d6b11dafd3 Support notes without project 2017-01-18 18:38:17 -05:00
Douwe Maan 12db4cc0e7 Merge branch 'jej-note-search-uses-finder' into 'security'
Fix missing Note access checks in by moving Note#search to updated NoteFinder

Split from !2024 to partially solve https://gitlab.com/gitlab-org/gitlab-ce/issues/23867

## Which fixes are in this MR?

⚠️ - Potentially untested  
💣 - No test coverage  
🚥 - Test coverage of some sort exists (a test failed when error raised)  
🚦 - Test coverage of return value (a test failed when nil used)  
 - Permissions check tested

### Note lookup without access check

- [x]  app/finders/notes_finder.rb:13 :download_code check
- [x]  app/finders/notes_finder.rb:19 `SnippetsFinder`
- [x]  app/models/note.rb:121 [`Issue#visible_to_user`]
- [x]  lib/gitlab/project_search_results.rb:113
  - This is the only use of `app/models/note.rb:121` above, but importantly has no access checks at all. This means it leaks MR comments and snippets when those features are `team-only` in addition to the issue comments which would be fixed by `app/models/note.rb:121`.
  - It is only called from SearchController where `can?(current_user, :download_code, @project)` is checked, so commit comments are not leaked.

### Previous discussions
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b915c5267a63628b0bafd23d37792ae73ceae272_13_13 `: download_code` check on commit
- [x] https://dev.gitlab.org/gitlab/gitlabhq/merge_requests/2024/diffs#b915c5267a63628b0bafd23d37792ae73ceae272_19_19 `SnippetsFinder` should be used
  - `SnippetsFinder` should check if the snippets feature is enabled -> https://gitlab.com/gitlab-org/gitlab-ce/issues/25223

###  Acceptance criteria met?
- [x] Tests added for new code
- [x] TODO comments removed
- [x] Squashed and removed skipped tests
- [x] Changelog entry
- [ ] State Gitlab versions affected and issue severity in description
- [ ] Create technical debt issue for NotesFinder.
  - Either split into `NotesFinder::ForTarget` and `NotesFinder::Search` or consider object per notable type such as `NotesFinder::OnIssue`. For the first option could create `NotesFinder::Base` which is either inherited from or which can be included in the other two.
  - Avoid case statement anti-pattern in this finder with use of `NotesFinder::OnCommit` etc. Consider something on the finder for this? `Model.finder(user, project)`
  - Move `inc_author` to the controller, and implement `related_notes` to replace `non_diff_notes`/`mr_and_commit_notes`

See merge request !2035
2016-12-15 11:40:12 -03:00