2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

Added Slack username option. (#10285)

refs #9735.
This commit is contained in:
Greg Hart 2018-12-14 05:57:32 -06:00 committed by Fabien O'Carroll
parent 2645ff05a0
commit 261a8234e9
2 changed files with 4 additions and 3 deletions

View file

@ -89,7 +89,7 @@
"defaultValue": "[{\"label\":\"Home\", \"url\":\"/\"},{\"label\":\"Tag\", \"url\":\"/tag/getting-started/\"}, {\"label\":\"Author\", \"url\":\"/author/ghost/\"},{\"label\":\"Help\", \"url\":\"https://help.ghost.org\"}]"
},
"slack": {
"defaultValue": "[{\"url\":\"\"}]"
"defaultValue": "[{\"url\":\"\", \"username\":\"Ghost\"}]"
},
"unsplash": {
"defaultValue": "{\"isActive\": true}"

View file

@ -42,6 +42,7 @@ function ping(post) {
// Quit here if slack integration is not activated
if (slackSettings && slackSettings.url && slackSettings.url !== '') {
slackSettings.username = slackSettings.username ? slackSettings.username : 'Ghost';
// Only ping when not a page
if (post.page) {
return;
@ -62,7 +63,7 @@ function ping(post) {
text: `Notification from *${blogTitle}* :ghost:`,
unfurl_links: true,
icon_url: imageLib.blogIcon.getIconUrl(true),
username: 'Ghost',
username: slackSettings.username,
// We don't want to send attachment if it is a test notification.
attachments: [
{
@ -102,7 +103,7 @@ function ping(post) {
text: message,
unfurl_links: true,
icon_url: imageLib.blogIcon.getIconUrl(true),
username: 'Ghost'
username: slackSettings.username
};
}