Skip to content

Commit b454433

Browse files
author
Guillaume DUPE
committed
Backlog upgrade for redmine 4.0.5
- task directory deleted - Add sidekiq dependancy to GemFile - Change deprecated method *_filter by *_action, it is the equivalent since Rails5.2 - Change css z-index to prevent search menu to pass under backlog menu - hash attribute to prevent internal error when drag and drop task - Error Block Message in impediment
1 parent b2424fe commit b454433

File tree

105 files changed

+89
-18394
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+89
-18394
lines changed

Gemfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
1+
gem "sidekiq"
2+
gem 'erubis', '~> 2.7'
23
gem "holidays", "~>1.0.3"
34
gem "icalendar"
45
gem "open-uri-cached"

app/controllers/rb_all_projects_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class RbAllProjectsController < ApplicationController
22
unloadable
33

4-
before_filter :authorize_global
4+
before_action :authorize_global
55

66
def statistics
77
backlogs_projects = RbCommonHelper.find_backlogs_enabled_active_projects

app/controllers/rb_application_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
class RbApplicationController < ApplicationController
33
unloadable
44

5-
before_filter :load_project, :authorize, :check_if_plugin_is_configured
5+
before_action :load_project, :authorize, :check_if_plugin_is_configured
66

77
#provide list of javascript_include_tags which must be rendered before common.js
88
def rb_jquery_plugins

app/controllers/rb_calendars_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class RbCalendarsController < RbApplicationController
55

66
case Backlogs.platform
77
when :redmine
8-
before_filter :require_admin_or_api_request, :only => :ical
8+
before_action :require_admin_or_api_request, :only => :ical
99
accept_api_auth :ical
1010
when :chiliproject
1111
accept_key_auth :ical

app/controllers/rb_impediments_controller.rb

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ class RbImpedimentsController < RbApplicationController
44
unloadable
55

66
def create
7-
@settings = Backlogs.settings
7+
params.permit!
8+
@settings = Backlogs.setting
89
begin
910
@impediment = RbTask.create_with_relationships(params, User.current.id, @project.id, true)
1011
rescue => e
11-
render :text => e.message.blank? ? e.to_s : e.message, :status => 400
12+
Rails.logger.error(e.message.blank? ? e.to_s : e.message)
13+
render :partial => "backlogs/model_errors", :object => { "base" => e.message.blank? ? e.to_s : e.message }, :status => 400
1214
return
1315
end
1416

@@ -22,8 +24,9 @@ def create
2224
end
2325

2426
def update
27+
params.permit!
2528
@impediment = RbTask.find_by_id(params[:id])
26-
@settings = Backlogs.settings
29+
@settings = Backlogs.setting
2730
begin
2831
result = @impediment.update_with_relationships(params)
2932
rescue => e

app/controllers/rb_project_settings_controller.rb

+3
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ def project_settings
2323
:tab => 'backlogs'
2424
end
2525

26+
def project_settings_params
27+
params.require(:rb_project_settings).permit(:project_id);
28+
end
2629
end

app/controllers/rb_releases_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def edit
4949
def update
5050
except = ['id', 'project_id']
5151
attribs = params.select{|k,v| (!except.include? k) and (RbRelease.column_names.include? k) }
52-
attribs = Hash[*attribs.flatten]
52+
attribs = attribs.to_enum.to_h
5353
begin
5454
result = @release.update_attributes attribs
5555
rescue => e

app/controllers/rb_server_variables_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class RbServerVariablesController < RbApplicationController
77

88
# for index there's no @project
99
# (eliminates the need of RbAllProjectsController)
10-
skip_before_filter :load_project, :authorize, :only => [:index]
10+
skip_before_action :load_project, :authorize, :only => [:index]
1111

1212
def index
1313
@context = params[:context]

app/controllers/rb_sprints_controller.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class RbSprintsController < RbApplicationController
1212

1313
def create
1414
attribs = params.select{|k,v| k != 'id' and RbSprint.column_names.include? k }
15-
attribs = Hash[*attribs.flatten]
15+
attribs = attribs.to_enum.to_h
1616
@sprint = RbSprint.new(attribs)
1717

1818
#share the sprint according to the global setting
@@ -43,7 +43,7 @@ def create
4343
def update
4444
except = ['id', 'project_id']
4545
attribs = params.select{|k,v| (!except.include? k) and (RbSprint.column_names.include? k) }
46-
attribs = Hash[*attribs.flatten]
46+
attribs = attribs.to_enum.to_h
4747
begin
4848
result = @sprint.update_attributes attribs
4949
rescue => e

app/controllers/rb_stories_controller.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def create
3232
begin
3333
story = RbStory.create_and_position(params)
3434
rescue => e
35-
render :text => e.message.blank? ? e.to_s : e.message, :status => 400
35+
Rails.logger.error(e.message.blank? ? e.to_s : e.message)
36+
render text: e.message.blank? ? e.to_s : e.message, status: 400
3637
return
3738
end
3839

@@ -48,6 +49,7 @@ def update
4849
begin
4950
result = story.update_and_position!(params)
5051
rescue => e
52+
Rails.logger.error(e.message.blank? ? e.to_s : e.message)
5153
render :text => e.message.blank? ? e.to_s : e.message, :status => 400
5254
return
5355
end

