|
@@ -80,12 +80,13 @@ module.exports = function(crowi) {
|
|
|
return diffText;
|
|
return diffText;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const prepareAttachmentTextForComment = function(page, user, channel, updateType, previousRevision) {
|
|
|
|
|
- return {
|
|
|
|
|
- channel: '#general',
|
|
|
|
|
- username: 'Growi',
|
|
|
|
|
- text: '`comment uploaded`'
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ const prepareAttachmentTextForComment = function(comment) {
|
|
|
|
|
+ let body = comment.comment;
|
|
|
|
|
+ if (body.length > 2000) {
|
|
|
|
|
+ body = body.substr(0, 2000) + '...';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return convertMarkdownToMrkdwn(body);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const prepareSlackMessageForPage = function(page, user, channel, updateType, previousRevision) {
|
|
const prepareSlackMessageForPage = function(page, user, channel, updateType, previousRevision) {
|
|
@@ -132,8 +133,6 @@ module.exports = function(crowi) {
|
|
|
author_name: '@' + user.username,
|
|
author_name: '@' + user.username,
|
|
|
author_link: url + '/user/' + user.username,
|
|
author_link: url + '/user/' + user.username,
|
|
|
author_icon: user.image,
|
|
author_icon: user.image,
|
|
|
- title: comment.comment,
|
|
|
|
|
- title_link: url + '/' + comment._id,
|
|
|
|
|
text: body,
|
|
text: body,
|
|
|
mrkdwn_in: ['text'],
|
|
mrkdwn_in: ['text'],
|
|
|
};
|
|
};
|
|
@@ -144,7 +143,7 @@ module.exports = function(crowi) {
|
|
|
const message = {
|
|
const message = {
|
|
|
channel: '#' + channel,
|
|
channel: '#' + channel,
|
|
|
username: Config.appTitle(config),
|
|
username: Config.appTitle(config),
|
|
|
- text: getSlackMessageText(comment.path, user, updateType),
|
|
|
|
|
|
|
+ text: getSlackMessageText(comment.page.path, user, updateType),
|
|
|
attachments: [attachment],
|
|
attachments: [attachment],
|
|
|
};
|
|
};
|
|
|
|
|
|