Skip to content

Commit

Permalink
Problem clicking action menu (three dots) in DMS file grid #1501
Browse files Browse the repository at this point in the history
  • Loading branch information
picman committed Jan 10, 2024
1 parent 0adcc62 commit 29a3b92
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 1 addition & 3 deletions app/models/dmsf_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ def self.findn_file_by_name(project_id, folder, name)
end

def approval_allowed_zero_minor
last_revision.minor_version.zero? if Setting.plugin_redmine_dmsf['only_approval_zero_minor_version']

true
Setting.plugin_redmine_dmsf['only_approval_zero_minor_version'] ? last_revision.minor_version&.zero? : true
end

def last_revision
Expand Down
18 changes: 18 additions & 0 deletions test/unit/dmsf_file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,4 +304,22 @@ def test_copy_to_author
assert f
assert_equal @jsmith.id, f.last_revision.user_id, 'Author must be updated when copying'
end

def test_approval_allowed_zero_minor_yes
with_settings plugin_redmine_dmsf: { 'only_approval_zero_minor_version' => true } do
@file1.last_revision.minor_version = 0
assert @file1.approval_allowed_zero_minor
@file1.last_revision.minor_version = 1
assert_not @file1.approval_allowed_zero_minor
end
end

def test_approval_allowed_zero_minor_no
with_settings plugin_redmine_dmsf: { 'only_approval_zero_minor_version' => nil } do
@file1.last_revision.minor_version = 0
assert @file1.approval_allowed_zero_minor
@file1.last_revision.minor_version = 1
assert @file1.approval_allowed_zero_minor
end
end
end

0 comments on commit 29a3b92

Please sign in to comment.