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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#52039] File link status displays not found files
Eric Schubert3049fc559298
diff --git a/docs/api/apiv3/components/schemas/file_link_read_model.yml b/docs/api/apiv3/components/schemas/file_link_read_model.ymlindex a50c6cd7c2a..bcf76660873 100644--- a/docs/api/apiv3/components/schemas/file_link_read_model.yml+++ b/docs/api/apiv3/components/schemas/file_link_read_model.yml@@ -85,14 +85,16 @@ properties:The uri to delete the file link.**Resource**: N/A- permission:+ status:allOf:- $ref: './link.yml'- description: |-- The urn of the user specific file link permission on its storage. Can be one of:+ The urn of the user specific file link status on its storage. Can be one of:- - urn:openproject-org:api:v3:file-links:permission:View- - urn:openproject-org:api:v3:file-links:permission:NotAllowed+ - urn:openproject-org:api:v3:file-links:permission:ViewAllowed+ - urn:openproject-org:api:v3:file-links:permission:ViewNotAllowed+ - urn:openproject-org:api:v3:file-links:NotFound+ - urn:openproject-org:api:v3:file-links:Error**Resource**: N/AoriginOpen:@@ -196,7 +198,7 @@ example:title: Obi-Wan Kenobidelete:href: /api/v3/work_package/17/file_links/1337- permission:+ status:href: urn:openproject-org:api:v3:file-links:permission:Viewtitle: VieworiginOpen:diff --git a/frontend/src/app/core/state/file-links/file-link.model.ts b/frontend/src/app/core/state/file-links/file-link.model.tsindex c6072ecbfd9..a8f1a2cd839 100644--- a/frontend/src/app/core/state/file-links/file-link.model.ts+++ b/frontend/src/app/core/state/file-links/file-link.model.ts@@ -37,7 +37,7 @@ export interface IFileLinkHalResourceLinks extends IHalResourceLinks {container:IHalResourceLink;creator:IHalResourceLink;delete?:IHalResourceLink;- permission?:IHalResourceLink;+ status?:IHalResourceLink;originOpen:IHalResourceLink;staticOriginOpen:IHalResourceLink;originOpenLocation:IHalResourceLink;diff --git a/frontend/src/app/core/state/project-storages/project-storage.model.ts b/frontend/src/app/core/state/project-storages/project-storage.model.tsindex 7bc7c6b9702..787c06225e8 100644--- a/frontend/src/app/core/state/project-storages/project-storage.model.ts+++ b/frontend/src/app/core/state/project-storages/project-storage.model.ts@@ -34,6 +34,7 @@ export interface IProjectStorageHalResourceLinks extends IHalResourceLinks {project:IHalResourceLink;creator:IHalResourceLink;projectFolder?:IHalOptionalTitledLink;+ openWithConnectionEnsured:IHalResourceLink;}export interface IProjectStorage {diff --git a/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.component.ts b/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.component.tsindex ce4fb211c50..eaedbf7d1ac 100644--- a/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.component.ts+++ b/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.component.ts@@ -42,11 +42,16 @@ import { I18nService } from 'core-app/core/i18n/i18n.service';import { TimezoneService } from 'core-app/core/datetime/timezone.service';import { IFileIcon } from 'core-app/shared/components/storages/icons.mapping';import { IFileLink, IFileLinkOriginData } from 'core-app/core/state/file-links/file-link.model';-import { fileLinkViewAllowed } from 'core-app/shared/components/storages/storages-constants.const';+import {+ fileLinkStatusError, fileLinkStatusNotFound,+ fileLinkViewAllowed,+ fileLinkViewNotAllowed,+} from 'core-app/shared/components/storages/storages-constants.const';import { PrincipalRendererService } from 'core-app/shared/components/principal/principal-renderer.service';import { ConfirmDialogOptions } from 'core-app/shared/components/modals/confirm-dialog/confirm-dialog.modal';import { ConfirmDialogService } from 'core-app/shared/components/modals/confirm-dialog/confirm-dialog.service';import { getIconForMimeType, isDirectory } from 'core-app/shared/components/storages/functions/storages.functions';+import { FloatingAction } from 'core-app/shared/components/storages/file-link-list-item/floating-action';import SpotDropAlignmentOption from 'core-app/spot/drop-alignment-options';@Component({@@ -70,11 +75,11 @@ export class FileLinkListItemComponent implements OnInit, AfterViewInit {fileLinkIcon:IFileIcon;- downloadAllowed:boolean;+ floatingActions:FloatingAction[];- viewAllowed:boolean;+ tooltipAlignment:SpotDropAlignmentOption = SpotDropAlignmentOption.TopLeft;- tooltipAllignment:SpotDropAlignmentOption = SpotDropAlignmentOption.TopLeft;+ tooltip:string;text = {title: {@@ -83,13 +88,12 @@ export class FileLinkListItemComponent implements OnInit, AfterViewInit {removeFileLink: this.i18n.t('js.storages.file_links.remove'),downloadFileLink: '',},- floatingText: {- noViewPermission: this.i18n.t('js.storages.file_links.no_permission'),- },removalTitle: this.i18n.t('js.storages.file_links.remove'),removalButtonLabel: this.i18n.t('js.storages.file_links.remove_short'),removalConfirmation: this.i18n.t('js.storages.file_links.remove_confirmation'),- notAllowdTooltipText: this.i18n.t('js.storages.file_links.not_allowed_tooltip'),+ notLoggedInTooltipText: this.i18n.t('js.storages.file_links.tooltip.not_logged_in'),+ viewNotAllowedTooltipText: this.i18n.t('js.storages.file_links.tooltip.view_not_allowed'),+ notFoundTooltipText: this.i18n.t('js.storages.file_links.tooltip.not_found'),};constructor(@@ -99,6 +103,18 @@ export class FileLinkListItemComponent implements OnInit, AfterViewInit {private readonly principalRendererService:PrincipalRendererService,) {}+ public get hasTooltip():boolean {+ return this.tooltip !== '';+ }++ public get clickable():boolean {+ return !(this.disabled || this.statusIs(fileLinkStatusNotFound));+ }++ public get hasFaultyStatus():boolean {+ return !this.statusIs(fileLinkViewAllowed);+ }+private get originData():IFileLinkOriginData {return this.fileLink.originData;}@@ -110,14 +126,14 @@ export class FileLinkListItemComponent implements OnInit, AfterViewInit {this.fileLinkIcon = getIconForMimeType(this.originData.mimeType);- this.downloadAllowed = !isDirectory(this.originData);+ this.tooltip = this.toolTipText();this.text.title.downloadFileLink = this.i18n.t('js.storages.file_links.download',{ fileName: this.fileLink.originData.name },);- this.viewAllowed = !this.fileLink._links.permission || this.fileLink._links.permission.href === fileLinkViewAllowed;+ this.floatingActions = this.getFloatingActions();}ngAfterViewInit():void {@@ -154,4 +170,83 @@ export class FileLinkListItemComponent implements OnInit, AfterViewInit {.then(() => { this.removeFileLink.emit(); }).catch(() => { /* confirmation rejected */ });}++ private toolTipText():string {+ if (this.disabled) {+ return this.text.notLoggedInTooltipText;+ }++ if (!this.fileLink._links.status) {+ return '';+ }++ switch (this.fileLink._links.status.href) {+ case fileLinkViewNotAllowed:+ return this.text.viewNotAllowedTooltipText;+ case fileLinkStatusError:+ return this.text.notLoggedInTooltipText;+ case fileLinkStatusNotFound:+ return this.text.notFoundTooltipText;+ default:+ return '';+ }+ }++ private statusIs(value:string):boolean {+ return !!this.fileLink._links.status && this.fileLink._links.status.href === value;+ }++ private getFloatingActions():FloatingAction[] {+ if (this.disabled) {+ return [];+ }++ if (this.statusIs(fileLinkStatusNotFound) && this.allowEditing) {+ return [this.removeAction()];+ }++ if (this.hasFaultyStatus) {+ return [];+ }++ // healthy file link+ const actions:FloatingAction[] = [];+ if (!isDirectory(this.originData)) {+ actions.push(this.downloadAction());+ }++ actions.push(this.openInLocationAction());++ if (this.allowEditing) {+ actions.push(this.removeAction());+ }++ return actions;+ }++ private removeAction():FloatingAction {+ return new FloatingAction(+ 'remove-link',+ this.text.title.removeFileLink,+ () => this.confirmRemoveFileLink(),+ );+ }++ private downloadAction():FloatingAction {+ return new FloatingAction(+ 'download-arrow',+ this.text.title.downloadFileLink,+ undefined,+ { url: this.fileLink._links.staticOriginDownload.href, target: '_self' },+ );+ }++ private openInLocationAction():FloatingAction {+ return new FloatingAction(+ 'folder-open',+ this.text.title.openFileLocation,+ undefined,+ { url: this.fileLink._links.staticOriginOpenLocation.href, target: '_blank' },+ );+ }}diff --git a/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.html b/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.htmlindex 0a009bdbab7..c21d2b68d83 100644--- a/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.html+++ b/frontend/src/app/shared/components/storages/file-link-list-item/file-link-list-item.html@@ -1,13 +1,13 @@<spot-tooltip- [disabled]="!disabled"- [alignment]="tooltipAllignment"+ [disabled]="!hasTooltip"+ [alignment]="tooltipAlignment"class="spot-list--item-floating-wrapper op-file-list--item-floating-wrapper"- [ngClass]="{ 'spot-list--item-floating-wrapper_disabled op-file-list--item-floating-wrapper__disabled': disabled }"+ [ngClass]="{ 'spot-list--item-floating-wrapper_disabled op-file-list--item-floating-wrapper__disabled': floatingActions.length === 0 }"><pslot="body"class="spot-body-small"- >{{text.notAllowdTooltipText}}</p>+ >{{ tooltip }}</p><ng-containerslot="trigger"@@ -16,8 +16,8 @@class="spot-list--item-action spot-list--item-action_link op-file-list--item-action"[ngClass]="{'spot-list--item-action_disabled': disabled,- 'op-file-list--item-action_disabled': disabled,- 'op-file-list--item-action_view-not-allowed': !viewAllowed+ 'op-file-list--item-action_disabled': !clickable,+ 'op-file-list--item-action_faulty-status': hasFaultyStatus}"[href]="fileLink._links.staticOriginOpen.href"target="_blank"@@ -42,41 +42,26 @@></div></a><div- *ngIf="!disabled && viewAllowed"+ *ngIf="floatingActions.length > 0"class="spot-list--item-floating-actions op-file-list--item-floating-actions hidden-for-mobile">- <a- *ngIf="downloadAllowed"- class="spot-link"- [title]="text.title.downloadFileLink"- [href]="fileLink._links.staticOriginDownload.href"- >- <span class="spot-icon spot-icon_download-arrow"></span>- </a>- <a- class="spot-link"- [title]="text.title.openFileLocation"- [href]="fileLink._links.staticOriginOpenLocation.href"- target="_blank"- >- <span class="spot-icon spot-icon_folder-open"></span>- </a>- <button- *ngIf="allowEditing"- class="spot-link"- data-test-selector="file-list--item-remove-floating-action"- [title]="text.title.removeFileLink"- (click)="confirmRemoveFileLink()"- >- <span class="spot-icon spot-icon_remove-link"></span>- </button>- </div>- <div- *ngIf="!disabled && !viewAllowed"- class="spot-list--item-floating-actions op-file-list--item-floating-text hidden-for-mobile"- >- <span class="spot-icon spot-icon_info2 op-files-tab--icon op-file-list--item-floating-text-icon"></span>- <span [textContent]="text.floatingText.noViewPermission"></span>+ <ng-container *ngFor="let action of floatingActions">+ <a *ngIf="!!action.href"+ class="spot-link"+ [title]="action.title"+ [href]="action.href.url"+ [target]="action.href.target"+ >+ <span class="spot-icon spot-icon_{{action.iconClass}}"></span>+ </a>+ <button *ngIf="!!action.action"+ class="spot-link"+ [title]="action.title"+ (click)="action.action()"+ >+ <span class="spot-icon spot-icon_{{action.iconClass}}"></span>+ </button>+ </ng-container></div></ng-container></spot-tooltip>diff --git a/frontend/src/app/shared/components/storages/file-link-list-item/floating-action.ts b/frontend/src/app/shared/components/storages/file-link-list-item/floating-action.tsnew file mode 100644index 00000000000..5e659b74bac--- /dev/null+++ b/frontend/src/app/shared/components/storages/file-link-list-item/floating-action.ts@@ -0,0 +1,36 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2024 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License+// as published by the Free Software Foundation; either version 2+// of the License, or (at your option) any later version.+//+// This program is distributed in the hope that it will be useful,+// but WITHOUT ANY WARRANTY; without even the implied warranty of+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+// GNU General Public License for more details.+//+// You should have received a copy of the GNU General Public License+// along with this program; if not, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//++++export class FloatingAction {+ constructor(+ public readonly iconClass:string,+ public readonly title:string,+ public readonly action?:() => void,+ public readonly href?:{ url:string, target:string },+ ) { }+}diff --git a/frontend/src/app/shared/components/storages/storage-information/storage-information.service.ts b/frontend/src/app/shared/components/storages/storage-information/storage-information.service.tsindex 0101901df29..04c6bb0d795 100644--- a/frontend/src/app/shared/components/storages/storage-information/storage-information.service.ts+++ b/frontend/src/app/shared/components/storages/storage-information/storage-information.service.ts@@ -37,7 +37,7 @@ import { StorageInformationBox } from 'core-app/shared/components/storages/storaimport { CurrentUserService } from 'core-app/core/current-user/current-user.service';import { storageLocaleString } from 'core-app/shared/components/storages/functions/storages.functions';import {- fileLinkViewError,+ fileLinkStatusError,storageAuthorizationError,storageConnected,storageFailedAuthorization,@@ -121,6 +121,6 @@ export class StorageInformationService {}private hasFileLinkViewErrors(fileLinks:IFileLink[]):boolean {- return fileLinks.filter((fileLink) => fileLink._links.permission?.href === fileLinkViewError).length > 0;+ return fileLinks.filter((fileLink) => fileLink._links.status?.href === fileLinkStatusError).length > 0;}}diff --git a/frontend/src/app/shared/components/storages/storage/storage.component.ts b/frontend/src/app/shared/components/storages/storage/storage.component.tsindex 2c70c534b5d..e12aa67baad 100644--- a/frontend/src/app/shared/components/storages/storage/storage.component.ts+++ b/frontend/src/app/shared/components/storages/storage/storage.component.ts@@ -58,7 +58,7 @@ import { IPrepareUploadLink, IStorage } from 'core-app/core/state/storages/storaimport { IProjectStorage } from 'core-app/core/state/project-storages/project-storage.model';import { FileLinksResourceService } from 'core-app/core/state/file-links/file-links.service';import {- fileLinkViewError,+ fileLinkStatusError,nextcloud,storageConnected,} from 'core-app/shared/components/storages/storages-constants.const';@@ -515,7 +515,7 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnD}private hasFileLinkViewErrors(fileLinks:IFileLink[]):boolean {- return fileLinks.filter((fileLink) => fileLink._links.permission?.href === fileLinkViewError).length > 0;+ return fileLinks.filter((fileLink) => fileLink._links.status?.href === fileLinkStatusError).length > 0;}private collectionKey():Observable<string> {diff --git a/frontend/src/app/shared/components/storages/storages-constants.const.ts b/frontend/src/app/shared/components/storages/storages-constants.const.tsindex 330565c5b6c..cd3f4ee772f 100644--- a/frontend/src/app/shared/components/storages/storages-constants.const.ts+++ b/frontend/src/app/shared/components/storages/storages-constants.const.ts@@ -8,6 +8,7 @@ export const storageFailedAuthorization = 'urn:openproject-org:api:v3:storages:aexport const storageAuthorizationError = 'urn:openproject-org:api:v3:storages:authorization:Error';// File link view permission flags-export const fileLinkViewAllowed = 'urn:openproject-org:api:v3:file-links:permission:View';-export const fileLinkViewNotAllowed = 'urn:openproject-org:api:v3:file-links:permission:NotAllowed';-export const fileLinkViewError = 'urn:openproject-org:api:v3:file-links:permission:Error';+export const fileLinkViewAllowed = 'urn:openproject-org:api:v3:file-links:permission:ViewAllowed';+export const fileLinkViewNotAllowed = 'urn:openproject-org:api:v3:file-links:permission:ViewNotAllowed';+export const fileLinkStatusNotFound = 'urn:openproject-org:api:v3:file-links:NotFound';+export const fileLinkStatusError = 'urn:openproject-org:api:v3:file-links:Error';diff --git a/frontend/src/global_styles/content/work_packages/shared/_file_list.sass b/frontend/src/global_styles/content/work_packages/shared/_file_list.sassindex 3067ee27a45..20fb319f633 100644--- a/frontend/src/global_styles/content/work_packages/shared/_file_list.sass+++ b/frontend/src/global_styles/content/work_packages/shared/_file_list.sass@@ -31,11 +31,14 @@&-actiontext-decoration: none+ &_disabled+ pointer-events: none+&:not(&_disabled):hover.op-file-list--item-title > :not(.spot-icon)text-decoration: underline- &-action_view-not-allowed &-title+ &-action_faulty-status &-titleopacity: 0.5&-titlediff --git a/modules/storages/app/models/storages/file_link.rb b/modules/storages/app/models/storages/file_link.rbindex abc7fa4bc55..150f7eaa6d7 100644--- a/modules/storages/app/models/storages/file_link.rb+++ b/modules/storages/app/models/storages/file_link.rb@@ -26,42 +26,21 @@# See COPYRIGHT and LICENSE files for more details.#++-# A FileLink represents a single file stored in some Storage-# (currently basically a Nextcloud store). Additional attributes-# and constraints are defined in db/migrate/20220113144759_create_file_links.rb-# FileLinks are attached to a "container", which currently has to-# be a WorkPackage.-#-# Purpose: The code below is a standard Ruby model:-# https://guides.rubyonrails.org/active_model_basics.html-# It defines defines checks and permissions on the Ruby level.-# Additional attributes and constraints are defined in-# db/migrate/20220113144759_create_file_links.rb migration.+# A FileLink represents a relation to a single file stored in some cloud file storage.+# Additional attributes and constraints are defined in db/migrate/20220113144759_create_file_links.rb+# FileLinks are attached to a "container", which currently has to be a WorkPackage.class Storages::FileLink < ApplicationRecord- # Every FileLink references its Storage. A "on delete cascade" is defined in- # the migration, so this FileLink will be deleted when deleting the Storage.belongs_to :storage-- # The object who created the FileLink should be of type User.belongs_to :creator, class_name: 'User'-- # FileLinks are attached to a container (currently a WorkPackage)- # Wieland: This needs to become more flexible in the futurebelongs_to :container, polymorphic: true- # Currently only WorkPackages are supported as containers for FileLinks- # For some reason this case is not handled in the belongs_to above.validates :container_type, inclusion: { in: ["WorkPackage", nil] }-- # origin_id is the Nextcloud ID of the file and should be valid.validates :origin_id, presence: true- # Is this file shared with me in Nextcloud?- # This attribute is _not_ to be stored in the DB- attr_writer :origin_permission+ attr_writer :origin_status- def origin_permission- @origin_permission || nil+ def origin_status+ @origin_status || nilenddelegate :project, to: :containerdiff --git a/modules/storages/app/services/storages/file_link_sync_service.rb b/modules/storages/app/services/storages/file_link_sync_service.rbindex 610db552e1f..cbf10178a1c 100644--- a/modules/storages/app/services/storages/file_link_sync_service.rb+++ b/modules/storages/app/services/storages/file_link_sync_service.rb@@ -58,10 +58,10 @@ class Storages::FileLinkSyncService.call(storage:, user: @user, file_ids: file_links.map(&:origin_id)).map { |file_infos| to_hash(file_infos) }.match(- on_success: set_file_link_permissions(file_links),+ on_success: set_file_link_status(file_links),on_failure: ->(_) {ServiceResult.success(result: file_links.map do |file_link|- file_link.origin_permission = :error+ file_link.origin_status = :errorfile_linkend)}@@ -72,7 +72,7 @@ class Storages::FileLinkSyncServicefile_infos.index_by { |file_info| file_info.id.to_s }.to_hend- def set_file_link_permissions(file_links)+ def set_file_link_status(file_links)->(file_infos) doresulting_file_links = []@@ -81,18 +81,15 @@ class Storages::FileLinkSyncServicecase file_info.status_codewhen 200- next if file_info.trashed-update_file_link(file_link, file_info)- file_link.origin_permission = :view+ file_link.origin_status = :view_allowedwhen 403- file_link.origin_permission = :not_allowed+ file_link.origin_status = :view_not_allowedwhen 404- file_link.destroy- next+ file_link.origin_status = :not_foundelse- file_link.origin_permission = :error+ file_link.origin_status = :errorendresulting_file_links << file_linkdiff --git a/modules/storages/config/locales/js-en.yml b/modules/storages/config/locales/js-en.ymlindex 8755e5ee13c..dea52558077 100644--- a/modules/storages/config/locales/js-en.yml+++ b/modules/storages/config/locales/js-en.yml@@ -56,7 +56,6 @@ en:Currently there are no linked files to this work package. Start linking files with the action below or fromwithin %{storageType}.download: "Download %{fileName}"- no_permission: "You have no permission to see this file."open: "Open file on storage"open_location: "Open file in location"remove: "Remove file link"@@ -91,6 +90,9 @@ en:contact your administrator for more information.link_uploaded_file_error: >An error occurred linking the recently uploaded file '%{fileName}' to the work package %{workPackageId}.- not_allowed_tooltip: "Please log in to Nextcloud to access this file"+ tooltip:+ not_logged_in: "Please log in to Nextcloud to access this file."+ view_not_allowed: "You have no permission to see this file."+ not_found: "This file cannot be found."already_linked_file: "This file is already linked to this work package."already_linked_directory: "This directory is already linked to this work package."diff --git a/modules/storages/lib/api/v3/file_links/file_link_representer.rb b/modules/storages/lib/api/v3/file_links/file_link_representer.rbindex 81ee7d26404..85bf00b127c 100644--- a/modules/storages/lib/api/v3/file_links/file_link_representer.rb+++ b/modules/storages/lib/api/v3/file_links/file_link_representer.rb@@ -27,21 +27,26 @@#++module API::V3::FileLinks- URN_PERMISSION_VIEW = "#{::API::V3::URN_PREFIX}file-links:permission:View".freeze- URN_PERMISSION_NOT_ALLOWED = "#{::API::V3::URN_PREFIX}file-links:permission:NotAllowed".freeze- URN_PERMISSION_ERROR = "#{::API::V3::URN_PREFIX}file-links:permission:Error".freeze+ URN_PERMISSION_VIEW = "#{::API::V3::URN_PREFIX}file-links:permission:ViewAllowed".freeze+ URN_PERMISSION_NOT_ALLOWED = "#{::API::V3::URN_PREFIX}file-links:permission:ViewNotAllowed".freeze+ URN_STATUS_NOT_FOUND = "#{::API::V3::URN_PREFIX}file-links:NotFound".freeze+ URN_STATUS_ERROR = "#{::API::V3::URN_PREFIX}file-links:Error".freezePERMISSION_LINKS = {- view: {+ view_allowed: {href: URN_PERMISSION_VIEW,- title: 'View'+ title: 'View allowed'},- not_allowed: {+ view_not_allowed: {href: URN_PERMISSION_NOT_ALLOWED,- title: 'Not allowed'+ title: 'View not allowed'+ },+ not_found: {+ href: URN_STATUS_NOT_FOUND,+ title: 'Not found'},error: {- href: URN_PERMISSION_ERROR,+ href: URN_STATUS_ERROR,title: 'Error'}}.freeze@@ -83,10 +88,10 @@ module API::V3::FileLinksend# Show a permission link only if we have actual permission information for a specific user- link :permission, uncacheable: true do- next if represented.origin_permission.nil?+ link :status, uncacheable: true do+ next if represented.origin_status.nil?- PERMISSION_LINKS[represented.origin_permission]+ PERMISSION_LINKS[represented.origin_status]endlink :staticOriginOpen do