@atomist/slack-messages
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -10,8 +10,22 @@ # Change Log | ||
[Unreleased]: https://github.com/atomist/slack-messages/compare/0.8.0...HEAD | ||
[Unreleased]: https://github.com/atomist/slack-messages/compare/0.11.0...HEAD | ||
## [0.11.0] - 2017-08-17 | ||
[0.11.0]: https://github.com/atomist/slack-messages/compare/0.10.0...0.11.0 | ||
Option Groups | ||
### Added | ||
- Support for option_groups in menus | ||
## [0.10.0] - 2017-08-17 | ||
[0.10.0]: https://github.com/atomist/slack-messages/compare/0.9.0...0.10.0 | ||
Menus | ||
### Added | ||
- New function `rugMenuFrom` in SlackMessages for building Slack combo | ||
@@ -22,2 +36,8 @@ boxes | ||
[0.8.0]: https://github.com/atomist/slack-messages/compare/0.8.0...0.9.0 | ||
Standard messages | ||
### Added | ||
- Add standard formatted Slack messages and ResponseMessage for success, | ||
@@ -24,0 +44,0 @@ error, and warning to Rug messages. Add standard colors for each |
{ | ||
"name": "@atomist/slack-messages", | ||
"description": "utilities for creating Slack messages", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"author": "Atomist", | ||
@@ -21,3 +21,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@atomist/rug": "^1.0.0-m.5", | ||
"@atomist/rug": "^1.0.0-m.6", | ||
"deprecated-decorator": "^0.1.6", | ||
@@ -27,2 +27,3 @@ "lodash": "^4.17.4" | ||
"devDependencies": { | ||
"@types/lodash": "^4.14.73", | ||
"@types/mocha": "^2.2.41", | ||
@@ -29,0 +30,0 @@ "@types/power-assert": "^1.4.29", |
@@ -20,3 +20,3 @@ # @atomist/slack-messages | ||
Construct message as a plain map following Slack message formatting API: | ||
Construct a message as a plain map following the Slack message formatting API: | ||
@@ -49,7 +49,9 @@ https://api.slack.com/docs/message-formatting | ||
And then simply render message. This will construct JSON string representation of the message: | ||
And then render the message with SlackMessages.render. This will construct a JSON string representation of the message: | ||
```typescript | ||
import { render } from "@atomist/slack-messages/SlackMessages" | ||
const renderedMsg = render(msg); | ||
``` | ||
Or to produce pretty JSON string: | ||
Or to produce a pretty JSON string: | ||
```typescript | ||
@@ -84,3 +86,3 @@ const renderedMsg = render(msg, true); | ||
``` | ||
Note that `render` function will automatically assign unique `callback_id` to each attachments that has actions. | ||
Note that the `render` function will automatically assign a unique `callback_id` to each attachments that has actions. | ||
But, if you provide your custom `callback_id` it will be preserved as is. | ||
@@ -169,5 +171,7 @@ | ||
GitHub and Slack markdown are different enough to make your GitHub issues or GitHub PRs look quite bad in Slack by default. You can use `githubToSlack` function from `Markdown` to convert text that uses GitHub markdown to text that will look good in Slack: | ||
GitHub and Slack markdown are different enough to make your GitHub issues or GitHub PRs look quite bad in Slack by default. You can use the `githubToSlack` function from `Markdown` to convert text that uses GitHub markdown to text that will look good in Slack: | ||
```typescript | ||
import { githubToSlack } from "@atomist/slack-messages/Markdown" | ||
githubToSlack("* list item 1\n* list item 2\n\**some bold text** and *some italic text* with a link [click here](http://someplace.com)"); | ||
@@ -174,0 +178,0 @@ => "• list item 1\n• list item 2\n*some bold text* and _some italic text_ with a link <http://someplace.com|click here>" |
@@ -94,2 +94,6 @@ /** | ||
} | ||
export interface OptionGroup { | ||
text: string; | ||
options: SelectOption[]; | ||
} | ||
export declare type DataSource = "static" | "users" | "channels" | "conversations" | "external"; | ||
@@ -108,2 +112,3 @@ /** | ||
options?: SelectOption[]; | ||
option_groups?: OptionGroup[]; | ||
data_source?: DataSource; | ||
@@ -139,5 +144,5 @@ } | ||
text: string; | ||
options: SelectOption[] | DataSource; | ||
options: SelectOption[] | DataSource | OptionGroup[]; | ||
} | ||
/** Construct Slack menu that will execute provided rug instruction. */ | ||
export declare function rugMenuFrom(action: SelectSpec, command: SelectableIdentifiableInstruction): Action; |
@@ -214,4 +214,12 @@ "use strict"; | ||
} | ||
else { | ||
select.options = action.options; | ||
else if (action.options.length > 0) { | ||
var first = action.options[0]; | ||
if (first.value) { | ||
// then it's normal options | ||
select.options = action.options; | ||
} | ||
else { | ||
// then it's option groups | ||
select.option_groups = action.options; | ||
} | ||
} | ||
@@ -218,0 +226,0 @@ for (var attr in action) { |
Sorry, the diff of this file is not supported yet
71505
819
239
9
Updated@atomist/rug@^1.0.0-m.6