Skip to content
Snippets Groups Projects
Commit 3b667833 authored by Marcelo Schmidt's avatar Marcelo Schmidt
Browse files

Merge branch 'master' of github.com:RocketChat/Rocket.Chat

parents a04d0602 e08bfa79
No related merge requests found
...@@ -36,6 +36,20 @@ ...@@ -36,6 +36,20 @@
isEnable: -> isEnable: ->
return @canReadMessage is true return @canReadMessage is true
refreshUnreadMark: (rid) ->
rid ?= Session.get 'openedRoom'
if rid?
subscription = ChatSubscription.findOne rid: rid
room = RoomManager.openedRooms[subscription.t + subscription.name]
if room?
$roomDom = $(room.dom)
$roomDom.find('.message.first-unread').addClass('first-unread-opaque')
if (subscription.rid isnt rid or readMessage.isEnable() is false) and (subscription.alert or subscription.unread > 0)
$roomDom.find('.message.first-unread').removeClass('first-unread').removeClass('first-unread-opaque')
firstUnreadId = ChatMessage.findOne({rid: subscription.rid, ts: {$gt: subscription.ls}, 'u._id': {$ne: Meteor.userId()}}, {sort: {ts: 1}})?._id
if firstUnreadId?
$roomDom.find('.message#'+firstUnreadId).addClass('first-unread')
Meteor.startup -> Meteor.startup ->
$(window).on 'blur', -> $(window).on 'blur', ->
...@@ -43,11 +57,14 @@ Meteor.startup -> ...@@ -43,11 +57,14 @@ Meteor.startup ->
$(window).on 'focus', -> $(window).on 'focus', ->
readMessage.enable() readMessage.enable()
readMessage.read()
$(window).on 'click', (e) -> $(window).on 'click', (e) ->
readMessage.enable()
readMessage.read() readMessage.read()
$(window).on 'touchend', (e) -> $(window).on 'touchend', (e) ->
readMessage.enable()
readMessage.read() readMessage.read()
$(window).on 'keyup', (e) -> $(window).on 'keyup', (e) ->
......
...@@ -38,6 +38,11 @@ openRoom = (type, name) -> ...@@ -38,6 +38,11 @@ openRoom = (type, name) ->
Session.set 'editRoomTitle', false Session.set 'editRoomTitle', false
readMessage.disable() readMessage.disable()
Meteor.setTimeout ->
readMessage.refreshUnreadMark()
readMessage.enable()
readMessage.readNow()
, 2000
# KonchatNotification.removeRoomNotification(params._id) # KonchatNotification.removeRoomNotification(params._id)
if Meteor.Device.isDesktop() if Meteor.Device.isDesktop()
......
...@@ -26,14 +26,7 @@ Meteor.startup -> ...@@ -26,14 +26,7 @@ Meteor.startup ->
if subscription.alert is true if subscription.alert is true
unreadAlert = '•' unreadAlert = '•'
room = RoomManager.openedRooms[subscription.t + subscription.name] readMessage.refreshUnreadMark(subscription.rid)
if room?
if (subscription.rid isnt rid or readMessage.isEnable() is false) and (subscription.alert or subscription.unread > 0)
$roomDom = $(room.dom)
$roomDom.find('.message.first-unread').removeClass('first-unread')
firstUnreadId = ChatMessage.findOne({rid: subscription.rid, ts: {$gt: subscription.ls}, 'u._id': {$ne: Meteor.userId()}}, {sort: {ts: 1}})?._id
if firstUnreadId?
$roomDom.find('.message#'+firstUnreadId).addClass('first-unread')
if unreadCount > 0 if unreadCount > 0
if unreadCount > 999 if unreadCount > 999
......
...@@ -129,16 +129,28 @@ blockquote { ...@@ -129,16 +129,28 @@ blockquote {
} }
.first-unread { .first-unread {
&.first-unread-opaque {
.body {
&::before {
background-color: #E6E6E6;
}
&::after {
color: #B3B3B3;
}
}
}
.body { .body {
&::before { &::before {
content: ""; content: "";
background-color: rgba(255, 0, 0, 0.54); background-color: #FF8080;
display: block; display: block;
height: 1px; height: 1px;
position: absolute; position: absolute;
right: 0px; right: 0px;
left: 50px; left: 50px;
top: -3px; top: -3px;
.transition(background-color, .5s, linear);
} }
&::after { &::after {
...@@ -152,7 +164,8 @@ blockquote { ...@@ -152,7 +164,8 @@ blockquote {
line-height: 10px; line-height: 10px;
background-color: white; background-color: white;
padding-left: 5px; padding-left: 5px;
color: red; color: #FF0000;
.transition(color, .5s, linear);
} }
} }
} }
......
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
<th>{{_ "Stats_Total_Direct_Messages"}}</th> <th>{{_ "Stats_Total_Direct_Messages"}}</th>
<td>{{statistics.totalDirect}}</td> <td>{{statistics.totalDirect}}</td>
</tr> </tr>
<tr>
<th>{{_ "Stats_Total_Messages"}}</th>
<td>{{statistics.totalMessages}}</td>
</tr>
<tr> <tr>
<th>{{_ "Stats_Max_Room_Users"}}</th> <th>{{_ "Stats_Max_Room_Users"}}</th>
<td>{{statistics.maxRoomUsers}}</td> <td>{{statistics.maxRoomUsers}}</td>
......
...@@ -245,7 +245,8 @@ ...@@ -245,7 +245,8 @@
"Stats_OS_Type": "OS Type", "Stats_OS_Type": "OS Type",
"Stats_OS_Uptime": "OS Uptime", "Stats_OS_Uptime": "OS Uptime",
"Stats_Total_Channels": "Total Channels", "Stats_Total_Channels": "Total Channels",
"Stats_Total_Direct_Messages": "Total Direct Messages", "Stats_Total_Direct_Messages": "Total Direct Messages Rooms",
"Stats_Total_Messages": "Total Messages",
"Stats_Total_Private_Groups": "Total Private Groups", "Stats_Total_Private_Groups": "Total Private Groups",
"Stats_Total_Rooms": "Total Rooms", "Stats_Total_Rooms": "Total Rooms",
"Stats_Total_Users": "Total Users", "Stats_Total_Users": "Total Users",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// the entire section is optional. // the entire section is optional.
App.info({ App.info({
id: 'com.konecty.rocket.chat', id: 'com.konecty.rocket.chat',
version: '0.1.4', version: '0.1.5',
name: 'Rocket.Chat', name: 'Rocket.Chat',
description: 'Rocket.Chat', description: 'Rocket.Chat',
author: 'Rocket.Chat Development Group', author: 'Rocket.Chat Development Group',
...@@ -52,6 +52,8 @@ App.setPreference('StatusBarOverlaysWebView', false); ...@@ -52,6 +52,8 @@ App.setPreference('StatusBarOverlaysWebView', false);
App.setPreference('StatusBarStyle', 'lightcontent'); App.setPreference('StatusBarStyle', 'lightcontent');
App.setPreference('StatusBarBackgroundColor', '#000000'); App.setPreference('StatusBarBackgroundColor', '#000000');
App.setPreference('ShowSplashScreenSpinner', false); App.setPreference('ShowSplashScreenSpinner', false);
App.setPreference('android-targetSdkVersion', '19');
App.setPreference('android-minSdkVersion', '19');
App.accessRule('*'); App.accessRule('*');
// Pass preferences for a particular PhoneGap/Cordova plugin // Pass preferences for a particular PhoneGap/Cordova plugin
......
...@@ -18,6 +18,9 @@ RocketChat.getStatistics = -> ...@@ -18,6 +18,9 @@ RocketChat.getStatistics = ->
statistics.totalPrivateGroups = ChatRoom.find({ t: 'p' }).count() statistics.totalPrivateGroups = ChatRoom.find({ t: 'p' }).count()
statistics.totalDirect = ChatRoom.find({ t: 'd' }).count() statistics.totalDirect = ChatRoom.find({ t: 'd' }).count()
# Message statistics
statistics.totalMessages = ChatMessage.find().count()
m = -> m = ->
emit 1, emit 1,
sum: this.usernames.length or 0 sum: this.usernames.length or 0
......
...@@ -99,6 +99,14 @@ RocketChat.sendMessage = (user, message, room, options) -> ...@@ -99,6 +99,14 @@ RocketChat.sendMessage = (user, message, room, options) ->
mentionIds.push mention._id mentionIds.push mention._id
if mentionIds.length > 0 if mentionIds.length > 0
usersOfMention = Meteor.users.find({_id: {$in: mentionIds}}, {fields: {_id: 1, username: 1}}).fetch()
if room.t is 'c' and mentionIds.indexOf('all') is -1
for usersOfMentionItem in usersOfMention
if room.usernames.indexOf(usersOfMentionItem.username) is -1
Meteor.runAsUser usersOfMentionItem._id, ->
Meteor.call 'joinRoom', room._id
### ###
Update all other subscriptions of mentioned users to alert their owners and incrementing Update all other subscriptions of mentioned users to alert their owners and incrementing
the unread counter for mentions and direct messages the unread counter for mentions and direct messages
...@@ -141,7 +149,6 @@ RocketChat.sendMessage = (user, message, room, options) -> ...@@ -141,7 +149,6 @@ RocketChat.sendMessage = (user, message, room, options) ->
query._id = query._id =
$in: mentionIds $in: mentionIds
usersOfMention = Meteor.users.find(query, {fields: {_id: 1}}).fetch()
usersOfMentionIds = _.pluck(usersOfMention, '_id'); usersOfMentionIds = _.pluck(usersOfMention, '_id');
if usersOfMentionIds.length > 0 if usersOfMentionIds.length > 0
Push.send Push.send
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment