From bba0789a35840461b8b801c89448b202362a09f7 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 19 Aug 2026 11:56:44 +0000 Subject: [PATCH] :bug: Add membership-side test for share-link token visibility Add test coverage for the allow side of the share-link token filtering: team members and file owners should still see all share-links, while anonymous share-link holders only see their own token. This protects the (:type perms) = :share-link guard from accidental regression that could break the owner's share-link management dialog. AI-assisted-by: qwen3.7-plus --- backend/test/backend_tests/rpc_viewer_test.clj | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/backend/test/backend_tests/rpc_viewer_test.clj b/backend/test/backend_tests/rpc_viewer_test.clj index 8b4b2d2511..7e157a524e 100644 --- a/backend/test/backend_tests/rpc_viewer_test.clj +++ b/backend/test/backend_tests/rpc_viewer_test.clj @@ -188,4 +188,20 @@ (t/is (= link-a-id (:id (first share-links)))) ;; Should NOT see Link B's token - (t/is (not (some #(= link-b-id (:id %)) share-links))))))) + (t/is (not (some #(= link-b-id (:id %)) share-links))))) + + (t/testing "team member still sees all share-links" + (let [out (th/command! {::th/type :get-view-only-bundle + ::rpc/profile-id (:id owner) + :file-id (:id file)}) + err (:error out) + result (:result out) + share-links (:share-links result)] + + ;; Should not error + (t/is (nil? err)) + + ;; Team member should see both share-links + (t/is (= 2 (count share-links))) + (t/is (some #(= link-a-id (:id %)) share-links)) + (t/is (some #(= link-b-id (:id %)) share-links))))))