Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Hides nav buttons when selecting own profile #6760

Merged
merged 2 commits into from
Apr 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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