Add support for default mentions

Signed-off-by: Alessandro Grassi <alessandro.grassi@2ndquadrant.com>
This commit is contained in:
Alessandro Grassi
2017-10-10 16:25:53 +02:00
parent 763cf347f6
commit bbd6a69f8d
8 changed files with 19 additions and 5 deletions

View File

@@ -219,9 +219,12 @@ class Messenger
result
end
def self.mentions(text)
return nil if text.nil?
names = extract_usernames(text)
def self.mentions(project, text)
names = []
Messenger.textfield_for_project(project, :default_mentions).split(',').each { |m|
names.push m.strip
}
names += extract_usernames(text) unless text.nil?
names.present? ? '\nTo: ' + names.join(', ') : nil
end

View File

@@ -12,6 +12,7 @@ class MessengerSetting < ActiveRecord::Base
'messenger_username',
'messenger_verify_ssl',
'auto_mentions',
'default_mentions',
'display_watchers',
'post_updates',
'new_include_description',
@@ -33,6 +34,7 @@ class MessengerSetting < ActiveRecord::Base
:messenger_username,
:messenger_verify_ssl,
:auto_mentions,
:default_mentions,
:display_watchers,
:post_updates,
:new_include_description,