changeset 2770:74364824c1e1 beta

Hide add/delete pull request members when you don't have permission for it
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 01 Sep 2012 21:33:31 +0200
parents 52617fb79010
children 9640c1c6399b
files rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html rhodecode/templates/pullrequests/pullrequest_show.html
diffstat 2 files changed, 20 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html	Sat Sep 01 21:06:51 2012 +0200
+++ b/rhodecode/templates/admin/users/user_edit_my_account_pullrequests.html	Sat Sep 01 21:33:31 2012 +0200
@@ -4,16 +4,18 @@
     %if c.my_pull_requests:
       %for pull_request in c.my_pull_requests:
       <li>
-      <div style="float:left">
-      <a href="${h.url('pullrequest_show',repo_name=pull_request.other_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
-      ${_('Pull request #%s opened on %s') % (pull_request.pull_request_id, h.fmt_date(pull_request.created_on))}
-      </a>
-      </div>
-      <div style="float:left;margin-top: -5px">
-        ${h.form(url('pullrequest_delete', repo_name=pull_request.other_repo.repo_name, pull_request_id=pull_request.pull_request_id),method='delete')}
-          ${h.submit('remove_%s' % pull_request.pull_request_id,'',class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
-        ${h.end_form()}
-     </div>      
+        <div style="height: 12px">
+          <div style="float:left">
+          <a href="${h.url('pullrequest_show',repo_name=pull_request.other_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
+          ${_('Pull request #%s opened on %s') % (pull_request.pull_request_id, h.fmt_date(pull_request.created_on))}
+          </a>
+          </div>
+          <div style="float:left;margin-top: -5px">
+            ${h.form(url('pullrequest_delete', repo_name=pull_request.other_repo.repo_name, pull_request_id=pull_request.pull_request_id),method='delete')}
+              ${h.submit('remove_%s' % pull_request.pull_request_id,'',class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
+            ${h.end_form()}
+          </div>
+        </div>
       </li>
       %endfor
    %else:
@@ -26,9 +28,11 @@
     %if c.my_pull_requests:
       %for pull_request in c.participate_in_pull_requests:
       <li>
-      <a href="${h.url('pullrequest_show',repo_name=pull_request.other_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
-      ${_('Pull request #%s opened by %s on %s') % (pull_request.pull_request_id, pull_request.author.full_name, h.fmt_date(pull_request.created_on))}
-      </a>
+        <div style="height: 12px">
+        <a href="${h.url('pullrequest_show',repo_name=pull_request.other_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
+        ${_('Pull request #%s opened by %s on %s') % (pull_request.pull_request_id, pull_request.author.full_name, h.fmt_date(pull_request.created_on))}
+        </a>
+      </div>
       </li>
       %endfor
     %else:
--- a/rhodecode/templates/pullrequests/pullrequest_show.html	Sat Sep 01 21:06:51 2012 +0200
+++ b/rhodecode/templates/pullrequests/pullrequest_show.html	Sat Sep 01 21:33:31 2012 +0200
@@ -93,7 +93,7 @@
                   <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(member.email,14)}"/> </div>
                   <div style="float:left">${member.full_name} (${_('owner')})</div>
                   <input type="hidden" value="${member.user_id}" name="review_members" />
-                  %if not c.pull_request.is_closed():
+                  %if not c.pull_request.is_closed() and (h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.author.user_id == c.rhodecode_user.user_id):
                   <span class="delete_icon action_button" onclick="removeReviewer(${member.user_id})"></span>
                   %endif
                 </div>
@@ -103,6 +103,7 @@
           </div>
           %if not c.pull_request.is_closed():
           <div class='ac'>
+            %if h.HasPermissionAny('hg.admin', 'repository.admin')() or c.pull_request.author.user_id == c.rhodecode_user.user_id:
             <div class="reviewer_ac">
                ${h.text('user', class_='yui-ac-input')}
                <span class="help-block">${_('Add reviewer to this pull request.')}</span>
@@ -111,6 +112,7 @@
             <div style="padding:0px 10px">
              <span id="update_pull_request" class="ui-btn xsmall">${_('save')}</span>
             </div>
+            %endif
           </div>
           %endif
         </div>