From b36c4fdefd3b46f4a11149fa0ea56f6c739cbbcf Mon Sep 17 00:00:00 2001 From: Andrej Date: Tue, 12 Nov 2024 06:25:45 +0100 Subject: [PATCH] Fix generating of double activities [SCI-10644] --- app/controllers/my_module_tags_controller.rb | 24 ++++++++++--------- .../packs/vue/legacy/datetime_picker.js | 1 + 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/controllers/my_module_tags_controller.rb b/app/controllers/my_module_tags_controller.rb index da3e9f754..0e59be185 100644 --- a/app/controllers/my_module_tags_controller.rb +++ b/app/controllers/my_module_tags_controller.rb @@ -57,18 +57,20 @@ class MyModuleTagsController < ApplicationController @mt.created_by = current_user @mt.save - my_module = @mt.my_module + if @mt.valid? + my_module = @mt.my_module - Activities::CreateActivityService - .call(activity_type: :add_task_tag, - owner: current_user, - subject: my_module, - project: my_module.project, - team: my_module.team, - message_items: { - my_module: my_module.id, - tag: @mt.tag.id - }) + Activities::CreateActivityService + .call(activity_type: :add_task_tag, + owner: current_user, + subject: my_module, + project: my_module.project, + team: my_module.team, + message_items: { + my_module: my_module.id, + tag: @mt.tag.id + }) + end redirect_to my_module_tags_edit_path(format: :json), turbolinks: false, status: :see_other end diff --git a/app/javascript/packs/vue/legacy/datetime_picker.js b/app/javascript/packs/vue/legacy/datetime_picker.js index 57f9dabdf..7f1360966 100644 --- a/app/javascript/packs/vue/legacy/datetime_picker.js +++ b/app/javascript/packs/vue/legacy/datetime_picker.js @@ -67,6 +67,7 @@ window.initDateTimePickerComponent = (id) => { }, clearDate() { this.date = null; + this.$refs.vueDateTime.manualUpdate = true; this.$refs.vueDateTime.datetime = null; this.$nextTick(() => { if (this.onChange) this.onChange(null);