Skip to content

Commit

Permalink
Merge commit '73ec47270227f38532a53736b60ee6e4a43785ef' (remote-track…
Browse files Browse the repository at this point in the history
…ing branch 'redmine/master') into yuya-develop
  • Loading branch information
nishidayuya committed Nov 1, 2024
2 parents dbb406a + 73ec472 commit d90e3d2
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
10 changes: 0 additions & 10 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,6 @@ Rails/Blank:
- 'lib/redmine/field_format.rb'
- 'lib/redmine/wiki_formatting/macros.rb'

# This cop supports safe autocorrection (--autocorrect).
Rails/ContentTag:
Exclude:
- 'lib/redmine/wiki_formatting/markdown/formatter.rb'

# Configuration parameters: Include.
# Include: db/**/*.rb
Rails/CreateTableWithTimestamps:
Expand Down Expand Up @@ -683,7 +678,6 @@ Style/Alias:
- 'lib/redmine/export/pdf.rb'
- 'lib/redmine/menu_manager.rb'
- 'lib/redmine/plugin.rb'
- 'lib/redmine/wiki_formatting/markdown/formatter.rb'
- 'lib/redmine/wiki_formatting/textile/formatter.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
Expand Down Expand Up @@ -753,7 +747,6 @@ Style/ClassVars:
- 'lib/redmine/twofa.rb'
- 'lib/redmine/wiki_formatting.rb'
- 'lib/redmine/wiki_formatting/macros.rb'
- 'lib/redmine/wiki_formatting/markdown/formatter.rb'
- 'test/helpers/activities_helper_test.rb'

# This cop supports safe autocorrection (--autocorrect).
Expand Down Expand Up @@ -957,7 +950,6 @@ Style/MultilineIfModifier:
- 'app/helpers/attachments_helper.rb'
- 'app/helpers/custom_fields_helper.rb'
- 'app/helpers/projects_helper.rb'
- 'app/helpers/reports_helper.rb'
- 'app/helpers/repositories_helper.rb'
- 'app/helpers/search_helper.rb'
- 'app/models/issue_query.rb'
Expand Down Expand Up @@ -1108,7 +1100,6 @@ Style/RedundantAssignment:
- 'lib/redmine/scm/adapters/bazaar_adapter.rb'
- 'lib/redmine/scm/adapters/filesystem_adapter.rb'
- 'lib/redmine/wiki_formatting.rb'
- 'lib/redmine/wiki_formatting/markdown/formatter.rb'

# This cop supports safe autocorrection (--autocorrect).
Style/RedundantBegin:
Expand Down Expand Up @@ -1211,7 +1202,6 @@ Style/RescueModifier:
- 'lib/redmine/field_format.rb'
- 'lib/redmine/search.rb'
- 'lib/redmine/wiki_formatting.rb'
- 'test/unit/lib/redmine/wiki_formatting/markdown_formatter_test.rb'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

ruby '>= 3.1.0', '< 3.4.0'

gem 'rails', '7.2.1.2'
gem 'rails', '7.2.2'
gem 'rouge', '~> 4.2'
gem 'mini_mime', '~> 1.1.0'
gem "actionpack-xml_parser"
Expand Down Expand Up @@ -109,7 +109,7 @@ group :test do
# RuboCop
gem 'rubocop', '~> 1.67.0', require: false
gem 'rubocop-performance', '~> 1.22.0', require: false
gem 'rubocop-rails', '~> 2.26.0', require: false
gem 'rubocop-rails', '~> 2.27.0', require: false
end

local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
Expand Down
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,7 @@ td.gantt_selected_column .gantt_hdr,.gantt_selected_column_container {
border: 0;
box-shadow: none;
white-space: pre-wrap;
pointer-events: none;
}

/***** SVG Icons *****/
Expand Down
8 changes: 4 additions & 4 deletions app/helpers/reports_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
module ReportsHelper
def aggregate(data, criteria)
a = 0
data.each do |row|
data&.each do |row|
match = 1
criteria.each do |k, v|
criteria&.each do |k, v|
unless (row[k].to_s == v.to_s) ||
(k == 'closed' &&
(v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
match = 0
end
end unless criteria.nil?
end
a = a + row["total"].to_i if match == 1
end unless data.nil?
end
a
end

Expand Down
1 change: 1 addition & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ def remove_references_before_destroy
Issue.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id])
Issue.where(['assigned_to_id = ?', id]).update_all('assigned_to_id = NULL')
Journal.where(['user_id = ?', id]).update_all(['user_id = ?', substitute.id])
Journal.where(['updated_by_id = ?', id]).update_all(['updated_by_id = ?', substitute.id])
JournalDetail.
where(["property = 'attr' AND prop_key = 'assigned_to_id' AND old_value = ?", id.to_s]).
update_all(['old_value = ?', substitute.id.to_s])
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class UpdateOrphanedJournalUpdatedByIdToAnonymous < ActiveRecord::Migration[7.2]
def up
# Don't use `User.anonymous` here because it creates a new anonymous
# user if one doesn't exist yet.
anonymous_user_id = AnonymousUser.unscoped.pick(:id)
# The absence of an anonymous user implies a fresh installation.
return if anonymous_user_id.nil?

Journal.joins('LEFT JOIN users ON users.id = journals.updated_by_id')
.where.not(updated_by_id: nil)
.where(users: { id: nil })
.update_all(updated_by_id: anonymous_user_id)
end

def down
# no-op
end
end
7 changes: 6 additions & 1 deletion test/unit/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,17 @@ def test_destroy_should_unassign_issues
def test_destroy_should_update_journals
issue = Issue.generate!(:project_id => 1, :author_id => 2,
:tracker_id => 1, :subject => 'foo')
# Prepare a journal with both user_id and updated_by_id set to 2
issue.init_journal(User.find(2), "update")
issue.save!
journal = issue.journals.first
journal.update_columns(updated_by_id: 2)

User.find(2).destroy
assert_nil User.find_by_id(2)
assert_equal User.anonymous, issue.journals.first.reload.user
journal.reload
assert_equal User.anonymous, journal.user
assert_equal User.anonymous, journal.updated_by
end

def test_destroy_should_update_journal_details_old_value
Expand Down

0 comments on commit d90e3d2

Please sign in to comment.