diff --git a/.github/changelog/add-pre-publish-tags-hint b/.github/changelog/add-pre-publish-tags-hint new file mode 100644 index 0000000000..5bcda89ac2 --- /dev/null +++ b/.github/changelog/add-pre-publish-tags-hint @@ -0,0 +1,4 @@ +Significance: minor +Type: added + +Before publishing, the tag and post format suggestions now explain what tags and formats do on the Fediverse. diff --git a/build/pre-publish-panel/plugin.asset.php b/build/pre-publish-panel/plugin.asset.php index 92fe809fdd..f74e7e5a18 100644 --- a/build/pre-publish-panel/plugin.asset.php +++ b/build/pre-publish-panel/plugin.asset.php @@ -3,12 +3,14 @@ 'react-jsx-runtime', 'wp-block-editor', 'wp-components', + 'wp-core-data', 'wp-data', 'wp-dom', 'wp-editor', 'wp-element', + 'wp-hooks', 'wp-i18n', 'wp-plugins' ), - 'version' => '8bf8219b700555911ae5' + 'version' => 'a6df243d59adf493fc82' ); diff --git a/build/pre-publish-panel/plugin.js b/build/pre-publish-panel/plugin.js index 23ea2053ed..74039584b0 100644 --- a/build/pre-publish-panel/plugin.js +++ b/build/pre-publish-panel/plugin.js @@ -1,3 +1,6 @@ -(()=>{"use strict";const t=window.wp.editor,e=window.wp.blockEditor,o=window.wp.plugins,i=window.wp.components,n=window.wp.data,a=window.wp.element,s=window.wp.i18n,r=window.wp.dom,u=window._activityPubOptions?.noteLength||500,l=["youtube","vimeo","dailymotion","tiktok","videopress"],d=["spotify","soundcloud","mixcloud"],c=["core/paragraph","core/heading","core/list-item","core/preformatted","core/verse","core/pullquote"],p=["core/gallery","jetpack/tiled-gallery","jetpack/slideshow"],g={gallery:(0,s.__)("Gallery","activitypub"),video:(0,s.__)("Video","activitypub"),audio:(0,s.__)("Audio","activitypub"),image:(0,s.__)("Image","activitypub"),status:(0,s.__)("Status","activitypub")},m=(t,e)=>"core/pullquote"===t?e?.value||"":e?.content||"",h=t=>{const e={imageCount:0,galleryCount:0,videoCount:0,audioCount:0,textLength:0,textBlockCount:0};if(!t||!t.length)return e;for(const o of t){const{name:t,attributes:i,innerBlocks:n}=o;if("core/image"===t)e.imageCount++;else if(p.includes(t))e.galleryCount++;else if("core/video"===t)e.videoCount++;else if("core/audio"===t)e.audioCount++;else if("core/embed"===t){const t=(i?.providerNameSlug||"").toLowerCase();l.includes(t)?e.videoCount++:d.includes(t)&&e.audioCount++}if(c.includes(t)){const o=(0,r.__unstableStripHTML)(m(t,i));e.textLength+=o.length,e.textBlockCount++}if(n&&n.length){const t=h(n);e.imageCount+=t.imageCount,e.galleryCount+=t.galleryCount,e.videoCount+=t.videoCount,e.audioCount+=t.audioCount,e.textLength+=t.textLength,e.textBlockCount+=t.textBlockCount}}return e},v=window.ReactJSXRuntime;(0,o.registerPlugin)("activitypub-pre-publish",{render:()=>{const{blocks:o,postFormat:r}=(0,n.useSelect)(o=>({blocks:o(e.store).getBlocks(),postFormat:o(t.store).getEditedPostAttribute("format")}),[]),{editPost:l}=(0,n.useDispatch)(t.store),d=(0,a.useMemo)(()=>((t,e)=>{if(e&&"standard"!==e)return null;const o=h(t),i=o.imageCount>0||o.galleryCount>0||o.videoCount>0||o.audioCount>0;return(o.galleryCount>0||o.imageCount>1)&&o.textLength0&&o.textLength0&&o.textLength0&&o.textLength<280&&o.textBlockCount<=3?{format:"status",message:(0,s.__)("This is a short post with no media. Changing the format to Status won't change your post content, but will share it as a Note on the Fediverse, which is the standard format on platforms like Mastodon.","activitypub")}:null})(o,r),[o,r]);if("wordpress-post-format"!==window._activityPubOptions?.objectType)return null;if(!d){if(r&&"standard"!==r&&g[r]){const e=g[r]||r;return(0,v.jsx)(t.PluginPrePublishPanel,{title:(0,s.__)("Fediverse ⁂","activitypub"),initialOpen:!0,children:(0,v.jsx)("p",{children:(0,s.sprintf)(/* translators: %s: The current post format name (e.g., "Image", "Gallery", "Video"). */ /* translators: %s: The current post format name (e.g., "Image", "Gallery", "Video"). */ -(0,s.__)("This post will be shared in %s format on the Fediverse.","activitypub"),e)})})}return null}return(0,v.jsxs)(t.PluginPrePublishPanel,{title:(0,s.__)("Fediverse ⁂","activitypub"),initialOpen:!0,children:[(0,v.jsx)("p",{children:d.message}),(0,v.jsx)(i.Button,{variant:"secondary",onClick:()=>l({format:d.format}),children:(0,s.sprintf)(/* translators: %s: The suggested post format name (e.g., "Image", "Gallery", "Video"). */ /* translators: %s: The suggested post format name (e.g., "Image", "Gallery", "Video"). */ -(0,s.__)("Set format to %s","activitypub"),g[d.format]||d.format)})]})}})})(); \ No newline at end of file +(()=>{"use strict";const t=window.wp.editor,e=window.wp.blockEditor,o=window.wp.coreData,i=window.wp.plugins,s=window.wp.components,a=window.wp.data,n=window.wp.element,r=window.wp.hooks,u=window.wp.i18n,l=window.wp.dom,d=window._activityPubOptions?.noteLength||500,p=["youtube","vimeo","dailymotion","tiktok","videopress"],c=["spotify","soundcloud","mixcloud"],h=["core/paragraph","core/heading","core/list-item","core/preformatted","core/verse","core/pullquote"],m=["core/gallery","jetpack/tiled-gallery","jetpack/slideshow"],g={gallery:(0,u.__)("Gallery","activitypub"),video:(0,u.__)("Video","activitypub"),audio:(0,u.__)("Audio","activitypub"),image:(0,u.__)("Image","activitypub"),status:(0,u.__)("Status","activitypub")},f=(t,e)=>"core/pullquote"===t?e?.value||"":e?.content||"",w=t=>{const e={imageCount:0,galleryCount:0,videoCount:0,audioCount:0,textLength:0,textBlockCount:0};if(!t||!t.length)return e;for(const o of t){const{name:t,attributes:i,innerBlocks:s}=o;if("core/image"===t)e.imageCount++;else if(m.includes(t))e.galleryCount++;else if("core/video"===t)e.videoCount++;else if("core/audio"===t)e.audioCount++;else if("core/embed"===t){const t=(i?.providerNameSlug||"").toLowerCase();p.includes(t)?e.videoCount++:c.includes(t)&&e.audioCount++}if(h.includes(t)){const o=(0,l.__unstableStripHTML)(f(t,i));e.textLength+=o.length,e.textBlockCount++}if(s&&s.length){const t=w(s);e.imageCount+=t.imageCount,e.galleryCount+=t.galleryCount,e.videoCount+=t.videoCount,e.audioCount+=t.audioCount,e.textLength+=t.textLength,e.textBlockCount+=t.textBlockCount}}return e},y=window.ReactJSXRuntime,v=(0,y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,y.jsx)("text",{x:"12",y:"18",fontSize:"18",textAnchor:"middle",fill:"currentColor",children:"⁂"})});(0,r.addFilter)("i18n.gettext_default","activitypub/tags-suggestion",(t,e)=>{if("Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling."===e&&"wordpress-post-format"===window._activityPubOptions?.objectType)return t+" "+(0,u.__)(/* translators: Appended to the editor's post format suggestion, after "Your theme uses post formats […]". */ +"The format also changes how your post is shared on the Fediverse.","activitypub");if("%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post."!==e)return t;let o=(0,u.__)(/* translators: Appended to the editor's tag suggestion, after "Tags help users and search engines navigate your site […]". */ +"Tags are also shared as hashtags, which help people on the Fediverse find your post.","activitypub");return window._activityPubOptions?.useHashtags&&(o+=" "+/* translators: Appended after the previous sentence. "#hashtag" stands for a word written with a leading # in the post content. */ /* translators: Appended after the previous sentence. "#hashtag" stands for a word written with a leading # in the post content. */ +(0,u.__)("Any #hashtag you write in your post is added as a tag too.","activitypub")),t+" "+o.replace(/%/g,"%%")}),(0,i.registerPlugin)("activitypub-pre-publish",{icon:v,render:()=>{const{blocks:i,postFormat:r,coreSuggestsFormat:l}=(0,a.useSelect)(i=>{const s=i(t.store).getEditedPostAttribute("format"),a=i(t.store).getSuggestedPostFormat(),n=i(o.store).getThemeSupports()?.formats??[];return{blocks:i(e.store).getBlocks(),postFormat:s,coreSuggestsFormat:!!a&&n.includes(a)&&a!==s}},[]),{editPost:p}=(0,a.useDispatch)(t.store),c=(0,n.useMemo)(()=>((t,e)=>{if(e&&"standard"!==e)return null;const o=w(t),i=o.imageCount>0||o.galleryCount>0||o.videoCount>0||o.audioCount>0;return(o.galleryCount>0||o.imageCount>1)&&o.textLength0&&o.textLength0&&o.textLength0&&o.textLength<280&&o.textBlockCount<=3?{format:"status",message:(0,u.__)("This is a short post without media. With the Status format, it is shared as a short post on the Fediverse, the way posts look on platforms like Mastodon. Your post content stays the same.","activitypub")}:null})(i,r),[i,r]);if("wordpress-post-format"!==window._activityPubOptions?.objectType)return null;if(!c){if(r&&"standard"!==r&&g[r]){const e=g[r]||r;return(0,y.jsx)(t.PluginPrePublishPanel,{title:(0,u.__)("Post format","activitypub"),initialOpen:!0,children:(0,y.jsx)("p",{children:(0,u.sprintf)(/* translators: %s: The current post format name (e.g., "Image", "Gallery", "Video"). */ /* translators: %s: The current post format name (e.g., "Image", "Gallery", "Video"). */ +(0,u.__)("This post will be shared in %s format on the Fediverse.","activitypub"),e)})})}return null}return l?null:(0,y.jsxs)(t.PluginPrePublishPanel,{title:[(0,u.__)("Suggestion:","activitypub"),(0,y.jsx)("span",{className:"editor-post-publish-panel__link",children:(0,u.__)("Use a post format","activitypub")},"label")],initialOpen:!1,children:[(0,y.jsx)("p",{children:c.message}),(0,y.jsx)("p",{children:(0,y.jsx)(s.Button,{__next40pxDefaultSize:!0,variant:"link",onClick:()=>p({format:c.format}),children:(0,u.sprintf)(/* translators: %s: The suggested post format name (e.g., "Image", "Gallery", "Video"). */ /* translators: %s: The suggested post format name (e.g., "Image", "Gallery", "Video"). */ +(0,u.__)('Apply the "%s" format.',"activitypub"),g[c.format]||c.format)})})]})}})})(); \ No newline at end of file diff --git a/includes/class-blocks.php b/includes/class-blocks.php index 7f7864d9ab..d18430e7e0 100644 --- a/includes/class-blocks.php +++ b/includes/class-blocks.php @@ -115,6 +115,7 @@ public static function enqueue_editor_assets() { 'noteLength' => ACTIVITYPUB_NOTE_LENGTH, 'statsImageUrlEndpoint' => Stats_Image::is_available() ? \get_rest_url( null, ACTIVITYPUB_REST_NAMESPACE . '/stats/image-url/{user_id}/{year}' ) : '', 'reactionTypes' => self::get_reaction_types(), + 'useHashtags' => '1' === \get_option( 'activitypub_use_hashtags', '0' ), ); \wp_localize_script( 'wp-editor', '_activityPubOptions', $data ); diff --git a/package-lock.json b/package-lock.json index ebebbd339a..a2006363ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ "@wordpress/editor": "^16.1.0", "@wordpress/element": "^10.0.0", "@wordpress/env": "^12.1.0", + "@wordpress/hooks": "^5.1.0", "@wordpress/html-entities": "^5.0.0", "@wordpress/i18n": "^7.0.0", "@wordpress/icons": "^20.0.0", diff --git a/package.json b/package.json index beb614173d..f7bc9c0068 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "@wordpress/editor": "^16.1.0", "@wordpress/element": "^10.0.0", "@wordpress/env": "^12.1.0", + "@wordpress/hooks": "^5.1.0", "@wordpress/html-entities": "^5.0.0", "@wordpress/i18n": "^7.0.0", "@wordpress/icons": "^20.0.0", diff --git a/src/pre-publish-panel/__tests__/plugin.test.js b/src/pre-publish-panel/__tests__/plugin.test.js index 13802a874a..6a747acc12 100644 --- a/src/pre-publish-panel/__tests__/plugin.test.js +++ b/src/pre-publish-panel/__tests__/plugin.test.js @@ -5,7 +5,55 @@ // Set up the global options before importing utils, so NOTE_LENGTH picks up the value. window._activityPubOptions = { noteLength: 500 }; +import { render, screen } from '@testing-library/react'; +import { registerPlugin } from '@wordpress/plugins'; +import { applyFilters } from '@wordpress/hooks'; +import { __, sprintf } from '@wordpress/i18n'; import { analyzeBlocks, getSuggestedPostFormat } from '../utils'; +import '../plugin'; + +// The editor state the panels read, changed per test. +let mockEditorState; + +jest.mock( '@wordpress/plugins', () => ( { registerPlugin: jest.fn() } ) ); + +jest.mock( '@wordpress/editor', () => ( { + PluginPrePublishPanel: ( { title, children } ) => ( +
+

