Skip to content

Extract the composer's destination checks into useDestinationIssues #415

Open

Description

@paulocastellano

Context

resources/js/components/posts/composer/PostComposerDialog.vue is about 3,500 lines. The checks that decide whether a destination can be scheduled are plain script with no template, around lines 1309–1487:

  • destinationIssues(account): media warnings, the Instagram image aspect ratio, text and hashtags over the account's limit, missing required settings, and empty or too long thread replies (with their media).
  • groupIssues(group) / groupIssueLabel(group): the deduplicated count shown on each network card.
  • blockingIssue / hasBlockingIssues: what disables the submit button and fills its tooltip.
  • metaRequirement(account), SET_MEDIA_WARNINGS and setMediaWarning(account).

They depend on composition.resolvedDestination(), props.platformConfigs, and the limit helpers remainingCharacters (~L1032), replyLimit (~L1069) and remainingHashtags (~L1289).

This was left in place on purpose to keep #406 focused.

Proposal

  • Move these into resources/js/composables/composer/useDestinationIssues.ts, taking the composition and the platform configs as arguments, and move the three limit helpers with them if nothing else in the dialog needs them.
  • Keep the DestinationIssue type next to the composable.
  • No behaviour change: the composer browser tests (tests/Browser/PostComposerDialogTest.php, ComposerNetworkCardsTest.php, ComposerChannelSettingsTest.php, ComposerMediaTrayTest.php) must pass untouched.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions