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

[IMPROVE] Show rooms with mentions on unread category even with hide counter #13948

Merged
merged 1 commit into from
Mar 29, 2019
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: 0 additions & 2 deletions app/ui-sidenav/client/chatRoomItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ Template.chatRoomItem.helpers({

const archivedClass = this.archived ? 'archived' : false;

this.alert = !this.hideUnreadStatus && this.alert; // && (!hasFocus || FlowRouter.getParam('_id') !== this.rid);

const icon = this.t !== 'd' && roomTypes.getIcon(this);
const avatar = !icon;

Expand Down
14 changes: 11 additions & 3 deletions app/ui-sidenav/client/roomList.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ Template.roomList.helpers({

if (this.identifier === 'unread') {
query.alert = true;
query.hideUnreadStatus = { $ne: true };
query.$or = [
{ hideUnreadStatus: { $ne: true } },
{ unread: { $gt: 0 } },
];

return ChatSubscription.find(query, { sort });
}
Expand All @@ -64,7 +67,7 @@ Template.roomList.helpers({
query.prid = { $exists: true };
}

if (this.identifier === 'unread' || this.identifier === 'tokens') {
if (this.identifier === 'tokens') {
types = ['c', 'p'];
}

Expand All @@ -82,7 +85,12 @@ Template.roomList.helpers({
if (getUserPreference(user, 'sidebarShowUnread')) {
query.$or = [
{ alert: { $ne: true } },
{ hideUnreadStatus: true },
{
$and: [
{ hideUnreadStatus: true },
{ unread: 0 },
],
},
];
}
query.t = { $in: types };
Expand Down
2 changes: 1 addition & 1 deletion app/ui-sidenav/client/sidebarItem.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</template>

<template name="sidebarItem">
<li class="sidebar-item{{#if or unread alert }} sidebar-item--unread{{/if}}{{#if active}} sidebar-item--active{{/if}}{{#if toolbar}} popup-item{{/if}}" data-id="{{_id}}">
<li class="sidebar-item{{#if showUnread }} sidebar-item--unread{{/if}}{{#if active}} sidebar-item--active{{/if}}{{#if toolbar}} popup-item{{/if}}" data-id="{{_id}}">
<a class="sidebar-item__link" href="{{#if route}}{{route}}{{else}}{{pathFor pathSection group=pathGroup}}{{/if}}" aria-label="{{name}}">
{{#unless isLivechatQueue}}

Expand Down
7 changes: 3 additions & 4 deletions app/ui-sidenav/client/sidebarItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import { hasAtLeastOnePermission } from '../../authorization';
import { menu } from '../../ui-utils';

Template.sidebarItem.helpers({
or(...args) {
args.pop();
return args.some((arg) => arg);
},
streaming() {
return this.streamingOptions && Object.keys(this.streamingOptions).length;
},
Expand All @@ -36,6 +32,9 @@ Template.sidebarItem.helpers({
isLivechatQueue() {
return this.pathSection === 'livechat-queue';
},
showUnread() {
return this.unread > 0 || (!this.hideUnreadStatus && this.alert);
},
});

function timeAgo(time) {
Expand Down