Skip to content

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

[chore] added feature flag for linking files

Eric Schubert722a96416422
diff --git a/frontend/src/app/core/config/configuration.service.ts b/frontend/src/app/core/config/configuration.service.ts
index 27d5bc3fcec..a43ef85db4f 100644
--- a/frontend/src/app/core/config/configuration.service.ts
+++ b/frontend/src/app/core/config/configuration.service.ts
@@ -30,7 +30,6 @@ import { I18nService } from 'core-app/core/i18n/i18n.service';
import { ConfigurationResource } from 'core-app/features/hal/resources/configuration-resource';
import * as moment from 'moment';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
-import { WeekdayService } from 'core-app/core/days/weekday.service';
@Injectable({ providedIn: 'root' })
export class ConfigurationService {
@@ -118,6 +117,10 @@ export class ConfigurationService {
return this.systemPreference('hostName');
}
+ public get activeFeatureFlags():string[] {
+ return this.systemPreference<string[]>('activeFeatureFlags');
+ }
+
private loadConfiguration() {
return this
.apiV3Service
diff --git a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts
index 611c03e2ed7..65cfdf91815 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts
+++ b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.component.ts
@@ -60,6 +60,7 @@ import {
StorageInformationBox,
} from 'core-app/shared/components/file-links/storage-information/storage-information-box';
import { OpModalService } from 'core-app/shared/components/modal/modal.service';
+import { ConfigurationService } from 'core-app/core/config/configuration.service';
import {
FilePickerModalComponent,
} from 'core-app/shared/components/file-links/file-picker-modal/file-picker-modal.component';
@@ -108,16 +109,21 @@ export class FileLinkListComponent extends UntilDestroyedMixin implements OnInit
},
};
+ public get storageFileLinkingEnabled():boolean {
+ return this.configurationService.activeFeatureFlags.includes('storageFileLinking');
+ }
+
private get storageFilesLocation():string {
return this.storage._links.open.href;
}
constructor(
private readonly i18n:I18nService,
+ private readonly cookieService:CookieService,
private readonly opModalService:OpModalService,
- private readonly fileLinkResourceService:FileLinksResourceService,
private readonly currentUserService:CurrentUserService,
- private readonly cookieService:CookieService,
+ private readonly configurationService:ConfigurationService,
+ private readonly fileLinkResourceService:FileLinksResourceService,
) {
super();
}
diff --git a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html
index ca2911924d9..5d102714fb1 100644
--- a/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html
+++ b/frontend/src/app/shared/components/file-links/file-link-list/file-link-list.html
@@ -37,6 +37,7 @@
<span [textContent]="text.actions.linkFile(storageType)"></span>
</button>
<button
+ *ngIf="storageFileLinkingEnabled"
type="button"
class="spot-link op-file-list--action-button"
data-qa-selector="op-file-list--link-existing-file-button"
diff --git a/lib_static/open_project/feature_decisions.rb b/lib_static/open_project/feature_decisions.rb
index 73b4f2b461b..64aa0ac5dfa 100644
--- a/lib_static/open_project/feature_decisions.rb
+++ b/lib_static/open_project/feature_decisions.rb
@@ -40,7 +40,7 @@ module OpenProject
# * the method `.the_name_of_the_flag_active?` for querying the state
# of the flag. By default, it is false.
# * fetching the overwritten value from
- # * ENV variable (`OPENPROJECT_THE_NAME_OF_THE_FLAG_ACTIVE = 'true'`)
+ # * ENV variable (`OPENPROJECT_FEATURE_THE_NAME_OF_THE_FLAG_ACTIVE = 'true'`)
# * configuration.yml file (`the_name_of_the_flag_active: true`)
# * from the settings database table (`Setting.feature_the_name_of_the_flag_active = true)
# * including the flag in the `.active` array in case it is enabled
diff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rb
index 2655cdad318..0fda873f225 100644
--- a/modules/storages/lib/open_project/storages/engine.rb
+++ b/modules/storages/lib/open_project/storages/engine.rb
@@ -40,6 +40,10 @@ module OpenProject::Storages
# please see comments inside ActsAsOpEngine class
include OpenProject::Plugins::ActsAsOpEngine
+ initializer 'openproject_storages.feature_decisions' do
+ OpenProject::FeatureDecisions.add :storage_file_linking
+ end
+
# For documentation see the definition of register in "ActsAsOpEngine"
# This corresponds to the openproject-storage.gemspec
# Pass a block to the plugin (for defining permissions, menu items and the like)