1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-02-03 23:53:23 +00:00

Set time entry author in controller (#32774).

git-svn-id: http://svn.redmine.org/redmine/trunk@19677 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2020-04-05 19:24:32 +00:00
parent 99df2c5c58
commit 31c8e71d8e
2 changed files with 2 additions and 0 deletions

View File

@ -614,6 +614,7 @@ class IssuesController < ApplicationController
time_entry = @time_entry || TimeEntry.new
time_entry.project = @issue.project
time_entry.issue = @issue
time_entry.author = User.current
time_entry.user = User.current
time_entry.spent_on = User.current.today
time_entry.safe_attributes = params[:time_entry]

View File

@ -50,6 +50,7 @@ class TimeEntry < ActiveRecord::Base
validates_length_of :comments, :maximum => 1024, :allow_nil => true
validates :spent_on, :date => true
before_validation :set_project_if_nil
#TODO: remove this, author should be always explicitly set
before_validation :set_author_if_nil
validate :validate_time_entry