Skip to content

Commit

Permalink
🐛 Fix issue with Slack-formatted timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
raycharius committed Jun 25, 2020
1 parent 66b8525 commit bbc8e7f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log

## v1.2.0 – 2020-06-26
## v1.2.1 – 2020-06-27

* Fix issue where Slack timestamp format not permitted for `ts` and `threadTs` parameters of the `Message` surface object.

## v1.2.0 – 2020-06-27

* Parameter `ts` for the `Message` surface object is now supported.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slack-block-builder",
"version": "1.2.0",
"version": "1.2.1",
"description": "Maintainable code for interactive Slack messages, modals and home tabs. A must-have for the Slack Block Kit framework.",
"author": {
"name": "Ray East",
Expand Down
12 changes: 6 additions & 6 deletions src/surfaces/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,25 @@ class Message extends Surface {
*
* {@link https://api.slack.com/messaging/composing|View in Slack API Documentation}
*
* @param {timestamp} timestamp The timestamp of message to be replied to
* @param {string} string The Slack-produced timestamp of message to be replied to
* @return {this} The instance on which the method is called
*/

threadTs(timestamp) {
return this.set(timestamp, props.threadTs);
threadTs(string) {
return this.set(string, props.threadTs);
}

/**
* Used to update a message. Sets the timestamp of the message to update.
*
* {@link https://api.slack.com/messaging/composing|View in Slack API Documentation}
*
* @param {timestamp} timestamp The timestamp of message to be replied to
* @param {string} string The Slack-produced timestamp of message to be replaced
* @return {this} The instance on which the method is called
*/

ts(timestamp) {
return this.set(timestamp, props.ts);
ts(string) {
return this.set(string, props.ts);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/utility/validators/default-type-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ module.exports = {
notifyOnClose: types.isBool,
description: types.isString,
asUser: types.isBool,
ts: types.isTimestamp,
threadTs: types.isTimestamp,
ts: types.isString,
threadTs: types.isString,
replaceOriginal: types.isBool,
deleteOriginal: types.isBool,
responseType: types.isResponseTypeEnum,
Expand Down
4 changes: 2 additions & 2 deletions tests/mocks/valid-prop-data-mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ module.exports = {
privateMetaData: types.string,
callbackId: types.string,
asUser: types.bool,
threadsTs: types.timestamp,
ts: types.timestamp,
threadsTs: types.string,
ts: types.string,
replaceOriginal: types.bool,
deleteOriginal: types.bool,
responseType: types.ephemeral,
Expand Down
6 changes: 3 additions & 3 deletions tests/surfaces/mocks/message.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ const { getSurfaces, ...Surfaces } = require('../../../src/surfaces');
const props = {
channel: 'channel',
text: 'text',
ts: 1593125546.000100,
threadTs: 1593125546.000100,
postAt: 1593125546.000100,
ts: '1593125546.000100',
threadTs: '1593125546.000100',
postAt: 1593125546,
};

const mock = new Surfaces.Message({ ...props });
Expand Down

0 comments on commit bbc8e7f

Please sign in to comment.