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

Cleared up files tab in preparation for propper storages implementation

Andreas Pfohlfa2d32730f49
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
index acb7b149370..199687aeb13 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/files-tab/op-files-tab.html
@@ -1,6 +1,6 @@
<div class="op-tab-content--container">
<section data-qa-selector="op-tab-content--tab-section">
- <div *ngIf="!canViewFileLinks" class="op-tab-content--header">
+ <div class="op-tab-content--header">
<h3 class="op-tab-content--header-text" [textContent]="text.attachments.label"></h3>
</div>
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts
index d102f8e8c94..a70a016961e 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-files-count.function.ts
@@ -43,7 +43,7 @@ export function workPackageFilesCount(
return combineLatest(
[
attachmentService.all(workPackage.$links.attachments.href || ''),
- fileLinkService.all(workPackage.$links.fileLinks.href || ''),
+ fileLinkService.all(workPackage.$links.fileLinks?.href || ''),
],
).pipe(
map(([a, f]) => a.length + f.length),
diff --git a/modules/storages/spec/features/show_file_links_spec.rb b/modules/storages/spec/features/show_file_links_spec.rb
index b98af1b61e1..2ee4dc1b3b3 100644
--- a/modules/storages/spec/features/show_file_links_spec.rb
+++ b/modules/storages/spec/features/show_file_links_spec.rb
@@ -29,7 +29,7 @@
require_relative '../spec_helper'
describe 'Showing of file links in work package', :enable_storages, type: :feature, js: true do
- let(:permissions) { %i(view_work_packages view_file_links) }
+ let(:permissions) { %i(view_work_packages edit_work_packages view_file_links) }
let(:project) { create(:project) }
let(:current_user) do
create(:user, member_in_project: project, member_with_permissions: permissions)
@@ -60,7 +60,11 @@ describe 'Showing of file links in work package', :enable_storages, type: :featu
end
context 'if user has no permission to see file links' do
- let(:permissions) { %i(view_work_packages view_file_links) }
+ let(:permissions) { %i(view_work_packages edit_work_packages) }
+
+ before do
+ project_storage
+ end
it 'must not show a file links section' do
expect(page).to have_selector('[data-qa-selector="op-tab-content--tab-section"]', count: 1)