Fixed issue #587 - Group restrictions not respected in slack notification. Thanks to @jepf
This commit is contained in:
parent
6cf0f5cc6c
commit
fb64e186b5
2 changed files with 26 additions and 6 deletions
|
@ -27,7 +27,7 @@ class Index extends App.ControllerIntegrationBase
|
|||
|
||||
configureAttributes = [
|
||||
{ name: 'types', display: 'Trigger', tag: 'checkbox', options: options, 'null': false, class: 'vertical', note: 'Where notification is sent.' },
|
||||
{ name: 'group_id', display: 'Group', tag: 'select', relation: 'Group', multiple: true, 'null': false, note: 'Only for this groups.' },
|
||||
{ name: 'group_ids', display: 'Group', tag: 'select', relation: 'Group', multiple: true, 'null': false, note: 'Only for this groups.' },
|
||||
{ name: 'webhook', display: 'Webhook', tag: 'input', type: 'url', limit: 200, 'null': false, placeholder: 'https://hooks.slack.com/services/...' },
|
||||
{ name: 'username', display: 'Username', tag: 'input', type: 'text', limit: 100, 'null': false, placeholder: 'username' },
|
||||
{ name: 'channel', display: 'Channel', tag: 'input', type: 'text', limit: 100, 'null': true, placeholder: '#channel' },
|
||||
|
|
20
db/migrate/20170113000002_slack_group_config_issue_587.rb
Normal file
20
db/migrate/20170113000002_slack_group_config_issue_587.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
class SlackGroupConfigIssue587 < ActiveRecord::Migration
|
||||
def up
|
||||
|
||||
# return if it's a new setup
|
||||
return if !Setting.find_by(name: 'system_init_done')
|
||||
|
||||
setting = Setting.find_by(name: 'slack_config')
|
||||
return if !setting
|
||||
|
||||
return if !setting.state_current['value']
|
||||
return if !setting.state_current['value']['items']
|
||||
config_item = setting.state_current['value']['items'].first
|
||||
return if !config_item
|
||||
|
||||
return if !config_item.key?('group_id')
|
||||
config_item['group_ids'] = config_item.delete('group_id')
|
||||
|
||||
setting.save!
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue