Repository navigation
fix(app-shell): a member takes back their own comment reaction through the unreact door - #26384
Merged
Merged
Conversation
Claude-Session: https://claude.ai/code/session_01ADHkmPysaCwFvT4Pqb88z8 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmPysaCwFvT4Pqb88z8 Co-authored-by: Claude <noreply@anthropic.com>
… door Claude-Session: https://claude.ai/code/session_01ADHkmPysaCwFvT4Pqb88z8 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmPysaCwFvT4Pqb88z8 Co-authored-by: Claude <noreply@anthropic.com>
…-6tmyk6 # Conflicts: # scripts/sdui-manifest.sources/core.json
Contributor
Author
席位核对 · ACCEPT · seat
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Fixes #26346
Clause-②: no
Metadata-protocol: none
维护者速读
DELETE /api/v1/comments/reactions/:id,不再走通用数据删除接口;撤回按钮的权限判断不再要求delete授权。delete授权,而全员授权集按 ADR-0090 D5 不能带它。服务端那一半已在 PR fix(plugin-audit): a member removes their own comment reaction through an own-row unreact door #26345 落地。ui/packages/app-shell/src/views/RecordDetailView.tsx的handleToggleReaction里write的撤回分支;②ui/packages/core/src/utils/affordanceGrants.ts的feedReactionRemove行;③RecordDetailView.feedGrant-12082.test.tsx新增的 describe 块。pnpm --dir ui exec vitest run packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx,预期全绿,其中 "a member with no grant beyond create on sys_comment_reaction adds a reaction and takes it back" 断言请求打到/api/v1/comments/reactions/new-row、方法 DELETE。What changes
DELETE /api/v1/comments/reactions/:id(mounted by@objectstack/plugin-audit, server half in fix(plugin-audit): a member removes their own comment reaction through an own-row unreact door #26345), called through the page's existing authenticated fetch andVITE_SERVER_URLbase, the way the record page already reaches non-data routes. No body and no query parameter are sent. A non-2xx answer is a refused write: the existing settle step puts the reaction back and raises the one "Your reaction was not saved" toast. The genericDELETE /api/v1/data/sys_comment_reaction/:idis no longer called from the feed. No@objectstack/clientmethod is added.feedReactionRemoveinAFFORDANCE_GRANTSchanges value from{ crud: 'delete', grant: 'delete' }to{ crud: null, grant: 'create' }.crud: nullbecause the write no longer goes through the object's data door (the same meaning the attachment rows carry);grant: 'create'because the take-back is offered to whoever may react. The row's TYPE keeps its shape (AffordanceGrantRow, same two keys) andConsoleAffordancekeeps the same member set; no export is added or removed.groupReactionRowskeys on the row's server-stampeduser_id). A click on another member's chip adds the caller's own reaction.ui/content/docs/plugins/plugin-detail.mdxno longer says a take-back needs the delete grant.git rm, and CI's Build & E2E UI regenerates the manifest (sdui.manifest.jsonunchanged: 106 components).Tests
New regression cases (in
RecordDetailView.feedGrant-12082.test.tsx, describe "a take-back goes through the unreact door, and only on the caller's own reaction"):sys_comment_reactionadds 🎉 and clicks it again: one call to/api/v1/comments/reactions/new-rowwith{ method: 'DELETE', credentials: 'include' }, no data-door delete, and the chip goes away;toast.erroris raised once.Forced test edits:
ui/packages/app-shell/src/views/RecordDetailView.feedGrant-12082.test.tsx— the authenticated-fetch mock now returns a hoisted mock (it returned a barevi.fn()); "a take-back asks the delete grant … writes nothing" becomes "a take-back reads no delete grant … removes it through the unreact door"; the full-grant CONTROL and the registered-schema case assert the door's URL instead ofdataSource.delete(sys_comment_reaction, r1).ui/packages/plugin-form/src/affordanceGrantMap-12082.test.tsx—EXPECTED_GRANT.feedReactionRemoveis'create'; the write-census entryRecordDetailView > handleToggleReaction > write :: deleteis deleted, since that site no longer calls aDataSourcewrite (the census states it does not see a write through its own route, the same as the attachment upload).ui/packages/app-shell/src/views/RecordDetailView.reactionRecords-12078.test.tsx— not named in the dispatch; forced because its fake server asserted the take-back asdelete(sys_comment_reaction, id). The fake server now also models the unreact door per member (removes the member's own row,403on anyone else's), and the two take-back cases assert the removed ids at the door and thatdeleteis not called.Acceptance notes
created_by; the chip decides "mine" on the row'suser_id. Both are stamped server-side from the reacting session at create (the create hook stampsuser_id, the engine stampscreated_by), so they name the same member for every row made through the data door. Keying the chip oncreated_bywas not done here (it would move the read's grouping too); noted for the seat.feedReactionRemoverow now asks the same grant asfeedReactionAdd, and the reaction control is only handed over whenfeedReactionAddallows it, so on the records store the take-back is in practice decided by ownership alone, as the card asks.Verification
Tests and ablation
Commands and readings are in the os-dev-report on #26346, taken at this PR's head.
Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmPysaCwFvT4Pqb88z8