Skip to content

Commit

Permalink
Merge pull request #10016 from RocketChat/sidebar-viewmode-admin-option
Browse files Browse the repository at this point in the history
[FIX] Missing sidebar default options on admin
  • Loading branch information
rodrigok authored Mar 15, 2018
2 parents c20f3fd + 12ad2c4 commit 5d58203
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 82 deletions.
1 change: 0 additions & 1 deletion packages/rocketchat-api/server/v1/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ RocketChat.API.v1.addRoute('users.setPreferences', { authRequired: true }, {
enableAutoAway: Match.Maybe(Boolean),
highlights: Match.Maybe(Array),
desktopNotificationDuration: Match.Maybe(Number),
viewMode: Match.Maybe(Number),
hideUsernames: Match.Maybe(Boolean),
hideRoles: Match.Maybe(Boolean),
hideAvatars: Match.Maybe(Boolean),
Expand Down
42 changes: 21 additions & 21 deletions packages/rocketchat-lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,29 @@ RocketChat.settings.addGroup('Accounts', function() {
'public': true,
i18nLabel: 'Sidebar_list_mode'
});
this.add('Accounts_Default_User_Preferences_mergeChannels', false, {
this.add('Accounts_Default_User_Preferences_sidebarViewMode', 'medium', {
type: 'select',
values: [
{
key: 'extended',
i18nLabel: 'Extended'
},
{
key: 'medium',
i18nLabel: 'Medium'
},
{
key: 'condensed',
i18nLabel: 'Condensed'
}
],
'public': true,
i18nLabel: 'Sidebar_list_mode'
});
this.add('Accounts_Default_User_Preferences_sidebarHideAvatar', false, {
type: 'boolean',
'public': true,
i18nLabel: 'UI_Merge_Channels_Groups'
i18nLabel: 'Hide_Avatars'
});
this.add('Accounts_Default_User_Preferences_sidebarShowUnread', false, {
type: 'boolean',
Expand Down Expand Up @@ -352,25 +371,6 @@ RocketChat.settings.addGroup('Accounts', function() {
'public': true,
i18nLabel: 'Enter_Behaviour'
});
this.add('Accounts_Default_User_Preferences_viewMode', 0, {
type: 'select',
values: [
{
key: 0,
i18nLabel: 'Normal'
},
{
key: 1,
i18nLabel: 'Cozy'
},
{
key: 2,
i18nLabel: 'Compact'
}
],
'public': true,
i18nLabel: 'View_mode'
});
this.add('Accounts_Default_User_Preferences_emailNotificationMode', 'all', {
type: 'select',
values: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,6 @@
display: none;
}

.sidebar--medium .sidebar-item {
height: var(--sidebar-item-height-medium);

&__picture {
flex: 0 0 var(--sidebar-item-thumb-size-medium);

width: var(--sidebar-item-thumb-size-medium);
height: var(--sidebar-item-thumb-size-medium);
}

&__user-thumb {
width: var(--sidebar-item-thumb-size-medium);
height: var(--sidebar-item-thumb-size-medium);
}
}

.sidebar--extended .sidebar-item {
height: var(--sidebar-item-height-extended);

Expand Down Expand Up @@ -64,6 +48,22 @@
}
}

.sidebar--medium .sidebar-item {
height: var(--sidebar-item-height-medium);

&__picture {
flex: 0 0 var(--sidebar-item-thumb-size-medium);

width: var(--sidebar-item-thumb-size-medium);
height: var(--sidebar-item-thumb-size-medium);
}

&__user-thumb {
width: var(--sidebar-item-thumb-size-medium);
height: var(--sidebar-item-thumb-size-medium);
}
}

.sidebar-item {
position: relative;

Expand Down Expand Up @@ -192,7 +192,7 @@
&__message {
display: flex;
overflow: hidden;
flex-direction: row;
flex-direction: row !important;
flex: 1;

margin: 0 -3px;
Expand Down
11 changes: 0 additions & 11 deletions packages/rocketchat-ui-account/client/accountPreferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,6 @@ <h1>{{_ "Messages"}}</h1>
<div class="info">{{_ "Enter_Behaviour_Description"}}</div>
</div>
</div>
<div class="input-line double-col" id="viewMode">
<label>{{_ "View_mode"}}</label>
<div>
<select class="input-monitor rc-input__element" name="viewMode">
<option value="0" selected="{{selected 'viewMode' '0'}}">{{_ "Normal"}}</option>
<option value="1" selected="{{selected 'viewMode' '1'}}">{{_ "Cozy"}}</option>
<option value="2" selected="{{selected 'viewMode' '2'}}">{{_ "Compact"}}</option>
</select>
<div class="info">{{_ "View_mode_info"}}</div>
</div>
</div>
<div class="input-line double-col" id="emailNotificationMode">
<label>{{_ "Email_Notification_Mode"}}</label>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ Template.accountPreferences.onCreated(function() {
data.saveMobileBandwidth = JSON.parse($('input[name=saveMobileBandwidth]:checked').val());
data.collapseMediaByDefault = JSON.parse($('input[name=collapseMediaByDefault]:checked').val());
data.muteFocusedConversations = JSON.parse($('#muteFocusedConversations').find('input:checked').val());
data.viewMode = parseInt($('#viewMode').find('select').val());
data.hideUsernames = JSON.parse($('#hideUsernames').find('input:checked').val());
data.hideFlexTab = JSON.parse($('#hideFlexTab').find('input:checked').val());
data.hideAvatars = JSON.parse($('#hideAvatars').find('input:checked').val());
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-ui/client/views/app/room.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</div>
{{/each}}
</div>
<div class="messages-box {{#if selectable}}selectable{{/if}} {{viewMode}} {{hasLeader}}">
<div class="messages-box {{#if selectable}}selectable{{/if}} {{hasLeader}}">
<div class="ticks-bar"></div>
<button class="new-message background-primary-action-color color-content-background-color not">
<i class="icon-down-big"></i>
Expand Down
7 changes: 0 additions & 7 deletions packages/rocketchat-ui/client/views/app/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,6 @@ Template.room.helpers({
if (isSubscribed(this._id) && favoritesEnabled()) { return true; }
},

viewMode() {
const user = Meteor.user();
const viewMode = RocketChat.getUserPreference(user, 'viewMode');
const modes = ['', 'cozy', 'compact'];
return modes[viewMode] || modes[0];
},

selectable() {
return Template.instance().selectable.get();
},
Expand Down
1 change: 0 additions & 1 deletion server/methods/saveUserPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Meteor.methods({
enableAutoAway: Match.Optional(Boolean),
highlights: Match.Optional([String]),
desktopNotificationDuration: Match.Optional(Number),
viewMode: Match.Optional(Number),
hideUsernames: Match.Optional(Boolean),
hideRoles: Match.Optional(Boolean),
hideAvatars: Match.Optional(Boolean),
Expand Down
1 change: 0 additions & 1 deletion tests/data/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const preferences = {
enableAutoAway: true,
highlights: [],
desktopNotificationDuration: 0,
viewMode: 0,
hideUsernames: false,
hideRoles: false,
hideAvatars: false,
Expand Down
18 changes: 0 additions & 18 deletions tests/end-to-end/ui/11-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -883,16 +883,6 @@ describe('[Administration]', () => {
admin.accountsRoomsListExhibitionMode.getValue().should.equal('category');
});

it('it should show the merge channels field', () => {
admin.accountsMergeChannelsTrue.scroll();
admin.accountsMergeChannelsTrue.isVisible().should.be.true;
admin.accountsMergeChannelsFalse.isVisible().should.be.true;
});
it('the merge channels field value should be false', () => {
admin.accountsMergeChannelsTrue.isSelected().should.be.false;
admin.accountsMergeChannelsFalse.isSelected().should.be.true;
});

it('it should show the enter key behavior field', () => {
admin.accountsSendOnEnter.click();
admin.accountsSendOnEnter.isVisible().should.be.true;
Expand All @@ -901,14 +891,6 @@ describe('[Administration]', () => {
admin.accountsSendOnEnter.getValue().should.equal('normal');
});

it('it should show the view mode field', () => {
admin.accountsViewMode.click();
admin.accountsViewMode.isVisible().should.be.true;
});
it('the view mode field value should be 0', () => {
admin.accountsViewMode.getValue().should.equal('0');
});

it('it should show the offline email notification field', () => {
admin.accountsEmailNotificationMode.click();
admin.accountsEmailNotificationMode.isVisible().should.be.true;
Expand Down
3 changes: 0 additions & 3 deletions tests/pageobjects/administration.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,6 @@ class Administration extends Page {
get accountsSendOnEnter() { return browser.element('[name="Accounts_Default_User_Preferences_sendOnEnter"]'); }
get accountsSendOnEnterReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_sendOnEnter"]'); }

get accountsViewMode() { return browser.element('[name="Accounts_Default_User_Preferences_viewMode"]'); }
get accountsViewModeReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_viewMode"]'); }

get accountsEmailNotificationMode() { return browser.element('[name="Accounts_Default_User_Preferences_emailNotificationMode"]'); }
get accountsEmailNotificationModeReset() { return browser.element('.reset-setting[data-setting="Accounts_Default_User_Preferences_emailNotificationMode"]'); }

Expand Down

0 comments on commit 5d58203

Please sign in to comment.