summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authormicael.bergeron <micael.bergeron@solutionstlm.com>2017-07-27 16:38:52 -0400
committermicael.bergeron <micael.bergeron@solutionstlm.com>2017-09-06 09:00:57 -0400
commit5e600db21ce5d6544f559ea6d25aab2858dd465e (patch)
tree9f1d2232c47efb7c2731bc820652b59cf2ebd1f4 /app
parentb97f9629cabadca1125351a8aa514791524dea3f (diff)
downloadgitlab-ce-5e600db21ce5d6544f559ea6d25aab2858dd465e.tar.gz
fix #35161, add a first-time contributor badge
a new badge will be added when an user that doesn't yet have any merged merge request is discussing on either issues or merge requests that he created. this is indented for people to use extra care when discussing with a new contributor.
Diffstat (limited to 'app')
-rw-r--r--app/helpers/notes_helper.rb5
-rw-r--r--app/views/projects/notes/_actions.html.haml3
2 files changed, 8 insertions, 0 deletions
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 083ace65b09..1e7d346ab8f 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -76,6 +76,11 @@ module NotesHelper
note.project.team.human_max_access(note.author_id)
end
+ def note_first_contribution_for_user?(note)
+ note.noteable.author_id == note.author_id &&
+ note.project.merge_requests.merged.where(author_id: note.author_id).empty?
+ end
+
def discussion_path(discussion)
if discussion.for_merge_request?
return unless discussion.diff_discussion?
diff --git a/app/views/projects/notes/_actions.html.haml b/app/views/projects/notes/_actions.html.haml
index fb07141d2ac..38548cbe93a 100644
--- a/app/views/projects/notes/_actions.html.haml
+++ b/app/views/projects/notes/_actions.html.haml
@@ -1,6 +1,9 @@
- access = note_max_access_for_user(note)
- if access
%span.note-role= access
+- if note_first_contribution_for_user?(note)
+ %span.note-role.has-tooltip{ title: _("This user hasn't yet contributed code to this project. Handle with care.")}
+ = _('First-time contributor')
- if note.resolvable?
- can_resolve = can?(current_user, :resolve_note, note)