app/controllers/rb_taskboards_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def show
77
stories = @sprint.stories
88
@story_ids = stories.map{|s| s.id}
99

10-
@settings = Backlogs.settings
10+
@settings = Backlogs.setting
1111

1212
## determine status columns to show
1313
tracker = Tracker.find_by_id(RbTask.tracker)

app/controllers/rb_tasks_controller.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ class RbTasksController < RbApplicationController
44
unloadable
55

66
def create
7-
@settings = Backlogs.settings
7+
params.permit!
8+
@settings = Backlogs.setting
89
@task = nil
910
begin
1011
@task = RbTask.create_with_relationships(params, User.current.id, @project.id)
1112
rescue => e
13+
Rails.logger.error(e.to_yaml)
14+
Rails.logger.error(e.backtrace)
1215
render :text => e.message.blank? ? e.to_s : e.message, :status => 400
1316
return
1417
end
@@ -23,8 +26,9 @@ def create
2326
end
2427

2528
def update
29+
params.permit!
2630
@task = RbTask.find_by_id(params[:id])
27-
@settings = Backlogs.settings
31+
@settings = Backlogs.setting
2832
result = @task.update_with_relationships(params)
2933
status = (result ? 200 : 400)
3034
@include_meta = true

app/helpers/rb_partials_helper.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def def_erb_method(method_name_and_args, filename)
1313
define_method "#{method_name}_with_html_safe" do |*args, &block|
1414
send("#{method_name}_without_html_safe", *args, &block).html_safe
1515
end
16-
alias_method_chain method_name, :html_safe
16+
alias_method "#{method_name}_without_html_safe", method_name
17+
alias_method method_name, "#{method_name}_with_html_safe"
1718
method_name
1819
end
1920

app/models/rb_issue_history.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class RbIssueHistory < ActiveRecord::Base
44
self.table_name = 'rb_issue_history'
5-
attr_protected :created_at # hack, all attributes will be mass asigment
5+
#attr_protected :created_at # hack, all attributes will be mass asigment
66
belongs_to :issue
77

88
serialize :history, Array

app/models/rb_journal.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
class RbJournal < ActiveRecord::Base
2-
unloadable
3-
attr_protected :created_at # hack, all attributes will be mass asigment
2+
#unloadable
3+
#attr_protected :created_at # hack, all attributes will be mass asigment
44
end

app/models/rb_project_settings.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class RbProjectSettings < ActiveRecord::Base
2-
unloadable
3-
attr_protected :created_at # hack, all attributes will be mass asigment
2+
#unloadable
3+
#attr_protected :created_at # hack, all attributes will be mass asigment
44
belongs_to :project
5-
attr_accessible :project_id
5+
#attr_accessible :project_id
66
end
77

app/models/rb_release.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ class RbRelease < ActiveRecord::Base
165165
has_many :issues, :class_name => 'RbStory', :foreign_key => 'release_id', :dependent => :nullify
166166
has_many :rb_release_burnchart_day_cache, :dependent => :delete_all, :foreign_key => 'release_id'
167167

168-
attr_accessible :project_id, :name, :release_start_date, :release_end_date, :status
169-
attr_accessible :project, :description, :planned_velocity, :sharing
168+
#attr_accessible :project_id, :name, :release_start_date, :release_end_date, :status
169+
#attr_accessible :project, :description, :planned_velocity, :sharing
170170

171171
validates_presence_of :project_id, :name, :release_start_date, :release_end_date
172172
validates_inclusion_of :status, :in => RELEASE_STATUSES

app/models/rb_release_burnchart_day_cache.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Release burnchart cache per day per story.
22
# Table layout optimized for quickly summing up release burncharts.
33
class RbReleaseBurnchartDayCache < ActiveRecord::Base
4-
unloadable
5-
attr_protected :created_at # hack, all attributes will be mass asigment
4+
#unloadable
5+
#attr_protected :created_at # hack, all attributes will be mass asigment
66
belongs_to :issue
77
belongs_to :release
88

app/models/rb_release_multiview.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
class RbReleaseMultiview < ActiveRecord::Base
22
self.table_name = 'rb_releases_multiview'
33

4-
unloadable
5-
attr_protected :created_at # hack, all attributes will be mass asigment
4+
#unloadable
5+
#attr_protected :created_at # hack, all attributes will be mass asigment
66

77
belongs_to :project
88

9-
attr_accessible :name, :project_id, :release_ids, :project, :description
9+
#attr_accessible :name, :project_id, :release_ids, :project, :description
1010
serialize :release_ids
1111

1212
validates_presence_of :project_id, :name

app/models/rb_sprint_burndown.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class RbSprintBurndown < ActiveRecord::Base
55
self.table_name = 'rb_sprint_burndown'
66
belongs_to :version
77

8-
attr_accessible :directon, :version_id, :stories, :burndown
8+
#attr_accessible :directon, :version_id, :stories, :burndown
99

1010
serialize :stories, Array
1111
serialize :burndown, Hash

app/models/rb_stats.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1414

