##// END OF EJS Templates
Fixed that non array commit_update_keywords raises an error (#7590)....
Jean-Philippe Lang -
r11986:60d6e169781e
parent child
Show More
@@ -1,74 +1,74
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class SettingsController < ApplicationController
19 19 layout 'admin'
20 20 menu_item :plugins, :only => :plugin
21 21
22 22 helper :queries
23 23
24 24 before_filter :require_admin
25 25
26 26 def index
27 27 edit
28 28 render :action => 'edit'
29 29 end
30 30
31 31 def edit
32 32 @notifiables = Redmine::Notifiable.all
33 33 if request.post? && params[:settings] && params[:settings].is_a?(Hash)
34 34 settings = (params[:settings] || {}).dup.symbolize_keys
35 35 settings.each do |name, value|
36 36 Setting.set_from_params name, value
37 37 end
38 38 flash[:notice] = l(:notice_successful_update)
39 39 redirect_to settings_path(:tab => params[:tab])
40 40 else
41 41 @options = {}
42 42 user_format = User::USER_FORMATS.collect{|key, value| [key, value[:setting_order]]}.sort{|a, b| a[1] <=> b[1]}
43 43 @options[:user_format] = user_format.collect{|f| [User.current.name(f[0]), f[0].to_s]}
44 44 @deliveries = ActionMailer::Base.perform_deliveries
45 45
46 46 @guessed_host_and_path = request.host_with_port.dup
47 47 @guessed_host_and_path << ('/'+ Redmine::Utils.relative_url_root.gsub(%r{^\/}, '')) unless Redmine::Utils.relative_url_root.blank?
48 48
49 49 @commit_update_keywords = Setting.commit_update_keywords.dup
50 @commit_update_keywords << {} if @commit_update_keywords.blank?
50 @commit_update_keywords = [{}] unless @commit_update_keywords.is_a?(Array) && @commit_update_keywords.any?
51 51
52 52 Redmine::Themes.rescan
53 53 end
54 54 end
55 55
56 56 def plugin
57 57 @plugin = Redmine::Plugin.find(params[:id])
58 58 unless @plugin.configurable?
59 59 render_404
60 60 return
61 61 end
62 62
63 63 if request.post?
64 64 Setting.send "plugin_#{@plugin.id}=", params[:settings]
65 65 flash[:notice] = l(:notice_successful_update)
66 66 redirect_to plugin_settings_path(@plugin)
67 67 else
68 68 @partial = @plugin.settings[:partial]
69 69 @settings = Setting.send "plugin_#{@plugin.id}"
70 70 end
71 71 rescue Redmine::PluginNotFound
72 72 render_404
73 73 end
74 74 end
General Comments 0
You need to be logged in to leave comments. Login now