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

guard button by feature flag

ulferts639f682f3f44
diff --git a/config/initializers/feature_decisions.rb b/config/initializers/feature_decisions.rb
index b3f771bbedb..9ec1dd49b9c 100644
--- a/config/initializers/feature_decisions.rb
+++ b/config/initializers/feature_decisions.rb
@@ -40,3 +40,4 @@ require_relative '../../lib_static/open_project/feature_decisions'
# end
OpenProject::FeatureDecisions.add :personal_theme_selection
+OpenProject::FeatureDecisions.add :work_package_sharing
diff --git a/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.component.ts b/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.component.ts
index efbca01ba93..56126449931 100644
--- a/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.component.ts
@@ -30,6 +30,7 @@ import { HalResourceEditingService } from 'core-app/shared/components/fields/edi
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { Component, Input } from '@angular/core';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
+import { ConfigurationService } from 'core-app/core/config/configuration.service';
@Component({
selector: 'wp-details-toolbar',
@@ -40,10 +41,16 @@ export class WorkPackageSplitViewToolbarComponent {
@Input() displayNotificationsButton:boolean;
+ public displayShareButton = false;
+
public text = {
button_more: this.I18n.t('js.button_more'),
};
constructor(readonly I18n:I18nService,
- readonly halEditing:HalResourceEditingService) {}
+ readonly halEditing:HalResourceEditingService,
+ readonly configurationService:ConfigurationService) {
+
+ this.displayShareButton = this.configurationService.activeFeatureFlags.includes('workPackageSharing')
+ }
}
diff --git a/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.html b/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.html
index 26cb2f613ca..ac8bd5f1958 100644
--- a/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.html
+++ b/frontend/src/app/features/work-packages/components/wp-details/wp-details-toolbar.html
@@ -10,9 +10,10 @@
data-test-selector="mark-notification-read-button"
></op-work-package-mark-notification-button>
- <wp-share-button [workPackage]="workPackage">
+ <wp-share-button [workPackage]="workPackage"
+ *ngIf="displayShareButton">
</wp-share-button>
-
+
<button class="button dropdown-relative"
[attr.accesskey]="7"
diff --git a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts
index eae4eef5a90..800fecea476 100644
--- a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.component.ts
@@ -41,6 +41,7 @@ import { WorkPackageNotificationService } from 'core-app/features/work-packages/
import { WpSingleViewService } from 'core-app/features/work-packages/routing/wp-view-base/state/wp-single-view.service';
import { CommentService } from 'core-app/features/work-packages/components/wp-activity/comment-service';
import { RecentItemsService } from 'core-app/core/recent-items.service';
+import { ConfigurationService } from 'core-app/core/config/configuration.service';
@Component({
templateUrl: './wp-full-view.html',
@@ -61,6 +62,8 @@ export class WorkPackagesFullViewComponent extends WorkPackageSingleViewBase imp
public displayTimerButton = false;
+ public displayShareButton = false;
+
public watchers:any;
public text = {
@@ -76,7 +79,7 @@ export class WorkPackagesFullViewComponent extends WorkPackageSingleViewBase imp
public wpTableSelection:WorkPackageViewSelectionService,
public recentItemsService:RecentItemsService,
readonly $state:StateService,
- // private readonly i18n:I18nService,
+ private readonly configurationService:ConfigurationService,
) {
super(injector, $state.params.workPackageId);
}
@@ -102,6 +105,7 @@ export class WorkPackagesFullViewComponent extends WorkPackageSingleViewBase imp
this.isWatched = Object.prototype.hasOwnProperty.call(wp, 'unwatch');
this.displayWatchButton = Object.prototype.hasOwnProperty.call(wp, 'unwatch') || Object.prototype.hasOwnProperty.call(wp, 'watch');
this.displayTimerButton = Object.prototype.hasOwnProperty.call(wp, 'logTime');
+ this.displayShareButton = this.configurationService.activeFeatureFlags.includes('workPackageSharing')
// watchers
if (wp.watchers) {
diff --git a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
index 3220c3da56e..8468ea829d5 100644
--- a/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
+++ b/frontend/src/app/features/work-packages/routing/wp-full-view/wp-full-view.html
@@ -25,7 +25,7 @@
[stateName$]="stateName$">
</wp-create-button>
</li>
- <li class="toolbar-item">
+ <li class="toolbar-item" *ngIf="displayShareButton">
<wp-share-button [workPackage]="workPackage">
</wp-share-button>
</li>
diff --git a/spec/features/work_packages/share_spec.rb b/spec/features/work_packages/share_spec.rb
index f8570524da5..a0eb82a12b4 100644
--- a/spec/features/work_packages/share_spec.rb
+++ b/spec/features/work_packages/share_spec.rb
@@ -30,7 +30,10 @@
require 'spec_helper'
-RSpec.describe 'Work package sharing', :js, :with_cuprite do
+RSpec.describe 'Work package sharing',
+ :js,
+ :with_cuprite,
+ with_flag: { work_package_sharing: true } do
let(:sharer_role) do
create(:role,
permissions: %i(view_work_packages