|
@@ -93,11 +93,18 @@ module.exports = function(crowi) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
slack.convertMarkdownToMrkdwn = function(body) {
|
|
slack.convertMarkdownToMrkdwn = function(body) {
|
|
|
|
|
+ var config = crowi.getConfig();
|
|
|
|
|
+ var url = '';
|
|
|
|
|
+ if (config.crowi && config.crowi['app:url']) {
|
|
|
|
|
+ url = config.crowi['app:url'];
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
body = body
|
|
body = body
|
|
|
.replace(/\n\*\s(.+)/g, '\n• $1')
|
|
.replace(/\n\*\s(.+)/g, '\n• $1')
|
|
|
.replace(/#{1,}\s?(.+)/g, '\n*$1*')
|
|
.replace(/#{1,}\s?(.+)/g, '\n*$1*')
|
|
|
- .replace(/(\[(.+)\]\((https?:\/\/.+)\))/g, '<$3|$2>');
|
|
|
|
|
|
|
+ .replace(/(\[(.+)\]\((https?:\/\/.+)\))/g, '<$3|$2>')
|
|
|
|
|
+ .replace(/(\[(.+)\]\((\/.+)\))/g, '<' + url + '$3|$2>')
|
|
|
|
|
+ ;
|
|
|
|
|
|
|
|
return body;
|
|
return body;
|
|
|
};
|
|
};
|
|
@@ -117,12 +124,17 @@ module.exports = function(crowi) {
|
|
|
|
|
|
|
|
diff.diffLines(previousRevision.body, page.revision.body).forEach(function(line) {
|
|
diff.diffLines(previousRevision.body, page.revision.body).forEach(function(line) {
|
|
|
debug('diff line', line)
|
|
debug('diff line', line)
|
|
|
|
|
+ var value = line.value.replace(/\r\n|\r/g, '\n');
|
|
|
if (line.added) {
|
|
if (line.added) {
|
|
|
- diffText += '+' + line.value.replace(/\n/g, '\n+ ');
|
|
|
|
|
|
|
+ diffText += sprintf(':pencil2: ...\n%s', line.value);
|
|
|
} else if (line.removed) {
|
|
} else if (line.removed) {
|
|
|
- diffText += '-' + line.value.replace(/\n/g, '\n- ');
|
|
|
|
|
|
|
+ // diffText += '-' + line.value.replace(/(.+)?\n/g, '- $1\n');
|
|
|
|
|
+ // 1以下は無視
|
|
|
|
|
+ if (line.count > 1) {
|
|
|
|
|
+ diffText += sprintf(':wastebasket: ... %s lines\n', line.count);
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- diffText += '...\n';
|
|
|
|
|
|
|
+ //diffText += '...\n';
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -170,9 +182,9 @@ module.exports = function(crowi) {
|
|
|
var text;
|
|
var text;
|
|
|
|
|
|
|
|
if (updateType == 'create') {
|
|
if (updateType == 'create') {
|
|
|
- text = sprintf('%s created a new page! %s', user.username, path);
|
|
|
|
|
|
|
+ text = sprintf(':white_check_mark: %s created a new page! %s', user.username, path);
|
|
|
} else {
|
|
} else {
|
|
|
- text = sprintf('%s updated %s', user.username, path);
|
|
|
|
|
|
|
+ text = sprintf(':up: %s updated %s', user.username, path);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return text;
|
|
return text;
|