diff --git a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json index de48c301bb9f1..d59e861de708b 100644 --- a/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json +++ b/packages/rocketchat-google-vision/.npm/package/npm-shrinkwrap.json @@ -1,6 +1,93 @@ { "lockfileVersion": 1, "dependencies": { + "@google-cloud/common": { + "version": "0.13.6", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-0.13.6.tgz", + "integrity": "sha1-qdjhN7xCmkSrqWif5qDkMxeE+FM=" + }, + "@google-cloud/common-grpc": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@google-cloud/common-grpc/-/common-grpc-0.4.3.tgz", + "integrity": "sha512-A3nErp1qV8iCWPYQniBhot7Gx+kZHTAuRzOQyoPpfbv9pLmsvZgTWzVUg1/R1ncrirQElHUDhIFXPV+kr+UJAA==", + "dependencies": { + "dot-prop": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-2.4.0.tgz", + "integrity": "sha1-hI4o9/HVB0DGdHqzywdnBGK2+Jw=" + } + } + }, + "@google-cloud/storage": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@google-cloud/storage/-/storage-1.2.1.tgz", + "integrity": "sha1-oPLiCHG4YvDqZKkKxI/AiEXPlQU=" + }, + "@google-cloud/vision": { + "version": "0.11.5", + "resolved": "https://registry.npmjs.org/@google-cloud/vision/-/vision-0.11.5.tgz", + "integrity": "sha1-W9sS0ptVQsX7fbtelDLDmsrR9v4=" + }, + "@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" + }, + "@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" + }, + "@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=" + }, + "@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" + }, + "@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" + }, + "@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" + }, + "@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" + }, + "@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" + }, + "@types/long": { + "version": "3.0.32", + "resolved": "https://registry.npmjs.org/@types/long/-/long-3.0.32.tgz", + "integrity": "sha512-ZXyOOm83p7X8p3s0IYM3VeueNmHpkk/yMlP8CLeOnEcu6hIwPH7YjZBvhQkR0ZFS2DqZAxKtJ/M5fcuv3OU5BA==" + }, + "@types/node": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.5.1.tgz", + "integrity": "sha512-SrmAO+NhnsuG/6TychSl2VdxBZiw/d6V+8j+DFo8O3PwFi+QeYXWHhAw+b170aSc6zYab6/PjEWRZHIDN9mNUw==" + }, "ajv": { "version": "5.5.1", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.1.tgz", @@ -353,14 +440,14 @@ "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, "grpc": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.7.2.tgz", - "integrity": "sha512-GH6xziNGjW8LAtqQ3HmYI7Tx8BIlr46iaMRXHfh46kkaOP6PNWUx47ULNTUlXSYR3P00d0Pl8uzodTLwPk805w==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/grpc/-/grpc-1.8.0.tgz", + "integrity": "sha512-AwVQiyMdNv09O4kwec3z52HwkPuo1i61Uk1oENWM9CDeLAUiixQLMpXDIJL31MmZdAuKnAYds/naFEXzprbgHg==", "dependencies": { "abbrev": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=" + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, "ajv": { "version": "4.11.8", @@ -485,9 +572,9 @@ } }, "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=" + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==" }, "deep-extend": { "version": "0.4.2", @@ -505,9 +592,9 @@ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" }, "detect-libc": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.2.tgz", - "integrity": "sha1-ca1dIEvxempsqPRQxhRUBm70YeE=" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=" }, "ecc-jsbn": { "version": "0.1.1", @@ -567,9 +654,9 @@ } }, "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=" + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==" }, "graceful-fs": { "version": "4.1.11", @@ -617,9 +704,9 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ini": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", - "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=" + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" }, "is-fullwidth-code-point": { "version": "1.0.0", @@ -711,14 +798,12 @@ "node-pre-gyp": { "version": "0.6.39", "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.39.tgz", - "integrity": "sha512-OsJV74qxnvz/AMGgcfZoDaeDXKD3oY3QVIbBmwszTFkRisTSXbMQyn4UWzUMOtA5SVhrBZOTp0wcoSBgfMfMmQ==", - "dependencies": { - "nopt": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", - "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=" - } - } + "integrity": "sha512-OsJV74qxnvz/AMGgcfZoDaeDXKD3oY3QVIbBmwszTFkRisTSXbMQyn4UWzUMOtA5SVhrBZOTp0wcoSBgfMfMmQ==" + }, + "nopt": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=" }, "npmlog": { "version": "4.1.2", @@ -1239,9 +1324,9 @@ "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==" }, "retry-request": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.3.0.tgz", - "integrity": "sha512-bCbvtnZkfgB2TnbKMUUxzSR5W4AJQyMD6D6UcCsE/wBTVmlsS59OrDQr4RKV/Kq1hiIBmUYlbxd9MZ0cfpjrAQ==" + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-3.3.1.tgz", + "integrity": "sha512-PjAmtWIxjNj4Co/6FRtBl8afRP3CxrrIAnUzb1dzydfROd+6xt7xAebFeskgQgkfFf8NmzrXIoaB3HxmswXyxw==" }, "rgb-hex": { "version": "1.0.0", diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 3b9f3c2c6b1c4..7df608709a019 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -1652,6 +1652,7 @@ "Should_exists_a_user_with_this_username": "The user must already exist.", "Show_agent_email": "Show agent email", "Show_all": "Show All", + "Show_hidden_rooms_when_unread_messages": "Show hidden rooms when unread messages", "Show_room_counter_on_sidebar": "Show room counter on sidebar", "Show_more": "Show more", "show_offline_users": "show offline users", @@ -2122,4 +2123,4 @@ "your_message_optional": "your message (optional)", "Your_password_is_wrong": "Your password is wrong!", "Your_push_was_sent_to_s_devices": "Your push was sent to %s devices" -} \ No newline at end of file +} diff --git a/packages/rocketchat-i18n/i18n/es.i18n.json b/packages/rocketchat-i18n/i18n/es.i18n.json index a27b588677fa7..433dd9260da8a 100644 --- a/packages/rocketchat-i18n/i18n/es.i18n.json +++ b/packages/rocketchat-i18n/i18n/es.i18n.json @@ -1113,6 +1113,7 @@ "Should_be_a_URL_of_an_image": "Debe de ser un URL de una imagen. ", "Should_exists_a_user_with_this_username": "Ya debe existir el usuario.", "Show_all": "Mostrar todo", + "Show_hidden_rooms_when_unread_messages": "Mostrar salas ocultas al recibir mensajes", "Show_more": "Mostrar más", "show_offline_users": "Mostrar usuarios desconectados", "Show_only_online": "Mostrar sólo en linea", @@ -1385,4 +1386,4 @@ "Your_mail_was_sent_to_s": "Su correo electrónico fue enviado a %s", "Your_password_is_wrong": "Su contraseña es incorrecta!", "Your_push_was_sent_to_s_devices": "Su push fue enviado a los dispositivos %s" -} \ No newline at end of file +} diff --git a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json index 1847d68194db4..af845bb3eabc9 100644 --- a/packages/rocketchat-i18n/i18n/pt-BR.i18n.json +++ b/packages/rocketchat-i18n/i18n/pt-BR.i18n.json @@ -1045,6 +1045,7 @@ "Should_be_a_URL_of_an_image": "Deve ser uma URL de uma imagem.", "Should_exists_a_user_with_this_username": "O usuário já deve existir.", "Show_all": "Mostrar tudo", + "Show_hidden_rooms_when_unread_messages": "Mostrar salas escondidas ao receber mensagens", "Show_more": "Mostrar mais", "show_offline_users": "mostrar usuários offline", "Show_only_online": "Mostrar apenas online", diff --git a/packages/rocketchat-i18n/i18n/pt.i18n.json b/packages/rocketchat-i18n/i18n/pt.i18n.json index 11533f78fd738..78dafd991abc6 100644 --- a/packages/rocketchat-i18n/i18n/pt.i18n.json +++ b/packages/rocketchat-i18n/i18n/pt.i18n.json @@ -1066,6 +1066,7 @@ "Should_be_a_URL_of_an_image": "Deve ser uma URL de uma imagem.", "Should_exists_a_user_with_this_username": "O usuário já deve existir.", "Show_all": "Mostrar tudo", + "Show_hidden_rooms_when_unread_messages": "Mostrar salas escondidas ao receber mensagens", "Show_more": "Mostrar mais", "show_offline_users": "mostrar usuários offline", "Show_only_online": "Mostrar apenas online", diff --git a/packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js b/packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js index b7f97dba1aaca..f77e87964a42c 100644 --- a/packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js +++ b/packages/rocketchat-lib/server/lib/notifyUsersOnMessage.js @@ -105,10 +105,25 @@ RocketChat.callbacks.add('afterSaveMessage', function(message, room) { // Update all the room activity tracker fields RocketChat.models.Rooms.incMsgCountAndSetLastMessageById(message.rid, 1, message.ts, RocketChat.settings.get('Store_Last_Message') && message); - // Update all other subscriptions to alert their owners but witout incrementing + // Update all other subscriptions to alert their owners but without incrementing // the unread counter, as it is only for mentions and direct messages RocketChat.models.Subscriptions.setAlertForRoomIdExcludingUserId(message.rid, message.u._id); + const subscriptions = RocketChat.models.Subscriptions.findByRoomIdAndNotUserId(message.rid, message.u._id).fetch(); + + let user = {}; + let openRoom; + + subscriptions.forEach(subscription => { + user = RocketChat.models.Users.findOneById(subscription.u._id); + + openRoom = user && user.settings && user.settings.preferences && user.settings.preferences.showHiddenRoomsWhenUnreadMessages; + + if (typeof openRoom === 'undefined' || openRoom === true) { + RocketChat.models.Subscriptions.setOpenRoomBySubscriptionId(subscription._id); + } + }); + return message; }, RocketChat.callbacks.priority.LOW, 'notifyUsersOnMessage'); diff --git a/packages/rocketchat-lib/server/models/Subscriptions.js b/packages/rocketchat-lib/server/models/Subscriptions.js index 4c59e26add7fe..8e6694aeee492 100644 --- a/packages/rocketchat-lib/server/models/Subscriptions.js +++ b/packages/rocketchat-lib/server/models/Subscriptions.js @@ -418,6 +418,7 @@ class ModelSubscriptions extends RocketChat.models._Base { return this.update(query, update, { multi: true }); } + setAlertForRoomIdExcludingUserId(roomId, userId) { const query = { rid: roomId, @@ -425,20 +426,29 @@ class ModelSubscriptions extends RocketChat.models._Base { $ne: userId }, $or: [ - { alert: { $ne: true } }, - { open: { $ne: true } } + { alert: { $ne: true } } ] }; const update = { $set: { - alert: true, - open: true + alert: true } }; + return this.update(query, update, { multi: true }); } + setOpenRoomBySubscriptionId(_id) { + const update = { + $set: { + open: true + } + }; + + return this.update(_id, update); + } + setBlockedByRoomId(rid, blocked, blocker) { const query = { rid, diff --git a/packages/rocketchat-ui-account/client/accountPreferences.html b/packages/rocketchat-ui-account/client/accountPreferences.html index 17b6bcf090d65..a3b9a16b5ecc2 100644 --- a/packages/rocketchat-ui-account/client/accountPreferences.html +++ b/packages/rocketchat-ui-account/client/accountPreferences.html @@ -191,6 +191,14 @@

