[PATCH 3 of 4] pullrequest: re-add username when adding reviewers

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Jun 23 15:59:59 EDT 2015


# HG changeset patch
# User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
# Date 1435087755 -7200
#      Tue Jun 23 21:29:15 2015 +0200
# Node ID b609779e357e262092c323bc63eebd569e9e1f36
# Parent  20f661572d9e67ada5021a9a660f2bf4c9ad6920
pullrequest: re-add username when adding reviewers

Commit 90e982b6bca8 removed the username when adding reviewers, to align the
way new and existing reviewers are displayed. However, when a user does not
have a name set, the list of reviewers becomes useless.

Hence, show 'username (Full Name)' consistently for new and existing
reviewers.

diff --git a/kallithea/public/js/base.js b/kallithea/public/js/base.js
--- a/kallithea/public/js/base.js
+++ b/kallithea/public/js/base.js
@@ -1469,7 +1469,10 @@ var MentionsAutoComplete = function (div
 }
 
 var addReviewMember = function(id,fname,lname,nname,gravatar_link,gravatar_size){
-    var displayname = "{0} {1}".format(fname, lname);
+    var displayname = nname;
+    if ((fname != "") && (lname != "")) {
+        displayname += " ({0} {1})".format(fname, lname);
+    }
     var gravatarelm = '<img alt="gravatar" style="width: {0}px; height: {0}px" src="{1}"/>'.format(gravatar_size, gravatar_link);
     if (!gravatar_link)
         gravatarelm = '<i class="icon-user" style="font-size: {0}px;"></i>'.format(gravatar_size);
diff --git a/kallithea/templates/pullrequests/pullrequest_show.html b/kallithea/templates/pullrequests/pullrequest_show.html
--- a/kallithea/templates/pullrequests/pullrequest_show.html
+++ b/kallithea/templates/pullrequests/pullrequest_show.html
@@ -223,7 +223,7 @@
                   <div class="reviewer_gravatar gravatar">
                     ${h.gravatar(member.email, size=14)}
                   </div>
-                  <div style="float:left;">${member.full_name} (${_('Owner') if c.pull_request.user_id == member.user_id else _('Reviewer')})</div>
+                  <div style="float:left;">${member.full_name_and_username} (${_('Owner') if c.pull_request.user_id == member.user_id else _('Reviewer')})</div>
                   <input type="hidden" value="${member.user_id}" name="review_members" />
                   %if editable:
                   <div class="reviewer_member_remove action_button" onclick="removeReviewMember(${member.user_id})" title="${_('Remove reviewer')}">


More information about the kallithea-general mailing list