Skip to content

Commit ce92ba1

Browse files
committed
test(record-page): the phone's sheet after #36200: ✓ on any thread read, Delete behind the own-comment door (#36076)
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgTfxZyB5T41DdoPaBy
1 parent ebc1df7 commit ce92ba1

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

‎.changeset/36076-phone-comment-page.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ On a phone the record page's top bar gains the comments icon, with the number of
1616
- The comment box is docked at the foot of the screen and stands on the keyboard while it is up. One line until tapped; then a row under the text holds mention, bold, italic, list and code, and send at the right end. In the list it writes a comment, in a thread a reply. No 「Ctrl+Enter」 hint.
1717
- A long press on a comment (or its context menu) raises a sheet from the bottom: six reactions, 「标记已解决」 on a thread's first comment, 「编辑」 and 「删除」 (red, confirmed first), each offered exactly where the desktop's hover row offers it.
1818
- The filter at the top right is the desktop's: 「显示已解决」 and 「只看我参与的」.
19-
- The 动态 tab holds the system entries alone, as on the desktop. On a phone the comments live on this page: this replaces the line of the record comment panel's entry (objectstack#36075) that said the phone keeps them in its 动态 tab.
19+
- The 动态 tab holds the system entries alone, as on the desktop. On a phone the comments live on this page: this replaces the lines of the two objectstack#36075 entries (the record comment panel, and resolved threads) that said the phone keeps the comments in its 动态 tab, or keeps its feed as before.
2020
- The page is in the URL (`?comments=` for the list, `?comments=<id>` for a thread), so a link or a reload opens it where it was.
2121

2222
Unchanged: the desktop; who may write, resolve, edit or delete a comment (the phone offers each exactly where the desktop does); a record page authored in full and an object with `enable.feeds: false` show no icon.

‎ui/packages/plugin-detail/src/comments/CommentsPage.test.tsx‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,30 @@ describe('CommentsPage — the long press', () => {
280280
fireEvent.click(el);
281281
const rows = () =>
282282
Array.from(sheet()!.querySelectorAll('[data-comment-action]')).map((row) => row.getAttribute('data-comment-action'));
283-
// Grace's comment, before the host has its answer: the viewer moderates, so Delete only.
284-
expect(rows()).toEqual(['delete']);
285-
// The answer lands with the sheet still up.
283+
// Grace's comment, before the host has its answer: Mark resolved (any
284+
// thread the viewer reads, objectstack#36186) and Delete (the viewer moderates).
285+
expect(rows()).toEqual(['resolve', 'delete']);
286+
// The answer lands with the sheet still up: Edit of another's comment joins.
286287
rerender(view(true));
287288
expect(rows()).toEqual(['resolve', 'edit', 'delete']);
288289
fireEvent.click(sheet()!.querySelector('[data-comment-action="resolve"]')!);
289290
expect(writes.onResolveComment).toHaveBeenCalledWith('c2', true);
290291
});
291292

293+
it("behind the own-comment delete door (objectstack#36191) Delete is offered on the viewer's own comment with no reply only", () => {
294+
renderPage({ threadId: 'c1' }, { ownCommentDeletesOnly: true, moderatesComments: true });
295+
const rowsOf = (id: string) => {
296+
hold(commentEl(id));
297+
return Array.from(sheet()!.querySelectorAll('[data-comment-action]')).map((el) => el.getAttribute('data-comment-action'));
298+
};
299+
// The viewer's own reply: Delete.
300+
expect(rowsOf('r2')).toContain('delete');
301+
// The viewer's own comment with replies under it: the door keeps it.
302+
expect(rowsOf('c1')).not.toContain('delete');
303+
// Grace's reply: not the viewer's, so no Delete even though they moderate.
304+
expect(rowsOf('r1')).not.toContain('delete');
305+
});
306+
292307
it('a read-only discussion raises no sheet and docks no box', () => {
293308
render(
294309
<DiscussionContextProvider items={ITEMS as any[]}>

0 commit comments

Comments
 (0)