Federated board stacks return 500: getReadMark() called with null user in CardService::enrichCards()

Abierto Apto para principiantes
#8,721 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php
Área
api, backend

Línea de trabajo

El fallo está en CardService::enrichCards() en lib/Service/CardService.php, donde se llama a getReadMark() con un usuario null cuando una tarjeta tiene comentarios. Lee la firma de getReadMark() en el Comments Manager del núcleo de Nextcloud y luego busca dónde el endpoint de stacks construye el usuario para las solicitudes federadas. Está terminado cuando una solicitud sin usuario conectado devuelve el stack sin un TypeError y el recuento de comentarios no leídos se trata como 0 u omite.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Describe the bug
When a board is shared through Deck federation, the remote server's request for the board's stacks fails with HTTP 500 on the owning server whenever a card in the stack has comments. The owning server logs:

OC\Comments\Manager::getReadMark(): Argument #3 ($user) must be of type OCP\IUser, null given,
called in custom_apps/deck/lib/Service/CardService.php on line 88

The federated request (user agent Nextcloud-Server-Crawler/34.0.5) has no logged-in user, so $user is null. CardService::enrichCards() passes it straight to getReadMark() whenever $countComments > 0. The same line is unchanged on main.

On the remote server this surfaces as DeckFederationProxy exceptions (Server error: GET .../ocs/v2.php/apps/deck/api/v1.0/stacks/<id> resulted in a 500), and the federated board does not load for its users.

To Reproduce

  1. On server A, create a board with a stack containing a card that has at least one comment.
  2. Share the board with a user on server B via federation.
  3. As the user on server B, open the federated board.
  4. Server B logs a 500 from GET /ocs/v2.php/apps/deck/api/v1.0/stacks/<id> on server A; server A logs the getReadMark() TypeError above.

Expected behavior
Stacks load for federated users. Unread-comment counts could be skipped (or treated as 0) when there is no local user.

Suggested fix
In CardService::enrichCards(), only call getReadMark() when $user !== null:

$lastRead = ($countComments > 0 && $user !== null)
    ? $this->commentsManager->getReadMark('deckCard', (string)$card->getId(), $user)
    : null;
Server details
  • Nextcloud: 34.0.5 (official Docker image)
  • Deck: 1.18.5 on the owning server, 1.18.6 on the remote servers
  • Database: MariaDB 10.11
  • PHP: as shipped in nextcloud:34.0.5

Log entry on the owning server (trimmed):

"app":"deck","method":"GET","url":"/ocs/v2.php/apps/deck/api/v1.0/stacks/14",
"userAgent":"Nextcloud-Server-Crawler/34.0.5","version":"34.0.5.1",
"Exception":"Exception","Message":"OC\\Comments\\Manager::getReadMark(): Argument #3 ($user) must be of type OCP\\IUser, null given, called in /var/www/html/custom_apps/deck/lib/Service/CardService.php on line 88 in file '/var/www/html/lib/private/Comments/Manager.php' line 1437"

29 occurrences on the owning server in the last week.

Lenguaje dominante
JavaScript
Estrellas
1.4k
Forks
363
Merge medio
1 d 5 h
PR fusionados (30 d)
116

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de nextcloud/deck

Todos los issues de nextcloud/deck

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.