Commit e6842ff5 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Improve code design

parent f5ff3721
......@@ -28,7 +28,7 @@ class ChatSlashCommandsService < Service
end
def trigger(params)
return nil unless valid_token?(params[:token])
return unless valid_token?(params[:token])
user = find_chat_user(params)
unless user
......
......@@ -14,13 +14,15 @@ class SlackSlashCommandsService < ChatSlashCommandsService
end
def trigger(params)
result = super
# Format messages to be Slack-compatible
if result && result[:text]
result[:text] = Slack::Notifier::LinkFormatter.format(result[:text])
super.tap do |result|
result[:text] = format(result[:text])
end
end
private
result
def format(text)
Slack::Notifier::LinkFormatter.format(text) if text
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