diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-07-12 17:00:49 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-07-19 20:59:00 -0300 |
commit | ede048b930b2ceb89013793d878524eb20248d1f (patch) | |
tree | 4650debc2eaefa36fef4636efc60cdb60ae47fa5 /app/models/project_services | |
parent | 8bd520d70e035cd67d19b7962911ae9c31d1ff3d (diff) | |
download | gitlab-ce-ede048b930b2ceb89013793d878524eb20248d1f.tar.gz |
Add project service documentation and update integration documentation
Diffstat (limited to 'app/models/project_services')
-rw-r--r-- | app/models/project_services/slack_service.rb | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/app/models/project_services/slack_service.rb b/app/models/project_services/slack_service.rb index a1f146ac05a..647188cc2ab 100644 --- a/app/models/project_services/slack_service.rb +++ b/app/models/project_services/slack_service.rb @@ -5,7 +5,7 @@ class SlackService < Service def initialize_properties # Custom serialized properties initialization - self.supported_events.each { |event| self.class.prop_accessor event_channel_name(event) } + self.supported_events.each { |event| self.class.prop_accessor(event_channel_name(event)) } if properties.nil? self.properties = {} @@ -36,7 +36,7 @@ class SlackService < Service [ { type: 'text', name: 'webhook', placeholder: 'https://hooks.slack.com/services/...' }, { type: 'text', name: 'username', placeholder: 'username' }, - { type: 'text', name: 'channel', placeholder: "#General" }, + { type: 'text', name: 'channel', placeholder: "#general" }, { type: 'checkbox', name: 'notify_only_broken_builds' }, ] @@ -99,18 +99,13 @@ class SlackService < Service def get_channel_field(event) field_name = event_channel_name(event) - self.send(field_name) + self.public_send(field_name) end def build_event_channels - channels = [] - - supported_events.each do |event| - channel_name = event_channel_name(event) - channels << { type: 'text', name: channel_name, placeholder: "#General" } + supported_events.reduce([]) do |channels, event| + channels << { type: 'text', name: event_channel_name(event), placeholder: "#general" } end - - channels end def event_channel_name(event) |