Merge pull request #17859 from opf/bug/61308-log-time-triggered-from-my-spent-time-widget-allows-logging-time-for-other-users

do not show the user input when logging from the my page
This commit is contained in:
Klaus Zanders
2025-02-06 16:43:16 +01:00
committed by GitHub
2 changed files with 13 additions and 7 deletions
@@ -429,7 +429,7 @@ export class TimeEntryCalendarComponent implements AfterViewInit, OnDestroy {
private editEvent(entry:TimeEntryResource):void {
void this.turboRequests.request(
`${this.pathHelper.timeEntryEditDialog(entry.id as string)}`,
`${this.pathHelper.timeEntryEditDialog(entry.id as string)}?onlyMe=true`,
{ method: 'GET' },
);
}
@@ -465,7 +465,7 @@ export class TimeEntryCalendarComponent implements AfterViewInit, OnDestroy {
}
void this.turboRequests.request(
`${this.pathHelper.timeEntryDialog()}?date=${date.format('YYYY-MM-DD')}`,
`${this.pathHelper.timeEntryDialog()}?date=${date.format('YYYY-MM-DD')}&onlyMe=true`,
{ method: 'GET' },
);
}
@@ -46,11 +46,7 @@ class TimeEntriesController < ApplicationController
def dialog
@show_work_package = params[:work_package_id].blank?
@show_user = if @project
User.current.allowed_in_project?(:log_time, @project)
else
User.current.allowed_in_any_project?(:log_time)
end
@show_user = show_user_input_in_dialog
@time_entry.spent_on ||= params[:date].presence || Time.zone.today
end
@@ -132,6 +128,16 @@ class TimeEntriesController < ApplicationController
private
def show_user_input_in_dialog
return false if params[:onlyMe] == "true"
if @project
User.current.allowed_in_project?(:log_time, @project)
else
User.current.allowed_in_any_project?(:log_time)
end
end
def form_config_options
{
show_user: params[:time_entry][:show_user] == "true",