{ title }

+ { children } +
+ ), + PostTaxonomiesFlatTermSelector: ( { slug } ) =>
, + store: 'core/editor', +} ) ); + +jest.mock( '@wordpress/components', () => ( { + Button: ( { children, onClick } ) => , +} ) ); + +jest.mock( '@wordpress/block-editor', () => ( { store: 'core/block-editor' } ) ); + +jest.mock( '@wordpress/core-data', () => ( { store: 'core' } ) ); + +jest.mock( '@wordpress/data', () => ( { + useDispatch: () => ( { editPost: jest.fn() } ), + useSelect: ( callback ) => + callback( ( store ) => { + if ( 'core/block-editor' === store ) { + return { getBlocks: () => mockEditorState.blocks ?? [] }; + } + + if ( 'core' === store ) { + return { getThemeSupports: () => ( { formats: mockEditorState.themeFormats ?? [] } ) }; + } + + return { + getEditedPostAttribute: ( attribute ) => mockEditorState.attributes[ attribute ], + getSuggestedPostFormat: () => mockEditorState.coreSuggestion ?? null, + }; + } ), +} ) ); describe( 'analyzeBlocks', () => { test( 'returns all zeros for empty blocks', () => { @@ -397,3 +445,132 @@ describe( 'getSuggestedPostFormat', () => { expect( result.format ).toBe( 'gallery' ); } ); } ); + +describe( 'Tags suggestion', () => { + const Panels = () => { + const { render: Render } = registerPlugin.mock.calls[ 0 ][ 1 ]; + return ; + }; + + const coreText = + '%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'; + + beforeEach( () => { + window._activityPubOptions = { noteLength: 500 }; + mockEditorState = { attributes: {} }; + } ); + + test( 'marks the panels with the asterism icon', () => { + const { container } = render( registerPlugin.mock.calls[ 0 ][ 1 ].icon ); + + expect( container.querySelector( 'svg text' ) ).toHaveTextContent( '⁂' ); + } ); + + test( 'renders no panel of its own', () => { + render( ); + + expect( screen.queryByTestId( 'pre-publish-panel' ) ).toBeNull(); + } ); + + test( 'adds a note on hashtags to core suggestion text', () => { + // Core's call, through the default i18n instance. + expect( + sprintf( + /* translators: %s: The taxonomy name. */ + __( + '%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post.' + ), + 'Tags' + ) + ).toBe( + 'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post. Tags are also shared as hashtags, which help people on the Fediverse find your post.' + ); + } ); + + test( 'adds a note on hashtags to the suggestion text before WordPress 6.9', () => { + expect( + __( + 'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.' + ) + ).toBe( + 'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post. Tags are also shared as hashtags, which help people on the Fediverse find your post.' + ); + } ); + + test( 'mentions hashtags in the content when they are enabled', () => { + window._activityPubOptions.useHashtags = true; + + expect( sprintf( applyFilters( 'i18n.gettext_default', coreText, coreText, undefined ), 'Tags' ) ).toMatch( + /Any #hashtag you write in your post is added as a tag too\.$/ + ); + } ); + + test( 'leaves other core strings alone', () => { + expect( __( 'Add a few keywords to describe your post.' ) ).toBe( 'Add a few keywords to describe your post.' ); + } ); +} ); + +describe( 'Post format suggestion text', () => { + const coreText = + 'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'; + + test( 'adds a note on the Fediverse when the format sets the object type', () => { + window._activityPubOptions = { objectType: 'wordpress-post-format' }; + + // Core's call, through the default i18n instance. + expect( + __( + 'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.' + ) + ).toBe( `${ coreText } The format also changes how your post is shared on the Fediverse.` ); + } ); + + test( 'leaves the text alone when the format does not set the object type', () => { + window._activityPubOptions = { objectType: 'note' }; + + expect( applyFilters( 'i18n.gettext_default', coreText, coreText, undefined ) ).toBe( coreText ); + } ); +} ); + +describe( 'Post format panel', () => { + const Panels = () => { + const { render: Render } = registerPlugin.mock.calls[ 0 ][ 1 ]; + return ; + }; + + beforeEach( () => { + window._activityPubOptions = { noteLength: 500, objectType: 'wordpress-post-format' }; + mockEditorState = { + attributes: { format: 'standard' }, + blocks: [ { name: 'core/image', attributes: {}, innerBlocks: [] } ], + }; + } ); + + test( 'titles a format suggestion as a suggestion', () => { + render( ); + + expect( screen.getByRole( 'heading' ) ).toHaveTextContent( 'Suggestion:Use a post format' ); + } ); + + test( 'titles the confirmation of a set format as the post format', () => { + mockEditorState.attributes.format = 'image'; + render( ); + + expect( screen.getByRole( 'heading' ) ).toHaveTextContent( /^Post format$/ ); + } ); + + test( 'leaves the suggestion to core when core suggests a format', () => { + mockEditorState.coreSuggestion = 'image'; + mockEditorState.themeFormats = [ 'image' ]; + render( ); + + expect( screen.queryByTestId( 'pre-publish-panel' ) ).toBeNull(); + } ); + + test( "suggests a format when the theme does not support core's suggestion", () => { + mockEditorState.coreSuggestion = 'image'; + render( ); + + expect( screen.getByRole( 'heading' ) ).toHaveTextContent( 'Suggestion:Use a post format' ); + } ); +} ); diff --git a/src/pre-publish-panel/plugin.js b/src/pre-publish-panel/plugin.js index e99d6a6b72..0be3cb97df 100644 --- a/src/pre-publish-panel/plugin.js +++ b/src/pre-publish-panel/plugin.js @@ -1,25 +1,47 @@ import { PluginPrePublishPanel, store as editorStore } from '@wordpress/editor'; import { store as blockEditorStore } from '@wordpress/block-editor'; +import { store as coreStore } from '@wordpress/core-data'; import { registerPlugin } from '@wordpress/plugins'; import { Button } from '@wordpress/components'; import { useSelect, useDispatch } from '@wordpress/data'; import { useMemo } from '@wordpress/element'; +import { addFilter } from '@wordpress/hooks'; import { __, sprintf } from '@wordpress/i18n'; import { getSuggestedPostFormat, FORMAT_LABELS } from './utils'; +/** + * The asterism, the icon that marks the plugin's panels. + * + * @type {React.JSX.Element} + */ +const asterism = ( + +); + /** * Pre-publish panel that suggests a post format for better federation. * * Only renders when the object type setting is 'wordpress-post-format' and * the post content suggests a better format than the default Article. + * A suggestion is left out while core's own post format suggestion shows. * * @return {React.JSX.Element|null} The pre-publish panel or null. */ const PrePublishPanel = () => { - const { blocks, postFormat } = useSelect( ( selectFn ) => { + const { blocks, postFormat, coreSuggestsFormat } = useSelect( ( selectFn ) => { + const format = selectFn( editorStore ).getEditedPostAttribute( 'format' ); + const coreFormat = selectFn( editorStore ).getSuggestedPostFormat(); + const themeFormats = selectFn( coreStore ).getThemeSupports()?.formats ?? []; + return { blocks: selectFn( blockEditorStore ).getBlocks(), - postFormat: selectFn( editorStore ).getEditedPostAttribute( 'format' ), + postFormat: format, + // Same check as core's own "Use a post format" suggestion. + coreSuggestsFormat: !! coreFormat && themeFormats.includes( coreFormat ) && coreFormat !== format, }; }, [] ); @@ -37,7 +59,7 @@ const PrePublishPanel = () => { if ( postFormat && postFormat !== 'standard' && FORMAT_LABELS[ postFormat ] ) { const formatLabel = FORMAT_LABELS[ postFormat ] || postFormat; return ( - +

{ sprintf( /* translators: %s: The current post format name (e.g., "Image", "Gallery", "Video"). */ @@ -52,18 +74,99 @@ const PrePublishPanel = () => { return null; } + // Core already suggests a post format, a second suggestion would repeat it. + if ( coreSuggestsFormat ) { + return null; + } + return ( - + + { __( 'Use a post format', 'activitypub' ) } + , + ] } + initialOpen={ false } + >

{ suggestion.message }

- +

+ +

); }; -registerPlugin( 'activitypub-pre-publish', { render: PrePublishPanel } ); +/** + * The text of core's tags suggestion, which gets a note on hashtags. + * + * @type {string} + */ +const CORE_TAGS_TEXT = + '%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'; + +/** + * The text of core's tags suggestion before WordPress 6.9, which names the taxonomy itself. + * + * @type {string} + */ +const CORE_TAGS_TEXT_BEFORE_6_9 = + 'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'; + +/** + * The text of core's post format suggestion, which gets a note on the Fediverse. + * + * @type {string} + */ +const CORE_FORMAT_TEXT = + 'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'; + +addFilter( 'i18n.gettext_default', 'activitypub/tags-suggestion', ( translation, text ) => { + // Core's format suggestion replaces the plugin's own, so it says what the format does on the Fediverse. + if ( CORE_FORMAT_TEXT === text && window._activityPubOptions?.objectType === 'wordpress-post-format' ) { + return ( + translation + + ' ' + + __( + /* translators: Appended to the editor's post format suggestion, after "Your theme uses post formats […]". */ + 'The format also changes how your post is shared on the Fediverse.', + 'activitypub' + ) + ); + } + + if ( CORE_TAGS_TEXT !== text && CORE_TAGS_TEXT_BEFORE_6_9 !== text ) { + return translation; + } + + let note = __( + /* translators: Appended to the editor's tag suggestion, after "Tags help users and search engines navigate your site […]". */ + 'Tags are also shared as hashtags, which help people on the Fediverse find your post.', + 'activitypub' + ); + + if ( window._activityPubOptions?.useHashtags ) { + note += + ' ' + + /* translators: Appended after the previous sentence. "#hashtag" stands for a word written with a leading # in the post content. */ + __( 'Any #hashtag you write in your post is added as a tag too.', 'activitypub' ); + } + + // Since 6.9 core fills in the taxonomy name with sprintf(), so a percent sign in the note must stay literal. + return translation + ' ' + ( CORE_TAGS_TEXT === text ? note.replace( /%/g, '%%' ) : note ); +} ); + +registerPlugin( 'activitypub-pre-publish', { + icon: asterism, + render: PrePublishPanel, +} ); diff --git a/src/pre-publish-panel/utils.js b/src/pre-publish-panel/utils.js index 422d5c68b0..621848c79f 100644 --- a/src/pre-publish-panel/utils.js +++ b/src/pre-publish-panel/utils.js @@ -164,7 +164,7 @@ export const getSuggestedPostFormat = ( blocks, currentFormat ) => { return { format: 'gallery', message: __( - "This post contains multiple images. Changing the format to Gallery won't change your post content, but will share it as a media post on the Fediverse, making it visible on platforms like Pixelfed.", + 'This post contains multiple images. With the Gallery format, it is shared as a media post on the Fediverse and shows up on platforms like Pixelfed. Your post content stays the same.', 'activitypub' ), }; @@ -175,7 +175,7 @@ export const getSuggestedPostFormat = ( blocks, currentFormat ) => { return { format: 'video', message: __( - "This post contains a video. Changing the format to Video won't change your post content, but will share it as a media post on the Fediverse, improving compatibility with video-focused platforms.", + 'This post contains a video. With the Video format, it is shared as a media post on the Fediverse and works better on video platforms. Your post content stays the same.', 'activitypub' ), }; @@ -186,7 +186,7 @@ export const getSuggestedPostFormat = ( blocks, currentFormat ) => { return { format: 'audio', message: __( - "This post contains audio content. Changing the format to Audio won't change your post content, but will share it as a media post on the Fediverse, improving compatibility with audio-focused platforms.", + 'This post contains audio. With the Audio format, it is shared as a media post on the Fediverse and works better on audio platforms. Your post content stays the same.', 'activitypub' ), }; @@ -202,7 +202,7 @@ export const getSuggestedPostFormat = ( blocks, currentFormat ) => { return { format: 'image', message: __( - "This post contains an image. Changing the format to Image won't change your post content, but will share it as a media post on the Fediverse, making it visible on platforms like Pixelfed.", + 'This post contains an image. With the Image format, it is shared as a media post on the Fediverse and shows up on platforms like Pixelfed. Your post content stays the same.', 'activitypub' ), }; @@ -213,7 +213,7 @@ export const getSuggestedPostFormat = ( blocks, currentFormat ) => { return { format: 'status', message: __( - "This is a short post with no media. Changing the format to Status won't change your post content, but will share it as a Note on the Fediverse, which is the standard format on platforms like Mastodon.", + 'This is a short post without media. With the Status format, it is shared as a short post on the Fediverse, the way posts look on platforms like Mastodon. Your post content stays the same.', 'activitypub' ), };