Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Add an "Attachments" source to the block inserter's Media tab, listing images attached to the current post with the ability to attach and detach them ([#79336](https://github.com/WordPress/gutenberg/pull/79336)).

### Enhancements

- Notes: Remove the snackbar notice shown when a note is resolved or reopened, as the note's appearance already updates in place to reflect the change ([#80017](https://github.com/WordPress/gutenberg/pull/80017)).

### Bug Fixes

- External images are now sideloaded on the server when uploaded to the media library, via a new `mediaSideloadFromUrl` block editor setting, so the upload works when the editor is cross-origin isolated (e.g. with client-side media processing enabled) ([#79409](https://github.com/WordPress/gutenberg/pull/79409)).
Expand Down
20 changes: 6 additions & 14 deletions packages/editor/src/components/collab-sidebar/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,6 @@ export function useNoteActions() {
};

const onEdit = async ( { id, content, status } ) => {
const messageType = status ? status : 'updated';
const messages = {
approved: __( 'Note marked as resolved.' ),
hold: __( 'Note reopened.' ),
updated: __( 'Note updated.' ),
};

try {
// For resolution or reopen actions, create a new note with metadata.
if ( status === 'approved' || status === 'hold' ) {
Expand Down Expand Up @@ -429,16 +422,15 @@ export function useNoteActions() {
await saveEntityRecord( 'root', 'comment', updateData, {
throwOnError: true,
} );
}

createNotice(
'snackbar',
messages[ messageType ] ?? __( 'Note updated.' ),
{
// Resolving or reopening a note visibly updates the note in
// place, so those actions don't need a snackbar; only surface
// one when a note's content is edited.
Comment thread
Mamaduka marked this conversation as resolved.
Resolved
createNotice( 'snackbar', __( 'Note updated.' ), {
type: 'snackbar',
isDismissible: true,
}
);
} );
}
} catch ( error ) {
onError( error );
}
Expand Down
43 changes: 8 additions & 35 deletions test/e2e/specs/editor/various/block-notes.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ test.describe( 'Block Notes', () => {

const resolveButton = page.getByRole( 'button', { name: 'Resolve' } );
await resolveButton.click();
await expect(
page
.getByRole( 'button', { name: 'Dismiss this notice' } )
.filter( { hasText: 'Note marked as resolved.' } )
).toBeVisible();
await expect( thread ).toBeFocused();
await expect( thread ).toHaveAttribute( 'aria-expanded', 'false' );

Expand All @@ -181,11 +176,6 @@ test.describe( 'Block Notes', () => {

await blockNoteUtils.clickBlockNoteActionMenuItem( 'Reopen' );
await expect( resolveButton ).toBeEnabled();
await expect(
page
.getByRole( 'button', { name: 'Dismiss this notice' } )
.filter( { hasText: 'Note reopened.' } )
).toBeVisible();
} );

test( 'can reopen a resolved note when adding a reply', async ( {
Expand All @@ -200,14 +190,11 @@ test.describe( 'Block Notes', () => {

const resolveButton = page.getByRole( 'button', { name: 'Resolve' } );
await resolveButton.click();
await expect(
page
.getByRole( 'button', { name: 'Dismiss this notice' } )
.filter( { hasText: 'Note marked as resolved.' } )
).toBeVisible();

await blockNoteUtils.openBlockNoteSidebar();
await page.locator( '.editor-collab-sidebar-panel__thread' ).click();
// Re-selecting the thread shows the Resolve button, now disabled,
// confirming the note was resolved.
await expect( resolveButton ).toBeDisabled();
const commentForm = page.getByRole( 'textbox', { name: 'Reply to' } );
await commentForm.fill( 'Test reply that reopens the comment.' );
Expand All @@ -217,11 +204,6 @@ test.describe( 'Block Notes', () => {
.click();

await expect( resolveButton ).toBeEnabled();
await expect(
page
.getByRole( 'button', { name: 'Dismiss this notice' } )
.filter( { hasText: 'Note reopened.' } )
).toBeVisible();
} );

test( 'selecting a block or note marks it as an active', async ( {
Expand Down Expand Up @@ -1008,11 +990,9 @@ test.describe( 'Block Notes', () => {
} );
await threadA.click();
await page.getByRole( 'button', { name: 'Resolve' } ).click();
await expect(
page
.getByRole( 'button', { name: 'Dismiss this notice' } )
.filter( { hasText: 'Note marked as resolved.' } )
).toBeVisible();
// Resolving removes the note from the floating "Unresolved notes"
// view, which confirms the action completed.
await expect( threadA ).toBeHidden();

// Note B should still be visible and unresolved (expanded).
const threadB = settings.getByRole( 'treeitem', {
Expand Down Expand Up @@ -1051,11 +1031,9 @@ test.describe( 'Block Notes', () => {
} );
await firstThread.click();
await page.getByRole( 'button', { name: 'Resolve' } ).click();
await expect(
page
.getByRole( 'button', { name: 'Dismiss this notice' } )
.filter( { hasText: 'Note marked as resolved.' } )
).toBeVisible();
// Resolving removes the note from the floating "Unresolved notes"
// view, which confirms the action completed.
await expect( firstThread ).toBeHidden();

// Click the title to deselect the block and its comment.
await editor.canvas
Expand Down Expand Up @@ -1360,11 +1338,6 @@ test.describe( 'Block Notes', () => {
// Resolving drops the highlight, so the marker is removed from the
// content and the note settles back to a block-level note.
await page.getByRole( 'button', { name: 'Resolve' } ).click();
await expect(
page
.getByRole( 'button', { name: 'Dismiss this notice' } )
.filter( { hasText: 'Note marked as resolved.' } )
).toBeVisible();

await expect( editor.canvas.locator( 'mark.wp-note' ) ).toHaveCount(
0
Expand Down
Loading