From b5bd17b17329b2256bdc12173e14bcf951e89efe Mon Sep 17 00:00:00 2001 From: Night Date: Sun, 25 Sep 2016 16:38:15 -0700 Subject: [PATCH] better formatting --- plugin.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin.rb b/plugin.rb index 1f3fc75..a0ebdfe 100644 --- a/plugin.rb +++ b/plugin.rb @@ -18,6 +18,7 @@ next if post.post_type == Post.types[:moderator_action] post_url = "#{Discourse.base_url}#{post.url}" + user_url = "#{Discourse.base_url}/users/#{user.username_lower}" uri = URI.parse(SiteSetting.slack_url) http = Net::HTTP.new(uri.host, uri.port) @@ -59,10 +60,13 @@ :attachments => [ { :fallback => "New " + (post.try(:is_first_post?) ? "topic" : "post in #{topic.title}") + " by #{display_name} - #{post_url}", - :pretext => "New " + (post.try(:is_first_post?) ? "topic" : "post") + " by #{display_name}:", + :author_icon => user.small_avatar_url, + :author_name => display_name, + :author_link => user_url, :title => (show_category_name ? "[" + category.name + "] " : "") + topic.title, :title_link => post_url, - :text => post.excerpt(200, text_entities: true, strip_links: true) + :text => post.excerpt(200, text_entities: true, strip_links: true), + :ts => post.created_at.to_i } ] }.to_json