Fix issue closed permission bug
This commit is contained in:
parent
3644faabe0
commit
01a3fe9afe
@ -5,7 +5,7 @@ Changelog
|
||||
++++++
|
||||
|
||||
- fix mail notification if issue author changed
|
||||
|
||||
- fix permission bug for closed issues with freezed mode
|
||||
|
||||
2.0.20
|
||||
++++++
|
||||
|
@ -145,10 +145,9 @@ module Additionals
|
||||
end
|
||||
|
||||
def validate_change_on_closed
|
||||
return true if !closed? ||
|
||||
new_record? ||
|
||||
!Additionals.setting?(:issue_freezed_with_close) ||
|
||||
return true if new_record? ||
|
||||
!status_was.is_closed ||
|
||||
!Additionals.setting?(:issue_freezed_with_close) ||
|
||||
User.current.allowed_to?(:edit_closed_issues, project)
|
||||
|
||||
errors.add :base, :issue_changes_not_allowed
|
||||
|
@ -65,6 +65,25 @@ class IssueTest < Additionals::TestCase
|
||||
assert_not issue.save
|
||||
issue.reload
|
||||
assert_not_equal 'Should be not be saved', issue.subject
|
||||
|
||||
issue.status_id = 1
|
||||
assert issue.status_was.is_closed
|
||||
assert_not issue.closed?
|
||||
assert_not issue.save
|
||||
end
|
||||
end
|
||||
|
||||
def test_new_issue_should_always_be_changeable
|
||||
with_additionals_settings(issue_freezed_with_close: 1) do
|
||||
User.current = users(:users_003)
|
||||
|
||||
issue = Issue.generate subject: 'new issue for closing test',
|
||||
status_id: 1
|
||||
assert issue.save
|
||||
|
||||
issue = Issue.generate subject: 'new issue for closing test and closed state',
|
||||
status_id: 5
|
||||
assert issue.save
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user