nextcloud / nextcloud/metavox

File Link: mark references whose target no longer resolves as "unavailable"

Open
#85 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

design enhancement
Dominant language
PHP
Stars
25
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Follow-up to #73 (observation 2 from @CedricWagner).

Problem

When a linked target is deleted (or otherwise no longer resolvable for the current user), its reference stays in the File Link field list — which is intentional (we do not prune on delete; see the reasoning in #73). But a dead entry currently looks identical to a live one, which is confusing.

Proposed fix (UI only, no event listening)

When a token's fileid does not resolve, render it in an explicit unavailable state instead of a normal clickable row:

  • greyed out, non-clickable name (fall back to the basename of the cached path so there is still a label),
  • a small "no longer available" hint/badge,
  • keep the remove (×) button so the user can clear it deliberately.

Implementation notes

  • The resolution already happens server-side via FileReferenceService::resolveMany(); a token is "unavailable" when its fileId is absent from the resolved map.
  • FileLinkFieldInput.vue already declares a resolved prop shaped [{ fileId, name, path, exists }], but exists is currently never populated/used. Wire that through: mark a token unavailable when there is no resolved entry for its id.
  • Backend (Application::resolveFilelinkNames() and the sidebar/grid resolve paths) currently returns only fileid => name for resolved ids. Expose enough for the frontend to distinguish "resolved" from "unresolved" (e.g. include the resolved-id set, or pass through exists).
  • Pure frontend + a small payload tweak — no CacheEntryRemovedEvent/move listeners.

Acceptance

  • A File Link row pointing at a deleted/inaccessible file shows as unavailable (greyed, "no longer available") and is not clickable.
  • The user can still remove it.
  • A live reference is unchanged.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with FileLinkFieldInput.vue and trace how its resolved prop is populated. Then inspect FileReferenceService::resolveMany(), Application::resolveFilelinkNames(), and the sidebar/grid resolution paths to preserve the distinction between resolved and unresolved IDs. Done means unavailable rows are greyed out and non-clickable with a hint, remain removable, and live references are unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
backend, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.