mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
35ecaee6d3
closes #6584 - Frontend Changes: - adds 'Apps' to Navigation Menu - adds 'Slack' as nested page to Apps - adds `apps.css` - adds `slack-integration` model and uses `slack-settings` custom transform to parse JSON file - adds validation for `slack` model - adds fixtures and `slack/test` API endpoint to Mirage - adds acceptance tests for `apps-test` and `slack-test` - adds unit tests for `slack-settings` and `slack-integration` - Backend Changes: - adds API endpoint `slack/test` to send Test Notification - adds default-values for slack model - sends payload to slack: - text: the url of the blogpost / test message - icon_url: url to ghost logo - username: Ghost - adds `slack/index.js` to send webhook to slack if - a new post is published (if slack webhook url is saved in settings) - user clicks on 'Send Test Notification' in UI - adds `slack.init()` to `server.index.js` to add event listener - adds unit test for `slack/index`
28 lines
511 B
JavaScript
28 lines
511 B
JavaScript
// # Slack API
|
|
// API for sending Test Notifications to Slack
|
|
var events = require('../events'),
|
|
Promise = require('bluebird'),
|
|
slack;
|
|
|
|
/**
|
|
* ## Slack API Method
|
|
*
|
|
* **See:** [API Methods](index.js.html#api%20methods)
|
|
* @typedef Slack
|
|
* @param slack
|
|
*/
|
|
slack = {
|
|
/**
|
|
* ### SendTest
|
|
* Send a test notification
|
|
*
|
|
* @public
|
|
*/
|
|
sendTest: function () {
|
|
events.emit('slack.test');
|
|
return Promise.resolve();
|
|
}
|
|
};
|
|
|
|
module.exports = slack;
|