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

Revert "[34840] Unclear error message when subproject column for action board cannot be displayed due to missing permissions (handling this bug in another way) (#8852)"

ulfertsa9a83f2dbcc4
diff --git a/frontend/src/app/modules/boards/board/board-partitioned-page/board-list-container.component.ts b/frontend/src/app/modules/boards/board/board-partitioned-page/board-list-container.component.ts
index c4397e34de1..b9970d0ad46 100644
--- a/frontend/src/app/modules/boards/board/board-partitioned-page/board-list-container.component.ts
+++ b/frontend/src/app/modules/boards/board/board-partitioned-page/board-list-container.component.ts
@@ -1,5 +1,5 @@
import {Component, ElementRef, Injector, OnInit, QueryList, ViewChild, ViewChildren} from "@angular/core";
-import {forkJoin, Observable, of, Subscription} from "rxjs";
+import {Observable, Subscription} from "rxjs";
import {QueryResource} from "core-app/modules/hal/resources/query-resource";
import {BoardListComponent} from "core-app/modules/boards/board/board-list/board-list.component";
import {StateService} from "@uirouter/core";
@@ -19,10 +19,9 @@ import {BoardPartitionedPageComponent} from "core-app/modules/boards/board/board
import {AddListModalComponent} from "core-app/modules/boards/board/add-list-modal/add-list-modal.component";
import {I18nService} from "core-app/modules/common/i18n/i18n.service";
import {BoardListCrossSelectionService} from "core-app/modules/boards/board/board-list/board-list-cross-selection.service";
-import {catchError, filter, map, switchMap, tap} from "rxjs/operators";
+import {filter} from "rxjs/operators";
import {BoardActionsRegistryService} from "core-app/modules/boards/board/board-actions/board-actions-registry.service";
import {APIV3Service} from "core-app/modules/apiv3/api-v3.service";
-import { WorkPackageStatesInitializationService } from 'core-app/components/wp-list/wp-states-initialization.service';
@Component({
templateUrl: './board-list-container.component.html',
@@ -67,7 +66,6 @@ export class BoardListContainerComponent extends UntilDestroyedMixin implements
trackByQueryId = (index:number, widget:GridWidgetResource) => widget.options.queryId;
board$:Observable<Board>;
- boardWidgets:GridWidgetResource[] = [];
private currentQueryUpdatedMonitoring:Subscription;
@@ -84,27 +82,30 @@ export class BoardListContainerComponent extends UntilDestroyedMixin implements
readonly Boards:BoardService,
readonly Banner:BannersService,
readonly boardListCrossSelectionService:BoardListCrossSelectionService,
- readonly wpStatesInitialization:WorkPackageStatesInitializationService,
readonly Drag:DragAndDropService,
- readonly apiv3Service:APIV3Service,
readonly QueryUpdated:QueryUpdatedService) {
super();
}
ngOnInit():void {
const id:string = this.state.params.board_id.toString();
+
this.board$ = this
.apiV3Service
.boards
.id(id)
- .requireAndStream()
- .pipe(
- this.setAllowedBoardWidgets,
- tap(board => this.setupQueryUpdatedMonitoring(board))
- );
+ .requireAndStream();
this.Boards.currentBoard$.next(id);
+ this.board$
+ .pipe(
+ this.untilDestroyed()
+ )
+ .subscribe(board => {
+ this.setupQueryUpdatedMonitoring(board);
+ });
+
this.boardListCrossSelectionService
.selections()
.pipe(
@@ -117,43 +118,6 @@ export class BoardListContainerComponent extends UntilDestroyedMixin implements
});
}
- setAllowedBoardWidgets = (boardObservable:Observable<Board>) => {
- // The grid config could have widgets that the user is not allowed to
- // see, so we filter out those that rise an access error.
- return boardObservable
- .pipe(
- switchMap(
- board => this.getAllowedBoardWidgets(board).pipe(map(allowedBoardWidgets => ({board, allowedBoardWidgets}))),
- ),
- map(result => {
- this.boardWidgets = result.allowedBoardWidgets;
- return result.board;
- })
- );
- }
-
- getAllowedBoardWidgets(board:Board) {
- if (board.queries.length) {
- const queryRequests$ = board.queries.map(query => this.apiv3Service.queries
- .find({filters: JSON.stringify(query.options.filters)} , query.options.queryId as string)
- .pipe(
- map(() => query),
- catchError(error => {
- const userIsNotAllowedToSeeSubprojectError = 'urn:openproject-org:api:v3:errors:InvalidQuery';
- const result = error.errorIdentifier === userIsNotAllowedToSeeSubprojectError ? null : query;
-
- return of(result);
- })
- )
- );
-
- return forkJoin([...queryRequests$])
- .pipe(map(boardWidgets => boardWidgets.filter(boardWidget => !!boardWidget) as GridWidgetResource[]));
- } else {
- return of([]);
- }
- }
-
moveList(board:Board, event:CdkDragDrop<GridWidgetResource[]>) {
moveItemInArray(board.queries, event.previousIndex, event.currentIndex);
this.saveBoard(board);
@@ -246,4 +210,4 @@ export class BoardListContainerComponent extends UntilDestroyedMixin implements
.filter(value => value !== undefined);
}
-}
+}
\ No newline at end of file
diff --git a/modules/boards/spec/features/action_boards/subproject_board_spec.rb b/modules/boards/spec/features/action_boards/subproject_board_spec.rb
index 1e24d32f40d..562e2342946 100644
--- a/modules/boards/spec/features/action_boards/subproject_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/subproject_board_spec.rb
@@ -171,11 +171,8 @@ describe 'Subproject action board', type: :feature, js: true do
login_as only_parent_user
board_page.visit!
- # Not allowed subproject lists should not rise error and
- # should not be shown
- expect(page).to have_no_selector('.notification-box.-error')
- board_page.expect_no_list 'Child 1'
- board_page.expect_no_list 'Child 2'
+ # We will see an error for the two boards pages
+ expect(page).to have_selector('.notification-box.-error', count: 2)
end
end
end