Fix problem with closed issues and time log
This commit is contained in:
parent
425a0c35bf
commit
79f53b9da9
5
app/overrides/issues/edit.rb
Normal file
5
app/overrides/issues/edit.rb
Normal file
@ -0,0 +1,5 @@
|
||||
Deface::Override.new virtual_path: 'issues/_edit',
|
||||
name: 'edit-issue-permission',
|
||||
replace: 'erb[silent]:contains("User.current.allowed_to?(:log_time, @project)")',
|
||||
original: '98560fb12bb71f775f2a7fd1884c97f8cd632cd3',
|
||||
text: '<% if User.current.allowed_to?(:log_time, @project) && @issue.log_time_allowed? %>'
|
@ -1,5 +1,10 @@
|
||||
Deface::Override.new virtual_path: 'issues/_action_menu',
|
||||
name: 'show-issue-log-time',
|
||||
replace: 'erb[loud]:contains("User.current.allowed_to?(:log_time, @project)")',
|
||||
original: '4bbf065b9f960687e07f76e7232eb21bf183a981',
|
||||
partial: 'issues/additionals_action_menu_log_time'
|
||||
Deface::Override.new virtual_path: 'issues/_action_menu',
|
||||
name: 'add-issue-assign-to-me',
|
||||
insert_bottom: 'div.contextual',
|
||||
original: 'c0a30490bb9ac5c5644e674319f17e40c57034d8',
|
||||
original: '44ef032156db0dfdb67301fdb9ef8901abeca18a',
|
||||
partial: 'issues/additionals_action_menu'
|
||||
|
@ -0,0 +1,2 @@
|
||||
- if User.current.allowed_to?(:log_time, @project) && @issue.log_time_allowed?
|
||||
= link_to l(:button_log_time), new_issue_time_entry_path(@issue), class: 'icon icon-time-add'
|
@ -56,7 +56,7 @@ module Additionals
|
||||
end
|
||||
|
||||
def log_time_allowed?(user = User.current)
|
||||
!closed? || user.allowed_to?(:log_time_on_closed_issues, project)
|
||||
!status_was.is_closed || user.allowed_to?(:log_time_on_closed_issues, project)
|
||||
end
|
||||
|
||||
def editable_with_additionals?(user = User.current)
|
||||
|
@ -13,7 +13,8 @@ module Additionals
|
||||
module InstanceMethods
|
||||
def validate_issue_allowed
|
||||
return unless issue_id && issue
|
||||
return if Setting.commit_logtime_enabled? && (issue.updated_on + 3.seconds) > Additionals.now_with_user_time_zone
|
||||
# NOTE: do not use user time zone here, because issue do not use it
|
||||
return if Setting.commit_logtime_enabled? && (issue.updated_on + 5.seconds) > Time.zone.now
|
||||
|
||||
errors.add(:issue_id, :issue_log_time_not_allowed) unless issue.log_time_allowed?
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user