1515
class RbStats < ActiveRecord::Base
16-
attr_protected :created_at # hack, all attributes will be mass asigment
16+
#attr_protected :created_at # hack, all attributes will be mass asigment
1717
REDMINE_PROPERTIES = ['estimated_hours', 'fixed_version_id', 'status_id', 'story_points', 'remaining_hours']
1818
JOURNALED_PROPERTIES = {
1919
'estimated_hours' => :float,

app/models/rb_story.rb

+7-8
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ def self.create_and_position(params)
175175
attribs = params.select{|k,v| !['prev', 'next', 'id', 'lft', 'rgt'].include?(k) && RbStory.column_names.include?(k) }
176176

177177
attribs[:status] = RbStory.class_default_status
178-
attribs = Hash[*attribs.flatten]
178+
attribs = attribs.to_enum.to_h
179179
s = RbStory.new(attribs)
180-
s.save!
180+
s.save
181181
s.position!(params)
182182

183183
return s
@@ -263,7 +263,7 @@ def update_and_position!(params)
263263

264264
# lft and rgt fields are handled by acts_as_nested_set
265265
attribs = params.select{|k,v| !['prev', 'id', 'project_id', 'lft', 'rgt'].include?(k) && RbStory.column_names.include?(k) }
266-
attribs = Hash[*attribs.flatten]
266+
attribs = attribs.to_enum.to_h
267267

268268
return self.journalized_update_attributes attribs
269269
end
@@ -291,11 +291,10 @@ def update_release_burnchart_data(days,release_burndown_id)
291291
end
292292

293293
def save_release_burnchart_data(series,release_burndown_id)
294-
RbReleaseBurnchartDayCache.delete_all(
295-
["issue_id = ? AND release_id = ? AND day IN (?)",
296-
self.id,
297-
release_burndown_id,
298-
series.series(:day)])
294+
RbReleaseBurnchartDayCache.where(["issue_id = ? AND release_id = ? AND day IN (?)",
295+
self.id,
296+
release_burndown_id,
297+
series.series(:day)]).delete_all
299298

300299
series.each{|s|
301300
RbReleaseBurnchartDayCache.create(:issue_id => self.id,

app/models/rb_task.rb

+7-5
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def self.rb_safe_attributes(params)
5959
attribs = params.select {|k,v| safe_attributes_names.include?(k) }
6060
# lft and rgt fields are handled by acts_as_nested_set
6161
attribs = attribs.select{|k,v| k != 'lft' and k != 'rgt' }
62-
attribs = Hash[*attribs.flatten] if attribs.is_a?(Array)
62+
attribs = attribs.to_enum.to_h if attribs.is_a?(Array)
6363
return attribs
6464
end
6565

@@ -82,14 +82,16 @@ def self.create_with_relationships(params, user_id, project_id, is_impediment =
8282
end
8383
end
8484

85-
task = new(attribs)
85+
attribs = attribs.to_enum.to_h
86+
task = RbTask.new(attribs)
8687
if params['parent_issue_id']
8788
parent = Issue.find(params['parent_issue_id'])
8889
task.start_date = parent.start_date
8990
end
90-
task.save!
9191

92-
raise "Block list must be comma-separated list of task IDs" if is_impediment && !task.validate_blocks_list(blocks) # could we do that before save and integrate cross-project checks?
92+
return task if is_impediment && !task.validate_blocks_list(blocks) # could we do that before save and integrate cross-project checks?
93+
94+
task.save!
9395

9496
task.move_before params[:next] unless is_impediment # impediments are not hosted under a single parent, so you can't tree-order them
9597
task.update_blocked_list blocks.split(/\D+/) if is_impediment
@@ -175,7 +177,7 @@ def update_blocked_list(for_blocking)
175177

176178
def validate_blocks_list(list)
177179
if list.split(/\D+/).length==0
178-
errors.add :blocks, :must_have_comma_delimited_list
180+
errors.add :blocks, :must_have_comma_delimited_list.to_s
179181
false
180182
else
181183
true

assets/stylesheets/global.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ a:hover{
3030
position:relative;
3131
width:100%;
3232
box-shadow: 0 3px 4px #A0A0A0;
33-
z-index:1000;
33+
z-index:98;
3434
border-radius: 10px;
3535
}
3636
#toolbar .breadcrumbs{

assets/stylesheets/taskboard.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ See RB.Taskboard.initialize()
4444
margin-bottom:0;
4545
margin-right:10px;
4646
position: absolute;
47-
z-index: 200;
47+
z-index: 100;
4848
}
4949
#board_header td{
5050
background-color:#EEEEEE;

config/locales/en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ en:
8686
error_release_end_after_start: "Release end date has to be after start date"
8787
error_sprint_end_before_start: "Sprint cannot end before it starts"
8888
error_taken: "is already in use"
89+
error_impediment: "Block list must be comma-separated list of task IDs"
8990
event_sprint_summary: "%{project}: %{summary}"
9091
field_assigned_to: "Assigned To"
9192
field_backlogs_issue_type: "Backlog type"

features/.autotest

-19
This file was deleted.

0 commit comments

Comments
 (0)