-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
different color for @all notifications #2593
Comments
this pain is real! lol What about the cases where you have an |
@you comes first of course |
The @ALL and @you have different color now sincie 0.27 (merge #2865) : Linked to this (and maybe issue #171) it would be great to be able to set diffrent sound for @ALL and @you. And beeing abel to mute one type of notification and not the other. |
Ok, I started working on this and would need some pointers concerning the "good way" to implement it: The goal: Being able to see a different count for
To add it, I need to update the template in (I don't add it to direct messages since it's unread count is already the direct one) Alternative: Could transform Am I on the good path ? The diff would look like that globally: diff --git a/client/startup/unread.coffee b/client/startup/unread.coffee
index 3d24407..5a16a32 100644
--- a/client/startup/unread.coffee
+++ b/client/startup/unread.coffee
@@ -5,7 +5,8 @@ Meteor.startup ->
unreadCount = 0
unreadAlert = false
- subscriptions = ChatSubscription.find({open: true}, { fields: { unread: 1, alert: 1, rid: 1, t: 1, name: 1, ls: 1 } })
+ subscriptions = ChatSubscription.find({open: true}, { fields: { unread: 1, unreadMe: 1, alert: 1, rid: 1, t: 1, name: 1, ls: 1 } })
openedRoomId = undefined
Tracker.nonreactive ->
diff --git a/packages/rocketchat-lib/server/methods/joinDefaultChannels.coffee b/packages/rocketchat-lib/server/methods/joinDefaultChannels.coffee
index 120eef2..0ad63d3 100644
--- a/packages/rocketchat-lib/server/methods/joinDefaultChannels.coffee
+++ b/packages/rocketchat-lib/server/methods/joinDefaultChannels.coffee
@@ -23,7 +23,8 @@ Meteor.methods
ts: new Date()
open: true
alert: true
unread: 1
+ unreadMe: 1
# Insert user joined message
if not silenced
diff --git a/packages/rocketchat-lib/server/models/Subscriptions.coffee b/packages/rocketchat-lib/server/models/Subscriptions.coffee
index 6db90a4..f67859a 100644
--- a/packages/rocketchat-lib/server/models/Subscriptions.coffee
+++ b/packages/rocketchat-lib/server/models/Subscriptions.coffee
@@ -10,6 +10,7 @@ RocketChat.models.Subscriptions = new class extends RocketChat.models._Base
@tryEnsureIndex { 'open': 1 }
@tryEnsureIndex { 'alert': 1 }
@tryEnsureIndex { 'unread': 1 }
+ @tryEnsureIndex { 'unreadMe': 1 }
@tryEnsureIndex { 'ts': 1 }
@tryEnsureIndex { 'ls': 1 }
@tryEnsureIndex { 'desktopNotifications': 1 }, { sparse: 1 }
@@ -130,6 +131,7 @@ RocketChat.models.Subscriptions = new class extends RocketChat.models._Base
open: true
alert: false
unread: 0
+ unreadMe: 0
ls: new Date
return @update query, update
@@ -200,6 +202,7 @@ RocketChat.models.Subscriptions = new class extends RocketChat.models._Base
open: true
$inc:
unread: inc
+ unreadMe: inc
return @update query, update, { multi: true }
@@ -230,6 +233,7 @@ RocketChat.models.Subscriptions = new class extends RocketChat.models._Base
open: true
$inc:
unread: inc
+ unreadMe: inc
return @update query, update, { multi: true }
@@ -284,6 +288,7 @@ RocketChat.models.Subscriptions = new class extends RocketChat.models._Base
open: false
alert: false
unread: 0
+ unreadMe: false
ts: room.ts
rid: room._id
name: room.name
diff --git a/packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.coffee b/packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.coffee
index 6213ff9..a7169d4 100644
--- a/packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.coffee
+++ b/packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.coffee
@@ -6,8 +6,12 @@ Template.chatRoomItem.helpers
unread: ->
if (FlowRouter.getParam('_id') isnt this.rid or not document.hasFocus()) and this.unread > 0
return this.unread
+ unreadMe: ->
+ return this.unreadMe
+
userStatus: ->
return 'status-' + (Session.get('user_' + this.name + '_status') or 'offline')
diff --git a/packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.html b/packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.html
index 8a1a68b..427677c 100644
--- a/packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.html
+++ b/packages/rocketchat-ui-sidenav/side-nav/chatRoomItem.html
@@ -2,7 +2,7 @@
<li class="link-room-{{rid}} {{active}} {{#if unread}}has-unread{{/if}} {{#if alert}}has-alert{{/if}}">
<a class="open-room" href="{{route}}" title="{{name}}">
{{#if unread}}
- <span class="unread">{{unread}}</span>
+ <span class="unread unread-direct">{{unread}} - {{unreadMe}}</span>
{{/if}}
<i class="{{roomIcon}} {{userStatus}}" aria-label=""></i>
<span class='name'>{{name}}</span>
diff --git a/server/methods/addUserToRoom.coffee b/server/methods/addUserToRoom.coffee
index 0b05a92..262615e 100644
--- a/server/methods/addUserToRoom.coffee
+++ b/server/methods/addUserToRoom.coffee
@@ -36,7 +36,7 @@ Meteor.methods
ts: now
open: true
alert: true
unread: 1
+ unreadMe: 1
fromUser = RocketChat.models.Users.findOneById fromId
RocketChat.models.Messages.createUserAddedWithRoomIdAndUser data.rid, newUser,
diff --git a/server/methods/joinRoom.coffee b/server/methods/joinRoom.coffee
index 5cfe335..7da2d92 100644
--- a/server/methods/joinRoom.coffee
+++ b/server/methods/joinRoom.coffee
@@ -29,6 +29,7 @@ Meteor.methods
open: true
alert: true
unread: 1
+ unreadMe: 1
RocketChat.models.Messages.createUserJoinWithRoomIdAndUser rid, user,
ts: now
diff --git a/server/publications/subscription.coffee b/server/publications/subscription.coffee
index 7ad7acc..7e391a9 100644
--- a/server/publications/subscription.coffee
+++ b/server/publications/subscription.coffee
@@ -14,6 +14,7 @@ Meteor.publish 'subscription', ->
open: 1
alert: 1
unread: 1
+ unreadMe: 1
archived: 1
desktopNotifications: 1
mobilePushNotifications: 1 |
That would have my preference. Allows for extension in the future. But other than that, yeah, that’s the direction |
Is this the right place to propose a different sound for the @ALL notification as well ? Just to know if somebody needs you now or if it's just a guy talking to the world about its last great idea (you can check that later). |
Imagine you're in a few dozen channels. You go away to fetch a cup of coffee, and you hear the notification sound. You get back to your laptiop - and seven channels have a green icon. One, and only one, has a message @you, the rest is @ALL.
Choose wisely, young padawan...
The text was updated successfully, but these errors were encountered: