Commit e6842ff5 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Improve code design

parent f5ff3721
...@@ -28,7 +28,7 @@ class ChatSlashCommandsService < Service ...@@ -28,7 +28,7 @@ class ChatSlashCommandsService < Service
end end
def trigger(params) def trigger(params)
return nil unless valid_token?(params[:token]) return unless valid_token?(params[:token])
user = find_chat_user(params) user = find_chat_user(params)
unless user unless user
......
...@@ -14,13 +14,15 @@ class SlackSlashCommandsService < ChatSlashCommandsService ...@@ -14,13 +14,15 @@ class SlackSlashCommandsService < ChatSlashCommandsService
end end
def trigger(params) def trigger(params)
result = super
# Format messages to be Slack-compatible # Format messages to be Slack-compatible
if result && result[:text] super.tap do |result|
result[:text] = Slack::Notifier::LinkFormatter.format(result[:text]) result[:text] = format(result[:text])
end end
end
private
result def format(text)
Slack::Notifier::LinkFormatter.format(text) if text
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment