Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Migrate off the OCA.Viewer global before Nextcloud 36

Aperta Adatta ai principianti
#2,026 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, php
Ambito
backend

Direzione di ricerca

Inizia in lib/Controller/PageController.php, all’import e nel dispatch di LoadViewer intorno alle righe 18 e 71-72. Conferma che Notes non contenga chiamate JavaScript a OCA.Viewer, quindi rimuovi l’integrazione obsoleta del viewer e verifica che i check o i test del progetto abbiano esito positivo; il lavoro è completato quando qui non è più necessario alcun codice di abilitazione di LoadViewer o viewer-app.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Notes dispatches the viewer's load event:

  • lib/Controller/PageController.php:18: use OCA\Viewer\Event\LoadViewer;
  • lib/Controller/PageController.php:71: if (\OCP\Server::get(IAppManager::class)->isEnabledForUser('viewer') && class_exists(LoadViewer::class))
  • lib/Controller/PageController.php:72: $this->eventDispatcher->dispatchTyped(new LoadViewer())

[!NOTE]
This one is not urgent. The class_exists() guard means the dispatch is skipped rather than
fatal once the class is gone, so nothing breaks. It just becomes dead code, along with the
isEnabledForUser('viewer') check, since there is no viewer app to enable and importing
@nextcloud/viewer is what puts the viewer on a page now.

Notes does not call OCA.Viewer from javascript, so there is nothing else to port here.


OCA.Viewer is gone in Viewer 7.0.0. The viewer ships as the
@nextcloud/viewer library rather than a
bundled app, and nextcloud/server#63954 removes the viewer app from Nextcloud 36 altogether.

Roughly what it looks like:

import { canView, getViewer } from '@nextcloud/viewer'

// OCA.Viewer.open({ path }) / ({ fileInfo, list })
getViewer().open(nodes, file)          // @nextcloud/files nodes
getViewer().openFolder(folder, file)   // when a path is all you have, let it fetch

// OCA.Viewer.mimetypes.includes(mime) / availableHandlers
canView(node)

The part that is not a rename is that the viewer takes @nextcloud/files nodes now, not
fileinfo objects or path strings. Importing the package is also all it takes to get the viewer
onto the page: no LoadViewer event to dispatch, and nothing to check about whether the app is
enabled.

[!IMPORTANT]
There is no compatibility shim, which was a deliberate call, so this is a real port rather
than a rename. Nothing breaks until the server PR lands; after that these calls throw on
Nextcloud 36.

[!TIP]
The developer manual covers the migration under
Critical changes
(being added in nextcloud/documentation#15597), and the
README
has the full before/after table. Happy to help with the port, just ping me.

👾 This issue was written with the help of Claude Code.

Lingua principale
JavaScript
Stelle
738
Fork
162
Merge medio
2h 40m
PR unite (30g)
39

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nextcloud/notes

Tutte le issue di nextcloud/notes

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.