Skip to content

Commit

Permalink
Merge pull request #6760 from gdelavald/hide-nav-buttons-for-self
Browse files Browse the repository at this point in the history
[FIX] Hides nav buttons when selecting own profile
  • Loading branch information
rodrigok authored Apr 24, 2017
2 parents 4952bcb + bead72a commit 1566f7e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 51 deletions.
104 changes: 53 additions & 51 deletions packages/rocketchat-ui-flextab/client/tabs/userInfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,67 +41,69 @@ <h3 title="{{name}}"><i class="status-{{status}}"></i> {{name}}</h3>
</div>
{{/with}}
<nav>
{{#if user.active}}
{{> videoButtons}}
{{/if}}
{{#if isDirect}}
{{#if isBlocker}}
<button class='button button-block tertiary unblock-user'><span><i class='icon-block'></i> {{_ "Unblock_User"}}</span></button>
{{else}}
<button class='button button-block danger block-user'><span><i class='icon-block'></i> {{_ "Block_User"}}</span></button>
{{#unless isSelf user.username}}
{{#if user.active}}
{{> videoButtons}}
{{/if}}
{{/if}}

{{#if showAll}}
{{#if canDirectMessage user.username}}
<button class='button button-block primary pvt-msg'><span><i class='icon-chat'></i> {{_ "Conversation"}}</span></button> {{/if}}
{{#if canSetOwner}}
{{#if isOwner}}
<button class="button button-block danger unset-owner"><span>{{_ "Remove_as_owner"}}</span></button>
{{#if isDirect}}
{{#if isBlocker}}
<button class='button button-block tertiary unblock-user'><span><i class='icon-block'></i> {{_ "Unblock_User"}}</span></button>
{{else}}
<button class="button button-block tertiary set-owner"><span>{{_ "Set_as_owner"}}</span></button>
<button class='button button-block danger block-user'><span><i class='icon-block'></i> {{_ "Block_User"}}</span></button>
{{/if}}
{{/if}}
{{#if canSetModerator}}
{{#if isModerator}}
<button class="button button-block danger unset-moderator"><span>{{_ "Remove_as_moderator"}}</span></button>
{{else}}
<button class="button button-block tertiary set-moderator"><span>{{_ "Set_as_moderator"}}</span></button>

{{#if showAll}}
{{#if canDirectMessage user.username}}
<button class='button button-block primary pvt-msg'><span><i class='icon-chat'></i> {{_ "Conversation"}}</span></button> {{/if}}
{{#if canSetOwner}}
{{#if isOwner}}
<button class="button button-block danger unset-owner"><span>{{_ "Remove_as_owner"}}</span></button>
{{else}}
<button class="button button-block tertiary set-owner"><span>{{_ "Set_as_owner"}}</span></button>
{{/if}}
{{/if}}
{{/if}}
{{#if canMuteUser}}
{{#if userMuted}}
<button class="button button-block secondary unmute-user primary"><span>{{_ "Unmute_user"}}</span></button>
{{else}}
<button class="button button-block danger mute-user"><span>{{_ "Mute_user"}}</span></button>
{{#if canSetModerator}}
{{#if isModerator}}
<button class="button button-block danger unset-moderator"><span>{{_ "Remove_as_moderator"}}</span></button>
{{else}}
<button class="button button-block tertiary set-moderator"><span>{{_ "Set_as_moderator"}}</span></button>
{{/if}}
{{/if}}
{{#if canMuteUser}}
{{#if userMuted}}
<button class="button button-block secondary unmute-user primary"><span>{{_ "Unmute_user"}}</span></button>
{{else}}
<button class="button button-block danger mute-user"><span>{{_ "Mute_user"}}</span></button>
{{/if}}
{{/if}}
{{#if canRemoveUser}}
<button class="button button-block danger remove-user"><span>{{_ "Remove_from_room"}}</span></button>
{{/if}}
{{/if}}
{{#if canRemoveUser}}
<button class="button button-block danger remove-user"><span>{{_ "Remove_from_room"}}</span></button>
{{/if}}
{{/if}}

{{#unless hideAdminControls}}
{{#if hasPermission 'edit-other-user-info'}}
<button class='button button-block primary edit-user'><span><i class='icon-edit'></i> {{_ "Edit"}}</span></button>
{{/if}}
{{#if hasPermission 'assign-admin-role'}}
{{#if hasAdminRole}}
<button class='button button-block danger remove-admin'><span><i class='icon-shield'></i> {{_ "Remove_Admin"}}</span></button>
{{else}}
<button class='button button-block secondary make-admin'><span><i class='icon-shield'></i> {{_ "Make_Admin"}}</span></button>
{{#unless hideAdminControls}}
{{#if hasPermission 'edit-other-user-info'}}
<button class='button button-block primary edit-user'><span><i class='icon-edit'></i> {{_ "Edit"}}</span></button>
{{/if}}
{{/if}}
{{#if hasPermission 'edit-other-user-active-status'}}
{{#if active}}
<button class='button button-block danger deactivate'><span><i class='icon-block'></i> {{_ "Deactivate"}}</span></button>
{{else}}
<button class='button button-block secondary activate'><span><i class='icon-ok-circled'></i> {{_ "Activate"}}</span></button>
{{#if hasPermission 'assign-admin-role'}}
{{#if hasAdminRole}}
<button class='button button-block danger remove-admin'><span><i class='icon-shield'></i> {{_ "Remove_Admin"}}</span></button>
{{else}}
<button class='button button-block secondary make-admin'><span><i class='icon-shield'></i> {{_ "Make_Admin"}}</span></button>
{{/if}}
{{/if}}
{{/if}}
{{#if hasPermission 'delete-user'}}
<button class='button button-block danger delete'><span><i class='icon-trash'></i> {{_ "Delete"}}</span></button>
{{/if}}
{{#if hasPermission 'edit-other-user-active-status'}}
{{#if active}}
<button class='button button-block danger deactivate'><span><i class='icon-block'></i> {{_ "Deactivate"}}</span></button>
{{else}}
<button class='button button-block secondary activate'><span><i class='icon-ok-circled'></i> {{_ "Activate"}}</span></button>
{{/if}}
{{/if}}
{{#if hasPermission 'delete-user'}}
<button class='button button-block danger delete'><span><i class='icon-trash'></i> {{_ "Delete"}}</span></button>
{{/if}}
{{/unless}}
{{/unless}}

{{#if showAll}}
Expand Down
5 changes: 5 additions & 0 deletions packages/rocketchat-ui-flextab/client/tabs/userInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ Template.userInfo.helpers({
return RocketChat.authz.hasAllPermission('create-d') && user && user.username !== username;
},

isSelf(username) {
const user = Meteor.user();
return user && user.username === username;
},

linkedinUsername() {
const user = Template.instance().user.get();
if (user && user.services && user.services.linkedin && user.services.linkedin.publicProfileUrl) {
Expand Down

0 comments on commit 1566f7e

Please sign in to comment.