Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
Let Move up and Move down take a free posting time on the channel queue (#498)
Paulo Castellano1b06688dc253
diff --git a/resources/js/components/publish/PostCardMenu.vue b/resources/js/components/publish/PostCardMenu.vueindex 62218a929..e8b4fecee 100644--- a/resources/js/components/publish/PostCardMenu.vue+++ b/resources/js/components/publish/PostCardMenu.vue@@ -27,19 +27,26 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltipimport { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';import { postPermalink } from '@/lib/postNetwork';import { isRecurring } from '@/lib/recurrence';-import { PostStatus, ScheduleMode } from '@/types/post';+import { PostStatus } from '@/types/post';import type { PostCard, PostCardMenuAction } from '@/types/publish';const props = withDefaults(defineProps<{post: PostCard;testKey: string;+ canMoveToTop?: boolean;canMoveUp?: boolean;canMoveDown?: boolean;movable?: boolean;details?: boolean;}>(),- { canMoveUp: false, canMoveDown: false, movable: true, details: true },+ {+ canMoveToTop: false,+ canMoveUp: false,+ canMoveDown: false,+ movable: true,+ details: true,+ },);const emit = defineEmits<{ select: [action: PostCardMenuAction] }>();@@ -53,11 +60,10 @@ const isDraft = computed(() => props.post.status === PostStatus.Draft);const canRecur = computed(() => isScheduled.value && props.post.scheduled_at !== null,);-const isQueued = computed(+const isMovable = computed(() =>canPublishDirectly.value &&isScheduled.value &&- props.post.schedule_mode === ScheduleMode.Queue &&props.movable !== false,);</script>@@ -142,9 +148,10 @@ const isQueued = computed({{ $t('posts.publish.actions.copy_link') }}</DropdownMenuItem></template>- <template v-if="isQueued">+ <template v-if="isMovable"><DropdownMenuSeparator /><DropdownMenuItem+ :disabled="!canMoveToTop":data-testid="`post-move-top-${testKey}`"@click="emit('select', 'move_top')">diff --git a/resources/js/components/publish/PostTimelineCard.vue b/resources/js/components/publish/PostTimelineCard.vueindex 907e70b09..bdfeb97a6 100644--- a/resources/js/components/publish/PostTimelineCard.vue+++ b/resources/js/components/publish/PostTimelineCard.vue@@ -99,6 +99,7 @@ const props = withDefaults(post: PostCard;tab: PublishTab;displayTimezone: string;+ canMoveToTop?: boolean;canMoveUp?: boolean;canMoveDown?: boolean;draggable?: boolean;@@ -106,6 +107,7 @@ const props = withDefaults(movable?: boolean;}>(),{+ canMoveToTop: false,canMoveUp: false,canMoveDown: false,draggable: false,@@ -946,6 +948,7 @@ defineExpose({ openDetails });v-if="canCreatePost && !isPublishing":post="post":test-key="post.id"+ :can-move-to-top="canMoveToTop":can-move-up="canMoveUp":can-move-down="canMoveDown":movable="movable"diff --git a/resources/js/components/publish/QueueDayGroup.vue b/resources/js/components/publish/QueueDayGroup.vueindex 38ec52365..999f0a2fa 100644--- a/resources/js/components/publish/QueueDayGroup.vue+++ b/resources/js/components/publish/QueueDayGroup.vue@@ -130,6 +130,9 @@ const slotTarget = (item: QueueItem): QueueSlotTarget | null =>:post="posts[item.post_id]"tab="queue":display-timezone="displayTimezone"+ :can-move-to-top="+ positions[item.post_id]?.canMoveToTop ?? false+ ":can-move-up="positions[item.post_id]?.canMoveUp ?? false":can-move-down="positions[item.post_id]?.canMoveDown ?? falsediff --git a/resources/js/components/publish/QueueTimeline.vue b/resources/js/components/publish/QueueTimeline.vueindex 5537efd0d..19cd05d6b 100644--- a/resources/js/components/publish/QueueTimeline.vue+++ b/resources/js/components/publish/QueueTimeline.vue@@ -11,12 +11,14 @@ import {type SortableQueueItem,} from '@/composables/useSortableQueue';import dayjs from '@/dayjs';+import { blank, filled } from '@/lib/helpers';import { PostStatus, ScheduleMode } from '@/types/post';import type {PostCard,PostCardMove,PublishSocialAccount,QueueDay,+ QueueItem,QueuePostPosition,} from '@/types/publish';@@ -55,29 +57,75 @@ const { register, registerSlot, dropIndicator, slotDropKey } =onMoveToSlot: (postId, slot) => emit('moveToSlot', postId, slot),});-const channelQueues = computed<Record<string, string[]>>(() => {- const movableAfter = now.value.add(1, 'minute');- const queues: Record<string, string[]> = {};-- for (const item of props.days.flatMap((day) => day.items)) {- const post = item.post_id ? props.posts[item.post_id] : undefined;-- if (- post &&- post.status === PostStatus.Scheduled &&- post.schedule_mode === ScheduleMode.Queue &&- dayjs.utc(item.at).isAfter(movableAfter)- ) {- queues[item.channel_id] = [- ...(queues[item.channel_id] ?? []),- post.id,- ];+type QueueStep =+ | { kind: 'queued' | 'custom'; postId: string }+ | { kind: 'slot'; slot: QueueSlotTarget };++interface QueueMoves {+ hasStepAbove: boolean;+ up?: QueueStep;+ down?: QueueStep;+}++const items = computed<QueueItem[]>(() =>+ props.days.flatMap((day) => day.items),+);++const isMovable = (item: QueueItem): boolean =>+ dayjs.utc(item.at).isAfter(now.value.add(1, 'minute'));++const postOf = (item: QueueItem): PostCard | undefined =>+ filled(item.post_id) ? props.posts[item.post_id] : undefined;++const isFreeSlot = (item: QueueItem): boolean =>+ item.type === 'slot' && blank(item.post_id) && isMovable(item);++const toStep = (item: QueueItem): QueueStep | null => {+ const post = postOf(item);++ if (post) {+ return post.status === PostStatus.Scheduled && isMovable(item)+ ? {+ kind:+ post.schedule_mode === ScheduleMode.Queue+ ? 'queued'+ : 'custom',+ postId: post.id,+ }+ : null;+ }++ return isFreeSlot(item)+ ? { kind: 'slot', slot: { channelId: item.channel_id, at: item.at } }+ : null;+};++const channelSteps = computed<Record<string, QueueStep[]>>(() => {+ const steps: Record<string, QueueStep[]> = {};++ for (const item of items.value) {+ const step = toStep(item);++ if (step) {+ (steps[item.channel_id] ??= []).push(step);}}- return queues;+ return steps;});+const queuedPostIds = (steps: QueueStep[]): string[] =>+ steps.flatMap((step) => (step.kind === 'queued' ? [step.postId] : []));++const channelQueues = computed<Record<string, string[]>>(() =>+ Object.fromEntries(+ Object.entries(channelSteps.value).map(([channelId, steps]) => [+ channelId,+ queuedPostIds(steps),+ ]),+ ),+);+const channelOf = computed<Record<string, string>>(() =>Object.fromEntries(Object.entries(channelQueues.value).flatMap(([channelId, ids]) =>@@ -86,59 +134,97 @@ const channelOf = computed<Record<string, string>>(() =>),);-const positions = computed<Record<string, QueuePostPosition>>(() =>- Object.fromEntries(- Object.values(channelQueues.value).flatMap((ids) =>- ids.map((id, index) => [- id,- {- canMoveUp: props.reorderable && index > 0,- canMoveDown: props.reorderable && index < ids.length - 1,- },- ]),- ),- ),+const movesToSlots = computed<boolean>(+ () => props.slotDrop && props.reorderable,);+const isMovableStep = (step: QueueStep): boolean =>+ step.kind === 'queued' || (step.kind === 'custom' && movesToSlots.value);++const canTake = (step: QueueStep, target: QueueStep): boolean =>+ target.kind === 'slot'+ ? props.slotDrop+ : step.kind === 'queued' && target.kind === 'queued';++const moves = computed<Record<string, QueueMoves>>(() => {+ const byPost: Record<string, QueueMoves> = {};++ for (const steps of Object.values(channelSteps.value)) {+ steps.forEach((step, index) => {+ if (step.kind === 'slot' || !isMovableStep(step)) {+ return;+ }++ const above = steps.slice(0, index);+ const below = steps.slice(index + 1);+ const reachable = (target: QueueStep): boolean =>+ canTake(step, target);++ byPost[step.postId] = {+ hasStepAbove: above.some((target) => target.kind !== 'custom'),+ up: above.findLast(reachable),+ down: below.find(reachable),+ };+ });+ }++ return byPost;+});++const positions = computed<Record<string, QueuePostPosition>>(() => {+ const byPost: Record<string, QueuePostPosition> = {};++ for (const [postId, { hasStepAbove, up, down }] of Object.entries(+ moves.value,+ )) {+ byPost[postId] = {+ canMoveToTop: !props.reorderable || hasStepAbove,+ canMoveUp: props.reorderable && filled(up),+ canMoveDown: props.reorderable && filled(down),+ };+ }++ return byPost;+});+const draggables = computed<Record<string, SortableQueueItem>>(() => {if (!props.reorderable) {return {};}- const movableAfter = now.value.add(1, 'minute');- const items: Record<string, SortableQueueItem> = {};+ const draggable: Record<string, SortableQueueItem> = {};- for (const [channelId, ids] of Object.entries(channelQueues.value)) {- if (ids.length > 1 || props.slotDrop) {- for (const postId of ids) {- items[postId] = { postId, channelId, queued: true };+ for (const [channelId, steps] of Object.entries(channelSteps.value)) {+ const sortable = props.slotDrop || queuedPostIds(steps).length > 1;++ for (const step of steps) {+ if (step.kind === 'queued' && sortable) {+ draggable[step.postId] = {+ postId: step.postId,+ channelId,+ queued: true,+ };+ } else if (step.kind === 'custom' && props.slotDrop) {+ draggable[step.postId] = {+ postId: step.postId,+ channelId,+ queued: false,+ };}}}- if (!props.slotDrop) {- return items;- }+ return draggable;+});- for (const item of props.days.flatMap((day) => day.items)) {- const post = item.post_id ? props.posts[item.post_id] : undefined;-- if (- post &&- !(post.id in items) &&- post.status === PostStatus.Scheduled &&- dayjs.utc(item.at).isAfter(movableAfter)- ) {- items[post.id] = {- postId: post.id,- channelId: item.channel_id,- queued: false,- };- }- }+const swapQueuedPosts = (postId: string, otherPostId: string): void => {+ const channelId = channelOf.value[postId];+ const ids = [...channelQueues.value[channelId]];+ const [from, to] = [ids.indexOf(postId), ids.indexOf(otherPostId)];- return items;-});+ [ids[from], ids[to]] = [ids[to], ids[from]];+ emit('reorder', channelId, ids);+};const onMove = (post: PostCard, direction: PostCardMove): void => {if (direction === 'top') {@@ -146,17 +232,13 @@ const onMove = (post: PostCard, direction: PostCardMove): void => {return;}- const channelId = channelOf.value[post.id];- const ids = channelId ? [...channelQueues.value[channelId]] : [];- const index = ids.indexOf(post.id);- const swapWith = direction === 'up' ? index - 1 : index + 1;+ const neighbour = moves.value[post.id]?.[direction];- if (index === -1 || swapWith < 0 || swapWith >= ids.length) {- return;+ if (neighbour?.kind === 'slot') {+ emit('moveToSlot', post.id, neighbour.slot);+ } else if (neighbour?.kind === 'queued') {+ swapQueuedPosts(post.id, neighbour.postId);}-- [ids[index], ids[swapWith]] = [ids[swapWith], ids[index]];- emit('reorder', channelId, ids);};const loadMoreTimes = (): void => {diff --git a/resources/js/types/publish.ts b/resources/js/types/publish.tsindex 413721d07..d5b2c6d14 100644--- a/resources/js/types/publish.ts+++ b/resources/js/types/publish.ts@@ -111,6 +111,7 @@ export interface QueueDay {}export interface QueuePostPosition {+ canMoveToTop: boolean;canMoveUp: boolean;canMoveDown: boolean;}diff --git a/tests/Browser/PublishQueueTest.php b/tests/Browser/PublishQueueTest.phpindex 48e4c2638..ed59e4bc5 100644--- a/tests/Browser/PublishQueueTest.php+++ b/tests/Browser/PublishQueueTest.php@@ -15,6 +15,7 @@ use App\Models\Post;use App\Models\SocialAccount;use App\Models\User;use App\Models\Workspace;+use App\Models\WorkspaceLabel;use App\Support\PostingSchedule;use Carbon\CarbonInterface;@@ -174,6 +175,82 @@ test('move down from the card menu swaps a queued post with the next one', funct$page->assertNoJavaScriptErrors();});+test('move down from the card menu moves a queued post into the free posting time after it', function () {+ [$user, , $channel] = publishQueueSetup();+ $post = publishQueuePost($user, $channel);+ $post->update(['content' => 'Queued post']);+ [, $nextFree] = $channel->posting_schedule->nextSlots(now()->addMinute(), $channel->timezone, 2);+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));+ waitFor($page, '@queue-slot-'.publishQueueSlotKey($channel, $nextFree));+ $page->click("@post-card-menu-{$post->id}");+ waitForState($page, "@post-move-down-{$post->id}", "element.getAttribute('data-disabled') === null");+ $page->click("@post-move-down-{$post->id}");+ waitForDatabase($page, fn () => $post->refresh()->scheduled_at->equalTo($nextFree));++ expect($post->refresh()->scheduled_at->equalTo($nextFree))->toBeTrue()+ ->and($post->schedule_mode)->toBe(ScheduleMode::Queue);+ $page->assertNoJavaScriptErrors();+});++test('move up from the card menu moves a queued post into the free posting time before it', function () {+ [$user, , $channel] = publishQueueSetup();+ $first = publishQueuePost($user, $channel);+ $post = publishQueuePost($user, $channel);+ $post->update(['content' => 'Queued post']);+ $freed = $first->scheduled_at;+ $first->delete();+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));+ waitFor($page, '@queue-slot-'.publishQueueSlotKey($channel, $freed));+ $page->click("@post-card-menu-{$post->id}");+ waitForState($page, "@post-move-up-{$post->id}", "element.getAttribute('data-disabled') === null");+ $page->click("@post-move-up-{$post->id}");+ waitForDatabase($page, fn () => $post->refresh()->scheduled_at->equalTo($freed));++ expect($post->refresh()->scheduled_at->equalTo($freed))->toBeTrue()+ ->and($post->schedule_mode)->toBe(ScheduleMode::Queue);+ $page->assertNoJavaScriptErrors();+});++test('move to top is disabled for the first post of the queue and enabled below it', function () {+ [$user, , $channel] = publishQueueSetup();+ $first = publishQueuePost($user, $channel);+ $second = publishQueuePost($user, $channel);+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));+ $page->click("@post-card-menu-{$first->id}");+ waitForState($page, "@post-move-top-{$first->id}", "element.getAttribute('data-disabled') !== null");+ $page->assertAttribute("@post-move-top-{$first->id}", 'data-disabled', '')+ ->keys("@post-move-top-{$first->id}", 'Escape');+ waitForGone($page, "@post-move-top-{$first->id}");++ $page->click("@post-card-menu-{$second->id}");+ waitFor($page, "@post-move-top-{$second->id}");+ $page->assertAttributeMissing("@post-move-top-{$second->id}", 'data-disabled')+ ->assertNoJavaScriptErrors();+});++test('move to top is enabled when a free posting time comes before the post', function () {+ [$user, , $channel] = publishQueueSetup();+ $first = publishQueuePost($user, $channel);+ $post = publishQueuePost($user, $channel);+ $freed = $first->scheduled_at;+ $first->delete();+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));+ waitFor($page, '@queue-slot-'.publishQueueSlotKey($channel, $freed));+ $page->click("@post-card-menu-{$post->id}");+ waitFor($page, "@post-move-top-{$post->id}");++ $page->assertAttributeMissing("@post-move-top-{$post->id}", 'data-disabled')+ ->assertNoJavaScriptErrors();+});+test('dragging a queued post above another reorders the queue', function () {[$user, , $channel] = publishQueueSetup();$a = publishQueuePost($user, $channel);@@ -379,6 +456,153 @@ function publishQueueCustomPost(User $user, SocialAccount $channel, CarbonInterfreturn $post;}+test('move up from the card menu moves a custom-time post into the free posting time before it', function () {+ [$user, , $channel] = publishQueueSetup();+ [$freeAbove, $slot] = $channel->posting_schedule->nextSlots(now()->addMinute(), $channel->timezone, 2);+ $custom = publishQueueCustomPost($user, $channel, $slot);+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));+ waitFor($page, '@queue-slot-'.publishQueueSlotKey($channel, $freeAbove));+ $page->click("@post-card-menu-{$custom->id}");+ waitFor($page, "@post-move-top-{$custom->id}");+ $page->assertAttributeMissing("@post-move-top-{$custom->id}", 'data-disabled')+ ->assertAttributeMissing("@post-move-down-{$custom->id}", 'data-disabled')+ ->click("@post-move-up-{$custom->id}");+ waitForDatabase($page, fn () => $custom->refresh()->scheduled_at->equalTo($freeAbove));++ expect($custom->refresh()->scheduled_at->equalTo($freeAbove))->toBeTrue()+ ->and($custom->schedule_mode)->toBe(ScheduleMode::Queue);+ $page->assertNoJavaScriptErrors();+});++/**+ * @return array{top: string, up: string, down: string}+ */+function publishQueueMoveActions(mixed $page, Post $post): array+{+ $page->click("@post-card-menu-{$post->id}");+ waitForOpen($page, "@post-card-menu-content-{$post->id}");++ $states = $page->script("['top', 'up', 'down'].map((action) => { const item = document.querySelector('[data-testid=\"post-move-' + action + '-{$post->id}\"]'); return item === null ? 'missing' : (item.hasAttribute('data-disabled') ? 'disabled' : 'enabled'); })");++ $page->keys("@post-card-menu-content-{$post->id}", 'Escape');+ waitForGone($page, "@post-card-menu-content-{$post->id}");++ return array_combine(['top', 'up', 'down'], $states);+}++test('move down from the card menu skips a custom-time post on the way to a free posting time', function () {+ [$user, , $channel] = publishQueueSetup();+ [, $customAt, $nextFree] = $channel->posting_schedule->nextSlots(now()->addMinute(), $channel->timezone, 3);+ $queued = publishQueuePost($user, $channel);+ $queued->update(['content' => 'Queued post']);+ $custom = publishQueueCustomPost($user, $channel, $customAt);+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));+ waitFor($page, '@queue-slot-'.publishQueueSlotKey($channel, $nextFree));+ $page->click("@post-card-menu-{$queued->id}");+ waitForState($page, "@post-move-down-{$queued->id}", "element.getAttribute('data-disabled') === null");+ $page->click("@post-move-down-{$queued->id}");+ waitForDatabase($page, fn () => $queued->refresh()->scheduled_at->equalTo($nextFree));++ expect($queued->refresh()->scheduled_at->equalTo($nextFree))->toBeTrue()+ ->and($custom->refresh()->scheduled_at->equalTo($customAt))->toBeTrue()+ ->and($custom->schedule_mode)->toBe(ScheduleMode::Custom);+ $page->assertNoJavaScriptErrors();+});++test('with the posting times hidden, the ends of the queue cannot move past them', function () {+ [$user, , $channel] = publishQueueSetup();+ $first = publishQueuePost($user, $channel);+ $last = publishQueuePost($user, $channel);+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));+ waitFor($page, "@post-card-{$last->id}");+ $page->click('@publish-menu');+ waitFor($page, '@publish-toggle-slots');+ $page->click('@publish-toggle-slots');+ waitForGone($page, '[data-testid^="queue-slot-"]');++ expect(publishQueueMoveActions($page, $first))->toBe(['top' => 'disabled', 'up' => 'disabled', 'down' => 'enabled'])+ ->and(publishQueueMoveActions($page, $last))->toBe(['top' => 'enabled', 'up' => 'enabled', 'down' => 'disabled']);+ $page->assertNoJavaScriptErrors();+});++test('on the list of all channels, the ends of the queue cannot move further and a custom-time post has no move actions', function () {+ [$user, , $channel] = publishQueueSetup();+ [, , $customAt] = $channel->posting_schedule->nextSlots(now()->addMinute(), $channel->timezone, 3);+ $first = publishQueuePost($user, $channel);+ $last = publishQueuePost($user, $channel);+ $custom = publishQueueCustomPost($user, $channel, $customAt->addDay());+ connectAiTo($user);+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.posts.index'));+ waitFor($page, "@post-card-{$custom->id}");++ expect(publishQueueMoveActions($page, $first))->toBe(['top' => 'disabled', 'up' => 'disabled', 'down' => 'enabled'])+ ->and(publishQueueMoveActions($page, $last))->toBe(['top' => 'enabled', 'up' => 'enabled', 'down' => 'disabled'])+ ->and(publishQueueMoveActions($page, $custom))->toBe(['top' => 'missing', 'up' => 'missing', 'down' => 'missing']);+ $page->assertNoJavaScriptErrors();+});++test('move down from the card menu moves a custom-time post into the free posting time after it', function () {+ [$user, , $channel] = publishQueueSetup();+ [$slot, $freeBelow] = $channel->posting_schedule->nextSlots(now()->addMinute(), $channel->timezone, 2);+ $custom = publishQueueCustomPost($user, $channel, $slot);+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));+ waitFor($page, '@queue-slot-'.publishQueueSlotKey($channel, $freeBelow));++ expect(publishQueueMoveActions($page, $custom))->toBe(['top' => 'disabled', 'up' => 'disabled', 'down' => 'enabled']);++ $page->click("@post-card-menu-{$custom->id}");+ waitFor($page, "@post-move-down-{$custom->id}");+ $page->click("@post-move-down-{$custom->id}");+ waitForDatabase($page, fn () => $custom->refresh()->scheduled_at->equalTo($freeBelow));++ expect($custom->refresh()->scheduled_at->equalTo($freeBelow))->toBeTrue()+ ->and($custom->schedule_mode)->toBe(ScheduleMode::Queue);+ $page->assertNoJavaScriptErrors();+});++test('move to top from the card menu puts a custom-time post first in the queue', function () {+ [$user, , $channel] = publishQueueSetup();+ [$freeAbove, $slot] = $channel->posting_schedule->nextSlots(now()->addMinute(), $channel->timezone, 2);+ $custom = publishQueueCustomPost($user, $channel, $slot);+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', $channel));+ waitFor($page, '@queue-slot-'.publishQueueSlotKey($channel, $freeAbove));+ $page->click("@post-card-menu-{$custom->id}");+ waitForState($page, "@post-move-top-{$custom->id}", "element.getAttribute('data-disabled') === null");+ $page->click("@post-move-top-{$custom->id}");+ waitForDatabase($page, fn () => $custom->refresh()->scheduled_at->equalTo($freeAbove));++ expect($custom->refresh()->scheduled_at->equalTo($freeAbove))->toBeTrue()+ ->and($custom->schedule_mode)->toBe(ScheduleMode::Queue);+ $page->assertNoJavaScriptErrors();+});++test('with a label filter, move to top stays available on the first post shown', function () {+ [$user, $workspace, $channel] = publishQueueSetup();+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id]);+ publishQueuePost($user, $channel);+ $labelled = publishQueuePost($user, $channel);+ $labelled->labels()->attach($label);+ $this->actingAs($user);++ $page = publishQueueVisitWithCleanStorage(route('app.channels.publish', ['account' => $channel, 'labels' => [$label->id]]));+ waitFor($page, "@post-card-{$labelled->id}");++ expect(publishQueueMoveActions($page, $labelled))->toBe(['top' => 'enabled', 'up' => 'disabled', 'down' => 'disabled']);+ $page->assertNoJavaScriptErrors();+});+function publishQueueFollows(mixed $page, string $firstTestId, string $secondTestId): bool{return (bool) $page->script("(document.querySelector('[data-testid=\"{$firstTestId}\"]').compareDocumentPosition(document.querySelector('[data-testid=\"{$secondTestId}\"]')) & Node.DOCUMENT_POSITION_FOLLOWING) > 0");