Skip to content

Commit

Permalink
Enhance plugin compatibility with Redmine 5.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nanego committed Mar 8, 2024
1 parent 7d57b1d commit 967d254
Show file tree
Hide file tree
Showing 51 changed files with 1,223 additions and 1,083 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/4_2_11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Install package dependencies
run: >
sudo apt-get install --yes --quiet
sudo apt-get update && sudo apt-get install --yes --quiet
build-essential
cmake
libicu-dev
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/5_1_1.yml → .github/workflows/5_1_2.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Tests 5.1.1
name: Tests 5.1.2

env:
PLUGIN_NAME: redmine_admin_activity
REDMINE_VERSION: 5.1.1
REDMINE_VERSION: 5.1.2
RAILS_ENV: test

on:
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Install package dependencies
run: >
sudo apt-get install --yes --quiet
sudo apt-get update && sudo apt-get install --yes --quiet
build-essential
cmake
libicu-dev
Expand Down Expand Up @@ -89,6 +89,7 @@ jobs:
- name: Prepare Redmine source
working-directory: redmine
run: |
rm -f test/integration/routing/plugins_test.rb # Fix routing tests # TODO Remove this line when https://www.redmine.org/issues/38707 is fixed
sed -i '/rubocop/d' Gemfile
rm -f .rubocop*
cp plugins/redmine_base_rspec/spec/support/database-${{ matrix.db }}.yml config/database.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

- name: Install package dependencies
run: >
sudo apt-get install --yes --quiet
sudo apt-get update && sudo apt-get install --yes --quiet
build-essential
cmake
libicu-dev
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ To run tests, install the redmine_base_rspec plugin (https://github.com/jbbarth/

|Plugin branch| Redmine Version | Test Status |
|-------------|-----------------|-------------------|
|master | 5.1.1 | [![5.1.1][1]][5] |
|master | 5.1.2 | [![5.1.2][1]][5] |
|master | 4.2.11 | [![4.2.11][2]][5] |
|master | master | [![master][4]][5] |

[1]: https://github.com/nanego/redmine_admin_activity/actions/workflows/5_1_1.yml/badge.svg
[1]: https://github.com/nanego/redmine_admin_activity/actions/workflows/5_1_2.yml/badge.svg
[2]: https://github.com/nanego/redmine_admin_activity/actions/workflows/4_2_11.yml/badge.svg
[4]: https://github.com/nanego/redmine_admin_activity/actions/workflows/master.yml/badge.svg
[5]: https://github.com/nanego/redmine_admin_activity/actions
2 changes: 1 addition & 1 deletion app/helpers/journal_settings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def link_to_journalized_if_exists(journalized)
link_to((journalized.to_s), (journalized.class.send :representative_link_path, journalized)) if journalized.present? && journalized.persisted?
else
# case of absence of implementation methods representative_link_path, to_s
return l(:label_absence_methodes) if journalized.present?
return l(:label_missing_methods) if journalized.present?
end
end

Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ en:
text_journal_has_many_changed: "%{class_name} has been changed from [%{old}] to [%{new}]"
label_customfieldenumeration: Key/value list
label_customfieldssection: Section
label_absence_methodes: TODO Absence of methods implementation representative_link_path or to_s
label_missing_methods: TODO Absence of methods implementation representative_link_path or to_s
label_this_user: "This user"
label_from_project: "from the project"
label_to_project: "to the project"
Expand Down
2 changes: 1 addition & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fr:
text_journal_has_many_changed: "%{class_name} a été changé de [%{old}] à [%{new}]"
label_customfieldenumeration: Liste clé/valeur
label_customfieldssection: Section
label_absence_methodes: TODO Absence d'implémentation des méthodes representative_link_path or to_s
label_missing_methods: TODO Absence d'implémentation des méthodes representative_link_path or to_s
label_this_user: "Cet utilisateur"
label_from_project: "du projet"
label_to_project: "au projet"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
require_dependency 'custom_field_enumerations_controller'

module RedmineAdminActivity::Controllers
module CustomFieldEnumerationsControllerPatch
extend ActiveSupport::Concern

def get_previous_custom_field_enumerations
@previous_custom_field_enumerations_ids = @custom_field.enumerations.select { |i| i.active }.map(&:id)
end

def create_custom_field_history

changes = get_custom_field_enumerations_changes(@custom_field, @previous_custom_field_enumerations_ids)

JournalSetting.create(
:user_id => User.current.id,
:value_changes => changes.except!(:custom_values),
:journalized_type => @custom_field.class.name,
:journalized_id => @custom_field.id,
:journalized_entry_type => "update",
)

end
end
end

class CustomFieldEnumerationsController
include RedmineAdminActivity::Journalizable
include RedmineAdminActivity::Controllers::CustomFieldEnumerationsControllerPatch

append_before_action :get_previous_custom_field_enumerations, :only => [:create, :destroy, :update_each]
after_action :create_custom_field_history, :only => [:create, :destroy, :update_each]

end
131 changes: 0 additions & 131 deletions lib/redmine_admin_activity/controllers/custom_fields_controller.rb

This file was deleted.

Loading

0 comments on commit 967d254

Please sign in to comment.