Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move slackify from ChatClient to Slack. #13415

Merged
merged 1 commit into from Feb 23, 2017
Merged

Move slackify from ChatClient to Slack. #13415

merged 1 commit into from Feb 23, 2017

Conversation

ashercodeorg
Copy link
Contributor

@ashercodeorg ashercodeorg commented Feb 23, 2017

From a design viewpoint, the ChatClient should not be concerned with how text should be sent to Slack, thus the refactor.

Note that this means calls to HipChat#message will be slackified twice. This seems safe, though technically the slackify method is not idempotent.

Copy link
Contributor

@aoby aoby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Why will calls from HipChat be slackified twice?

@ashercodeorg
Copy link
Contributor Author

Because calls to HipChat#message will get slackified there and again in Slack#message (per this PR).

gsub(/<a href=['"]([^'"]+)['"]>/, '<\1|').
gsub(/<\/a>/, '>').
gsub(/<br\/?>/, "\n")
Slack.message message.to_s, channel: channel, username: @@name, color: options[:color]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO(asher): Determine whether the typecast to a string is required. It makes sense that all messages should be a string.

@ashercodeorg ashercodeorg merged commit aa6e7c5 into staging Feb 23, 2017
@ashercodeorg ashercodeorg deleted the fixSlack branch February 23, 2017 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants