fix(#571): a grant is not a link, and shared-with-me gets its own list #582
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-571sv"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Backend for the tabbed Shares view — and a latent defect that was already shipped.
The defect.
FileStore.List(ctx, createdBy)filters on the creator and nothing else, so from the moment the first grant exists,GET /api/v1/sharesreturns grants mixed in with links. Every row then goes throughtoResp, which buildsstrings.TrimSuffix(base,"/") + "/s/" + s.Token. A grant has no token — so the existing Shares view would render a row with an empty path after/s/and a Copy button handing over a URL that resolves to nothing.Nobody would have seen this until someone made a grant and opened Shares.
TestShareListDistinguishesGrantsFromLinksnow pins it: a grant carries nourl, and carriesaddressee,roleand theidneeded to revoke it.toRespreturns early for a grant rather than filling in link fields it does not have.tokenandurlgainedomitemptyso a grant does not ship empty strings that look like a broken link.GET /api/v1/sharedanswers "what has been shared with me": the grants addressed to the caller, directly or through any of their groups, via theshare.GrantsForfan-in that already deduplicates.Each row carries
vpath—/shared/<owner>/<name>— so the view navigates to the real overlay path instead of rebuilding that string itself. It also carriesaddresseeKindandaddressee, because a grant held through a group behaves differently from one addressed to you: leave the group and it goes. Saying so in the list is the honest answer to "where did that file go?" later.The
/sharedoverlay still resolves all of this as a real tree; this endpoint exists so the view asks once rather than once per owner.Red witnessed on the runner before any of it existed.
Verified: three new API tests green, full Go suite green,
go build ./...green, all ten web tests green.