Files
redmine/app/controllers/messenger_settings_controller.rb
Igor Pronin f4382f7d86 Added feature to send messages directly to users to be notified
Added setting to enable this feature.
Tested on RocketChatIntegration
2020-08-20 16:33:08 +03:00

48 lines
2.0 KiB
Ruby

class MessengerSettingsController < ApplicationController
before_action :find_project_by_project_id
before_action :authorize
def update
setting = MessengerSetting.find_or_create @project.id
if setting.update allowed_params
flash[:notice] = l :notice_successful_update
redirect_to settings_project_path(@project, tab: 'messenger')
else
flash[:error] = setting.errors.full_messages.flatten.join("\n")
respond_to do |format|
format.html { redirect_back_or_default(settings_project_path(@project, tab: 'messenger')) }
format.api { render_validation_errors(setting) }
end
end
end
private
def allowed_params
params.require(:setting).permit :messenger_url,
:messenger_icon,
:messenger_channel,
:messenger_username,
:messenger_verify_ssl,
:messenger_direct_users_messages,
:auto_mentions,
:default_mentions,
:display_watchers,
:post_updates,
:new_include_description,
:updated_include_description,
:post_private_issues,
:post_private_notes,
:post_wiki,
:post_wiki_updates,
:post_db,
:post_db_updates,
:post_private_db,
:post_contact,
:post_contact_updates,
:post_private_contacts,
:post_password,
:post_password_updates
end
end