mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(post-menu): add Report/Delete, reorder buttons, edit-only-for-mods, copy link 5chan.app (#1089)
* Update crypto address UI for .bso accounts * feat(post-menu): add Report/Delete, reorder buttons, edit-only-for-mods, copy link 5chan.app - Remove redundant reason field from edit menu (purged posts unreachable) - Add Report post (placeholder alert) and Delete post (mobile) to post menus - Reorder: Report, Hide, Delete, Copy x3, Image search - Mobile edit checkbox only for mods; authors use Delete in post menu - Copy direct link always uses 5chan.app domain - 10px margin-top on mod menu save button * fix(post-menu): add confirmation before delete post (Bugbot)
This commit is contained in:
@@ -29,7 +29,10 @@ vi.mock('react-i18next', () => ({
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({}));
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
|
||||
useAccount: () => ({ author: { address: '0xmod' }, signer: { address: '0xauthor' } }),
|
||||
usePublishCommentEdit: () => ({ publishCommentEdit: vi.fn().mockResolvedValue(undefined) }),
|
||||
}));
|
||||
|
||||
vi.mock('@bitsocialnet/bitsocial-react-hooks/dist/lib/localforage-lru/index.js', () => ({
|
||||
default: {
|
||||
@@ -172,10 +175,10 @@ describe('PostMenuMobile', () => {
|
||||
container.remove();
|
||||
});
|
||||
|
||||
it('opens the mobile menu, copies share metadata, and shows edit controls for privileged users', async () => {
|
||||
it('opens the mobile menu, copies share metadata, and shows edit controls for mods', async () => {
|
||||
testState.privileges = {
|
||||
isAccountCommentAuthor: true,
|
||||
isAccountMod: false,
|
||||
isAccountMod: true,
|
||||
};
|
||||
|
||||
await renderMenu('/mu');
|
||||
@@ -203,12 +206,16 @@ describe('PostMenuMobile', () => {
|
||||
expect(testState.hideMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('shows edit controls on pseudonymous boards even without a local author-address match', async () => {
|
||||
it('does not show edit controls on pseudonymous boards when user is not a mod', async () => {
|
||||
testState.pseudonymityMode = 'per-post';
|
||||
testState.privileges = {
|
||||
isAccountCommentAuthor: false,
|
||||
isAccountMod: false,
|
||||
};
|
||||
|
||||
await renderMenu('/mu');
|
||||
|
||||
expect(document.body.querySelector('[data-testid="edit-menu"]')?.textContent).toBe('cid-1');
|
||||
expect(document.body.querySelector('[data-testid="edit-menu"]')).toBeNull();
|
||||
});
|
||||
|
||||
it("does not show edit controls when pseudonymity mode is 'none' and the user lacks privileges", async () => {
|
||||
|
||||
Reference in New Issue
Block a user