Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/13.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ulferts committed Dec 12, 2023
2 parents 110d504 + ddcddac commit 5ab5e04
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 59 deletions.
2 changes: 0 additions & 2 deletions config/initializers/feature_decisions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,3 @@
# initializer 'the_engine.feature_decisions' do
# OpenProject::FeatureDecisions.add :some_flag
# end

OpenProject::FeatureDecisions.add :work_package_sharing
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,14 @@ export class IanMenuComponent implements OnInit {
isEnterprise: true,
...this.eeGuardedDateAlertRoute,
},
{
key: 'shared',
title: this.I18n.t('js.notifications.menu.shared'),
icon: 'share',
...getUiLinkForFilters({ filter: 'reason', name: 'shared' }),
},
];

sharedMenuItem = {
key: 'shared',
title: this.I18n.t('js.notifications.menu.shared'),
icon: 'share',
...getUiLinkForFilters({ filter: 'reason', name: 'shared' }),
};

notificationsByProject$ = this.ianMenuService.notificationsByProject$.pipe(
map((items) => items
.map((item) => ({
Expand Down Expand Up @@ -171,11 +170,7 @@ export class IanMenuComponent implements OnInit {
readonly state:StateService,
readonly bannersService:BannersService,
readonly configurationService:ConfigurationService,
) {
if (this.configurationService.activeFeatureFlags.includes('workPackageSharing')) {
this.reasonMenuItems.push(this.sharedMenuItem);
}
}
) { }

ngOnInit():void {
this.ianMenuService.reload();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ <h5>{{ text.notifyImmediately.title }}</h5>
<spot-selector-field
[label]="text.shared"
[control]="form.get('shared')"
*ngIf="displaySharedOption"
>
<input
slot="input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl

public eeShowBanners = false;

public displaySharedOption = false;

public form = new UntypedFormGroup({
assignee: new UntypedFormControl(false),
responsible: new UntypedFormControl(false),
Expand Down Expand Up @@ -154,7 +152,6 @@ export class NotificationsSettingsPageComponent extends UntilDestroyedMixin impl
this.form.disable();
this.userId = (this.userId || this.uiRouterGlobals.params.userId) as string;
this.eeShowBanners = this.bannersService.eeShowBanners;
this.displaySharedOption = this.configurationService.activeFeatureFlags.includes('workPackageSharing');

this
.currentUserService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h5>{{ text.notifyImmediately.title }}</h5>
</td>
</ng-container>
</tr>
<tr *ngIf="displaySharedOption">
<tr>
<th class="op-table--cell op-table--cell_soft-heading">
{{ text.shared }}
</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ export class NotificationSettingsTableComponent implements OnInit {

public eeShowBanners = false;

public displaySharedOption = false;

public availableTimes = [
{
value: null,
Expand Down Expand Up @@ -89,7 +87,6 @@ export class NotificationSettingsTableComponent implements OnInit {

ngOnInit():void {
this.eeShowBanners = this.bannersService.eeShowBanners;
this.displaySharedOption = this.configurationService.activeFeatureFlags.includes('workPackageSharing');
}

projectLink(href:string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,26 @@
// See COPYRIGHT and LICENSE files for more details.
//++

import { HalResourceEditingService } from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';
import {
HalResourceEditingService,
} from 'core-app/shared/components/fields/edit/services/hal-resource-editing.service';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { Component, Input } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { ConfigurationService } from 'core-app/core/config/configuration.service';
import { CurrentUserService } from 'core-app/core/current-user/current-user.service';
import { Observable } from 'rxjs';

@Component({
selector: 'wp-details-toolbar',
templateUrl: './wp-details-toolbar.html',
})
export class WorkPackageSplitViewToolbarComponent {
export class WorkPackageSplitViewToolbarComponent implements OnInit {
@Input() workPackage:WorkPackageResource;

@Input() displayNotificationsButton:boolean;

public displayShareButton = false;
public displayShareButton$:false|Observable<boolean> = false;

public text = {
button_more: this.I18n.t('js.button_more'),
Expand All @@ -51,7 +55,11 @@ export class WorkPackageSplitViewToolbarComponent {
readonly I18n:I18nService,
readonly halEditing:HalResourceEditingService,
readonly configurationService:ConfigurationService,
readonly currentUserService:CurrentUserService,
) {
this.displayShareButton = this.configurationService.activeFeatureFlags.includes('workPackageSharing');
}

ngOnInit() {
this.displayShareButton$ = this.currentUserService.hasCapabilities$('work_package_shares/index', this.workPackage.project.id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
></op-work-package-mark-notification-button>

<wp-share-button [workPackage]="workPackage"
*ngIf="displayShareButton">
*ngIf="displayShareButton$ | async">
</wp-share-button>

<button class="button dropdown-relative"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,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')
&& this.currentUserService.hasCapabilities$('work_package_shares/index', wp.project.id);
this.displayShareButton$ = this.currentUserService.hasCapabilities$('work_package_shares/index', wp.project.id);

// watchers
if (wp.watchers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
RSpec.describe "Notification center sidemenu",
:js,
:with_cuprite,
with_ee: %i[date_alerts],
with_flag: { work_package_sharing: true } do
with_ee: %i[date_alerts] do
shared_let(:project) { create(:project) }
shared_let(:project2) { create(:project) }
shared_let(:project3) { create(:project, parent: project2) }
Expand Down
5 changes: 2 additions & 3 deletions spec/features/users/notifications/shared_examples.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
RSpec.shared_examples 'notification settings workflow' do
describe 'with another project the user can see',
with_ee: %i[date_alerts],
with_flag: { work_package_sharing: true } do
with_ee: %i[date_alerts] do
shared_let(:project) { create(:project) }
shared_let(:project_alt) { create(:project) }
shared_let(:role) { create(:project_role, permissions: %i[view_project]) }
Expand Down Expand Up @@ -118,7 +117,7 @@
container = page.find('[data-test-selector="notification-setting-inline-create"] ng-select')
settings_page.search_autocomplete container, query: project.name, results_selector: 'body'
expect(page).to have_text 'This project is already selected'
expect(page).to have_selector('.ng-option-disabled', text: project.name)
expect(page).to have_css('.ng-option-disabled', text: project.name)
end

context 'when overdue alerts are disabled for one project, enabled for another' do
Expand Down
3 changes: 1 addition & 2 deletions spec/features/work_packages/share/bulk_sharing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

RSpec.describe 'Work Packages', 'Bulk Sharing',
:js, :with_cuprite,
with_ee: %i[work_package_sharing],
with_flag: { work_package_sharing: true } do
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:comment_work_package_role) { create(:comment_work_package_role) }
shared_let(:edit_work_package_role) { create(:edit_work_package_role) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@

require 'rails_helper'

RSpec.describe 'Work Package Sharing Enterprise Restriction',
:js, :with_cuprite,
with_flag: { work_package_sharing: true } do
RSpec.describe 'Work Package Sharing Enterprise Restriction', :js, :with_cuprite do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:comment_work_package_role) { create(:comment_work_package_role) }
shared_let(:edit_work_package_role) { create(:edit_work_package_role) }
Expand Down
3 changes: 1 addition & 2 deletions spec/features/work_packages/share/filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

RSpec.describe 'Work package sharing',
:js, :with_cuprite,
with_ee: %i[work_package_sharing],
with_flag: { work_package_sharing: true } do
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:comment_work_package_role) { create(:comment_work_package_role) }
shared_let(:edit_work_package_role) { create(:edit_work_package_role) }
Expand Down
3 changes: 1 addition & 2 deletions spec/features/work_packages/share/multi_invite_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

RSpec.describe 'Work package sharing',
:js, :with_cuprite,
with_ee: %i[work_package_sharing],
with_flag: { work_package_sharing: true } do
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:comment_work_package_role) { create(:comment_work_package_role) }
shared_let(:edit_work_package_role) { create(:edit_work_package_role) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

RSpec.describe 'Work package sharing invited users',
:js, :with_cuprite,
with_ee: %i[work_package_sharing],
with_flag: { work_package_sharing: true } do
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:editor) { create(:admin, firstname: 'Mr.', lastname: 'Sharer') }

Expand Down
14 changes: 1 addition & 13 deletions spec/features/work_packages/share_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@

RSpec.describe 'Work package sharing',
:js, :with_cuprite,
with_ee: %i[work_package_sharing],
with_flag: { work_package_sharing: true } do
with_ee: %i[work_package_sharing] do
shared_let(:view_work_package_role) { create(:view_work_package_role) }
shared_let(:comment_work_package_role) { create(:comment_work_package_role) }
shared_let(:edit_work_package_role) { create(:edit_work_package_role) }
Expand Down Expand Up @@ -267,7 +266,6 @@ def inherited_member_roles(group:)
end
end


context 'when lacking share permission but having the viewing permission' do
let(:sharer_role) do
create(:project_role,
Expand Down Expand Up @@ -316,16 +314,6 @@ def inherited_member_roles(group:)
end
end

context 'without the feature flag enabled', with_flag: { work_package_sharing: false } do
let(:sharer_role) do
create(:project_role,
permissions: %i(view_work_packages
view_shared_work_packages))
end

it_behaves_like "'Share' button is not rendered"
end

context "without the viewing permission" do
let(:sharer_role) do
create(:project_role,
Expand Down

0 comments on commit 5ab5e04

Please sign in to comment.