{{_ "Messages"}}

{{/with}} +
+ +
+ + +
+
+
diff --git a/packages/rocketchat-ui-account/client/accountPreferences.js b/packages/rocketchat-ui-account/client/accountPreferences.js index 678257f8b066c..63e7918fb3362 100644 --- a/packages/rocketchat-ui-account/client/accountPreferences.js +++ b/packages/rocketchat-ui-account/client/accountPreferences.js @@ -141,6 +141,7 @@ Template.accountPreferences.onCreated(function() { data.mergeChannels = $('#mergeChannels').find('input:checked').val(); data.sendOnEnter = $('#sendOnEnter').find('select').val(); data.roomsListExhibitionMode = $('select[name=roomsListExhibitionMode]').val(); + data.showHiddenRoomsWhenUnreadMessages = $('input[name=showHiddenRoomsWhenUnreadMessages]:checked').val(); data.autoImageLoad = $('input[name=autoImageLoad]:checked').val(); data.emailNotificationMode = $('select[name=emailNotificationMode]').val(); data.desktopNotificationDuration = $('input[name=desktopNotificationDuration]').val(); diff --git a/server/methods/saveUserPreferences.js b/server/methods/saveUserPreferences.js index 0e9a56c2bd21d..226613f1e8dab 100644 --- a/server/methods/saveUserPreferences.js +++ b/server/methods/saveUserPreferences.js @@ -53,6 +53,10 @@ Meteor.methods({ preferences.unreadAlert = settings.unreadAlert === '1' ? true : false; } + if (settings.showHiddenRoomsWhenUnreadMessages) { + preferences.showHiddenRoomsWhenUnreadMessages = settings.showHiddenRoomsWhenUnreadMessages === '1'; + } + if (settings.notificationsSoundVolume) { preferences.notificationsSoundVolume = settings.notificationsSoundVolume; }