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
Remove attachment_filters guarded action
Oliver Günther0dd690b1b945
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rbindex 535c97fe79d..6a18ef676df 100644--- a/app/helpers/search_helper.rb+++ b/app/helpers/search_helper.rb@@ -135,7 +135,7 @@ module SearchHelperenddef only_if_tsv_supported(event)- if EnterpriseToken.allows_to?(:attachment_filters) && OpenProject::Database.allows_tsv? && event.respond_to?(:attachments)+ if OpenProject::Database.allows_tsv? && event.respond_to?(:attachments)yieldendenddiff --git a/app/models/queries/work_packages/filter/attachment_base_filter.rb b/app/models/queries/work_packages/filter/attachment_base_filter.rbindex 0cab831ff81..322d0f0b3ab 100644--- a/app/models/queries/work_packages/filter/attachment_base_filter.rb+++ b/app/models/queries/work_packages/filter/attachment_base_filter.rb@@ -34,7 +34,7 @@ class Queries::WorkPackages::Filter::AttachmentBaseFilter < Queries::WorkPackageenddef available?- EnterpriseToken.allows_to?(:attachment_filters) && OpenProject::Database.allows_tsv?+ OpenProject::Database.allows_tsv?endprotecteddiff --git a/app/models/queries/work_packages/filter/search_filter.rb b/app/models/queries/work_packages/filter/search_filter.rbindex cc7287cf09f..b9b7b10dae9 100644--- a/app/models/queries/work_packages/filter/search_filter.rb+++ b/app/models/queries/work_packages/filter/search_filter.rb@@ -108,6 +108,6 @@ class Queries::WorkPackages::Filter::SearchFilter <privatedef attachment_filters_allowed?- EnterpriseToken.allows_to?(:attachment_filters) && OpenProject::Database.allows_tsv?+ OpenProject::Database.allows_tsv?endenddiff --git a/app/services/authorization/enterprise_service.rb b/app/services/authorization/enterprise_service.rbindex 0fd21a9130d..8f032b95013 100644--- a/app/services/authorization/enterprise_service.rb+++ b/app/services/authorization/enterprise_service.rb@@ -30,7 +30,6 @@ class Authorization::EnterpriseServiceattr_accessor :tokenGUARDED_ACTIONS = %i(- attachment_filtersattribute_help_textsboard_viewconditional_highlightingdiff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 0ef6a5c03fd..7a706e5f703 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -323,8 +323,6 @@ en:one: "First sorting criteria"two: "Second sorting criteria"three: "Third sorting criteria"- upsale_for_more: "Advanced filters allow you to also filter for file names and content of work package attachments. Please upgrade to a paid plan to use this add-on."- upsale_link: 'Enterprise edition.'general_text_no: "no"general_text_yes: "yes"general_text_No: "No"diff --git a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.html b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.htmlindex 3b0e06846bf..4ce320beaf6 100644--- a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.html+++ b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.html@@ -70,11 +70,4 @@</div></li></ul>- <op-enterprise-banner class="advanced-filters--add-filter-info"- *ngIf="eeShowBanners"- [linkMessage]="text.upsale_link"- [textMessage]="text.upsale_for_more"- [moreInfoLink]="text.more_info_link"- opReferrer="wp-filter#filters">- </op-enterprise-banner></fieldset>diff --git a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.tsindex 2ffea9fb3dc..89f182ab7de 100644--- a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts+++ b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts@@ -27,12 +27,16 @@//++import {- ChangeDetectionStrategy, Component, Input, OnChanges, OnInit, Output, ViewChild,+ ChangeDetectionStrategy,+ Component,+ Input,+ OnChanges,+ Output,+ ViewChild,} from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';import { DebouncedEventEmitter } from 'core-app/shared/helpers/rxjs/debounced-event-emitter';import { trackByName } from 'core-app/shared/helpers/angular/tracking-functions';-import { BannersService } from 'core-app/core/enterprise/banners.service';import { NgSelectComponent } from '@ng-select/ng-select';import { WorkPackageViewFiltersService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-filters.service';import { WorkPackageFiltersService } from 'core-app/features/work-packages/components/filters/wp-filters/wp-filters.service';@@ -40,7 +44,6 @@ import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destrimport { componentDestroyed } from '@w11k/ngx-componentdestroyed';import { QueryFilterInstanceResource } from 'core-app/features/hal/resources/query-filter-instance-resource';import { QueryFilterResource } from 'core-app/features/hal/resources/query-filter-resource';-import { enterpriseDocsUrl } from 'core-app/core/setup/globals/constants.const';const ADD_FILTER_SELECT_INDEX = -1;@@ -49,7 +52,7 @@ const ADD_FILTER_SELECT_INDEX = -1;changeDetection: ChangeDetectionStrategy.OnPush,templateUrl: './query-filters.component.html',})-export class QueryFiltersComponent extends UntilDestroyedMixin implements OnInit, OnChanges {+export class QueryFiltersComponent extends UntilDestroyedMixin implements OnChanges {@ViewChild(NgSelectComponent) public ngSelectComponent:NgSelectComponent;@Input() public filters:QueryFilterInstanceResource[];@@ -63,8 +66,6 @@ export class QueryFiltersComponent extends UntilDestroyedMixin implements OnInitpublic remainingFilters:any[] = [];- public eeShowBanners = false;-public focusElementIndex = 0;public trackByName = trackByName;@@ -73,9 +74,6 @@ export class QueryFiltersComponent extends UntilDestroyedMixin implements OnInitopen_filter: this.I18n.t('js.filter.description.text_open_filter'),label_filter_add: this.I18n.t('js.work_packages.label_filter_add'),close_filter: this.I18n.t('js.filter.description.text_close_filter'),- upsale_for_more: this.I18n.t('js.filter.upsale_for_more'),- upsale_link: this.I18n.t('js.filter.upsale_link'),- more_info_link: enterpriseDocsUrl.website,close_form: this.I18n.t('js.close_form_title'),selected_filter_list: this.I18n.t('js.label_selected_filter_list'),button_delete: this.I18n.t('js.button_delete'),@@ -86,14 +84,10 @@ export class QueryFiltersComponent extends UntilDestroyedMixin implements OnInitconstructor(readonly wpTableFilters:WorkPackageViewFiltersService,readonly wpFiltersService:WorkPackageFiltersService,readonly I18n:I18nService,- readonly bannerService:BannersService) {+ ) {super();}- ngOnInit() {- this.eeShowBanners = this.bannerService.eeShowBanners;- }-ngOnChanges() {this.updateRemainingFilters();}diff --git a/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb b/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rbindex 2d34db4c623..60f79d2e721 100644--- a/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb+++ b/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb@@ -94,7 +94,7 @@ module Redminetoken_clauses = columns.map { |column| "(LOWER(#{column}) LIKE ?)" }- if EnterpriseToken.allows_to?(:attachment_filters) && OpenProject::Database.allows_tsv?+ if OpenProject::Database.allows_tsv?tsv_clauses = tsv_columns.map do |tsv_column|OpenProject::FullTextSearch.tsv_where(tsv_column[:table_name],tsv_column[:column_name],diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rbindex 02f1926b52f..27c5f165896 100644--- a/spec/features/search_spec.rb+++ b/spec/features/search_spec.rb@@ -362,8 +362,6 @@ describe 'Search', js: true, with_settings: { per_page_options: '5' }, with_maillet(:attachment_text) { "A text with the #{query} included" }it 'finds work packages with attachments' do- with_enterprise_token :attachment_filters-global_search.search queryglobal_search.submit_in_project_and_subproject_scopediff --git a/spec/features/work_packages/table/queries/filter_spec.rb b/spec/features/work_packages/table/queries/filter_spec.rbindex cfe545ea1c6..583f69fc116 100644--- a/spec/features/work_packages/table/queries/filter_spec.rb+++ b/spec/features/work_packages/table/queries/filter_spec.rb@@ -388,9 +388,6 @@ describe 'filter work packages', js: true dolet(:wp_table) { Pages::WorkPackagesTable.new }before do- allow(EnterpriseToken).to receive(:allows_to?).and_return(false)- allow(EnterpriseToken).to receive(:allows_to?).with(:attachment_filters).and_return(true)-allow_any_instance_of(Plaintext::Resolver).to receive(:text).and_return('I am the first text $1.99.')wp_with_attachment_aExtractFulltextJob.perform_now(attachment_a.id)diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rbindex 2ba9dfb9458..44502bc4b07 100644--- a/spec/helpers/search_helper_spec.rb+++ b/spec/helpers/search_helper_spec.rb@@ -118,10 +118,6 @@ describe 'search/index' doendend- before do- with_enterprise_token :attachment_filters- end-context 'with the token in the journal notes' dolet(:tokens) { %w(journals) }diff --git a/spec/models/queries/work_packages/filter/attachment_content_filter_spec.rb b/spec/models/queries/work_packages/filter/attachment_content_filter_spec.rbindex 46565b64f20..1d11edd06ba 100644--- a/spec/models/queries/work_packages/filter/attachment_content_filter_spec.rb+++ b/spec/models/queries/work_packages/filter/attachment_content_filter_spec.rb@@ -30,11 +30,6 @@ require 'spec_helper'describe Queries::WorkPackages::Filter::AttachmentContentFilter doif OpenProject::Database.allows_tsv?- before do- allow(EnterpriseToken).to receive(:allows_to?).and_return(false)- allow(EnterpriseToken).to receive(:allows_to?).with(:attachment_filters).and_return(true)- end-context 'WP with attachment' dolet(:context) { nil }let(:value) { 'ipsum' }diff --git a/spec/models/queries/work_packages/filter/attachment_file_name_filter_spec.rb b/spec/models/queries/work_packages/filter/attachment_file_name_filter_spec.rbindex bd304c82b97..e576175df9e 100644--- a/spec/models/queries/work_packages/filter/attachment_file_name_filter_spec.rb+++ b/spec/models/queries/work_packages/filter/attachment_file_name_filter_spec.rb@@ -30,11 +30,6 @@ require 'spec_helper'describe Queries::WorkPackages::Filter::AttachmentFileNameFilter doif OpenProject::Database.allows_tsv?- before do- allow(EnterpriseToken).to receive(:allows_to?).and_return(false)- allow(EnterpriseToken).to receive(:allows_to?).with(:attachment_filters).and_return(true)- end-it_behaves_like 'basic query filter' dolet(:type) { :text }let(:class_key) { :attachment_file_name }diff --git a/spec/models/queries/work_packages/filter/search_filter_spec.rb b/spec/models/queries/work_packages/filter/search_filter_spec.rbindex e31c4588d30..0f462859172 100644--- a/spec/models/queries/work_packages/filter/search_filter_spec.rb+++ b/spec/models/queries/work_packages/filter/search_filter_spec.rb@@ -95,11 +95,6 @@ describe Queries::WorkPackages::Filter::SearchFilter doif OpenProject::Database.allows_tsv?context 'DB allows tsv' docontext 'with EE' do- before do- allow(EnterpriseToken).to receive(:allows_to?).and_return(false)- allow(EnterpriseToken).to receive(:allows_to?).with(:attachment_filters).and_return(true)- end-it_behaves_like 'subject, description, and comment filter'context 'WP with attachment' do