diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/issuable.rb | 2 | ||||
-rw-r--r-- | app/models/merge_request.rb | 3 | ||||
-rw-r--r-- | app/models/note.rb | 11 | ||||
-rw-r--r-- | app/views/projects/notes/_actions.html.haml | 2 |
4 files changed, 8 insertions, 10 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 765ccf540c3..265f6e48540 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -338,7 +338,7 @@ module Issuable ## # Override in issuable specialization # - def first_contribution?(*) + def first_contribution? false end end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index a5b037d94c2..2a56bab48a3 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -960,8 +960,9 @@ class MergeRequest < ActiveRecord::Base Projects::OpenMergeRequestsCountService.new(target_project).refresh_cache end - def first_contribution?(*) + def first_contribution? return false if project.team.max_member_access(author_id) > Gitlab::Access::GUEST + project.merge_requests.merged.where(author_id: author_id).empty? end diff --git a/app/models/note.rb b/app/models/note.rb index b1fe60aa387..f44590e2144 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -47,7 +47,7 @@ class Note < ActiveRecord::Base # A special role that may be displayed on issuable's discussions attr_accessor :special_role - + default_value_for :system, false attr_mentionable :note, pipeline: :note @@ -233,15 +233,12 @@ class Note < ActiveRecord::Base self.class.has_special_role?(role, self) end - def specialize!(role) - self.special_role = role if !block_given? || yield(self) - end - def specialize_for_first_contribution!(noteable) return unless noteable.author_id == self.author_id - specialize!(Note::SpecialRole::FIRST_TIME_CONTRIBUTOR) + + self.special_role = Note::SpecialRole::FIRST_TIME_CONTRIBUTOR end - + def editable? !system? end diff --git a/app/views/projects/notes/_actions.html.haml b/app/views/projects/notes/_actions.html.haml index 999a1b850e1..de76832331a 100644 --- a/app/views/projects/notes/_actions.html.haml +++ b/app/views/projects/notes/_actions.html.haml @@ -1,5 +1,5 @@ - if note.has_special_role?(Note::SpecialRole::FIRST_TIME_CONTRIBUTOR) - %span.note-role.note-role-special.has-tooltip{ title: _("This user hasn't yet contributed code to this project. Handle with care.") } + %span.note-role.note-role-special.has-tooltip{ title: _("This is the author's first Merge Request to this project. Handle with care.") } = issuable_first_contribution_icon - if access = note_max_access_for_user(note) %span.note-role.note-role-access= Gitlab::Access.human_access(access) |