Skip to content

Commit

Permalink
Merge pull request RocketChat#228 from WideChat/karan_develop_push
Browse files Browse the repository at this point in the history
Add pushm and pushm_encrypted to Message object
  • Loading branch information
ear-dev committed Apr 14, 2020
2 parents df02d81 + 5b29060 commit 5867272
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/lib/server/functions/insertMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const insertMessage = function(user, message, room, upsert = false) {
alias: String,
emoji: String,
avatar: String,
pushm: Boolean,
attachments: [Match.Any],
}));

Expand Down
5 changes: 5 additions & 0 deletions app/lib/server/functions/processWebhookMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ export const processWebhookMessage = function(messageObj, user, defaultValues =
}
}

if (messageObj.pushm && messageObj.pushm === 'true') {
message.pushm = true;
message.pushm_encrypted = true;
}

const messageReturn = sendMessage(user, message, room);
sentData.push({ channel, message: messageReturn });
}
Expand Down
4 changes: 4 additions & 0 deletions app/models/server/models/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export class Messages extends Base {
this.tryEnsureIndex({ tcount: 1, tlm: 1 }, { sparse: true });
// livechat
this.tryEnsureIndex({ 'navigation.token': 1 }, { sparse: true });

// push-message
this.tryEnsureIndex({ pushm: 1 }, { sparse: true });
this.tryEnsureIndex({ pushm_encrypted: 1 }, { sparse: true });
}

setReactions(messageId, reactions) {
Expand Down

0 comments on commit 5867272

Please sign in to comment.