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

[NEW] Room counter sidebar preference #8866

Merged
merged 3 commits into from
Dec 4, 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
2 changes: 2 additions & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,7 @@
"Should_be_a_URL_of_an_image": "Should be a URL of an image.",
"Should_exists_a_user_with_this_username": "The user must already exist.",
"Show_all": "Show All",
"Show_message_counter_on_sidebar": "Show message counter on sidebar",
"Show_more": "Show more",
"show_offline_users": "show offline users",
"Show_on_registration_page": "Show on registration page",
Expand All @@ -1623,6 +1624,7 @@
"Showing_archived_results": "<p>Showing <b>%s</b> archived results</p>",
"Showing_online_users": "Showing: <b>__total_showing__</b>, Online: __online__, Total: __total__ users",
"Showing_results": "<p>Showing <b>%s</b> results</p>",
"Sidebar": "Sidebar",
"Sidebar_list_mode": "Sidebar Channel List Mode",
"Sign_in_to_start_talking": "Sign in to start talking",
"since_creation": "since %s",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

font-size: var(--rooms-list-title-text-size);
align-items: center;
justify-content: space-between;

&-text--livechat {
flex: 1;
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-theme/client/imports/forms/tags.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

width: 100%;
min-height: 43px;
padding: 0 1rem 0 3.25rem;
padding: 0 1rem 0 2.25rem;

border-width: var(--tags-border-width);
border-color: var(--tags-border-color);
Expand Down
12 changes: 12 additions & 0 deletions packages/rocketchat-ui-account/client/accountPreferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,18 @@ <h1>{{_ "Messages"}}</h1>
</div>
</div>
</div>
<div class="section">
<h1>{{_ "Sidebar"}}</h1>
<div class="section-content border-component-color">
<div class="input-line double-col" id="messageCounterSidebar">
<label>{{_ "Show_message_counter_on_sidebar"}}</label>
<div>
<label><input type="radio" name="messageCounterSidebar" value="1" checked="{{checked 'messageCounterSidebar' true}}"/> {{_ "True"}}</label>
<label><input type="radio" name="messageCounterSidebar" value="0" checked="{{checked 'messageCounterSidebar' false true}}"/> {{_ "False"}}</label>
</div>
</div>
</div>
</div>
<div class="section">
<h1>{{_ "Highlights"}}</h1>
<div class="section-content border-component-color">
Expand Down
2 changes: 2 additions & 0 deletions packages/rocketchat-ui-account/client/accountPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ Template.accountPreferences.onCreated(function() {
data.unreadAlert = $('#unreadAlert').find('input:checked').val();
data.notificationsSoundVolume = parseInt($('#notificationsSoundVolume').val());

data.messageCounterSidebar = $('#messageCounterSidebar').find('input:checked').val();

Meteor.call('saveUserPreferences', data, function(error, results) {
if (results) {
toastr.success(t('Preferences_saved'));
Expand Down
12 changes: 7 additions & 5 deletions packages/rocketchat-ui-sidenav/client/roomList.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
{{#if shouldAppear .. .}}
<h3 class="rooms-list__type">
<span class="rooms-list__type-text">{{_ ../label}}</span>
{{#with count}}
{{#if .}}
<span class="badge">{{.}}</span>
{{/if}}
{{/with}}
{{#if showCounter}}
{{#with count}}
{{#if .}}
<span class="badge">{{.}}</span>
{{/if}}
{{/with}}
{{/if}}
</h3>
<ul class="rooms-list__list {{ roomType ..}}">
{{#each room in this}}
Expand Down
5 changes: 5 additions & 0 deletions packages/rocketchat-ui-sidenav/client/roomList.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ Template.roomList.helpers({
if (room.header || room.identifier) {
return `type-${ room.header || room.identifier }`;
}
},

showCounter() {
const user = Meteor.user();
return user && user.settings && user.settings.preferences && user.settings.preferences.messageCounterSidebar;
}
});

Expand Down
1 change: 1 addition & 0 deletions server/methods/saveUserPreferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Meteor.methods({
preferences.hideFlexTab = settings.hideFlexTab === '1';
preferences.highlights = settings.highlights;
preferences.sendOnEnter = settings.sendOnEnter;
preferences.messageCounterSidebar = settings.messageCounterSidebar === '1';

RocketChat.models.Users.setPreferences(Meteor.userId(), preferences);

Expand Down