Skip to content

Commit

Permalink
Merge remote-tracking branch 'RC/develop' into DEEPL-translation
Browse files Browse the repository at this point in the history
  • Loading branch information
vickyokrm committed May 2, 2019
2 parents a14b080 + 5827ff3 commit d0198cc
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 22 deletions.
3 changes: 2 additions & 1 deletion app/lib/server/functions/notifications/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export function shouldNotifyAudio({
isHighlighted,
hasMentionToUser,
hasReplyToThread,
roomType,
}) {
if (disableAllMessageNotifications && audioNotifications == null && !hasReplyToThread) {
return false;
Expand All @@ -25,7 +26,7 @@ export function shouldNotifyAudio({
return true;
}

return (!disableAllMessageNotifications && (hasMentionToAll || hasMentionToHere)) || isHighlighted || audioNotifications === 'all' || hasMentionToUser || hasReplyToThread;
return roomType === 'd' || (!disableAllMessageNotifications && (hasMentionToAll || hasMentionToHere)) || isHighlighted || audioNotifications === 'all' || hasMentionToUser || hasReplyToThread;
}

export function notifyAudioUser(userId, message, room) {
Expand Down
16 changes: 14 additions & 2 deletions app/models/server/models/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,25 @@ export class Messages extends Base {
return this.find(query, options);
}

findVisibleByRoomId(roomId, options) {
findVisibleByRoomId(rid, options) {
const query = {
_hidden: {
$ne: true,
},

rid: roomId,
rid,
};

return this.find(query, options);
}

findVisibleThreadByThreadId(tmid, options) {
const query = {
_hidden: {
$ne: true,
},

tmid,
};

return this.find(query, options);
Expand Down
13 changes: 12 additions & 1 deletion app/statistics/server/functions/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,18 @@ statistics.get = function _getStatistics() {
statistics.mongoVersion = version;
statistics.mongoStorageEngine = storageEngine.name;
} catch (e) {
console.error('Error getting MongoDB info');
console.error('=== Error getting MongoDB info ===');
console.error(e && e.toString());
console.error('----------------------------------');
console.error('Without mongodb version we can\'t ensure you are running a compatible version.');
console.error('If you are running your mongodb with auth enabled and an user different from admin');
console.error('you may need to grant permissions for this user to check cluster data.');
console.error('You can do it via mongo shell running the following command replacing');
console.error('the string YOUR_USER by the correct user\'s name:');
console.error('');
console.error(' db.runCommand({ grantRolesToUser: "YOUR_USER" , roles: [{role: "clusterMonitor", db: "admin"}]})');
console.error('');
console.error('==================================');
}

statistics.uniqueUsersOfYesterday = Sessions.getUniqueUsersOfYesterday();
Expand Down
17 changes: 17 additions & 0 deletions app/theme/client/imports/general/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ button {
.first-unread .body {
&::before {
position: absolute;
z-index: 1;
top: 0;
left: 0;

Expand Down Expand Up @@ -199,6 +200,22 @@ button {
}
}

.message.new-day.first-unread {
&::after {
border-color: var(--rc-color-error);
}

& .body {
&::before {
display: none;
}

&::after {
top: -26px;
}
}
}

.hidden {
display: none;
}
Expand Down
2 changes: 1 addition & 1 deletion app/threads/client/flextab/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Template.thread.onRendered(function() {
const tmid = this.state.get('tmid');
this.threadsObserve && this.threadsObserve.stop();

this.threadsObserve = Messages.find({ tmid, _updatedAt: { $gt: new Date() } }, {
this.threadsObserve = Messages.find({ tmid, _updatedAt: { $gt: new Date() }, _hidden: { $ne: true } }, {
fields: {
collapsed: 0,
threadMsg: 0,
Expand Down
2 changes: 1 addition & 1 deletion app/threads/client/flextab/threads.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ Template.threads.onCreated(async function() {
this.autorun(() => {
const rid = this.state.get('rid');
this.threadsObserve && this.threadsObserve.stop();
this.threadsObserve = Messages.find({ rid, _updatedAt: { $gt: new Date() }, tcount: { $exists: true } }).observe({
this.threadsObserve = Messages.find({ rid, _updatedAt: { $gt: new Date() }, tcount: { $exists: true }, _hidden: { $ne: true } }).observe({
added: ({ _id, ...message }) => {
this.Threads.upsert({ _id }, message);
}, // Update message to re-render DOM
Expand Down
2 changes: 1 addition & 1 deletion app/threads/client/threads.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
margin-bottom: calc(var(--default-padding) / 2);
}

.message.collapsed + .message:not(.collapsed) {
.message.collapsed + .message:not(.collapsed):not(.new-day) {
margin-top: calc(var(--default-padding) / 2);
}

Expand Down
2 changes: 1 addition & 1 deletion app/threads/server/methods/getThreadMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Meteor.methods({

readThread({ userId: user._id, rid: thread.rid, tmid });

const result = Messages.find({ tmid }, { ...(skip && { skip }), ...(limit && { limit }), sort: { ts : -1 } }).fetch();
const result = Messages.findVisibleThreadByThreadId(tmid, { ...(skip && { skip }), ...(limit && { limit }), sort: { ts : -1 } }).fetch();

return [thread, ...result];
},
Expand Down
4 changes: 2 additions & 2 deletions app/ui-message/client/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
{{#if $gt msg.dcount 0}}
<button class="js-navigate-to-discussion rc-button rc-button--primary rc-button--small" data-rid={{roomId}}>
<!-- {{> icon icon="discussion"}} -->
<span class='reply-counter'>{{msg.dcount}}</span>&nbsp;{{_ i18nKeyMessage}}
<span>{{{_ 'message_counter' counter=i18nDiscussionCounter count=msg.dcount }}}</span>
</button>
{{else}}
<button class="js-navigate-to-discussion rc-button rc-button--primary rc-button--small no-replies" data-rid={{roomId}}>
Expand All @@ -105,7 +105,7 @@
<div class="message-discussion">
<button class="js-open-thread rc-button rc-button--primary rc-button--small" data-rid={{roomId}}>
{{> icon icon="thread"}}
<span class='reply-counter'>{{msg.tcount}}</span>&nbsp;{{_ i18nKeyReply}}
<span>{{{_ 'reply_counter' counter=i18nReplyCounter count=msg.tcount }}}</span>
</button>
<span class="discussion-reply-lm">{{ formatDateAndTime msg.tlm}}</span>
</div>
Expand Down
12 changes: 4 additions & 8 deletions app/ui-message/client/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,13 @@ Template.message.helpers({
and(a, b) {
return a && b;
},
i18nKeyMessage() {
i18nReplyCounter() {
const { msg } = this;
return msg.dcount > 1
? 'messages'
: 'message';
return `<span class='reply-counter'>${ msg.tcount }</span>`;
},
i18nKeyReply() {
i18nDiscussionCounter() {
const { msg } = this;
return msg.tcount > 1
? 'replies'
: 'reply';
return `<span class='reply-counter'>${ msg.dcount }</span>`;
},
formatDateAndTime,
encodeURI(text) {
Expand Down
8 changes: 6 additions & 2 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,8 @@
"Message_AudioRecorderEnabled_Description": "Requires 'audio/mp3' files to be an accepted media type within 'File Upload' settings.",
"Message_BadWordsFilterList": "Add Bad Words to the Blacklist",
"Message_BadWordsFilterListDescription": "Add List of Comma-separated list of bad words to filter",
"message_counter": "__counter__ message",
"message_counter_plural": "__counter__ messages",
"Message_DateFormat": "Date Format",
"Message_DateFormat_Description": "See also: <a href=\"http://momentjs.com/docs/#/displaying/format/\" target=\"momemt\">Moment.js</a>",
"Message_deleting_blocked": "This message cannot be deleted anymore",
Expand Down Expand Up @@ -2426,8 +2428,10 @@
"Removed": "Removed",
"Removed_User": "Removed User",
"Replied_on": "Replied on",
"Replies": "Replies",
"Reply": "Reply",
"reply_counter": "__counter__ reply",
"reply_counter_plural": "__counter__ replies",
"Replies": "Replies",
"Reply_in_thread": "Reply in Thread",
"Reply_in_direct_message": "Reply in Direct Message",
"ReplyTo": "Reply-To",
Expand Down Expand Up @@ -3242,4 +3246,4 @@
"Your_question": "Your question",
"Your_server_link": "Your server link",
"Your_workspace_is_ready": "Your workspace is ready to use 🎉"
}
}
6 changes: 5 additions & 1 deletion packages/rocketchat-i18n/i18n/pt-BR.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,8 @@
"Message_AudioRecorderEnabled_Description": "Requer arquivos 'audio / mp3' para ser um tipo de mídia aceito dentro das configurações 'Upload de arquivo'.",
"Message_BadWordsFilterList": "Adicione palavrões para a lista negra",
"Message_BadWordsFilterListDescription": "Adicione palavrões separados por vírgula para filtrar",
"message_counter": "__counter__ mensagem",
"message_counter_plural": "__counter__ mensagens",
"Message_DateFormat": "Formato de Data",
"Message_DateFormat_Description": "Veja também: <a href=\"http://momentjs.com/docs/#/displaying/format/\" target=\"momemt\">Moment.js</a>",
"Message_deleting_blocked": "Esta mensagem não pode ser mais apagada",
Expand Down Expand Up @@ -2380,6 +2382,8 @@
"Removed_User": "Usuário removido",
"Replies": "Respostas",
"Reply": "Responder",
"reply_counter": "__counter__ reposta",
"reply_counter_plural": "__counter__ respostas",
"ReplyTo": "Responder para",
"Report_Abuse": "Denunciar abuso",
"Report_exclamation_mark": "Relatar!",
Expand Down Expand Up @@ -3174,4 +3178,4 @@
"Your_question": "A sua pergunta",
"Your_server_link": "O link do seu servidor",
"Your_workspace_is_ready": "O seu espaço de trabalho está pronto a usar 🎉"
}
}
14 changes: 13 additions & 1 deletion server/startup/serverRunning.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@ Meteor.startup(function() {
mongoDbEngine = storageEngine.name;
} catch (e) {
mongoDbVersion = 'Error getting version';
console.error('Error getting MongoDB version');

console.error('=== Error getting MongoDB info ===');
console.error(e && e.toString());
console.error('----------------------------------');
console.error('Without mongodb version we can\'t ensure you are running a compatible version.');
console.error('If you are running your mongodb with auth enabled and an user different from admin');
console.error('you may need to grant permissions for this user to check cluster data.');
console.error('You can do it via mongo shell running the following command replacing');
console.error('the string YOUR_USER by the correct user\'s name:');
console.error('');
console.error(' db.runCommand({ grantRolesToUser: "YOUR_USER" , roles: [{role: "clusterMonitor", db: "admin"}]})');
console.error('');
console.error('==================================');
}

const desiredNodeVersion = semver.clean(fs.readFileSync(path.join(process.cwd(), '../../.node_version.txt')).toString());
Expand Down

0 comments on commit d0198cc

Please sign in to comment.