|
|
@@ -169,15 +169,19 @@ module.exports = function(crowi) {
|
|
|
};
|
|
|
|
|
|
// slack.post = function (channel, message, opts) {
|
|
|
- slack.post = (pageOrComment, user, channel, updateType, previousRevision) => {
|
|
|
- let messageObj;
|
|
|
- if (updateType === 'comment') {
|
|
|
- messageObj = prepareSlackMessageForComment(pageOrComment, user, channel, updateType);
|
|
|
- }
|
|
|
- else {
|
|
|
- messageObj = prepareSlackMessageForPage(pageOrComment, user, channel, updateType, previousRevision);
|
|
|
- }
|
|
|
+ slack.postPage = (page, user, channel, updateType, previousRevision) => {
|
|
|
+ const messageObj = prepareSlackMessageForPage(page, user, channel, updateType, previousRevision);
|
|
|
+
|
|
|
+ return promisifiedSlackSend(messageObj);
|
|
|
+ };
|
|
|
+
|
|
|
+ slack.postComment = (comment, user, channel, updateType) => {
|
|
|
+ const messageObj = prepareSlackMessageForComment(comment, user, channel, updateType);
|
|
|
+
|
|
|
+ return promisifiedSlackSend(messageObj);
|
|
|
+ };
|
|
|
|
|
|
+ const promisifiedSlackSend = (messageObj) => {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
// define callback function for Promise
|
|
|
const callback = function(err, res) {
|