From 6cfa07147157762b3810b39f81388df6e9f4a153 Mon Sep 17 00:00:00 2001 From: Inga Mai Date: Thu, 24 Sep 2020 13:57:08 +0200 Subject: [PATCH 01/11] Fix columns after resize and not only on init --- .../wp-attribute-group.component.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/components/wp-form-group/wp-attribute-group.component.ts b/frontend/src/app/components/wp-form-group/wp-attribute-group.component.ts index 91d72650cc..9f751116f7 100644 --- a/frontend/src/app/components/wp-form-group/wp-attribute-group.component.ts +++ b/frontend/src/app/components/wp-form-group/wp-attribute-group.component.ts @@ -31,22 +31,36 @@ import {I18nService} from 'core-app/modules/common/i18n/i18n.service'; import {FieldDescriptor, GroupDescriptor} from 'core-components/work-packages/wp-single-view/wp-single-view.component'; import {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-resource'; import {EditFormComponent} from "core-app/modules/fields/edit/edit-form/edit-form.component"; +import {UntilDestroyedMixin} from "core-app/helpers/angular/until-destroyed.mixin"; +import {fromEvent} from "rxjs"; +import {debounceTime} from "rxjs/operators"; @Component({ selector: 'wp-attribute-group', templateUrl: './wp-attribute-group.template.html' }) -export class WorkPackageFormAttributeGroupComponent implements AfterViewInit { +export class WorkPackageFormAttributeGroupComponent extends UntilDestroyedMixin implements AfterViewInit { @Input() public workPackage:WorkPackageResource; @Input() public group:GroupDescriptor; constructor(readonly I18n:I18nService, public wpEditForm:EditFormComponent, protected injector:Injector) { + super(); } ngAfterViewInit() { setTimeout(() => this.fixColumns()); + + // Listen to resize event and fix column start again + fromEvent(window, 'resize', { passive: true }) + .pipe( + this.untilDestroyed(), + debounceTime(250) + ) + .subscribe(() => { + this.fixColumns(); + }); } public trackByName(_index:number, elem:{ name:string }) { From 50165236dcedf9f89e7ff79571b8316a6f17ae9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 24 Sep 2020 15:37:51 +0200 Subject: [PATCH 02/11] [34433] Detect changes after catching errors on the form https://community.openproject.com/wp/34433 --- .../src/app/modules/time_entries/shared/modal/base.modal.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/modules/time_entries/shared/modal/base.modal.ts b/frontend/src/app/modules/time_entries/shared/modal/base.modal.ts index b0183b82eb..d81ccceff8 100644 --- a/frontend/src/app/modules/time_entries/shared/modal/base.modal.ts +++ b/frontend/src/app/modules/time_entries/shared/modal/base.modal.ts @@ -53,7 +53,10 @@ export abstract class TimeEntryBaseModal extends OpModalComponent { this.editForm.save() .then(() => this.reloadWorkPackageAndClose()) - .catch(() => this.formInFlight = false); + .catch(() => { + this.formInFlight = false; + this.cdRef.detectChanges(); + }); } public get saveText() { @@ -79,5 +82,6 @@ export abstract class TimeEntryBaseModal extends OpModalComponent { } this.service.close(); this.formInFlight = false; + this.cdRef.detectChanges(); } } From 31e85158813ab030a16e0d5b4bd8f26fb8dd6651 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Thu, 24 Sep 2020 12:22:19 +0000 Subject: [PATCH 03/11] Switch to workflow_dispatch event for Core/CD --- .github/workflows/continuous-delivery.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 0259cbf0f8..58364b18ad 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -1,18 +1,21 @@ -name: CD +name: Core/CD on: push: branches: - dev - release/* jobs: - trigger_downstream_merge: + trigger_downstream_workflow: if: github.repository == 'opf/openproject' runs-on: ubuntu-latest steps: - - name: Trigger downstream merge - uses: peter-evans/repository-dispatch@v1 - with: - repository: opf/saas-openproject - token: ${{ secrets.GH_OAUTH_TOKEN }} - event-type: trigger_downstream_merge - client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "repository": "${{ github.repository }}"}' + - name: Trigger downstream workflow + env: + TOKEN: ${{ secrets.OPENPROJECT_CI_TOKEN }} + SAAS_CD_WORKFLOW_ID: 2625552 + SAAS_REPOSITORY: opf/saas-openproject + run: | + curl -H"authorization: Bearer $TOKEN" \ + -XPOST -H"Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/$SAAS_REPOSITORY/actions/workflows/$SAAS_CD_WORKFLOW_ID/dispatches \ + -d '{"ref": "${{ github.ref }}"}' From dabfc91ec54cb91bcebf27f56fa43b5392772d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 24 Sep 2020 15:48:16 +0200 Subject: [PATCH 04/11] [34441][34425] Fix color variables used in scss foundation `$secondary-color` and `$grey-dark` were used in some places and those variables are no longer defined. For $secondary-color, we need to define scss variable since that style comes from foundation https://community.openproject.com/wp/34441 https://community.openproject.com/wp/34425 --- frontend/src/global_styles/content/_icon_control.sass | 4 ++-- frontend/src/global_styles/content/_list.sass | 4 ++-- frontend/src/global_styles/content/_news.sass | 2 +- .../src/global_styles/content/_types_form_configuration.sass | 2 +- frontend/src/global_styles/content/_user_mention.sass | 2 +- frontend/src/global_styles/content/editor/_macros.sass | 2 +- .../global_styles/content/work_packages/_table_content.sass | 2 +- .../content/work_packages/single_view/_attachments.sass | 2 +- frontend/src/global_styles/openproject/_scm.sass | 2 +- frontend/src/global_styles/openproject/_settings.scss | 2 +- frontend/src/global_styles/openproject/_variables.scss | 4 ++++ 11 files changed, 16 insertions(+), 12 deletions(-) diff --git a/frontend/src/global_styles/content/_icon_control.sass b/frontend/src/global_styles/content/_icon_control.sass index f712e0d309..a5c9fef2ba 100644 --- a/frontend/src/global_styles/content/_icon_control.sass +++ b/frontend/src/global_styles/content/_icon_control.sass @@ -36,7 +36,7 @@ text-align: center cursor: pointer border-radius: 50% - color: $gray-dark + color: var(--gray-dark) &:hover, &.-active text-decoration: none @@ -44,7 +44,7 @@ background: var(--button--highlight-background-color) &.-active:hover - color: $gray-dark + color: var(--gray-dark) background: white .icon-control--icon diff --git a/frontend/src/global_styles/content/_list.sass b/frontend/src/global_styles/content/_list.sass index 7a9530de7b..2d4101c25c 100644 --- a/frontend/src/global_styles/content/_list.sass +++ b/frontend/src/global_styles/content/_list.sass @@ -42,11 +42,11 @@ .me .time - border-bottom: 1px solid $gray-dark + border-bottom: 1px solid var(--gray-dark) .time, .description - color: $gray-dark + color: var(--gray-dark) .time, .description, diff --git a/frontend/src/global_styles/content/_news.sass b/frontend/src/global_styles/content/_news.sass index 12ad1c6a06..c8e626b976 100644 --- a/frontend/src/global_styles/content/_news.sass +++ b/frontend/src/global_styles/content/_news.sass @@ -38,7 +38,7 @@ .news-author font-size: 0.8rem - color: $gray-dark + color: var(--gray-dark) display: block padding: 5px 0 5px 40px line-height: 1.25 diff --git a/frontend/src/global_styles/content/_types_form_configuration.sass b/frontend/src/global_styles/content/_types_form_configuration.sass index 2fcdeaa4be..1f662d230b 100644 --- a/frontend/src/global_styles/content/_types_form_configuration.sass +++ b/frontend/src/global_styles/content/_types_form_configuration.sass @@ -47,7 +47,7 @@ #type-form-conf-inactive-group - background: $gray-dark + background: var(--gray-dark) .visibility-check, .delete-group, .delete-attribute diff --git a/frontend/src/global_styles/content/_user_mention.sass b/frontend/src/global_styles/content/_user_mention.sass index 189670c275..8c354d0c2e 100644 --- a/frontend/src/global_styles/content/_user_mention.sass +++ b/frontend/src/global_styles/content/_user_mention.sass @@ -34,7 +34,7 @@ &:before content: '@' - color: $gray-dark + color: var(--gray-dark) span.user-mention // Remove text selection cursor for group diff --git a/frontend/src/global_styles/content/editor/_macros.sass b/frontend/src/global_styles/content/editor/_macros.sass index 0224326588..c6247d3716 100644 --- a/frontend/src/global_styles/content/editor/_macros.sass +++ b/frontend/src/global_styles/content/editor/_macros.sass @@ -17,7 +17,7 @@ macro.macro-placeholder .macro-value font-style: italic - color: $gray-dark + color: var(--gray-dark) // Unavailable macros macro.macro-unavailable diff --git a/frontend/src/global_styles/content/work_packages/_table_content.sass b/frontend/src/global_styles/content/work_packages/_table_content.sass index 40ea25158d..3bd9246d8b 100644 --- a/frontend/src/global_styles/content/work_packages/_table_content.sass +++ b/frontend/src/global_styles/content/work_packages/_table_content.sass @@ -117,7 +117,7 @@ html:not(.-browser-mobile) color: var(--content-link-color) padding: 0 0 0 0.25rem &.-disabled .icon:before - color: $gray-dark + color: var(--gray-dark) &:hover text-decoration: none diff --git a/frontend/src/global_styles/content/work_packages/single_view/_attachments.sass b/frontend/src/global_styles/content/work_packages/single_view/_attachments.sass index 5b8efc0274..d7d4995030 100644 --- a/frontend/src/global_styles/content/work_packages/single_view/_attachments.sass +++ b/frontend/src/global_styles/content/work_packages/single_view/_attachments.sass @@ -72,7 +72,7 @@ label cursor: pointer - color: $gray-dark + color: var(--gray-dark) font-size: 0.9rem font-weight: bold line-height: 1.4 diff --git a/frontend/src/global_styles/openproject/_scm.sass b/frontend/src/global_styles/openproject/_scm.sass index 036ffd3732..331209b40b 100644 --- a/frontend/src/global_styles/openproject/_scm.sass +++ b/frontend/src/global_styles/openproject/_scm.sass @@ -92,7 +92,7 @@ li.change &::before content: '▸' - color: $gray-dark + color: var(--gray-dark) table.filecontent border: 1px solid #ccc diff --git a/frontend/src/global_styles/openproject/_settings.scss b/frontend/src/global_styles/openproject/_settings.scss index 9d4f132cf7..43bd9b96df 100644 --- a/frontend/src/global_styles/openproject/_settings.scss +++ b/frontend/src/global_styles/openproject/_settings.scss @@ -612,4 +612,4 @@ $label-color: var(--gray-dark); // left: 'left', // right: 'right', // title: 'title', -// ); +// ); \ No newline at end of file diff --git a/frontend/src/global_styles/openproject/_variables.scss b/frontend/src/global_styles/openproject/_variables.scss index eaecc09c06..ca4e5326b3 100644 --- a/frontend/src/global_styles/openproject/_variables.scss +++ b/frontend/src/global_styles/openproject/_variables.scss @@ -210,3 +210,7 @@ --work-package-details--tab-height: 40px; --warn:#C92A2A; } + +// SCSS variables needed for foundation, but that are set in css variables now only +// which cannot be set to sass unfortunately +$secondary-color: #bfbfbf; From 63ac61a67b98f68b24fe12cb642d326e39c04d89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 24 Sep 2020 15:57:03 +0200 Subject: [PATCH 05/11] [34439] Add meeting styles They were missing from the global styles definition after moving to the frontend. https://community.openproject.com/wp/34439 --- frontend/src/global_styles/content/modules/_index.sass | 1 + frontend/src/global_styles/content/modules/_meetings.scss | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/global_styles/content/modules/_index.sass b/frontend/src/global_styles/content/modules/_index.sass index ec4a9a3f1f..da34a6e3b9 100644 --- a/frontend/src/global_styles/content/modules/_index.sass +++ b/frontend/src/global_styles/content/modules/_index.sass @@ -7,3 +7,4 @@ @import 'documents' @import '2fa' @import 'webhooks' +@import 'meetings' diff --git a/frontend/src/global_styles/content/modules/_meetings.scss b/frontend/src/global_styles/content/modules/_meetings.scss index 5542f435c1..f3d7779fbe 100644 --- a/frontend/src/global_styles/content/modules/_meetings.scss +++ b/frontend/src/global_styles/content/modules/_meetings.scss @@ -39,8 +39,8 @@ dl.meetings { margin-bottom: 2em; } -dt.meeting { - margin-bottom: 1.5em; +dd.meeting { + margin-bottom: 2rem; } dl.meetings p { From 594de6078c76617eabdc57722d0572d32d7bb075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 24 Sep 2020 16:08:38 +0200 Subject: [PATCH 06/11] [34438] Fix missing import for sass-helper in backlogs The `rem-calc` function was not found, and sass just doesn't complain but outputs it incorrectly as is :-( https://community.openproject.com/wp/34438 --- frontend/src/global_styles/openproject/_functions.sass | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/global_styles/openproject/_functions.sass b/frontend/src/global_styles/openproject/_functions.sass index fff0644d7b..021021714d 100644 --- a/frontend/src/global_styles/openproject/_functions.sass +++ b/frontend/src/global_styles/openproject/_functions.sass @@ -26,6 +26,8 @@ // See docs/COPYRIGHT.rdoc for more details. //++ +@import "../vendor/foundation-apps/scss/helpers/functions" + @function rem-concat-list($list-of-pixels) $result: '' @each $pixel-val in $list-of-pixels From a842f44bda9c8788dfefcb2490a290c068877f63 Mon Sep 17 00:00:00 2001 From: ulferts Date: Fri, 25 Sep 2020 06:08:10 +0200 Subject: [PATCH 07/11] [22048] Destroy journals after destroying journalized * clenaup journal data upon aaj model removal * remove unused methods * simplify aaj options handling * delete orphaned journaled data via migration Existing instances might already have journal data for which the journal itself is deleted. This migration removes them. --- app/models/journal.rb | 21 +++----- app/services/journals/create_service.rb | 2 +- ...924085508_cleanup_orphaned_journal_data.rb | 37 +++++++++++++ .../lib/acts/journalized/creation.rb | 23 -------- .../lib/acts/journalized/options.rb | 53 +++++-------------- .../lib/acts_as_journalized.rb | 4 +- .../tabs/activity_revisions_spec.rb | 2 +- .../work_packages/tabs/activity_tab_spec.rb | 2 +- .../work_package_acts_as_journalized_spec.rb | 46 ++++++++++++++++ 9 files changed, 107 insertions(+), 83 deletions(-) create mode 100644 db/migrate/20200924085508_cleanup_orphaned_journal_data.rb diff --git a/app/models/journal.rb b/app/models/journal.rb index fc601268d5..bc40008b19 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -48,21 +48,12 @@ class Journal < ApplicationRecord has_many :attachable_journals, class_name: 'Journal::AttachableJournal', dependent: :destroy has_many :customizable_journals, class_name: 'Journal::CustomizableJournal', dependent: :destroy + before_destroy :destroy_data + # Scopes to all journals excluding the initial journal - useful for change # logs like the history on issue#show scope :changing, -> { where(['version > 1']) } - # TODO: check if this can be removed - # Overrides the +user=+ method created by the polymorphic +belongs_to+ user association. - # Based on the class of the object given, either the +user+ association columns or the - # +user_name+ string column is populated. - def user=(value) - case value - when ActiveRecord::Base then super(value) - else self.user = User.find_by_login(value) - end - end - # In conjunction with the included Comparable module, allows comparison of journal records # based on their corresponding version numbers, creation timestamps and IDs. def <=>(other) @@ -120,6 +111,10 @@ class Journal < ApplicationRecord private + def destroy_data + data.destroy + end + def predecessor @predecessor ||= self.class .where(journable_type: journable_type, journable_id: journable_id) @@ -127,8 +122,4 @@ class Journal < ApplicationRecord .order("#{self.class.table_name}.version DESC") .first end - - def journalized_object_type - "#{journaled_type.gsub('Journal', '')}".constantize - end end diff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rb index 1e1086c9c9..9a5e992683 100644 --- a/app/services/journals/create_service.rb +++ b/app/services/journals/create_service.rb @@ -385,7 +385,7 @@ module Journals end def journable_data_sql_addition - journable.class.vestal_journals_options[:data_sql]&.call(journable) || '' + journable.class.aaj_options[:data_sql]&.call(journable) || '' end def text_column_names diff --git a/db/migrate/20200924085508_cleanup_orphaned_journal_data.rb b/db/migrate/20200924085508_cleanup_orphaned_journal_data.rb new file mode 100644 index 0000000000..22d887d6ba --- /dev/null +++ b/db/migrate/20200924085508_cleanup_orphaned_journal_data.rb @@ -0,0 +1,37 @@ +class CleanupOrphanedJournalData < ActiveRecord::Migration[6.0] + def up + cleanup_orphaned_journals('attachable_journals') + cleanup_orphaned_journals('customizable_journals') + cleanup_orphaned_journals('attachment_journals') + cleanup_orphaned_journals('changeset_journals') + cleanup_orphaned_journals('message_journals') + cleanup_orphaned_journals('news_journals') + cleanup_orphaned_journals('wiki_content_journals') + cleanup_orphaned_journals('work_package_journals') + end + + # No down needed as this only cleans up data that should have been deleted anyway. + + private + + def cleanup_orphaned_journals(table) + execute <<~SQL + DELETE + FROM + #{table} + WHERE + #{table}.id IN ( + SELECT + #{table}.id + FROM + #{table} + LEFT OUTER JOIN + journals + ON + journals.id = #{table}.journal_id + WHERE + journals.id IS NULL + ) + SQL + end +end diff --git a/lib/plugins/acts_as_journalized/lib/acts/journalized/creation.rb b/lib/plugins/acts_as_journalized/lib/acts/journalized/creation.rb index 4abc754eb0..ac7e9b5917 100644 --- a/lib/plugins/acts_as_journalized/lib/acts/journalized/creation.rb +++ b/lib/plugins/acts_as_journalized/lib/acts/journalized/creation.rb @@ -79,29 +79,6 @@ module Acts::Journalized end end - # Class methods added to ActiveRecord::Base to facilitate the creation of new journals. - module ClassMethods - # Overrides the basal +prepare_journaled_options+ method defined in VestalVersions::Options - # to extract the :calculate option into +vestal_journals_options+. - def prepare_journaled_options(options) - result = super(options) - - assign_vestal = lambda do |key, array| - return unless result[key] - - vestal_journals_options[key] = if array - Array(result.delete(key)).map(&:to_s).uniq - else - result.delete(key) - end - end - - assign_vestal.call(:data_sql, false) - - result - end - end - module InstanceMethods # Returns an array of column names that are journaled. def journaled_columns_names diff --git a/lib/plugins/acts_as_journalized/lib/acts/journalized/options.rb b/lib/plugins/acts_as_journalized/lib/acts/journalized/options.rb index 01c143ec12..6d6c25cc38 100644 --- a/lib/plugins/acts_as_journalized/lib/acts/journalized/options.rb +++ b/lib/plugins/acts_as_journalized/lib/acts/journalized/options.rb @@ -85,55 +85,28 @@ module Acts::Journalized # 1. Those passed directly to the +journaled+ method # 2. Those specified in an initializer +configure+ block # 3. Default values specified in +prepare_journaled_options+ - # - # The method is overridden in feature modules that require specific options outside the - # standard +has_many+ associations. def prepare_journaled_options(options) - result_options = options_with_defaults(options) - - class_attribute :vestal_journals_options - self.vestal_journals_options = result_options.dup - - result_options.merge!( - extend: Array(result_options[:extend]).unshift(Versions) - ) - - result_options + class_attribute :aaj_options + self.aaj_options = options_with_defaults(options) end private - def options_with_defaults(options) - journal_options = split_option_hashes(options) + # Returns all of the provided options suitable for the + # has_many :journals + # association created by aaj + def has_many_journals_options + aaj_options + .slice(*ActiveRecord::Associations::Builder::HasMany.send(:valid_options, {})) + end - result_options = journal_options.symbolize_keys - result_options.reverse_merge!( + def options_with_defaults(options) + { class_name: Journal.name, - dependent: :delete_all, + dependent: :destroy, foreign_key: :journable_id, as: :journable - ) - - result_options - end - - # Splits an option has into three hashes: - ## => [{ options prefixed with "activity_" }, { options prefixed with "event_" }, { other options }] - def split_option_hashes(options) - journal_hash = {} - - options.each_pair do |k, v| - case k.to_s - when /\Aactivity_(.+)\z/ - raise "Configuring activity via acts_as_journalized is no longer supported." - when /\Aevent_(.+)\z/ - raise "Configuring events via acts_as_journalized is no longer supported." - else - journal_hash[k.to_sym] = v - end - end - - journal_hash + }.merge(options.symbolize_keys) end end end diff --git a/lib/plugins/acts_as_journalized/lib/acts_as_journalized.rb b/lib/plugins/acts_as_journalized/lib/acts_as_journalized.rb index cb0578675b..7f0a0650e4 100644 --- a/lib/plugins/acts_as_journalized/lib/acts_as_journalized.rb +++ b/lib/plugins/acts_as_journalized/lib/acts_as_journalized.rb @@ -73,11 +73,11 @@ module Acts include_aaj_modules - journal_hash = prepare_journaled_options(options) + prepare_journaled_options(options) has_many :journals, -> { order("#{Journal.table_name}.version ASC") - }, **journal_hash + }, **has_many_journals_options end private diff --git a/spec/features/work_packages/tabs/activity_revisions_spec.rb b/spec/features/work_packages/tabs/activity_revisions_spec.rb index 8cbd3c21bf..9290f391a1 100644 --- a/spec/features/work_packages/tabs/activity_revisions_spec.rb +++ b/spec/features/work_packages/tabs/activity_revisions_spec.rb @@ -8,7 +8,7 @@ describe 'Activity tab', js: true, selenium: true do work_package.update(attributes.merge(updated_at: at)) note_journal = work_package.journals.last - note_journal.update(created_at: at, user: attributes[:user]) + note_journal.update(created_at: at, user: user) end let(:project) { FactoryBot.create :project_with_types, public: true } diff --git a/spec/features/work_packages/tabs/activity_tab_spec.rb b/spec/features/work_packages/tabs/activity_tab_spec.rb index c25713c1a7..14bc26acc6 100644 --- a/spec/features/work_packages/tabs/activity_tab_spec.rb +++ b/spec/features/work_packages/tabs/activity_tab_spec.rb @@ -8,7 +8,7 @@ describe 'Activity tab', js: true, selenium: true do work_package.update(attributes.merge(updated_at: at)) note_journal = work_package.journals.last - note_journal.update(created_at: at, user: attributes[:user]) + note_journal.update(created_at: at, user: user) end let(:project) { FactoryBot.create :project_with_types, public: true } diff --git a/spec/models/work_package/work_package_acts_as_journalized_spec.rb b/spec/models/work_package/work_package_acts_as_journalized_spec.rb index bd5e4c27bd..b06a1d6204 100644 --- a/spec/models/work_package/work_package_acts_as_journalized_spec.rb +++ b/spec/models/work_package/work_package_acts_as_journalized_spec.rb @@ -458,6 +458,52 @@ describe WorkPackage, type: :model do end end + context 'on #destroy' do + let(:project) { FactoryBot.create(:project) } + let(:type) { FactoryBot.create(:type) } + let(:custom_field) do + FactoryBot.create(:int_wp_custom_field).tap do |cf| + project.work_package_custom_fields << cf + type.custom_fields << cf + end + end + let(:work_package) do + FactoryBot.create(:work_package, + project: project, + type: type, + custom_field_values: { custom_field.id => 5 }, + attachments: [attachment]) + end + let(:attachment) { FactoryBot.build(:attachment) } + let!(:journal) { work_package.journals.first } + let!(:customizable_journals) { journal.customizable_journals } + let!(:attachable_journals) { journal.attachable_journals } + + before do + work_package.destroy + end + + it 'removes the journal' do + expect(Journal.find_by(id: journal.id)) + .to be_nil + end + + it 'removes the journal data' do + expect(Journal::WorkPackageJournal.find_by(journal_id: journal.id)) + .to be_nil + end + + it 'removes the customizable journals' do + expect(Journal::CustomizableJournal.find_by(id: customizable_journals.map(&:id))) + .to be_nil + end + + it 'removes the attachable journals' do + expect(Journal::AttachableJournal.find_by(id: attachable_journals.map(&:id))) + .to be_nil + end + end + describe 'Acts as journalized' do before(:each) do @type ||= FactoryBot.create(:type_feature) From 77b891f19cac89f6412a2fabc39a27e634ae638b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 25 Sep 2020 06:46:55 +0200 Subject: [PATCH 08/11] [34529] Change breakpoints for logo for longer displaying smaller version [ci skip] https://community.openproject.com/wp/34529 --- frontend/src/global_styles/layout/_top_menu.sass | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/global_styles/layout/_top_menu.sass b/frontend/src/global_styles/layout/_top_menu.sass index 83e7fe6e0d..386263837a 100644 --- a/frontend/src/global_styles/layout/_top_menu.sass +++ b/frontend/src/global_styles/layout/_top_menu.sass @@ -253,10 +253,11 @@ $hamburger-width: 50px .nosidebar & display: none -@media only screen and (max-width: 18.75rem) +@media only screen and (max-width: 750px) #logo - max-width: 170px + display: none + -@media only screen and (max-width: 1210px) +@media only screen and (max-width: 1000px) #logo - display: none + max-width: 100px From 6ca489bcfd64d263ebb0008ec0eaf0ad98946396 Mon Sep 17 00:00:00 2001 From: bsatarnejad Date: Thu, 24 Sep 2020 14:43:56 +0200 Subject: [PATCH 09/11] make WP ids aligned --- .../input/global-search-input.component.sass | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/modules/global_search/input/global-search-input.component.sass b/frontend/src/app/modules/global_search/input/global-search-input.component.sass index b027369b04..0a8c77a234 100644 --- a/frontend/src/app/modules/global_search/input/global-search-input.component.sass +++ b/frontend/src/app/modules/global_search/input/global-search-input.component.sass @@ -148,11 +148,8 @@ $search-input-height: 30px .global-search--wp-content display: grid - grid-template-columns: auto 1fr auto - grid-template-rows: auto auto auto 1fr auto + grid-template-columns: 50% 1fr auto grid-template-areas: "project idlink status" - overflow: hidden - flex-grow: 1 font-size: 0.8rem padding: 5px 0 5px 0px @@ -162,12 +159,11 @@ $search-input-height: 30px .global-search--wp-id grid-area: idlink - place-self: center + place-self: right font-style: italic .global-search--wp-status grid-area: status - margin-right: 5px overflow: hidden font-style: italic From 881ff6e7f8053548ddecf7b780cb4baea0d30fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Fri, 25 Sep 2020 07:18:12 +0200 Subject: [PATCH 10/11] [34380] Restrict height of date field filters and correct x icon `visibility: hidden` doesn't remove the height of the element, which for date causes many elements to be still causing the DOM height. Setting it to `display: none` will however remove it from the grid calculation.. Setting the height to 0 caused a scrollbar to appear [ci skip] https://community.openproject.com/wp/34380 --- app/views/projects/filters/_boolean.html.erb | 1 + frontend/src/global_styles/content/_projects_list.sass | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/projects/filters/_boolean.html.erb b/app/views/projects/filters/_boolean.html.erb index 68b69d0e99..803ff54509 100644 --- a/app/views/projects/filters/_boolean.html.erb +++ b/app/views/projects/filters/_boolean.html.erb @@ -3,3 +3,4 @@ data-input-name="v-<%= filter.class.key %>" data-filter-name="boolean"> + diff --git a/frontend/src/global_styles/content/_projects_list.sass b/frontend/src/global_styles/content/_projects_list.sass index 40be9eee1a..868a9d47c8 100644 --- a/frontend/src/global_styles/content/_projects_list.sass +++ b/frontend/src/global_styles/content/_projects_list.sass @@ -47,6 +47,7 @@ form.project-filters // visibility based on operator type &.hidden visibility: hidden + height: 55px // visibility for list value selectors .multi-select From 388894237262146c33ccd6eb3140a394b29f1388 Mon Sep 17 00:00:00 2001 From: Aleix Suau Date: Thu, 24 Sep 2020 16:47:45 +0200 Subject: [PATCH 11/11] Removed duplicated 't' param on the static gantt query --- .../components/wp-query-select/wp-static-queries.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/wp-query-select/wp-static-queries.service.ts b/frontend/src/app/components/wp-query-select/wp-static-queries.service.ts index 2784fb2397..5705acf069 100644 --- a/frontend/src/app/components/wp-query-select/wp-static-queries.service.ts +++ b/frontend/src/app/components/wp-query-select/wp-static-queries.service.ts @@ -77,7 +77,7 @@ export class WorkPackageStaticQueriesService { { identifier: 'gantt', label: this.text.gantt, - query_props: `{"c":["id","type","subject","status","startDate","dueDate"],"tv":true,"tzl":"auto","tll":"{\\"left\\":\\"startDate\\",\\"right\\":\\"dueDate\\",\\"farRight\\":null}","hi":true,"g":"","t":"id:asc","t":"startDate:asc","f":[{"n":"status","o":"o","v":[]}]}` + query_props: `{"c":["id","type","subject","status","startDate","dueDate"],"tv":true,"tzl":"auto","tll":"{\\"left\\":\\"startDate\\",\\"right\\":\\"dueDate\\",\\"farRight\\":null}","hi":true,"g":"","t":"startDate:asc","f":[{"n":"status","o":"o","v":[]}]}` }, { identifier: 'recently_created', @@ -118,9 +118,10 @@ export class WorkPackageStaticQueriesService { let queryProps = JSON.parse(this.$state.params.query_props); delete queryProps.pp; delete queryProps.pa; + let queryPropsString = JSON.stringify(queryProps); const matched = _.find(this.all, item => - item.query_props && item.query_props === JSON.stringify(queryProps) + item.query_props && item.query_props === queryPropsString ); if (matched) {