Federated board stacks return 500: getReadMark() called with null user in CardService::enrichCards()
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
The crash is in CardService::enrichCards() in lib/Service/CardService.php, where getReadMark() is called with a null user when a card has comments. Read the Comments Manager getReadMark() signature in Nextcloud core, then find where the stacks endpoint builds the user for federated requests. Done when a request without a logged-in user returns the stack without a TypeError, and the unread-comment count is handled as 0 or skipped.
Written by the indexing model from the issue text.
Description
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
- On server A, create a board with a stack containing a card that has at least one comment.
- Share the board with a user on server B via federation.
- As the user on server B, open the federated board.
- Server B logs a 500 from
GET /ocs/v2.php/apps/deck/api/v1.0/stacks/<id>on server A; server A logs thegetReadMark()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.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 363
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 116
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud/deck
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
DeckProvider::setSubjects() overwrites IEvent subject with translated sentence → InvalidValueException, Deck bell notifications silently droppedPossibly taken @tcarrondo claimed this 11 days ago. Open0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
nextcloud/deck#8591 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
CSV export leaves trailing commas in tags and assigned-user fieldsPossibly taken @Kumar-s75 claimed this 61 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
nextcloud/deck#8361 · 1 reaction ·
Maintainers usually reply within 1 day
-
Board clone API failure is treated as a successful board responsePossibly taken @Kumar-s75 claimed this 61 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
Similar issues
-
status: ready
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
melodic-software/claude-code-plugins#15008 · 1 comment ·
Maintainers usually reply within 1 day
-
S-Needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
ACK_WAITING HELP_WANTED UPDATE_CS
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
OWASP/CheatSheetSeries#2935 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
docs-external-links-failure
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ComposioHQ/composio#5297 ·
Maintainers usually reply within 1 day