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

hide help mode button when permission is lacking

ulfertsb76927aef769
diff --git a/frontend/src/app/modules/grids/grid/add-widget.service.ts b/frontend/src/app/modules/grids/grid/add-widget.service.ts
index 37595384102..5b5774d228c 100644
--- a/frontend/src/app/modules/grids/grid/add-widget.service.ts
+++ b/frontend/src/app/modules/grids/grid/add-widget.service.ts
@@ -118,6 +118,6 @@ export class GridAddWidgetService {
}
public get isAllowed() {
- return this.layout.gridResource.updateImmediately;
+ return this.layout.gridResource && this.layout.gridResource.updateImmediately;
}
}
diff --git a/frontend/src/app/modules/grids/grid/page/grid-page.component.html b/frontend/src/app/modules/grids/grid/page/grid-page.component.html
index 04bf72c21fa..9048a24cd7c 100644
--- a/frontend/src/app/modules/grids/grid/page/grid-page.component.html
+++ b/frontend/src/app/modules/grids/grid/page/grid-page.component.html
@@ -7,6 +7,7 @@
<ul class="toolbar-items">
<li class="toolbar-item">
<button class="button"
+ *ngIf="addWidget.isAllowed"
[title]="addWidget.addText"
(click)="areas.toggleHelpMode()"
[ngClass]="{'-active': areas.inHelpMode}">
diff --git a/modules/dashboards/spec/features/read_only_allowed_spec.rb b/modules/dashboards/spec/features/read_only_allowed_spec.rb
index 40cff0e0c96..461bd863f1b 100644
--- a/modules/dashboards/spec/features/read_only_allowed_spec.rb
+++ b/modules/dashboards/spec/features/read_only_allowed_spec.rb
@@ -73,6 +73,7 @@ describe 'Read only mode when user lacks edit permission on dashboard', type: :f
it 'can not modify the dashboard but can still use it' do
dashboard_page.expect_unable_to_add_widget(dashboard.row_count, dashboard.column_count, :row)
+ dashboard_page.expect_no_help_mode
table_widget = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(1)')
diff --git a/modules/grids/spec/support/pages/grid.rb b/modules/grids/spec/support/pages/grid.rb
index c84020b12de..ac3d429b1de 100644
--- a/modules/grids/spec/support/pages/grid.rb
+++ b/modules/grids/spec/support/pages/grid.rb
@@ -39,6 +39,11 @@ module Pages
end
end
+ def expect_no_help_mode
+ expect(page)
+ .to have_no_selector('.toolbar-item .icon-add')
+ end
+
def expect_unable_to_add_widget(row_number, column_number, location, name = nil)
if name
expect_specific_widget_unaddable(row_number, column_number, location, name)