diff options
Diffstat (limited to 'app/models/time_entry.rb')
-rw-r--r-- | app/models/time_entry.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/time_entry.rb b/app/models/time_entry.rb index a763dc1be..e8ea1a88d 100644 --- a/app/models/time_entry.rb +++ b/app/models/time_entry.rb @@ -146,7 +146,9 @@ class TimeEntry < ActiveRecord::Base end end errors.add :project_id, :invalid if project.nil? - errors.add :user_id, :invalid if user_id != author_id && !self.assignable_users.map(&:id).include?(user_id) + if user_id_changed? && user_id != author_id && !self.assignable_users.map(&:id).include?(user_id) + errors.add :user_id, :invalid + end errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project) || @invalid_issue_id errors.add :activity_id, :inclusion if activity_id_changed? && project && !project.activities.include?(activity) if spent_on_changed? && user |