Skip to content
Snippets Groups Projects
Commit 7d1df221 authored by Diego Sampaio's avatar Diego Sampaio
Browse files

support for pinned message notification

parent 804b753f
No related branches found
No related tags found
Loading
...@@ -233,6 +233,14 @@ Importer.Slack = class Importer.Slack extends Importer.Base ...@@ -233,6 +233,14 @@ Importer.Slack = class Importer.Slack extends Importer.Base
RocketChat.models.Messages.createRoomSettingsChangedWithTypeRoomIdMessageAndUser 'room_changed_topic', room._id, message.purpose, @getRocketUser(message.user), { ts: new Date(parseInt(message.ts.split('.')[0]) * 1000) } RocketChat.models.Messages.createRoomSettingsChangedWithTypeRoomIdMessageAndUser 'room_changed_topic', room._id, message.purpose, @getRocketUser(message.user), { ts: new Date(parseInt(message.ts.split('.')[0]) * 1000) }
else if message.subtype is 'channel_topic' else if message.subtype is 'channel_topic'
RocketChat.models.Messages.createRoomSettingsChangedWithTypeRoomIdMessageAndUser 'room_changed_topic', room._id, message.topic, @getRocketUser(message.user), { ts: new Date(parseInt(message.ts.split('.')[0]) * 1000) } RocketChat.models.Messages.createRoomSettingsChangedWithTypeRoomIdMessageAndUser 'room_changed_topic', room._id, message.topic, @getRocketUser(message.user), { ts: new Date(parseInt(message.ts.split('.')[0]) * 1000) }
else if message.subtype is 'pinned_item'
RocketChat.models.Messages.createWithTypeRoomIdMessageAndUser 'message_pinned', room._id, '', @getRocketUser(message.user),
ts: new Date(parseInt(message.ts.split('.')[0]) * 1000)
attachments: [
"text" : @convertSlackMessageToRocketChat message.attachments[0].text
"author_name" : message.attachments[0].author_subname
"author_icon" : getAvatarUrlFromUsername(message.attachments[0].author_subname)
]
else if message.subtype is 'file_share' else if message.subtype is 'file_share'
if message.file?.url_private_download isnt undefined if message.file?.url_private_download isnt undefined
details = details =
......
Meteor.startup(() => {
RocketChat.MessageTypes.registerType({
id: 'message_pinned',
system: true,
message: 'Pinned_a_message'
});
})
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
"Message_AllowPinningByAnyone" : "Allow Anyone to Pin Messages", "Message_AllowPinningByAnyone" : "Allow Anyone to Pin Messages",
"Message_AllowPinningByAnyone_Description" : "Allow anyone to pin messages to a channel, not just administrators.", "Message_AllowPinningByAnyone_Description" : "Allow anyone to pin messages to a channel, not just administrators.",
"Pin_Message" : "Pin Message", "Pin_Message" : "Pin Message",
"Pinned_a_message" : "Pinned a message:",
"Unpin_Message" : "Unpin Message", "Unpin_Message" : "Unpin Message",
"Pinned_Messages" : "Pinned Messages", "Pinned_Messages" : "Pinned Messages",
"No_pinned_messages" : "No pinned messages" "No_pinned_messages" : "No pinned messages"
} }
\ No newline at end of file
...@@ -17,6 +17,7 @@ Package.onUse(function(api) { ...@@ -17,6 +17,7 @@ Package.onUse(function(api) {
api.addFiles([ api.addFiles([
'client/lib/PinnedMessage.coffee', 'client/lib/PinnedMessage.coffee',
'client/actionButton.coffee', 'client/actionButton.coffee',
'client/messageType.js',
'client/pinMessage.coffee', 'client/pinMessage.coffee',
'client/tabBar.coffee', 'client/tabBar.coffee',
'client/views/pinnedMessages.html', 'client/views/pinnedMessages.html',
......
...@@ -22,6 +22,13 @@ Meteor.methods ...@@ -22,6 +22,13 @@ Meteor.methods
RocketChat.models.Messages.setPinnedByIdAndUserId message._id, message.pinnedBy, message.pinned RocketChat.models.Messages.setPinnedByIdAndUserId message._id, message.pinnedBy, message.pinned
RocketChat.models.Messages.createWithTypeRoomIdMessageAndUser 'message_pinned', message.rid, '', me,
attachments: [
"text" : message.msg
"author_name" : message.u.username,
"author_icon" : getAvatarUrlFromUsername(message.u.username)
]
unpinMessage: (message) -> unpinMessage: (message) ->
if not Meteor.userId() if not Meteor.userId()
throw new Meteor.Error('invalid-user', "[methods] unpinMessage -> Invalid user") throw new Meteor.Error('invalid-user', "[methods] unpinMessage -> Invalid user")
......
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