Skip to content

Commit

Permalink
Merge remote-tracking branch 'knaou/master' into evolved
Browse files Browse the repository at this point in the history
  • Loading branch information
cat-in-136 committed Sep 4, 2018
2 parents 5bf4d69 + 940d8d8 commit b30750b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/views/settings/_slack_settings.html.erb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@
<input type="checkbox" id="settings_post_updates" value="1" name="settings[post_updates]" <%= settings['post_updates'] == '1' ? 'checked="checked"' : '' %> />
</p>

<p>
<label for="settings_post_message_updates">Post Forum's Message Updates?</label>
<input type="checkbox" id="settings_post_message_updates" value="1" name="settings[post_message_updates]" <%= settings['post_message_updates'] == '1' ? 'checked="checked"' : '' %> />
</p>

<p>
<label for="settings_post_wiki_updates">Post Wiki Updates?</label>
<input type="checkbox" id="settings_post_wiki_updates" value="1" name="settings[post_wiki_updates]" <%= settings['post_wiki_updates'] == '1' ? 'checked="checked"' : '' %> />
Expand Down
40 changes: 40 additions & 0 deletions lib/redmine_slack/listener.rb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,46 @@ def model_changeset_scan_commit_for_issue_ids_pre_issue_update(context={})
speak msg, channel, attachment, url
end

def controller_messages_new_after_save(context = { })
return unless Setting.plugin_redmine_slack['post_message_updates'] == '1'

project = context[:project]
message = context[:message]

user = message.author
project_url = "<#{object_url project}|#{escape project}>"
message_url = "<#{object_url message}|#{escape message.subject}>"
comment = "[#{project_url}] #{message_url} updated by *#{user}*"

channel = channel_for_project project
url = url_for_project project

attachment = {}
attachment[:text] = "#{escape message.content}"

speak comment, channel, attachment, url
end

def controller_messages_reply_after_save(context = { })
return unless Setting.plugin_redmine_slack['post_message_updates'] == '1'

project = context[:project]
message = context[:message]

user = message.author
project_url = "<#{object_url project}|#{escape project}>"
message_url = "<#{object_url message}|#{escape message.subject}>"
comment = "[#{project_url}] #{message_url} updated by *#{user}*"

channel = channel_for_project project
url = url_for_project project

attachment = {}
attachment[:text] = "#{escape message.content}"

speak comment, channel, attachment, url
end

def controller_wiki_edit_after_save(context = { })
return unless Setting.plugin_redmine_slack['post_wiki_updates'] == '1'

Expand Down

0 comments on commit b30750b

Please sign in to comment.