OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#62108] Meeting creation uses UTC offset, not timezone
Mir Bhatiae5205cc8debd
diff --git a/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts b/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.tsnew file mode 100644index 00000000000..b195aefcce4--- /dev/null+++ b/frontend/src/stimulus/controllers/dynamic/meetings/form.controller.ts@@ -0,0 +1,42 @@+import { ApplicationController } from 'stimulus-use';+import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';+import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';++export default class OpMeetingsFormController extends ApplicationController {+ private turboRequests:TurboRequestsService;+ private pathHelper:PathHelperService;++ static values = { structured: Boolean };++ declare structuredValue:boolean;++ async connect() {+ const context = await window.OpenProject.getPluginContext();+ this.turboRequests = context.services.turboRequests;+ this.pathHelper = context.services.pathHelperService;+ }++ updateTimezoneText():void {+ const data = new FormData(this.element as HTMLFormElement);+ const urlSearchParams = new URLSearchParams();+ let key:string;++ ['start_date', 'start_time_hour'].forEach((name) => {+ if (this.structuredValue === true) {+ key = `structured_meeting[${name}]`;+ } else {+ key = `meeting[${name}]`;+ }+ urlSearchParams.append(key, data.get(key) as string);+ });++ void this+ .turboRequests+ .request(+ `${this.pathHelper.staticBase}/meetings/fetch_timezone?${urlSearchParams.toString()}`,+ {+ headers: { Accept: 'text/vnd.turbo-stream.html' },+ },+ );+ }+}diff --git a/modules/meeting/app/components/meetings/index/form_component.html.erb b/modules/meeting/app/components/meetings/index/form_component.html.erbindex 7af4732a12c..0be5e7a1b24 100644--- a/modules/meeting/app/components/meetings/index/form_component.html.erb+++ b/modules/meeting/app/components/meetings/index/form_component.html.erb@@ -8,7 +8,7 @@turbo: true,controller: ["show-when-value-selected",- @meeting.is_a?(RecurringMeeting) ? "recurring-meetings--form" : nil+ @meeting.is_a?(RecurringMeeting) ? "recurring-meetings--form meetings--form" : "meetings--form"].compact.join(" "),"application-target": "dynamic"},@@ -43,7 +43,31 @@endmodal_body.with_row(mt: 3) do- render(Meeting::TimeGroup.new(f, meeting: @meeting))+ flex_layout(classes: "FormControl-horizontalGroup") do |time_row|+ time_row.with_column(flex: 1) do+ render(Meeting::StartDate.new(f, meeting: @meeting))+ end++ time_row.with_column(flex_layout: true, flex: 1) do |time_field|+ time_field.with_row do+ render(Meeting::StartTime.new(f, meeting: @meeting))+ end++ time_field.with_row(mt: 1) do+ render(+ Primer::Beta::Text.new(+ id: "meeting-timezone",+ font_size: :small,+ color: :subtle+ )+ ) { timezone_caption }+ end+ end++ time_row.with_column(flex: 1) do+ render(Meeting::Duration.new(f, meeting: @meeting))+ end+ endendif @meeting.is_a?(RecurringMeeting)@@ -55,7 +79,7 @@frequency_row.with_column(flex: 1,- style: "visibility: #{@meeting.frequency_working_days? ? "hidden" : "visible"}",+ style: "visibility: #{@meeting.frequency_working_days? ? 'hidden' : 'visible'}",data: {target_name: "frequency",not_value: "working_days",diff --git a/modules/meeting/app/components/meetings/index/form_component.rb b/modules/meeting/app/components/meetings/index/form_component.rbindex da1d60fdf2f..85780c6c1d9 100644--- a/modules/meeting/app/components/meetings/index/form_component.rb+++ b/modules/meeting/app/components/meetings/index/form_component.rb@@ -66,5 +66,9 @@ module Meetings:updateendend++ def timezone_caption+ friendly_timezone_name(User.current.time_zone, period: @meeting.start_time)+ endendenddiff --git a/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb b/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erbindex 8c48ab823a0..29d74d8c198 100644--- a/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb+++ b/modules/meeting/app/components/meetings/side_panel/details_form_component.html.erb@@ -3,7 +3,11 @@primer_form_with(model: @meeting,method: :put,- data: { turbo: true, turbo_stream: true },+ data: { turbo: true,+ turbo_stream: true,+ controller: "meetings--form",+ "application-target": "dynamic",+ "meetings--form-structured-value": true },url: update_details_project_meeting_path(@project, @meeting)) do |f|component_collection do |collection|@@ -13,8 +17,32 @@render(BaseErrorsComponent.new(@meeting, mb: 3))end- modal_body.with_row(mb: 3) do- render(Meeting::TimeGroup.new(f, meeting: @meeting))+ modal_body.with_row(mt: 3) do+ flex_layout(classes: "FormControl-horizontalGroup") do |time_row|+ time_row.with_column(flex: 1) do+ render(Meeting::StartDate.new(f, meeting: @meeting))+ end++ time_row.with_column(flex_layout: true, flex: 1) do |time_field|+ time_field.with_row do+ render(Meeting::StartTime.new(f, meeting: @meeting))+ end++ time_field.with_row(mt: 1) do+ render(+ Primer::Beta::Text.new(+ id: "meeting-timezone",+ font_size: :small,+ color: :subtle+ )+ ) { timezone_caption }+ end+ end++ time_row.with_column(flex: 1) do+ render(Meeting::Duration.new(f, meeting: @meeting))+ end+ endendmodal_body.with_row dodiff --git a/modules/meeting/app/components/meetings/side_panel/details_form_component.rb b/modules/meeting/app/components/meetings/side_panel/details_form_component.rbindex 3ba4b391928..0a3e5ba1af2 100644--- a/modules/meeting/app/components/meetings/side_panel/details_form_component.rb+++ b/modules/meeting/app/components/meetings/side_panel/details_form_component.rb@@ -53,5 +53,9 @@ module Meetingsdef start_time_initial_valueformat_time(@meeting.start_time, include_date: false, format: "%H:%M")end++ def timezone_caption+ friendly_timezone_name(User.current.time_zone, period: @meeting.start_time)+ endendenddiff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 624dd21bcea..79308caa6d3 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -32,8 +32,8 @@ class MeetingsController < ApplicationControllerbefore_action :determine_date_range, only: %i[history]before_action :determine_author, only: %i[history]- before_action :build_meeting, only: %i[new new_dialog]- before_action :find_meeting, except: %i[index new create new_dialog]+ before_action :build_meeting, only: %i[new new_dialog fetch_timezone]+ before_action :find_meeting, except: %i[index new create new_dialog fetch_timezone]before_action :redirect_to_project, only: %i[show]before_action :set_activity, only: %i[history]before_action :find_copy_from_meeting, only: %i[create]@@ -329,6 +329,21 @@ class MeetingsController < ApplicationControllerredirect_to action: :show, id: @meetingend+ def fetch_timezone+ User.execute_as(User.current) do+ meeting = Meeting.new(timezone_params)+ text = friendly_timezone_name(User.current.time_zone, period: meeting.start_time)++ respond_to do |format|+ format.html { render plain: text }+ format.turbo_stream do+ render turbo_stream: turbo_stream.update("meeting-timezone",+ plain: text)+ end+ end+ end+ end+privatedef load_query@@ -540,4 +555,14 @@ class MeetingsController < ApplicationControllerredirect_to project_meeting_path(@meeting.project, @meeting, tab: params[:tab]), status: :see_otherend++ def timezone_params+ meeting_params = if params[:meeting]+ params.require(:meeting)+ else+ params.require(:structured_meeting)+ end++ meeting_params.permit(:start_date, :start_time_hour).compact_blank+ endenddiff --git a/modules/meeting/app/forms/meeting/duration.rb b/modules/meeting/app/forms/meeting/duration.rbnew file mode 100644index 00000000000..a265d1056eb--- /dev/null+++ b/modules/meeting/app/forms/meeting/duration.rb@@ -0,0 +1,66 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++class Meeting::Duration < ApplicationForm+ form do |meeting_form|+ meeting_form.text_field(+ name: :duration,+ type: :text,+ value: @duration,+ placeholder: Meeting.human_attribute_name(:duration),+ label: Meeting.human_attribute_name(:duration),+ visually_hide_label: false,+ required: true,+ caption: I18n.t("text_in_hours"),+ data: {+ controller: "chronic-duration",+ application_target: "dynamic"+ }+ )+ end++ def initialize(meeting:)+ super()++ @meeting = meeting+ duration = duration_value(meeting)+ @duration = duration.nil? ? "" : ChronicDuration.output(duration * 3600, format: :hours_only)+ end++ private++ def duration_value(meeting)+ if meeting.is_a?(RecurringMeeting) && meeting.template+ meeting.template.duration+ else+ meeting.duration+ end+ end+enddiff --git a/modules/meeting/app/forms/meeting/start_date.rb b/modules/meeting/app/forms/meeting/start_date.rbnew file mode 100644index 00000000000..cc59d37f527--- /dev/null+++ b/modules/meeting/app/forms/meeting/start_date.rb@@ -0,0 +1,53 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++class Meeting::StartDate < ApplicationForm+ form do |meeting_form|+ meeting_form.text_field(+ name: :start_date,+ type: "date",+ value: @initial_date,+ placeholder: @meeting.class.human_attribute_name(:start_date),+ label: @meeting.class.human_attribute_name(:start_date),+ required: true,+ autofocus: false,+ data: {+ action: "input->recurring-meetings--form#updateFrequencyText input->meetings--form#updateTimezoneText"+ }+ )+ end++ def initialize(meeting:)+ super()++ @meeting = meeting+ @initial_date = meeting.start_date.presence || format_time_as_date(meeting.start_time, format: "%Y-%m-%d")+ end+enddiff --git a/modules/meeting/app/forms/meeting/start_time.rb b/modules/meeting/app/forms/meeting/start_time.rbnew file mode 100644index 00000000000..1d57da842d6--- /dev/null+++ b/modules/meeting/app/forms/meeting/start_time.rb@@ -0,0 +1,54 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++class Meeting::StartTime < ApplicationForm+ include Redmine::I18n++ form do |meeting_form|+ meeting_form.text_field(+ name: :start_time_hour,+ type: "time",+ value: @initial_time,+ placeholder: Meeting.human_attribute_name(:start_time),+ label: Meeting.human_attribute_name(:start_time),+ required: true,+ data: {+ action: "input->recurring-meetings--form#updateFrequencyText input->meetings--form#updateTimezoneText"+ }+ )+ end++ def initialize(meeting:)+ super()++ @meeting = meeting+ @initial_time = meeting.start_time_hour.presence || format_time(meeting.start_time, include_date: false, format: "%H:%M")+ end+enddiff --git a/modules/meeting/app/forms/recurring_meeting/frequency.rb b/modules/meeting/app/forms/recurring_meeting/frequency.rbindex 5224b7412ff..40c085a8cfc 100644--- a/modules/meeting/app/forms/recurring_meeting/frequency.rb+++ b/modules/meeting/app/forms/recurring_meeting/frequency.rb@@ -1,4 +1,5 @@# frozen_string_literal: true+#-- copyright# OpenProject is an open source project management software.# Copyright (C) the OpenProject GmbHdiff --git a/modules/meeting/config/routes.rb b/modules/meeting/config/routes.rbindex 5af11e6175b..f2ff0936874 100644--- a/modules/meeting/config/routes.rb+++ b/modules/meeting/config/routes.rb@@ -95,6 +95,7 @@ Rails.application.routes.draw docollection doget :new_dialogget "menu" => "meetings/menus#show"+ get :fetch_timezoneendresources :agenda_items, controller: "meeting_agenda_items" dodiff --git a/modules/meeting/lib/open_project/meeting/engine.rb b/modules/meeting/lib/open_project/meeting/engine.rbindex f6f02fa8a8e..25906f7bf53 100644--- a/modules/meeting/lib/open_project/meeting/engine.rb+++ b/modules/meeting/lib/open_project/meeting/engine.rb@@ -53,7 +53,7 @@ module OpenProject::Meetingpermissible_on: :projectpermission :create_meetings,{- meetings: %i[new create copy new_dialog],+ meetings: %i[new create copy new_dialog fetch_timezone],recurring_meetings: %i[new create copy init template_completed],"recurring_meetings/schedule": %i[update_text],"meetings/menus": %i[show]