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

Đang mở Phù hợp với người mới
#8,721 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
api, backend

Hướng nghiên cứu

Lỗi xảy ra trong CardService::enrichCards() ở lib/Service/CardService.php, nơi getReadMark() được gọi với người dùng null khi một thẻ có bình luận. Hãy đọc chữ ký của getReadMark() trong Comments Manager của lõi Nextcloud, sau đó tìm xem endpoint stacks tạo người dùng cho các yêu cầu liên hợp ở đâu. Hoàn thành khi một yêu cầu không có người dùng đăng nhập trả về stack mà không có TypeError, và số bình luận chưa đọc được xử lý là 0 hoặc bỏ qua.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
1.4k
Fork
363
Merge trung bình
1 ngày 5 giờ
Pull request đã merge (30 ngày)
116

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nextcloud/deck

Tất cả issue của nextcloud/deck

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.