Skip to content

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.

Instagram music, collaborators and trial reels (#406)

Paulo Castellano0d717d839135
diff --git a/.agents/skills/in-app-copy/SKILL.md b/.agents/skills/in-app-copy/SKILL.md
new file mode 100644
index 000000000..b3445a8b8
--- /dev/null
+++ b/.agents/skills/in-app-copy/SKILL.md
@@ -0,0 +1,146 @@
+---
+name: in-app-copy
+description: "Use this skill to write, rewrite or review any text the end user reads inside the TryPost app: lang keys in lang/*/*.php, labels, buttons, tabs, menu items, tooltips, popovers that ask for an action, empty states, dialogs and confirmations, errors, validation messages, toasts, settings descriptions and onboarding steps. Trigger on requests like 'improve this text', 'rewrite this popover', 'this copy is bad', 'review the product copy', 'translate this key', or any new UI string. Covers the three-step pattern for action prompts, tone, per-component rules, the 16-locale workflow and a review checklist. Not for marketing pages, emails' visual layout or AI prompts (see copywriting, the Maizzle rules and the AI agents rules)."
+metadata:
+ author: trypost
+---
+
+# In-app copy
+
+Text inside TryPost talks to someone who is in the middle of doing something: scheduling a post, connecting a channel, fixing an error. Every string exists to help them finish that task. Write from their side of the screen, never from how the system is built.
+
+This guide is the reference for writing new copy and for reviewing existing copy. The short version lives in `AGENTS.md` ("Writing in-app copy"); this skill holds the detail, the examples and the sources.
+
+## The core pattern: a prompt that asks the user to act
+
+When the UI stops the user and asks them to do something first (a popover, an empty state with a button, a blocking dialog, a tooltip on a disabled control), write it in three steps, in this order (owner decision, October 2026):
+
+1. **What is missing, in the user's words, addressed to them.** State the situation as it affects them.
+2. **Why it matters for what they just tried.** Tie it to the click that opened the prompt, not to how the feature works in general.
+3. **The next action, named by its button.** The body leads to the button; the button says exactly what happens. Always keep a way out.
+
+### Reference example: the queue setup popover
+
+Shown by `resources/js/components/publish/AddToQueueButton.vue` when someone clicks "Add to queue" on a channel without posting times (`posts.publish.actions.queue_setup`).
+
+Before (rejected):
+
+> **Set up the queue first**
+> This channel has no posting times yet. Add them, and every post you add to the queue takes the next free one.
+
+Also rejected (explains the mechanism before saying what is missing):
+
+> **When should this channel post?**
+> Posts in the queue go out at this channel's posting times, and it doesn't have any yet. Choose them once, and every post you add takes the next open time.
+
+After (approved):
+
+> **You haven't set up this channel's queue yet**
+> To add posts to the queue, set this channel's posting times. Each queued post goes out at the next open time.
+> [Not now] [Set posting times]
+
+For a member who cannot set posting times, same title, and the body names who can:
+
+> To add posts to the queue, a workspace admin needs to set this channel's posting times.
+
+Never show a button the user cannot use.
+
+## Tone and voice
+
+- **Talk to the user.** "You", "your channel", "your posts". Not "the user", not passive constructions that hide who acts.
+- **Lead with the point.** The first words carry the message; someone who reads only the title should know what is going on.
+- **Short.** A title and one or two sentences. A tooltip under about 80 characters. If a sentence explains how the system works before saying what to do, cut it or move it after.
+- **Plain words.** Name things by what the user sees, not by the code: "posting times", not "slots"; "channel", not "social account" or "destination"; "settings", not "meta".
+- **Direction, not mood.** No apologies ("Sorry"), no "please", no "Oops", no blame ("You entered an invalid…"). Say what happened and what to do.
+- **Active and specific verbs.** "Save changes", not "Submit". "Set posting times", not "Configure". "Connect through Facebook", not "Continue".
+- **No filler or generic warnings.** No "This action cannot be undone" line on everyday confirmations (see the delete rules in `AGENTS.md`). No "Are you sure?" as the only content.
+
+## Per component
+
+### Buttons, menu items, tabs, badges
+
+- Verb + object for actions: "Add to queue", "Copy link", "Remove music". A noun alone only for navigation tabs ("Queue", "Drafts").
+- **One action, one name, everywhere.** The button that says "Publish" leads to a toast or state that says "Published". The tab "Queue", the button "Add to queue" and a prompt about "the queue" use the same word.
+- Single line in every locale. Add the key to `tests/fixtures/single-line-copy.php` with the length of its longest translation (see "Translated copy must fit its UI slot" in `AGENTS.md`).
+
+### Tooltips
+
+- Add what the label does not say: the consequence, the scope, a shortcut. If the tooltip repeats the label, drop it.
+- A tooltip on a disabled control says why it is disabled and what unlocks it ("Wait for uploads to finish").
+- Nothing essential lives only in a tooltip: touch screens and keyboards may never show it.
+
+### Popovers and prompts that ask for an action
+
+Use the three-step pattern above. One prompt, one action; a way out ("Not now", "Maybe later") next to it. Cancel first, primary action last (`AGENTS.md`, "Dialog and slide-over actions").
+
+### Empty states
+
+Two different empty states (see "Empty states on list pages" in `AGENTS.md`):
+
+- **First use** (nothing exists yet): say what will live here and give the one action that creates it, for example (illustrative) "No labels yet. Labels group posts so you can filter them." + [Create label].
+- **No results** (a search or filter found nothing): say that nothing matched and how to widen it. "No posts match your search. Try a different keyword or clear the search." No create button.
+
+Never a bare "Nothing here".
+
+### Dialogs and confirmations
+
+- The title states the action and its object: "Delete this post?", "Discard changes?".
+- The body states what will be removed or lost, and nothing more.
+- The destructive button repeats the verb ("Delete", "Discard"), never "OK" or "Yes".
+- Typing to confirm only for the critical actions listed in `AGENTS.md`.
+
+### Errors and validation
+
+- Say what happened and how to fix it, in the interface's voice: "Couldn't load music from Instagram. Try again." "Enter a valid Instagram username."
+- Name the field or the limit with its value: "Add up to 3 collaborators."
+- When the network rejects something, say which network and what it needs: "Music needs an Instagram account connected through Facebook."
+- Never "Something went wrong" alone, never raw codes or exception text.
+
+### Toasts and success feedback
+
+- No success toast after creating, editing, deleting or copying everyday resources: the visible change (a new row, an inline check) is the feedback (owner decision, September 2026). Errors still toast.
+- When a toast is needed, it names the result in the past tense of the action: "Added to queue" after "Add to queue".
+
+### Settings descriptions and helper text
+
+- The line under a settings page title stays on one line in every locale.
+- Helper text under a field explains the effect of the setting, not its name.
+
+## Localization (16 locales)
+
+Every string ships in `lang/{ar,de,el,en,es,fr,it,ja,ko,nl,pl,pt-BR,ru,tr,uk,zh}`. `LocalizationParityTest` fails when a key is missing in one.
+
+- **Same structure, written natively.** Keep the three steps and the meaning; do not translate word for word.
+- **Reuse each locale's existing word** for the feature: queue is "fila", "Warteschlange", "file", "cola", "kolejka"; posting times is "horários de postagem", "Posting-Zeiten", "horaires de publication". Search the locale's file before choosing a term.
+- **Grammatical gender.** When "you haven't…" needs a gendered form for the user (Polish, Russian past tense in some phrasings, Arabic), rephrase impersonally: Polish "Kolejka tego kanału nie jest jeszcze skonfigurowana" ("This channel's queue isn't set up yet").
+- **Longest locale decides the layout.** French, German, Ukrainian, Russian, Polish and Portuguese usually run longest. Shorten the copy in that locale rather than letting a control wrap.
+- **Placeholders** (`:network`, `:count`, `:username`) stay in every locale; plurals use `trans_choice` with a `[0,*]` last segment.
+- Resolve UI keywords with `$t` in templates (see `.ai/rules/js.md`).
+
+## Reviewing existing copy (checklist)
+
+For each key under review:
+
+1. **Find where it renders:** `grep -rn "the.key" resources/js app` and open the screen. Copy is judged in context: what did the user just do, what are they trying to do?
+2. **Classify it:** button/label, tooltip, action prompt, empty state, dialog, error, toast, helper text.
+3. **Check it against this guide:**
+ - Does it talk to the user ("you") and lead with the point?
+ - For an action prompt: what is missing, why it matters now, the next action, in that order?
+ - Does it use the words the user sees on screen, and the same name as the button or tab it refers to?
+ - Is there any system vocabulary, apology, blame, filler, or a mechanism explained before the action?
+ - Is a member without permission shown something they cannot do?
+4. **Rewrite all 16 locales together**, natively, with each locale's existing terms.
+5. **Run the guards:** `php artisan test --compact --filter="LocalizationParity|SingleLineCopy"`, update the budget in `tests/fixtures/single-line-copy.php` for single-line controls, and run the browser tests that assert the text (`grep -rn "the.key" tests`).
+6. **Look at it in the browser** in English and in the longest locale before marking it done.
+
+## Sources
+
+The three-step pattern and the rules above follow these references (researched October 2026):
+
+- Nielsen Norman Group, [Empty States in Application Design: 3 Guidelines](https://www.nngroup.com/videos/empty-states-in-application-design-guidelines/): empty states communicate system status, teach what belongs in the space, and give a direct path to the key task; guidance shown in context beats an upfront tutorial.
+- Setproduct, [Empty state UI design: turn blank screens into next steps](https://www.setproduct.com/blog/empty-state-ui-design): an empty state states the status, teaches what belongs there, and offers a direct path to the next action.
+- SAP Fiori, [Designing for Empty States](https://www.sap.com/design-system/fiori-design-web/v1-96/foundations/best-practices/global-patterns/designing-for-empty-states): add a button or link for the next step where appropriate.
+- UX Planet, [Empty state design: a practical guide](https://uxplanet.org/empty-state-design-a-practical-guide-94ad0adbda45) and Babich, [Empty states: 5 practical tips for designers](https://babich.biz/blog/empty-states/): say why the space is empty and what the user can do next; no dead ends.
+- Flook, [Tooltips UX: 9 Design Rules](https://flook.co/blog/tooltips-ux): keep tooltips short, put the key point first, do not repeat the label, do not hide essential information in them, make them reachable by hover, focus and tap.
+- River Editor, [How to write UX copy (microcopy)](https://rivereditor.com/guides/how-to-write-ux-copy-microcopy-2026): action-led, user-centred microcopy; errors explain what happened and how to fix it.
+- UX writing skill references ([Tessl](https://tessl.io/registry/skills/github/Owl-Listener/designer-skills/ux-writing), [skills.sh](https://skills.sh/slb2248/ai-ux-skills/ux-writing)) and the [Harness tooltip and contextual help skill](https://openskillindex.com/skills/intense-visions-harness-engineering-ux-tooltip-contextual-help-15b751): empty states explain what will appear and give a clear call to action; onboarding introduces one concept at a time and points to a first action; tooltip length limits around 80 to 150 characters.
diff --git a/.claude/skills/in-app-copy/SKILL.md b/.claude/skills/in-app-copy/SKILL.md
new file mode 100644
index 000000000..b3445a8b8
--- /dev/null
+++ b/.claude/skills/in-app-copy/SKILL.md
@@ -0,0 +1,146 @@
+---
+name: in-app-copy
+description: "Use this skill to write, rewrite or review any text the end user reads inside the TryPost app: lang keys in lang/*/*.php, labels, buttons, tabs, menu items, tooltips, popovers that ask for an action, empty states, dialogs and confirmations, errors, validation messages, toasts, settings descriptions and onboarding steps. Trigger on requests like 'improve this text', 'rewrite this popover', 'this copy is bad', 'review the product copy', 'translate this key', or any new UI string. Covers the three-step pattern for action prompts, tone, per-component rules, the 16-locale workflow and a review checklist. Not for marketing pages, emails' visual layout or AI prompts (see copywriting, the Maizzle rules and the AI agents rules)."
+metadata:
+ author: trypost
+---
+
+# In-app copy
+
+Text inside TryPost talks to someone who is in the middle of doing something: scheduling a post, connecting a channel, fixing an error. Every string exists to help them finish that task. Write from their side of the screen, never from how the system is built.
+
+This guide is the reference for writing new copy and for reviewing existing copy. The short version lives in `AGENTS.md` ("Writing in-app copy"); this skill holds the detail, the examples and the sources.
+
+## The core pattern: a prompt that asks the user to act
+
+When the UI stops the user and asks them to do something first (a popover, an empty state with a button, a blocking dialog, a tooltip on a disabled control), write it in three steps, in this order (owner decision, October 2026):
+
+1. **What is missing, in the user's words, addressed to them.** State the situation as it affects them.
+2. **Why it matters for what they just tried.** Tie it to the click that opened the prompt, not to how the feature works in general.
+3. **The next action, named by its button.** The body leads to the button; the button says exactly what happens. Always keep a way out.
+
+### Reference example: the queue setup popover
+
+Shown by `resources/js/components/publish/AddToQueueButton.vue` when someone clicks "Add to queue" on a channel without posting times (`posts.publish.actions.queue_setup`).
+
+Before (rejected):
+
+> **Set up the queue first**
+> This channel has no posting times yet. Add them, and every post you add to the queue takes the next free one.
+
+Also rejected (explains the mechanism before saying what is missing):
+
+> **When should this channel post?**
+> Posts in the queue go out at this channel's posting times, and it doesn't have any yet. Choose them once, and every post you add takes the next open time.
+
+After (approved):
+
+> **You haven't set up this channel's queue yet**
+> To add posts to the queue, set this channel's posting times. Each queued post goes out at the next open time.
+> [Not now] [Set posting times]
+
+For a member who cannot set posting times, same title, and the body names who can:
+
+> To add posts to the queue, a workspace admin needs to set this channel's posting times.
+
+Never show a button the user cannot use.
+
+## Tone and voice
+
+- **Talk to the user.** "You", "your channel", "your posts". Not "the user", not passive constructions that hide who acts.
+- **Lead with the point.** The first words carry the message; someone who reads only the title should know what is going on.
+- **Short.** A title and one or two sentences. A tooltip under about 80 characters. If a sentence explains how the system works before saying what to do, cut it or move it after.
+- **Plain words.** Name things by what the user sees, not by the code: "posting times", not "slots"; "channel", not "social account" or "destination"; "settings", not "meta".
+- **Direction, not mood.** No apologies ("Sorry"), no "please", no "Oops", no blame ("You entered an invalid…"). Say what happened and what to do.
+- **Active and specific verbs.** "Save changes", not "Submit". "Set posting times", not "Configure". "Connect through Facebook", not "Continue".
+- **No filler or generic warnings.** No "This action cannot be undone" line on everyday confirmations (see the delete rules in `AGENTS.md`). No "Are you sure?" as the only content.
+
+## Per component
+
+### Buttons, menu items, tabs, badges
+
+- Verb + object for actions: "Add to queue", "Copy link", "Remove music". A noun alone only for navigation tabs ("Queue", "Drafts").
+- **One action, one name, everywhere.** The button that says "Publish" leads to a toast or state that says "Published". The tab "Queue", the button "Add to queue" and a prompt about "the queue" use the same word.
+- Single line in every locale. Add the key to `tests/fixtures/single-line-copy.php` with the length of its longest translation (see "Translated copy must fit its UI slot" in `AGENTS.md`).
+
+### Tooltips
+
+- Add what the label does not say: the consequence, the scope, a shortcut. If the tooltip repeats the label, drop it.
+- A tooltip on a disabled control says why it is disabled and what unlocks it ("Wait for uploads to finish").
+- Nothing essential lives only in a tooltip: touch screens and keyboards may never show it.
+
+### Popovers and prompts that ask for an action
+
+Use the three-step pattern above. One prompt, one action; a way out ("Not now", "Maybe later") next to it. Cancel first, primary action last (`AGENTS.md`, "Dialog and slide-over actions").
+
+### Empty states
+
+Two different empty states (see "Empty states on list pages" in `AGENTS.md`):
+
+- **First use** (nothing exists yet): say what will live here and give the one action that creates it, for example (illustrative) "No labels yet. Labels group posts so you can filter them." + [Create label].
+- **No results** (a search or filter found nothing): say that nothing matched and how to widen it. "No posts match your search. Try a different keyword or clear the search." No create button.
+
+Never a bare "Nothing here".
+
+### Dialogs and confirmations
+
+- The title states the action and its object: "Delete this post?", "Discard changes?".
+- The body states what will be removed or lost, and nothing more.
+- The destructive button repeats the verb ("Delete", "Discard"), never "OK" or "Yes".
+- Typing to confirm only for the critical actions listed in `AGENTS.md`.
+
+### Errors and validation
+
+- Say what happened and how to fix it, in the interface's voice: "Couldn't load music from Instagram. Try again." "Enter a valid Instagram username."
+- Name the field or the limit with its value: "Add up to 3 collaborators."
+- When the network rejects something, say which network and what it needs: "Music needs an Instagram account connected through Facebook."
+- Never "Something went wrong" alone, never raw codes or exception text.
+
+### Toasts and success feedback
+
+- No success toast after creating, editing, deleting or copying everyday resources: the visible change (a new row, an inline check) is the feedback (owner decision, September 2026). Errors still toast.
+- When a toast is needed, it names the result in the past tense of the action: "Added to queue" after "Add to queue".
+
+### Settings descriptions and helper text
+
+- The line under a settings page title stays on one line in every locale.
+- Helper text under a field explains the effect of the setting, not its name.
+
+## Localization (16 locales)
+
+Every string ships in `lang/{ar,de,el,en,es,fr,it,ja,ko,nl,pl,pt-BR,ru,tr,uk,zh}`. `LocalizationParityTest` fails when a key is missing in one.
+
+- **Same structure, written natively.** Keep the three steps and the meaning; do not translate word for word.
+- **Reuse each locale's existing word** for the feature: queue is "fila", "Warteschlange", "file", "cola", "kolejka"; posting times is "horários de postagem", "Posting-Zeiten", "horaires de publication". Search the locale's file before choosing a term.
+- **Grammatical gender.** When "you haven't…" needs a gendered form for the user (Polish, Russian past tense in some phrasings, Arabic), rephrase impersonally: Polish "Kolejka tego kanału nie jest jeszcze skonfigurowana" ("This channel's queue isn't set up yet").
+- **Longest locale decides the layout.** French, German, Ukrainian, Russian, Polish and Portuguese usually run longest. Shorten the copy in that locale rather than letting a control wrap.
+- **Placeholders** (`:network`, `:count`, `:username`) stay in every locale; plurals use `trans_choice` with a `[0,*]` last segment.
+- Resolve UI keywords with `$t` in templates (see `.ai/rules/js.md`).
+
+## Reviewing existing copy (checklist)
+
+For each key under review:
+
+1. **Find where it renders:** `grep -rn "the.key" resources/js app` and open the screen. Copy is judged in context: what did the user just do, what are they trying to do?
+2. **Classify it:** button/label, tooltip, action prompt, empty state, dialog, error, toast, helper text.
+3. **Check it against this guide:**
+ - Does it talk to the user ("you") and lead with the point?
+ - For an action prompt: what is missing, why it matters now, the next action, in that order?
+ - Does it use the words the user sees on screen, and the same name as the button or tab it refers to?
+ - Is there any system vocabulary, apology, blame, filler, or a mechanism explained before the action?
+ - Is a member without permission shown something they cannot do?
+4. **Rewrite all 16 locales together**, natively, with each locale's existing terms.
+5. **Run the guards:** `php artisan test --compact --filter="LocalizationParity|SingleLineCopy"`, update the budget in `tests/fixtures/single-line-copy.php` for single-line controls, and run the browser tests that assert the text (`grep -rn "the.key" tests`).
+6. **Look at it in the browser** in English and in the longest locale before marking it done.
+
+## Sources
+
+The three-step pattern and the rules above follow these references (researched October 2026):
+
+- Nielsen Norman Group, [Empty States in Application Design: 3 Guidelines](https://www.nngroup.com/videos/empty-states-in-application-design-guidelines/): empty states communicate system status, teach what belongs in the space, and give a direct path to the key task; guidance shown in context beats an upfront tutorial.
+- Setproduct, [Empty state UI design: turn blank screens into next steps](https://www.setproduct.com/blog/empty-state-ui-design): an empty state states the status, teaches what belongs there, and offers a direct path to the next action.
+- SAP Fiori, [Designing for Empty States](https://www.sap.com/design-system/fiori-design-web/v1-96/foundations/best-practices/global-patterns/designing-for-empty-states): add a button or link for the next step where appropriate.
+- UX Planet, [Empty state design: a practical guide](https://uxplanet.org/empty-state-design-a-practical-guide-94ad0adbda45) and Babich, [Empty states: 5 practical tips for designers](https://babich.biz/blog/empty-states/): say why the space is empty and what the user can do next; no dead ends.
+- Flook, [Tooltips UX: 9 Design Rules](https://flook.co/blog/tooltips-ux): keep tooltips short, put the key point first, do not repeat the label, do not hide essential information in them, make them reachable by hover, focus and tap.
+- River Editor, [How to write UX copy (microcopy)](https://rivereditor.com/guides/how-to-write-ux-copy-microcopy-2026): action-led, user-centred microcopy; errors explain what happened and how to fix it.
+- UX writing skill references ([Tessl](https://tessl.io/registry/skills/github/Owl-Listener/designer-skills/ux-writing), [skills.sh](https://skills.sh/slb2248/ai-ux-skills/ux-writing)) and the [Harness tooltip and contextual help skill](https://openskillindex.com/skills/intense-visions-harness-engineering-ux-tooltip-contextual-help-15b751): empty states explain what will appear and give a clear call to action; onboarding introduces one concept at a time and points to a first action; tooltip length limits around 80 to 150 characters.
diff --git a/.cursor/skills/in-app-copy/SKILL.md b/.cursor/skills/in-app-copy/SKILL.md
new file mode 100644
index 000000000..b3445a8b8
--- /dev/null
+++ b/.cursor/skills/in-app-copy/SKILL.md
@@ -0,0 +1,146 @@
+---
+name: in-app-copy
+description: "Use this skill to write, rewrite or review any text the end user reads inside the TryPost app: lang keys in lang/*/*.php, labels, buttons, tabs, menu items, tooltips, popovers that ask for an action, empty states, dialogs and confirmations, errors, validation messages, toasts, settings descriptions and onboarding steps. Trigger on requests like 'improve this text', 'rewrite this popover', 'this copy is bad', 'review the product copy', 'translate this key', or any new UI string. Covers the three-step pattern for action prompts, tone, per-component rules, the 16-locale workflow and a review checklist. Not for marketing pages, emails' visual layout or AI prompts (see copywriting, the Maizzle rules and the AI agents rules)."
+metadata:
+ author: trypost
+---
+
+# In-app copy
+
+Text inside TryPost talks to someone who is in the middle of doing something: scheduling a post, connecting a channel, fixing an error. Every string exists to help them finish that task. Write from their side of the screen, never from how the system is built.
+
+This guide is the reference for writing new copy and for reviewing existing copy. The short version lives in `AGENTS.md` ("Writing in-app copy"); this skill holds the detail, the examples and the sources.
+
+## The core pattern: a prompt that asks the user to act
+
+When the UI stops the user and asks them to do something first (a popover, an empty state with a button, a blocking dialog, a tooltip on a disabled control), write it in three steps, in this order (owner decision, October 2026):
+
+1. **What is missing, in the user's words, addressed to them.** State the situation as it affects them.
+2. **Why it matters for what they just tried.** Tie it to the click that opened the prompt, not to how the feature works in general.
+3. **The next action, named by its button.** The body leads to the button; the button says exactly what happens. Always keep a way out.
+
+### Reference example: the queue setup popover
+
+Shown by `resources/js/components/publish/AddToQueueButton.vue` when someone clicks "Add to queue" on a channel without posting times (`posts.publish.actions.queue_setup`).
+
+Before (rejected):
+
+> **Set up the queue first**
+> This channel has no posting times yet. Add them, and every post you add to the queue takes the next free one.
+
+Also rejected (explains the mechanism before saying what is missing):
+
+> **When should this channel post?**
+> Posts in the queue go out at this channel's posting times, and it doesn't have any yet. Choose them once, and every post you add takes the next open time.
+
+After (approved):
+
+> **You haven't set up this channel's queue yet**
+> To add posts to the queue, set this channel's posting times. Each queued post goes out at the next open time.
+> [Not now] [Set posting times]
+
+For a member who cannot set posting times, same title, and the body names who can:
+
+> To add posts to the queue, a workspace admin needs to set this channel's posting times.
+
+Never show a button the user cannot use.
+
+## Tone and voice
+
+- **Talk to the user.** "You", "your channel", "your posts". Not "the user", not passive constructions that hide who acts.
+- **Lead with the point.** The first words carry the message; someone who reads only the title should know what is going on.
+- **Short.** A title and one or two sentences. A tooltip under about 80 characters. If a sentence explains how the system works before saying what to do, cut it or move it after.
+- **Plain words.** Name things by what the user sees, not by the code: "posting times", not "slots"; "channel", not "social account" or "destination"; "settings", not "meta".
+- **Direction, not mood.** No apologies ("Sorry"), no "please", no "Oops", no blame ("You entered an invalid…"). Say what happened and what to do.
+- **Active and specific verbs.** "Save changes", not "Submit". "Set posting times", not "Configure". "Connect through Facebook", not "Continue".
+- **No filler or generic warnings.** No "This action cannot be undone" line on everyday confirmations (see the delete rules in `AGENTS.md`). No "Are you sure?" as the only content.
+
+## Per component
+
+### Buttons, menu items, tabs, badges
+
+- Verb + object for actions: "Add to queue", "Copy link", "Remove music". A noun alone only for navigation tabs ("Queue", "Drafts").
+- **One action, one name, everywhere.** The button that says "Publish" leads to a toast or state that says "Published". The tab "Queue", the button "Add to queue" and a prompt about "the queue" use the same word.
+- Single line in every locale. Add the key to `tests/fixtures/single-line-copy.php` with the length of its longest translation (see "Translated copy must fit its UI slot" in `AGENTS.md`).
+
+### Tooltips
+
+- Add what the label does not say: the consequence, the scope, a shortcut. If the tooltip repeats the label, drop it.
+- A tooltip on a disabled control says why it is disabled and what unlocks it ("Wait for uploads to finish").
+- Nothing essential lives only in a tooltip: touch screens and keyboards may never show it.
+
+### Popovers and prompts that ask for an action
+
+Use the three-step pattern above. One prompt, one action; a way out ("Not now", "Maybe later") next to it. Cancel first, primary action last (`AGENTS.md`, "Dialog and slide-over actions").
+
+### Empty states
+
+Two different empty states (see "Empty states on list pages" in `AGENTS.md`):
+
+- **First use** (nothing exists yet): say what will live here and give the one action that creates it, for example (illustrative) "No labels yet. Labels group posts so you can filter them." + [Create label].
+- **No results** (a search or filter found nothing): say that nothing matched and how to widen it. "No posts match your search. Try a different keyword or clear the search." No create button.
+
+Never a bare "Nothing here".
+
+### Dialogs and confirmations
+
+- The title states the action and its object: "Delete this post?", "Discard changes?".
+- The body states what will be removed or lost, and nothing more.
+- The destructive button repeats the verb ("Delete", "Discard"), never "OK" or "Yes".
+- Typing to confirm only for the critical actions listed in `AGENTS.md`.
+
+### Errors and validation
+
+- Say what happened and how to fix it, in the interface's voice: "Couldn't load music from Instagram. Try again." "Enter a valid Instagram username."
+- Name the field or the limit with its value: "Add up to 3 collaborators."
+- When the network rejects something, say which network and what it needs: "Music needs an Instagram account connected through Facebook."
+- Never "Something went wrong" alone, never raw codes or exception text.
+
+### Toasts and success feedback
+
+- No success toast after creating, editing, deleting or copying everyday resources: the visible change (a new row, an inline check) is the feedback (owner decision, September 2026). Errors still toast.
+- When a toast is needed, it names the result in the past tense of the action: "Added to queue" after "Add to queue".
+
+### Settings descriptions and helper text
+
+- The line under a settings page title stays on one line in every locale.
+- Helper text under a field explains the effect of the setting, not its name.
+
+## Localization (16 locales)
+
+Every string ships in `lang/{ar,de,el,en,es,fr,it,ja,ko,nl,pl,pt-BR,ru,tr,uk,zh}`. `LocalizationParityTest` fails when a key is missing in one.
+
+- **Same structure, written natively.** Keep the three steps and the meaning; do not translate word for word.
+- **Reuse each locale's existing word** for the feature: queue is "fila", "Warteschlange", "file", "cola", "kolejka"; posting times is "horários de postagem", "Posting-Zeiten", "horaires de publication". Search the locale's file before choosing a term.
+- **Grammatical gender.** When "you haven't…" needs a gendered form for the user (Polish, Russian past tense in some phrasings, Arabic), rephrase impersonally: Polish "Kolejka tego kanału nie jest jeszcze skonfigurowana" ("This channel's queue isn't set up yet").
+- **Longest locale decides the layout.** French, German, Ukrainian, Russian, Polish and Portuguese usually run longest. Shorten the copy in that locale rather than letting a control wrap.
+- **Placeholders** (`:network`, `:count`, `:username`) stay in every locale; plurals use `trans_choice` with a `[0,*]` last segment.
+- Resolve UI keywords with `$t` in templates (see `.ai/rules/js.md`).
+
+## Reviewing existing copy (checklist)
+
+For each key under review:
+
+1. **Find where it renders:** `grep -rn "the.key" resources/js app` and open the screen. Copy is judged in context: what did the user just do, what are they trying to do?
+2. **Classify it:** button/label, tooltip, action prompt, empty state, dialog, error, toast, helper text.
+3. **Check it against this guide:**
+ - Does it talk to the user ("you") and lead with the point?
+ - For an action prompt: what is missing, why it matters now, the next action, in that order?
+ - Does it use the words the user sees on screen, and the same name as the button or tab it refers to?
+ - Is there any system vocabulary, apology, blame, filler, or a mechanism explained before the action?
+ - Is a member without permission shown something they cannot do?
+4. **Rewrite all 16 locales together**, natively, with each locale's existing terms.
+5. **Run the guards:** `php artisan test --compact --filter="LocalizationParity|SingleLineCopy"`, update the budget in `tests/fixtures/single-line-copy.php` for single-line controls, and run the browser tests that assert the text (`grep -rn "the.key" tests`).
+6. **Look at it in the browser** in English and in the longest locale before marking it done.
+
+## Sources
+
+The three-step pattern and the rules above follow these references (researched October 2026):
+
+- Nielsen Norman Group, [Empty States in Application Design: 3 Guidelines](https://www.nngroup.com/videos/empty-states-in-application-design-guidelines/): empty states communicate system status, teach what belongs in the space, and give a direct path to the key task; guidance shown in context beats an upfront tutorial.
+- Setproduct, [Empty state UI design: turn blank screens into next steps](https://www.setproduct.com/blog/empty-state-ui-design): an empty state states the status, teaches what belongs there, and offers a direct path to the next action.
+- SAP Fiori, [Designing for Empty States](https://www.sap.com/design-system/fiori-design-web/v1-96/foundations/best-practices/global-patterns/designing-for-empty-states): add a button or link for the next step where appropriate.
+- UX Planet, [Empty state design: a practical guide](https://uxplanet.org/empty-state-design-a-practical-guide-94ad0adbda45) and Babich, [Empty states: 5 practical tips for designers](https://babich.biz/blog/empty-states/): say why the space is empty and what the user can do next; no dead ends.
+- Flook, [Tooltips UX: 9 Design Rules](https://flook.co/blog/tooltips-ux): keep tooltips short, put the key point first, do not repeat the label, do not hide essential information in them, make them reachable by hover, focus and tap.
+- River Editor, [How to write UX copy (microcopy)](https://rivereditor.com/guides/how-to-write-ux-copy-microcopy-2026): action-led, user-centred microcopy; errors explain what happened and how to fix it.
+- UX writing skill references ([Tessl](https://tessl.io/registry/skills/github/Owl-Listener/designer-skills/ux-writing), [skills.sh](https://skills.sh/slb2248/ai-ux-skills/ux-writing)) and the [Harness tooltip and contextual help skill](https://openskillindex.com/skills/intense-visions-harness-engineering-ux-tooltip-contextual-help-15b751): empty states explain what will appear and give a clear call to action; onboarding introduces one concept at a time and points to a first action; tooltip length limits around 80 to 150 characters.
diff --git a/AGENTS.md b/AGENTS.md
index d24d9022b..7c2f4670c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -208,6 +208,14 @@ Vue components must have a single root element.
- Always use arrow functions in Vue components and TypeScript files. Never use `function` declarations.
- Template event handlers call a named function (`@click="openCreateDialog"`), never an inline statement that mutates state (`@click="isCreateDialogOpen = true"`). Opening something usually grows a second step later (reset a form, focus, track an event), and a named function is where that goes. Passing an argument through is fine: `@click="openEditDialog(label)"`.
+- **A button that waits on a request shows it through the `Button` component's own `loading` prop whenever possible** (`<Button :loading="form.processing">`): it disables the button and swaps its label for the spinner, so every button waits the same way. Do not hand-roll a `<Spinner v-if>` inside the label or a separate disabled flag for this. When `loading` cannot fit (the label must stay visible next to the spinner, an `as-child` link, a control that is not our `Button`), keep the label and add the spinner next to it. Many existing buttons predate this rule; move them to `loading` when touching them, not in a sweep.
+- **Unsaved changes in the composer** go through `composables/composer/useUnsavedChanges.ts` (the history guard) and `useComposerUnsavedChanges.ts` (what counts as a change). The owner treats this guard as critical. How the guard works is written in the composable's docblock; three rules hold around it:
+ - The composer's save visits (`router.put` / `router.post` in `pages/publish/Index.vue`) send `replace: true`, so the saved page takes the place of the edit's history entry instead of stacking on it.
+ - A composer opened from a page of the app (`lib/inAppHistory.ts`, `cameFromAppPage()`) leaves through history: closing goes back, and saving goes back once the saved page lands and reloads that page. So after a save or close, one browser Back reaches the page before the list, calendar or tab it was opened from. A composer reached by its link or a reload has nothing behind it and still replaces its entry with the list.
+ - "Is there unsaved work" is decided by the snapshot comparison alone, never by `isSubmitting` or another request flag.
+ - Every change to the guard ships with a browser test in `tests/Browser/ComposerUnsavedChangesTest.php` that fails without it, checked by removing the change and running the test. History bugs here showed up only in a real browser (Inertia's own popstate handler is part of every flow).
+- **Composables are scoped by area.** A composable used by one area only lives in that area's folder, `resources/js/composables/<area>/` (e.g. `composables/composer/useComposerUnsavedChanges.ts`, `composables/echo/usePostEcho.ts`). Only composables shared across areas stay at the root of `resources/js/composables/`. When a scoped composable gains a consumer in another area, move it to the root in the same change.
+- Searching a list in the UI goes through `matchesSearch` / `filterBySearch` (`resources/js/lib/search.ts`): word by word, ignoring case and accents. Never hand-roll `.toLowerCase().includes(...)` for a search box.
## Inertia SSR
@@ -239,6 +247,23 @@ Typing the exact name is the stronger guard for the identity-bound ones, on purp
- **Exception — disconnecting a channel** (`DisconnectChannelDialog`, user decision October 2026): its keyword, `channels.disconnect_modal.keyword`, is translated and **lowercase** (`disconnect`, `desconectar`, …), shown as the input placeholder and in the copyable keyword line `Type [disconnect ⧉] to confirm.` (same markup as `ConfirmDeleteModal`), and still compared case-sensitively after trimming (`DISCONNECT` must not confirm). The dialog ends its description with a bold `This cannot be undone.` and offers **Refresh connection** before disconnecting. Do not carry either into the other dialogs.
- **Disconnecting an MCP app** (`settings/workspace/Mcp.vue`, owner decision October 2026) asks for the same `channels.disconnect_modal.keyword`, not the app's name, so the word matches the channel dialog in every locale (compared case-sensitively after trimming). It keeps the plain `ConfirmDeleteModal` without the refresh option or the bold line.
+## Writing in-app copy
+
+Text inside the app (popovers, empty states, dialogs, tooltips that ask for an action, errors, toasts) talks to the end user, who is in the middle of doing something. Write it from their side, not from how the system is built. The `copywriting` skill in `.agents/skills` is for marketing pages; it does not apply here.
+
+**Full guide, examples, per-component rules, the review checklist and the sources: the `in-app-copy` skill** (`.claude/skills/in-app-copy/SKILL.md`, mirrored in `.agents/skills` and `.cursor/skills`). Load it before writing or reviewing any user-facing string. The rules below are the minimum.
+
+- **A prompt that asks the user to act follows three steps, in this order** (owner decision October 2026):
+ 1. **What is missing, in the user's words and addressed to them:** "You haven't set up this channel's queue yet". Not a system state ("Set up the queue first", "No posting times configured").
+ 2. **Why it matters for what they just tried:** "To add posts to the queue, set this channel's posting times." Tie it to the click that opened the prompt, never to how the feature works in general.
+ 3. **The next action, named by its button:** the body leads to the button ("Set posting times"), and the button says exactly what happens. Keep a way out ("Not now").
+- **Talk to the user ("you"), lead with the point, keep it short.** One or two sentences. No explanation of the mechanism before the user knows what to do, no apology, no "please", no blame, no generic "This action cannot be undone" line.
+- **A user who cannot do the action** (a member without the permission) gets the same title and a body that names who can do it: "To add posts to the queue, a workspace admin needs to set this channel's posting times." Never show them a button they cannot use.
+- **Errors say what happened and how to fix it**, in the interface's voice: "Couldn't load music from Instagram. Try again." Not "Something went wrong".
+- **Use the words the user already sees on screen.** The same action keeps the same name everywhere (the button "Add to queue", the tab "Queue", the prompt "the queue"). Never introduce internal names (slots, holders, destinations, meta).
+- **Every locale follows the same structure**, written natively, not word for word: keep each locale's existing word for the feature (Fila, Warteschlange, file, cola), and rephrase a sentence that needs grammatical gender for the user into an impersonal one (Polish "Kolejka tego kanału nie jest jeszcze skonfigurowana").
+- Reference: the queue setup popover (`posts.publish.actions.queue_setup`, shown by `AddToQueueButton.vue`).
+
## Translated copy must fit its UI slot
Every lang string is rendered in all 16 locales, and the longest one decides the layout. Menu items, buttons, tabs, badges and other single-line controls must not wrap onto a second line in any locale.
@@ -430,6 +455,11 @@ There is no connect popup (owner decision 2026-10-06): no `window.open`, no
`force_login=true` (YouTube, Instagram and TikTok already send theirs on every
connect). X OAuth 2, LinkedIn, Pinterest, Threads and Discord document none, so
the step's instructions are the only help there.
+- Google connects (YouTube, Google Business) never send `include_granted_scopes`.
+ TryPost may run every Google feature on one OAuth client, and that flag folds in
+ the scopes the user granted elsewhere (the composer's `drive.file`), which Google
+ refuses to combine with the YouTube scopes ("scopes that cannot be requested
+ together"). Each Google flow asks for its own scopes only.
## Disconnecting a channel deletes its posts
@@ -742,6 +772,16 @@ Never derive the first-use state from the list or from the search box. A paginat
- **Requests are independent.** Every FormRequest (web under `App/`, API under `Api/`) and every MCP tool declares its own rules inline. Do not create a shared rules helper (e.g. `ChannelRequestRules::reorderQueue()`) for requests or tools to call, and do not make one request delegate its rules to another. Web, API and MCP agreeing is proven by the parity tests in `tests/Feature/Parity`, not by sharing a rules class. Domain rules that already exist as their own concept (`PostPlatformMetaRules`, `PostMediaRules`, `PostStatusRules`, `App\Rules\*` rule objects) stay shared.
- The classes under `app/Support/Requests/**` predate this rule and will be refactored away; do not add to them or copy their pattern.
+## Controllers: one per resource, mirrored on web and API
+
+A controller serves **one resource**. Network-specific endpoints never pile up in a generic controller: in October 2026 `Api\SocialAccountController` had grown to hold Pinterest boards, Discord channels, TikTok creator info, Instagram audio, the posting schedule and the queue slots, and was split (owner decision). Do not let it happen again.
+
+- **One controller per resource**, with resourceful method names (`index`, `show`, `store`, `update`, `destroy`, plus a few named verbs where REST has none, e.g. `generate`, `copy`, `reorder`, `moveToSlot`). A new network feature gets its own controller; it is never added as `pinterestBoards()` / `instagramAudio()` methods on `SocialAccountController` or any other controller.
+- **The web and the API mirror each other.** The same resource has the same controller name on both sides: `App\InstagramAudioController` ↔ `Api\InstagramAudioController`, `App\PinterestBoardController` ↔ `Api\PinterestBoardController`, `App\DiscordController` ↔ `Api\DiscordController`, `App\ChannelPostingScheduleController` ↔ `Api\ChannelPostingScheduleController`. When one side gains an endpoint, the other side's endpoint for the same resource goes in the controller with the same name.
+- **Channel features belong to their channel controller**: posting schedule reads and writes in `ChannelPostingScheduleController`, queue slots and ordering in `ChannelQueueController`, insights in `ChannelInsightsController`. `Api\SocialAccountController` only lists the connected accounts.
+- **MCP has no controllers**: one tool class per action (`app/Mcp/Tools/<Area>/<Verb><Resource>Tool.php`), never one tool that switches on the network.
+- Moving an endpoint between controllers keeps its URL and route name, so API clients see no change; the parity tests in `tests/Feature/Parity` must pass unchanged.
+
## Database engines (PostgreSQL + MySQL)
TryPost runs on **both PostgreSQL and MySQL**. Cloud runs PostgreSQL; a self-hosted install may pick either. Every query, migration, and test must work on both — the suite is expected to be green on each.
@@ -803,6 +843,9 @@ an `enabled` flag or posts with several channels. Posts created together share
- Required-on-publish (meta a platform needs to publish, e.g. Discord `channel_id`) also lives there: `addRequiredOnPublishErrors()` for request-driven flows (web/API update `withValidator`), `assertStoredPostPublishable()` for flows that publish stored state without resubmitting platforms (MCP `PublishPostTool`). Add new required-meta rules to `requiredMetaViolation()`, not inline.
- When adding a new platform's meta field, add it (and any publish requirement) to `PostPlatformMetaRules` ONLY, and cover it in `tests/Feature/Api/PostApiPlatformMetaTest.php` + `tests/Feature/Mcp/PostPlatformMetaToolTest.php`.
- `PostPlatformMetaRules::formatViolation()` holds meta no post may store, even as a draft (a YouTube title with `<` or `>`). Every create and update path (web, API, MCP, repurpose) goes through `App\Support\PostCompositionValidator`, which runs it and, once the post is scheduled or published, the content limits below.
+- **What a post stores in `meta` goes through `App\Support\PostMeta::forChannel($account, $meta, $stored)`, on create (`CreateChannelPost`) and on update (`UpdatePost`, passing the post's current meta as `$stored`).** It normalizes the meta, keeps the system keys the post already had (`PostPlatformMetaRules::SYSTEM_KEYS`, today Telegram `reactions`) and has one `match` arm per network that derives something. Never write `posts.meta` from a request without it, and never add a second helper next to it.
+- **A derived value is never taken from the request.** Only the id comes in; the server resolves what it names. The Discord `channel_name` has no validation rule: `PostMeta` drops any sent value and reads the name of `channel_id` from the guild's channel list in the cache (`DiscordClient::cachedChannels()`, warmed by the composer, the API, MCP and publishing). Without a cached list the post stores no name; that is accepted (owner decision October 2026). The composer may keep the name in its local meta for the live preview; the server ignores it.
+- **Saving never calls a network.** `PostMeta` runs inside the post's transaction and the channel queue lock, so a lookup there reads a cache only, never HTTP. A save never fails over a display name.
## Content limits
@@ -840,6 +883,17 @@ an `enabled` flag or posts with several channels. Posts created together share
- YouTube rejects an upload without a title (`invalidTitle`). A post with neither `meta.title` nor any text cannot be scheduled or published there: `PostPlatformMetaRules::contentMetaViolation()` (through `YouTubeMetadata::missingTitleViolation()`) reports it on `meta.title` in `PostCompositionValidator` (web, API, MCP, repurpose) and `assertStoredPostPublishable()`, and the publisher checks it again. Drafts may lack both.
- Categories are a fixed list, `App\Enums\YouTube\Category`; the composer reads it from `Platform::publishConfig()` (`categoryOptions`, `defaultCategoryId`). Do not copy it into TypeScript.
+## Instagram reels, music, collaborators and tags
+
+What a post can carry on Instagram depends on how the account is connected: through Instagram Login (`Platform::Instagram`) or through a Facebook Page (`Platform::InstagramFacebook`). The rules live in `PostPlatformMetaRules::instagramReelViolation()` (save, schedule and publish) and `InstagramPublisher` (publish); keep the two in step.
+
+- **Music (`meta.audio`)** is for reels on an account connected through Facebook only: Instagram's audio search and `audio_configuration` exist only on that API. The track id is numeric everywhere: the audio routes (`whereNumber('audioId')`), the MCP tools and the `meta.audio.id` rule. A draft may keep music without an id; scheduling or publishing it is refused.
+- **Reel-only options** (`trial_graduation`, `audio`, `share_to_feed`) apply to `ContentType::InstagramReel` only. A feed post with a single video still publishes as `REELS`, but without them (`InstagramPublisher::reelOptions()`). A trial reel cannot have collaborators.
+- **Music on an account that is not connected through Facebook fails the publish visibly** (`ContentPolicy`, `posts.form.instagram.music.requires_facebook`) instead of being dropped. This happens when a card connected through Facebook is reconnected through Instagram Login: its pending posts move to the new platform with their meta untouched. The user removes the music or reconnects through Facebook, then retries. Never strip the music silently, at reconnect or at publish.
+- **Collaborators are not people tags.** Collaborators (`meta.collaborators`, up to 3 usernames, stored without `@` and deduplicated) are co-authors invited on a feed post, carousel or reel, never a story. People tags belong to a media item (`media.*.meta.user_tags`), next to a video's cover frame (`meta.cover_offset_ms`). Both work the same on the web, the API and MCP.
+- **One Instagram identity, two ways to connect it.** An account connected through Instagram Login stores its Instagram account id in `social_accounts.meta.ig_user_id` (asked from `/me` on connect, filled for older accounts by the daily connection check). Comparing identities across the two platforms goes through `SocialAccount::isIdentity()` (and `SocialController::isIdentityOf()`), never a raw `platform_user_id` comparison, so one Instagram account is never seated twice and a card can move between the two connection methods.
+- **The system adds a key to an account's meta without losing what a reconnect saved meanwhile.** `ConnectionVerifier` reads the account again under a row lock, adds `ig_user_id` to that fresh meta and saves it quietly without timestamps, so `updated_at` does not move. Never write the in-memory meta of a model loaded earlier back over the column.
+
## Media Types (image / video / document)
- A media item is one of exactly three types: **image**, **video**, **document** (PDF). There is no standalone "audio" media type (audio exists only as a video voiceover input).
@@ -869,6 +923,10 @@ Browser tests live in `tests/Browser` and run on `pestphp/pest-plugin-browser` d
- **Never `sleep()` in a browser test.** The HTTP server that serves the page runs inside the same PHP process (an Amp loop that only ticks while Pest awaits Playwright), so a blocking `sleep()` starves every asset request: the page stays blank, the Vue app never mounts, and screenshots come out empty. Poll from the page with `$page->script(...)` (as the `waitFor*TestId()` helpers do) — that keeps the loop running.
- `BrowserTestCase` sets `$fakesVite = false` on purpose: these tests load real built assets, so faking Vite blanks the app.
- End page assertions with `->assertNoJavaScriptErrors()`.
+- Each `visit()` opens a new browser context: `localStorage`, cookies and history are not shared with the previous visit.
+- The page starts on `about:blank`, so a `back()` with nothing behind it can land there and a test can pass for the wrong reason. A history test starts from an app page (`visit(...)->navigate(...)`) and asserts where it ended with `assertPathIs()`.
+- `assertQueryStringMissing()` checks only the query string: on a route whose id is in the path (`app.posts.edit`) it passes whatever happens. Assert the path instead.
+- A new test for a fix must fail without the fix. Check it by removing the change, running the test, and restoring it.
- CI runs them in three shards, each in parallel with three processes (`./vendor/bin/pest tests/Browser --compact --parallel --processes=3 --shard=N/3`), leaving a CPU of the 4-vCPU runner to the database and the app server, against `npm run build` output, so keep them independent of a running dev server and of each other. Run them in parallel through `./vendor/bin/pest`, never `php artisan test --parallel`, which does not start the Playwright server. A test that only passes alone has a race: wait for the state you assert (poll the DOM or the database) instead of assuming timing.
## Array Data Access
@@ -882,6 +940,7 @@ Browser tests live in `tests/Browser` and run on `pestphp/pest-plugin-browser` d
- EVERY Eloquent model in `app/Models` MUST be registered in `Relation::enforceMorphMap([...])` inside `AppServiceProvider::configureMorphMap()`, keyed by a camelCase alias (e.g. `'postTemplate' => PostTemplate::class`).
- When you add a new model, add it to the morph map in the same change. `tests/Unit/MorphMapTest.php` fails if any model is missing.
- The alias is persisted in polymorphic columns, so never rename or remove an existing alias for a model that has stored rows.
+- **Models never make HTTP calls** (owner decision October 2026). A model holds pure rules over its own data (`SocialAccount::isIdentity()`); anything that asks a network lives in a service or an action (`ConnectionVerifier`, `DiscordClient`, the publishers) and writes the result back.
## Imports
diff --git a/app/Actions/Analytics/MoveAnalyticsIdentity.php b/app/Actions/Analytics/MoveAnalyticsIdentity.php
new file mode 100644
index 000000000..476610b8d
--- /dev/null
+++ b/app/Actions/Analytics/MoveAnalyticsIdentity.php
@@ -0,0 +1,57 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Actions\Analytics;
+
+use App\Models\AnalyticsAccountDailySnapshot;
+use App\Models\AnalyticsPublication;
+use App\Models\AnalyticsSyncState;
+use App\Models\SocialAccount;
+use Illuminate\Contracts\Database\Eloquent\Builder;
+
+class MoveAnalyticsIdentity
+{
+ /**
+ * Carries a card's analytics over when a reconnect seats it under another
+ * platform of its network (Instagram Login and Instagram through Facebook
+ * report different ids for one account). Its publications and daily
+ * snapshots follow the card, so their metrics keep being collected. A sync
+ * state follows it too, unless the new identity already has one from an
+ * earlier connection: the card takes that one over and the old one is
+ * released, as a disconnect would leave it.
+ */
+ public function handle(SocialAccount $account, string $previousPlatformUserId): void
+ {
+ $collectorsHeldByIdentity = AnalyticsSyncState::query()
+ ->forIdentity($account)
+ ->where(fn (Builder $query) => $query
+ ->whereNull('social_account_id')
+ ->orWhereNot('social_account_id', $account->id))
+ ->pluck('collector');
+
+ $account->analyticsSyncStates()
+ ->whereIn('collector', $collectorsHeldByIdentity)
+ ->update(['social_account_id' => null]);
+
+ $account->analyticsSyncStates()
+ ->whereNotIn('collector', $collectorsHeldByIdentity)
+ ->update(AnalyticsSyncState::identityFor($account));
+
+ AnalyticsPublication::query()
+ ->where('social_account_id', $account->id)
+ ->where('platform_user_id', $previousPlatformUserId)
+ ->update([
+ 'platform' => $account->platform,
+ 'platform_user_id' => $account->platform_user_id,
+ ]);
+
+ AnalyticsAccountDailySnapshot::query()
+ ->where('social_account_id', $account->id)
+ ->where('platform_user_id', $previousPlatformUserId)
+ ->update([
+ 'platform' => $account->platform,
+ 'platform_user_id' => $account->platform_user_id,
+ ]);
+ }
+}
diff --git a/app/Actions/Auth/ListActiveSessions.php b/app/Actions/Auth/ListActiveSessions.php
new file mode 100644
index 000000000..34b80c510
--- /dev/null
+++ b/app/Actions/Auth/ListActiveSessions.php
@@ -0,0 +1,36 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Actions\Auth;
+
+use App\Models\User;
+use Carbon\Carbon;
+use Illuminate\Support\Facades\DB;
+
+class ListActiveSessions
+{
+ /**
+ * The user's sessions, most recently active first. Only the database
+ * session driver keeps them, so any other driver lists none.
+ *
+ * @return list<array{id: string, user_agent: string|null, last_active: string, is_current: bool}>
+ */
+ public static function execute(User $user, string $currentSessionId): array
+ {
+ if (config('session.driver') !== 'database') {
+ return [];
+ }
+
+ return DB::table(config('session.table', 'sessions'))
+ ->where('user_id', $user->id)
+ ->orderByDesc('last_activity')
+ ->get()
+ ->map(fn (object $session): array => [
+ 'id' => $session->id,
+ 'user_agent' => $session->user_agent,
+ 'last_active' => Carbon::createFromTimestamp($session->last_activity)->diffForHumans(),
+ 'is_current' => $session->id === $currentSessionId,
+ ])->values()->all();
+ }
+}
diff --git a/app/Actions/Auth/ListConnectedAccounts.php b/app/Actions/Auth/ListConnectedAccounts.php
new file mode 100644
index 000000000..080cdfeb6
--- /dev/null
+++ b/app/Actions/Auth/ListConnectedAccounts.php
@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Actions\Auth;
+
+use App\Enums\Auth\SocialAuthProvider;
+use App\Models\User;
+
+class ListConnectedAccounts
+{
+ /**
+ * Every sign-in provider, whether the user is linked to it and whether
+ * unlinking it still leaves them a way to sign in.
+ *
+ * @return list<array{provider: string, label: string, connected: bool, can_disconnect: bool}>
+ */
+ public static function execute(User $user): array
+ {
+ return collect(SocialAuthProvider::cases())->map(fn (SocialAuthProvider $provider): array => [
+ 'provider' => $provider->value,
+ 'label' => $provider->label(),
+ 'connected' => $user->isConnectedTo($provider),
+ 'can_disconnect' => $user->isConnectedTo($provider) && $user->canDisconnectFrom($provider),
+ ])->values()->all();
+ }
+}
diff --git a/app/Actions/Auth/LogoutOtherSessions.php b/app/Actions/Auth/LogoutOtherSessions.php
new file mode 100644
index 000000000..0ada510a8
--- /dev/null
+++ b/app/Actions/Auth/LogoutOtherSessions.php
@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Actions\Auth;
+
+use App\Models\User;
+use Illuminate\Support\Facades\DB;
+
+class LogoutOtherSessions
+{
+ /**
+ * Ends every session of the user except the one making the request. Only
+ * the database session driver keeps them, so any other driver ends none.
+ */
+ public static function execute(User $user, string $currentSessionId): void
+ {
+ if (config('session.driver') !== 'database') {
+ return;
+ }
+
+ DB::table(config('session.table', 'sessions'))
+ ->where('user_id', $user->id)
+ ->where('id', '!=', $currentSessionId)
+ ->delete();
+ }
+}
diff --git a/app/Actions/Post/CreateChannelPost.php b/app/Actions/Post/CreateChannelPost.php
index 2dff0ed42..07af858a3 100644
--- a/app/Actions/Post/CreateChannelPost.php
+++ b/app/Actions/Post/CreateChannelPost.php
@@ -16,7 +16,7 @@ use App\Models\User;
use App\Models\Workspace;
use App\Support\Media\MediaCopyBatch;
use App\Support\PostApproval;
-use App\Support\PostPlatformMetaRules;
+use App\Support\PostMeta;
use Carbon\Carbon;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
@@ -63,7 +63,7 @@ class CreateChannelPost
...$account->channelSnapshot(),
'content_type' => $destination['content_type'],
'publish_status' => PublishStatus::Pending,
- 'meta' => PostPlatformMetaRules::normalize($destination['meta'] ?? []),
+ 'meta' => PostMeta::forChannel($account, $destination['meta'] ?? []),
]);
SyncOwnedMedia::execute(
diff --git a/app/Actions/Post/HostInlineMedia.php b/app/Actions/Post/HostInlineMedia.php
index fcb28df4e..28585886a 100644
--- a/app/Actions/Post/HostInlineMedia.php
+++ b/app/Actions/Post/HostInlineMedia.php
@@ -189,7 +189,7 @@ class HostInlineMedia
* @param array<string, mixed> $reference
* @return array<string, mixed>
*/
- private static function item(Media $row, array $reference): array
+ public static function item(Media $row, array $reference): array
{
$item = MediaItem::fromMedia($row)->toArray();
$edits = array_intersect_key((array) data_get($reference, 'meta', []), array_flip(SyncOwnedMedia::EDITABLE_META));
diff --git a/app/Actions/Post/UpdatePost.php b/app/Actions/Post/UpdatePost.php
index ee1e4d985..490b2f522 100644
--- a/app/Actions/Post/UpdatePost.php
+++ b/app/Actions/Post/UpdatePost.php
@@ -21,6 +21,7 @@ use App\Models\Workspace;
use App\Support\Media\MediaCopyBatch;
use App\Support\PostApproval;
use App\Support\PostCompositionValidator;
+use App\Support\PostMeta;
use App\Support\PostPlatformMetaRules;
use App\Support\PostStatusRules;
use Carbon\Carbon;
@@ -205,7 +206,7 @@ class UpdatePost
'schedule_mode' => $mode,
...PostApproval::transition($previousStatus, $storedStatus, $actor, $pending ? $position : null),
'content_type' => $destination['content_type'],
- 'meta' => PostPlatformMetaRules::forStorage($post->meta ?? [], $destination['meta']),
+ 'meta' => PostMeta::forChannel($channel, $destination['meta'], $post->meta ?? []),
]);
SyncOwnedMedia::execute($post, $destination['media'], $batch);
diff --git a/app/Actions/Repurpose/ActivateRepurpose.php b/app/Actions/Repurpose/ActivateRepurpose.php
index eacc82127..d2f0d7e71 100644
--- a/app/Actions/Repurpose/ActivateRepurpose.php
+++ b/app/Actions/Repurpose/ActivateRepurpose.php
@@ -80,7 +80,7 @@ class ActivateRepurpose
continue;
}
- $violation = PostPlatformMetaRules::requiredMetaViolation($account, data_get($destination, 'meta'));
+ $violation = PostPlatformMetaRules::requiredMetaViolation($account, data_get($destination, 'meta'), data_get($destination, 'content_type'));
if ($violation !== null) {
throw ValidationException::withMessages(['destinations' => $violation[1]]);
diff --git a/app/Actions/SocialAccount/GetInstagramAudio.php b/app/Actions/SocialAccount/GetInstagramAudio.php
new file mode 100644
index 000000000..5ad07ba13
--- /dev/null
+++ b/app/Actions/SocialAccount/GetInstagramAudio.php
@@ -0,0 +1,48 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Actions\SocialAccount;
+
+use App\Models\SocialAccount;
+use App\Support\Social\InstagramAudio;
+use Illuminate\Http\Client\ConnectionException;
+use Illuminate\Http\Client\RequestException;
+use Illuminate\Http\Exceptions\ThrottleRequestsException;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Http;
+
+/**
+ * One Instagram audio asset by its id, with fresh cover and preview links: the
+ * links Meta hands out expire, the id does not. Kept for an hour.
+ */
+class GetInstagramAudio
+{
+ /**
+ * @return array{id: string, type: string|null, title: string, artist: string|null, cover_url: string|null, duration_ms: int|null, preview_url: string|null}
+ *
+ * @throws ConnectionException
+ * @throws RequestException
+ * @throws ThrottleRequestsException
+ */
+ public static function execute(SocialAccount $account, string $audioId): array
+ {
+ return Cache::remember(
+ "instagram:audio:{$account->id}:{$audioId}",
+ now()->addHour(),
+ function () use ($account, $audioId): array {
+ InstagramAudio::spend($account);
+
+ $response = Http::connectTimeout(3)
+ ->timeout(8)
+ ->get("{$account->platform->instagramGraphBaseUrl()}/{$audioId}", [
+ 'user_id' => $account->platform_user_id,
+ 'access_token' => $account->access_token,
+ ])
+ ->throw();
+
+ return InstagramAudio::present($response->json());
+ },
+ );
+ }
+}
diff --git a/app/Actions/SocialAccount/SearchInstagramAudio.php b/app/Actions/SocialAccount/SearchInstagramAudio.php
new file mode 100644
index 000000000..2aec1e60c
--- /dev/null
+++ b/app/Actions/SocialAccount/SearchInstagramAudio.php
@@ -0,0 +1,191 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Actions\SocialAccount;
+
+use App\Models\SocialAccount;
+use App\Support\Social\InstagramAudio;
+use Illuminate\Http\Client\ConnectionException;
+use Illuminate\Http\Client\Pool;
+use Illuminate\Http\Client\RequestException;
+use Illuminate\Http\Client\Response;
+use Illuminate\Http\Exceptions\ThrottleRequestsException;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Str;
+
+/**
+ * Audio an Instagram account connected through Facebook may attach to a reel,
+ * read from the Instagram Audio API, which lists them under `audio`: music
+ * then original sounds (or one of the two catalogues), trending or matching a
+ * search. Each answer is kept for ten minutes per account, catalogue and query,
+ * and one with a catalogue missing for a minute.
+ *
+ * @see https://developers.facebook.com/docs/instagram-platform/content-publishing/audio-api/
+ */
+class SearchInstagramAudio
+{
+ /** Original sounds per search whose creator picture is looked up. */
+ private const int PICTURE_LOOKUPS = 10;
+
+ /**
+ * @param 'music'|'original_sound'|null $type one catalogue, or both when null
+ * @return list<array{id: string, type: string|null, title: string, artist: string|null, cover_url: string|null, duration_ms: int|null, preview_url: string|null}>
+ *
+ * @throws ConnectionException
+ * @throws RequestException
+ * @throws ThrottleRequestsException
+ */
+ public static function execute(SocialAccount $account, ?string $query = null, ?string $type = null): array
+ {
+ $query = Str::squish((string) $query);
+ $scope = $type ?? 'all';
+ $queryHash = md5(Str::lower($query));
+ $cacheKey = "instagram:audio-search:{$account->id}:{$scope}:{$queryHash}";
+
+ $cached = Cache::get($cacheKey);
+
+ if (is_array($cached)) {
+ return $cached;
+ }
+
+ InstagramAudio::spend($account);
+
+ [$tracks, $complete] = self::search($account, $query, $type === null ? InstagramAudio::TYPES : [$type]);
+
+ Cache::put($cacheKey, $tracks, $complete ? now()->addMinutes(10) : now()->addMinute());
+
+ return $tracks;
+ }
+
+ /**
+ * The tracks found and whether every catalogue answered. A catalogue that
+ * failed leaves the answer partial, so it is kept for a minute only.
+ *
+ * @param list<string> $types
+ * @return array{0: list<array{id: string, type: string|null, title: string, artist: string|null, cover_url: string|null, duration_ms: int|null, preview_url: string|null}>, 1: bool}
+ *
+ * @throws ConnectionException
+ * @throws RequestException
+ */
+ private static function search(SocialAccount $account, string $query, array $types): array
+ {
+ $url = "{$account->platform->instagramGraphBaseUrl()}/ig_audio";
+
+ $responses = Http::pool(fn (Pool $pool): array => collect($types)
+ ->map(fn (string $type) => $pool->as($type)
+ ->connectTimeout(3)
+ ->timeout(8)
+ ->get($url, array_filter([
+ 'audio_type' => $type,
+ 'user_id' => $account->platform_user_id,
+ 'search_query' => $query !== '' ? $query : null,
+ 'access_token' => $account->access_token,
+ ])))
+ ->all());
+
+ $succeeded = collect($responses)->filter(fn (mixed $response): bool => $response instanceof Response && $response->successful());
+
+ if ($succeeded->isEmpty()) {
+ $failed = collect($responses)->first();
+
+ throw $failed instanceof Response ? $failed->toException() ?? new ConnectionException('Instagram audio search failed.') : $failed;
+ }
+
+ $tracks = fn (string $type): Collection => Collection::make((array) data_get($succeeded->get($type)?->json(), 'audio', []))
+ ->map(fn (mixed $track): array => InstagramAudio::present($track))
+ ->filter(fn (array $track): bool => data_get($track, 'id') !== '');
+
+ $music = $query === ''
+ ? $tracks('music')
+ : $tracks('music')->filter(fn (array $track): bool => self::matches($track, $query));
+
+ $found = $music
+ ->concat(self::withCreatorPictures($account, $tracks('original_sound')))
+ ->unique('id')
+ ->values()
+ ->all();
+
+ return [$found, $succeeded->count() === count($types)];
+ }
+
+ /**
+ * The search lists an original sound without any picture; its own lookup
+ * carries the creator's profile picture, which stands in for the cover.
+ * Only the first few are looked up, together. A picture is shared by every
+ * account and kept for a few hours, as its URL expires; a failed lookup may
+ * be this account's token, so only this account skips it, for a few minutes.
+ *
+ * @param Collection<int, array{id: string, type: string|null, title: string, artist: string|null, cover_url: string|null, duration_ms: int|null, preview_url: string|null}> $sounds
+ * @return Collection<int, array{id: string, type: string|null, title: string, artist: string|null, cover_url: string|null, duration_ms: int|null, preview_url: string|null}>
+ */
+ private static function withCreatorPictures(SocialAccount $account, Collection $sounds): Collection
+ {
+ $missing = $sounds
+ ->take(self::PICTURE_LOOKUPS)
+ ->filter(fn (array $sound): bool => blank(data_get($sound, 'cover_url'))
+ && ! Cache::has(self::pictureCacheKey(data_get($sound, 'id')))
+ && ! Cache::has(self::failedPictureCacheKey($account, data_get($sound, 'id'))))
+ ->pluck('id');
+
+ if ($missing->isNotEmpty()) {
+ $responses = Http::pool(fn (Pool $pool): array => $missing
+ ->map(fn (string $id) => $pool->as($id)
+ ->connectTimeout(3)
+ ->timeout(5)
+ ->get("{$account->platform->instagramGraphBaseUrl()}/{$id}", [
+ 'user_id' => $account->platform_user_id,
+ 'access_token' => $account->access_token,
+ ]))
+ ->all());
+
+ collect($responses)->each(function (mixed $response, string $id) use ($account): void {
+ if ($response instanceof Response && $response->successful()) {
+ Cache::put(self::pictureCacheKey($id), (string) data_get($response->json(), 'profile_picture_url', ''), now()->addHours(6));
+
+ return;
+ }
+
+ Cache::put(self::failedPictureCacheKey($account, $id), true, now()->addMinutes(10));
+ });
+ }
+
+ return $sounds->map(fn (array $sound): array => [
+ ...$sound,
+ 'cover_url' => data_get($sound, 'cover_url') ?? (filled($picture = Cache::get(self::pictureCacheKey(data_get($sound, 'id')))) ? $picture : null),
+ ]);
+ }
+
+ private static function pictureCacheKey(string $audioId): string
+ {
+ return "instagram:audio-picture:{$audioId}";
+ }
+
+ private static function failedPictureCacheKey(SocialAccount $account, string $audioId): string
+ {
+ return "instagram:audio-picture-failed:{$account->id}:{$audioId}";
+ }
+
+ /**
+ * The music search answers with the closest tracks of the catalogue licensed
+ * to third parties, related or not, when the searched artist is not in it;
+ * only a track naming every searched word is kept. A word matches as typed
+ * or without accents, so "cafe" finds "Café" and "夜に駆ける" still counts.
+ *
+ * @param array{title: string, artist: string|null} $track
+ */
+ private static function matches(array $track, string $query): bool
+ {
+ $title = data_get($track, 'title');
+ $artist = data_get($track, 'artist');
+ $haystack = Str::lower("{$title} {$artist}");
+ $asciiHaystack = Str::lower(Str::ascii($haystack));
+
+ return collect(preg_split('/\s+/u', Str::lower($query)) ?: [])
+ ->filter()
+ ->every(fn (string $word): bool => str_contains($haystack, $word)
+ || (($asciiWord = Str::ascii($word)) !== '' && str_contains($asciiHaystack, $asciiWord)));
+ }
+}
diff --git a/app/Enums/Instagram/TrialGraduation.php b/app/Enums/Instagram/TrialGraduation.php
new file mode 100644
index 000000000..8171df062
--- /dev/null
+++ b/app/Enums/Instagram/TrialGraduation.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Enums\Instagram;
+
+/**
+ * `trial_params.graduation_strategy` of a trial reel: shared only with
+ * non-followers until it graduates to everyone.
+ *
+ * @see https://developers.facebook.com/docs/instagram-platform/instagram-graph-api/reference/ig-user/media
+ */
+enum TrialGraduation: string
+{
+ /** Graduated by hand in the Instagram app. */
+ case Manual = 'MANUAL';
+
+ /** Graduated by Instagram when the reel performs well. */
+ case Performance = 'SS_PERFORMANCE';
+}
diff --git a/app/Http/Controllers/Api/ChannelPostingScheduleController.php b/app/Http/Controllers/Api/ChannelPostingScheduleController.php
index 36dff7b2c..de89a98d7 100644
--- a/app/Http/Controllers/Api/ChannelPostingScheduleController.php
+++ b/app/Http/Controllers/Api/ChannelPostingScheduleController.php
@@ -15,6 +15,13 @@ use App\Models\SocialAccount;
class ChannelPostingScheduleController extends Controller
{
+ public function show(SocialAccount $account): ChannelPostingScheduleResource
+ {
+ $this->authorize('view', $account);
+
+ return new ChannelPostingScheduleResource($account);
+ }
+
public function update(UpdatePostingScheduleRequest $request, SocialAccount $account, UpdatePostingSchedule $update): ChannelPostingScheduleResource
{
$update->handle($account, $request->validated());
diff --git a/app/Http/Controllers/Api/ChannelQueueController.php b/app/Http/Controllers/Api/ChannelQueueController.php
index a10a43258..8aba350fd 100644
--- a/app/Http/Controllers/Api/ChannelQueueController.php
+++ b/app/Http/Controllers/Api/ChannelQueueController.php
@@ -4,10 +4,12 @@ declare(strict_types=1);
namespace App\Http\Controllers\Api;
+use App\Actions\Post\Queue\ListFreeQueueSlots;
use App\Actions\Post\Queue\MoveChannelPostToQueueSlot;
use App\Actions\Post\Queue\ReorderChannelQueue;
use App\Http\Requests\Api\Channel\MoveChannelPostToQueueSlotRequest;
use App\Http\Requests\Api\Channel\ReorderChannelQueueRequest;
+use App\Http\Resources\Api\ChannelFreeSlotsResource;
use App\Http\Resources\Api\PostResource;
use App\Models\Post;
use App\Models\SocialAccount;
@@ -16,6 +18,13 @@ use Illuminate\Http\Response as EmptyResponse;
class ChannelQueueController extends Controller
{
+ public function slots(SocialAccount $account): ChannelFreeSlotsResource
+ {
+ $this->authorize('view', $account);
+
+ return new ChannelFreeSlotsResource(ListFreeQueueSlots::handle($account));
+ }
+
public function reorder(ReorderChannelQueueRequest $request, SocialAccount $account): EmptyResponse
{
ReorderChannelQueue::handle($account, $request->validated('post_ids'));
diff --git a/app/Http/Controllers/Api/DiscordController.php b/app/Http/Controllers/Api/DiscordController.php
new file mode 100644
index 000000000..812f91fa6
--- /dev/null
+++ b/app/Http/Controllers/Api/DiscordController.php
@@ -0,0 +1,39 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Controllers\Api;
+
+use App\Actions\SocialAccount\ListDiscordChannels;
+use App\Enums\SocialAccount\Platform;
+use App\Exceptions\PlatformUnavailableException;
+use App\Models\SocialAccount;
+use Illuminate\Http\JsonResponse;
+use Illuminate\Http\Request;
+use Symfony\Component\HttpFoundation\Response;
+
+class DiscordController extends Controller
+{
+ public function channels(Request $request, SocialAccount $account): JsonResponse
+ {
+ $this->authorize('view', $account);
+
+ if ($account->platform !== Platform::Discord) {
+ return response()->json(
+ ['message' => 'Channels are only available for Discord accounts.'],
+ Response::HTTP_UNPROCESSABLE_ENTITY,
+ );
+ }
+
+ try {
+ return response()->json([
+ 'channels' => ListDiscordChannels::execute($account),
+ ]);
+ } catch (PlatformUnavailableException $e) {
+ return response()->json(
+ ['message' => $e->getMessage()],
+ Response::HTTP_BAD_GATEWAY,
+ );
+ }
+ }
+}
diff --git a/app/Http/Controllers/Api/InstagramAudioController.php b/app/Http/Controllers/Api/InstagramAudioController.php
new file mode 100644
index 000000000..a9cab5293
--- /dev/null
+++ b/app/Http/Controllers/Api/InstagramAudioController.php
@@ -0,0 +1,68 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Controllers\Api;
+
+use App\Actions\SocialAccount\GetInstagramAudio;
+use App\Actions\SocialAccount\SearchInstagramAudio;
+use App\Enums\SocialAccount\Platform;
+use App\Http\Requests\Api\SocialAccount\IndexInstagramAudioRequest;
+use App\Http\Resources\Api\InstagramAudioResource;
+use App\Models\SocialAccount;
+use Closure;
+use Illuminate\Http\Client\ConnectionException;
+use Illuminate\Http\Client\RequestException;
+use Illuminate\Http\JsonResponse;
+use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
+use Symfony\Component\HttpFoundation\Response;
+
+class InstagramAudioController extends Controller
+{
+ public function index(IndexInstagramAudioRequest $request, SocialAccount $account): JsonResponse|AnonymousResourceCollection
+ {
+ return $this->lookup($account, fn (): AnonymousResourceCollection => InstagramAudioResource::collection(
+ SearchInstagramAudio::execute($account, $request->validated('q'), $request->validated('type')),
+ ));
+ }
+
+ public function show(SocialAccount $account, string $audioId): JsonResponse|InstagramAudioResource
+ {
+ return $this->lookup($account, fn (): InstagramAudioResource => new InstagramAudioResource(GetInstagramAudio::execute($account, $audioId)));
+ }
+
+ /**
+ * @template T
+ *
+ * @param Closure(): T $lookup
+ * @return T|JsonResponse
+ */
+ private function lookup(SocialAccount $account, Closure $lookup): mixed
+ {
+ $this->authorize('view', $account);
+ $this->authorize('createPost', $account->workspace);
+
+ if (! in_array($account->platform, [Platform::Instagram, Platform::InstagramFacebook], true)) {
+ return response()->json(
+ ['message' => 'Instagram audio is only available for Instagram accounts.'],
+ Response::HTTP_UNPROCESSABLE_ENTITY,
+ );
+ }
+
+ if ($account->platform !== Platform::InstagramFacebook) {
+ return response()->json(
+ ['message' => __('posts.form.instagram.music.requires_facebook')],
+ Response::HTTP_UNPROCESSABLE_ENTITY,
+ );
+ }
+
+ try {
+ return $lookup();
+ } catch (ConnectionException|RequestException) {
+ return response()->json(
+ ['message' => __('posts.form.instagram.music.search_failed')],
+ Response::HTTP_BAD_GATEWAY,
+ );
+ }
+ }
+}
diff --git a/app/Http/Controllers/Api/PinterestBoardController.php b/app/Http/Controllers/Api/PinterestBoardController.php
new file mode 100644
index 000000000..d2421f1a6
--- /dev/null
+++ b/app/Http/Controllers/Api/PinterestBoardController.php
@@ -0,0 +1,72 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Controllers\Api;
+
+use App\Actions\SocialAccount\CreatePinterestBoard;
+use App\Actions\SocialAccount\ListPinterestBoards;
+use App\Enums\SocialAccount\Platform;
+use App\Exceptions\Social\ErrorCategory;
+use App\Exceptions\Social\PinterestPublishException;
+use App\Exceptions\TokenExpiredException;
+use App\Http\Requests\Api\SocialAccount\StorePinterestBoardRequest;
+use App\Http\Resources\Api\PinterestBoardResource;
+use App\Models\SocialAccount;
+use App\Support\Social\PinterestBoardFailure;
+use Illuminate\Http\Client\ConnectionException;
+use Illuminate\Http\JsonResponse;
+use Illuminate\Http\Request;
+use Illuminate\Validation\ValidationException;
+use Symfony\Component\HttpFoundation\Response;
+
+class PinterestBoardController extends Controller
+{
+ public function index(Request $request, SocialAccount $account): JsonResponse
+ {
+ $this->authorize('view', $account);
+
+ if ($account->platform !== Platform::Pinterest) {
+ return response()->json(
+ ['message' => 'Boards are only available for Pinterest accounts.'],
+ Response::HTTP_UNPROCESSABLE_ENTITY,
+ );
+ }
+
+ try {
+ return response()->json(ListPinterestBoards::execute($account));
+ } catch (TokenExpiredException $e) {
+ return response()->json(
+ ['message' => $e->getMessage()],
+ Response::HTTP_UNAUTHORIZED,
+ );
+ } catch (PinterestPublishException $e) {
+ return response()->json(
+ ['message' => $e->userMessage],
+ $this->statusForPinterestCategory($e->category),
+ );
+ }
+ }
+
+ public function store(StorePinterestBoardRequest $request, SocialAccount $account): JsonResponse
+ {
+ try {
+ $board = CreatePinterestBoard::execute($account, $request->validated());
+ } catch (TokenExpiredException|PinterestPublishException|ConnectionException $e) {
+ throw ValidationException::withMessages(['name' => PinterestBoardFailure::message($e)]);
+ }
+
+ return (new PinterestBoardResource($board))
+ ->response()
+ ->setStatusCode(Response::HTTP_CREATED);
+ }
+
+ private function statusForPinterestCategory(ErrorCategory $category): int
+ {
+ return match ($category) {
+ ErrorCategory::RateLimit => Response::HTTP_TOO_MANY_REQUESTS,
+ ErrorCategory::Permission => Response::HTTP_FORBIDDEN,
+ default => Response::HTTP_BAD_GATEWAY,
+ };
+ }
+}
diff --git a/app/Http/Controllers/Api/PostController.php b/app/Http/Controllers/Api/PostController.php
index bda9755aa..a08883cd5 100644
--- a/app/Http/Controllers/Api/PostController.php
+++ b/app/Http/Controllers/Api/PostController.php
@@ -173,7 +173,7 @@ class PostController extends Controller
throw ValidationException::withMessages(['upload_token' => $violation]);
}
- AppendPostMedia::execute($post, [MediaItem::fromMedia($media, $request->validated('alt'))->toArray()], $request->user());
+ AppendPostMedia::execute($post, [HostInlineMedia::item($media, $request->validated())], $request->user());
$post->refresh()->load(['socialAccount', 'labels']);
diff --git a/app/Http/Controllers/Api/SocialAccountController.php b/app/Http/Controllers/Api/SocialAccountController.php
index 9e7567ac0..3a329356a 100644
--- a/app/Http/Controllers/Api/SocialAccountController.php
+++ b/app/Http/Controllers/Api/SocialAccountController.php
@@ -4,30 +4,9 @@ declare(strict_types=1);
namespace App\Http\Controllers\Api;
-use App\Actions\Post\Queue\ListFreeQueueSlots;
-use App\Actions\SocialAccount\CreatePinterestBoard;
-use App\Actions\SocialAccount\ListDiscordChannels;
-use App\Actions\SocialAccount\ListPinterestBoards;
-use App\Enums\SocialAccount\Platform;
-use App\Exceptions\PlatformUnavailableException;
-use App\Exceptions\Social\ErrorCategory;
-use App\Exceptions\Social\PinterestPublishException;
-use App\Exceptions\TokenExpiredException;
-use App\Http\Requests\Api\SocialAccount\StorePinterestBoardRequest;
-use App\Http\Resources\Api\ChannelFreeSlotsResource;
-use App\Http\Resources\Api\ChannelPostingScheduleResource;
-use App\Http\Resources\Api\PinterestBoardResource;
use App\Http\Resources\Api\SocialAccountResource;
-use App\Http\Resources\Api\TikTokCreatorInfoResource;
-use App\Models\SocialAccount;
-use App\Services\Social\TikTokCreatorInfo;
-use App\Support\Social\PinterestBoardFailure;
-use Illuminate\Http\Client\ConnectionException;
-use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
-use Illuminate\Validation\ValidationException;
-use Symfony\Component\HttpFoundation\Response;
class SocialAccountController extends Controller
{
@@ -37,113 +16,4 @@ class SocialAccountController extends Controller
return SocialAccountResource::collection($accounts);
}
-
- public function boards(Request $request, SocialAccount $account): JsonResponse
- {
- $this->authorize('view', $account);
-
- if ($account->platform !== Platform::Pinterest) {
- return response()->json(
- ['message' => 'Boards are only available for Pinterest accounts.'],
- Response::HTTP_UNPROCESSABLE_ENTITY,
- );
- }
-
- try {
- return response()->json(ListPinterestBoards::execute($account));
- } catch (TokenExpiredException $e) {
- return response()->json(
- ['message' => $e->getMessage()],
- Response::HTTP_UNAUTHORIZED,
- );
- } catch (PinterestPublishException $e) {
- return response()->json(
- ['message' => $e->userMessage],
- $this->statusForPinterestCategory($e->category),
- );
- }
- }
-
- public function storeBoard(StorePinterestBoardRequest $request, SocialAccount $account): JsonResponse
- {
- try {
- $board = CreatePinterestBoard::execute($account, $request->validated());
- } catch (TokenExpiredException|PinterestPublishException|ConnectionException $e) {
- throw ValidationException::withMessages(['name' => PinterestBoardFailure::message($e)]);
- }
-
- return (new PinterestBoardResource($board))
- ->response()
- ->setStatusCode(Response::HTTP_CREATED);
- }
-
- public function channels(Request $request, SocialAccount $account): JsonResponse
- {
- $this->authorize('view', $account);
-
- if ($account->platform !== Platform::Discord) {
- return response()->json(
- ['message' => 'Channels are only available for Discord accounts.'],
- Response::HTTP_UNPROCESSABLE_ENTITY,
- );
- }
-
- try {
- return response()->json([
- 'channels' => ListDiscordChannels::execute($account),
- ]);
- } catch (PlatformUnavailableException $e) {
- return response()->json(
- ['message' => $e->getMessage()],
- Response::HTTP_BAD_GATEWAY,
- );
- }
- }
-
- public function tiktokCreatorInfo(SocialAccount $account, TikTokCreatorInfo $tikTokCreatorInfo): JsonResponse
- {
- $this->authorize('view', $account);
-
- if ($account->platform !== Platform::TikTok) {
- return response()->json(
- ['message' => 'Creator info is only available for TikTok accounts.'],
- Response::HTTP_UNPROCESSABLE_ENTITY,
- );
- }
-
- try {
- $creatorInfo = $tikTokCreatorInfo->interactive()->fetchOrFail($account);
- } catch (PlatformUnavailableException $e) {
- return response()->json(
- ['message' => $e->getMessage()],
- $e->httpStatus ?? Response::HTTP_BAD_GATEWAY,
- $e->retryDelaySeconds === null ? [] : ['Retry-After' => (string) $e->retryDelaySeconds],
- );
- }
-
- return (new TikTokCreatorInfoResource($creatorInfo))->response();
- }
-
- public function postingSchedule(SocialAccount $account): ChannelPostingScheduleResource
- {
- $this->authorize('view', $account);
-
- return new ChannelPostingScheduleResource($account);
- }
-
- public function freeSlots(SocialAccount $account): ChannelFreeSlotsResource
- {
- $this->authorize('view', $account);
-
- return new ChannelFreeSlotsResource(ListFreeQueueSlots::handle($account));
- }
-
- private function statusForPinterestCategory(ErrorCategory $category): int
- {
- return match ($category) {
- ErrorCategory::RateLimit => Response::HTTP_TOO_MANY_REQUESTS,
- ErrorCategory::Permission => Response::HTTP_FORBIDDEN,
- default => Response::HTTP_BAD_GATEWAY,
- };
- }
}
diff --git a/app/Http/Controllers/Api/TikTokCreatorInfoController.php b/app/Http/Controllers/Api/TikTokCreatorInfoController.php
new file mode 100644
index 000000000..713505cdb
--- /dev/null
+++ b/app/Http/Controllers/Api/TikTokCreatorInfoController.php
@@ -0,0 +1,40 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Controllers\Api;
+
+use App\Enums\SocialAccount\Platform;
+use App\Exceptions\PlatformUnavailableException;
+use App\Http\Resources\Api\TikTokCreatorInfoResource;
+use App\Models\SocialAccount;
+use App\Services\Social\TikTokCreatorInfo;
+use Illuminate\Http\JsonResponse;
+use Symfony\Component\HttpFoundation\Response;
+
+class TikTokCreatorInfoController extends Controller
+{
+ public function show(SocialAccount $account, TikTokCreatorInfo $tikTokCreatorInfo): JsonResponse
+ {
+ $this->authorize('view', $account);
+
+ if ($account->platform !== Platform::TikTok) {
+ return response()->json(
+ ['message' => 'Creator info is only available for TikTok accounts.'],
+ Response::HTTP_UNPROCESSABLE_ENTITY,
+ );
+ }
+
+ try {
+ $creatorInfo = $tikTokCreatorInfo->interactive()->fetchOrFail($account);
+ } catch (PlatformUnavailableException $e) {
+ return response()->json(
+ ['message' => $e->getMessage()],
+ $e->httpStatus ?? Response::HTTP_BAD_GATEWAY,
+ $e->retryDelaySeconds === null ? [] : ['Retry-After' => (string) $e->retryDelaySeconds],
+ );
+ }
+
+ return (new TikTokCreatorInfoResource($creatorInfo))->response();
+ }
+}
diff --git a/app/Http/Controllers/App/InstagramAudioController.php b/app/Http/Controllers/App/InstagramAudioController.php
new file mode 100644
index 000000000..82f921435
--- /dev/null
+++ b/app/Http/Controllers/App/InstagramAudioController.php
@@ -0,0 +1,67 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Controllers\App;
+
+use App\Actions\SocialAccount\GetInstagramAudio;
+use App\Actions\SocialAccount\SearchInstagramAudio;
+use App\Enums\SocialAccount\Platform as SocialPlatform;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\App\Instagram\IndexInstagramAudioRequest;
+use App\Http\Resources\App\InstagramAudioResource;
+use App\Models\SocialAccount;
+use Closure;
+use Illuminate\Http\Client\ConnectionException;
+use Illuminate\Http\Client\RequestException;
+use Illuminate\Http\Request;
+use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
+use Illuminate\Validation\ValidationException;
+use Symfony\Component\HttpFoundation\Response;
+
+class InstagramAudioController extends Controller
+{
+ public function index(IndexInstagramAudioRequest $request, SocialAccount $account): AnonymousResourceCollection
+ {
+ $this->authorizeAudioAccount($request, $account);
+
+ return InstagramAudioResource::collection($this->callInstagram(
+ fn (): array => SearchInstagramAudio::execute($account, $request->validated('q'), $request->validated('type')),
+ ));
+ }
+
+ public function show(Request $request, SocialAccount $account, string $audioId): InstagramAudioResource
+ {
+ $this->authorizeAudioAccount($request, $account);
+
+ return new InstagramAudioResource($this->callInstagram(
+ fn (): array => GetInstagramAudio::execute($account, $audioId),
+ ));
+ }
+
+ private function authorizeAudioAccount(Request $request, SocialAccount $account): void
+ {
+ $this->authorize('view', $account);
+
+ abort_unless(in_array($account->platform, [SocialPlatform::Instagram, SocialPlatform::InstagramFacebook], true), Response::HTTP_NOT_FOUND);
+
+ $this->authorize('createPost', $request->user()->currentWorkspace);
+
+ if ($account->platform !== SocialPlatform::InstagramFacebook) {
+ throw ValidationException::withMessages(['q' => __('posts.form.instagram.music.requires_facebook')]);
+ }
+ }
+
+ /**
+ * @param Closure(): array<int|string, mixed> $callback
+ * @return array<int|string, mixed>
+ */
+ private function callInstagram(Closure $callback): array
+ {
+ try {
+ return $callback();
+ } catch (ConnectionException|RequestException) {
+ throw ValidationException::withMessages(['q' => __('posts.form.instagram.music.search_failed')]);
+ }
+ }
+}
diff --git a/app/Http/Controllers/App/Settings/AuthenticationController.php b/app/Http/Controllers/App/Settings/AuthenticationController.php
deleted file mode 100644
index 24fd1bfa0..000000000
--- a/app/Http/Controllers/App/Settings/AuthenticationController.php
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Http\Controllers\App\Settings;
-
-use App\Enums\Auth\SocialAuthProvider;
-use App\Http\Controllers\App\Controller;
-use App\Http\Requests\App\Settings\AuthenticationPasswordRequest;
-use App\Models\User;
-use Carbon\Carbon;
-use Illuminate\Http\RedirectResponse;
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Validation\Rule;
-use Inertia\Inertia;
-use Inertia\Response;
-use Laravel\Socialite\Facades\Socialite;
-
-class AuthenticationController extends Controller
-{
- public function edit(Request $request): Response
- {
- $user = $request->user();
-
- return Inertia::render('settings/profile/Authentication', [
- 'sessions' => $this->getSessions($request),
- 'hasPassword' => (bool) $user->password,
- 'connectedAccounts' => $this->getConnectedAccounts($user),
- ]);
- }
-
- public function updatePassword(AuthenticationPasswordRequest $request): RedirectResponse
- {
- $request->user()->update([
- 'password' => $request->password,
- ]);
-
- return back()->with('flash.success', __('settings.flash.password_updated'));
- }
-
- public function destroyOtherSessions(Request $request): RedirectResponse
- {
- $user = $request->user();
-
- if ($user->password) {
- $request->validate([
- 'password' => ['required', 'string', 'current_password'],
- ]);
- } else {
- $request->validate([
- 'email_confirmation' => ['required', 'string', Rule::in([$user->email])],
- ], [
- 'email_confirmation.in' => __('settings.authentication.sessions.email_mismatch'),
- ]);
- }
-
- DB::table(config('session.table', 'sessions'))
- ->where('user_id', $user->id)
- ->where('id', '!=', $request->session()->getId())
- ->delete();
-
- return back()->with('flash.success', __('settings.authentication.sessions.flash_logged_out'));
- }
-
- public function connectProvider(string $provider): RedirectResponse
- {
- $socialProvider = SocialAuthProvider::tryFrom($provider);
-
- abort_unless($socialProvider?->isEnabled(), 404);
-
- return match ($socialProvider) {
- SocialAuthProvider::Google => Socialite::driver('google-auth')->redirect(),
- SocialAuthProvider::GitHub => Socialite::driver('github')->scopes(['read:user', 'user:email'])->redirect(),
- };
- }
-
- public function disconnectProvider(Request $request, string $provider): RedirectResponse
- {
- $socialProvider = SocialAuthProvider::tryFrom($provider);
-
- abort_unless($socialProvider !== null, 404);
-
- $user = $request->user();
-
- if (! $user->isConnectedTo($socialProvider)) {
- return back();
- }
-
- if (! $this->canDisconnect($user, $socialProvider)) {
- return back()->with('flash.error', __('settings.authentication.providers.flash_cannot_disconnect'));
- }
-
- $user->update(["{$socialProvider->value}_id" => null]);
-
- return back()->with('flash.success', __('settings.authentication.providers.flash_disconnected', [
- 'provider' => $socialProvider->label(),
- ]));
- }
-
- /**
- * @return array<int, array{id: string, ip_address: string|null, user_agent: string|null, last_active: string, is_current: bool}>
- */
- private function getSessions(Request $request): array
- {
- if (config('session.driver') !== 'database') {
- return [];
- }
-
- return collect(
- DB::table(config('session.table', 'sessions'))
- ->where('user_id', $request->user()->id)
- ->orderByDesc('last_activity')
- ->get()
- )->map(fn ($session) => [
- 'id' => $session->id,
- 'ip_address' => $session->ip_address,
- 'user_agent' => $session->user_agent,
- 'last_active' => Carbon::createFromTimestamp($session->last_activity)->diffForHumans(),
- 'is_current' => $session->id === $request->session()->getId(),
- ])->values()->all();
- }
-
- /**
- * @return array<int, array{provider: string, label: string, connected: bool, can_disconnect: bool}>
- */
- private function getConnectedAccounts(User $user): array
- {
- return collect(SocialAuthProvider::cases())->map(fn (SocialAuthProvider $provider) => [
- 'provider' => $provider->value,
- 'label' => $provider->label(),
- 'connected' => $user->isConnectedTo($provider),
- 'can_disconnect' => $user->isConnectedTo($provider) && $this->canDisconnect($user, $provider),
- ])->values()->all();
- }
-
- private function canDisconnect(User $user, SocialAuthProvider $provider): bool
- {
- if ($user->password) {
- return true;
- }
-
- return collect(SocialAuthProvider::cases())
- ->filter(fn (SocialAuthProvider $other) => $other !== $provider)
- ->contains(fn (SocialAuthProvider $other) => $user->isConnectedTo($other));
- }
-}
diff --git a/app/Http/Controllers/App/Settings/ConnectedAccountController.php b/app/Http/Controllers/App/Settings/ConnectedAccountController.php
new file mode 100644
index 000000000..2da6bcf67
--- /dev/null
+++ b/app/Http/Controllers/App/Settings/ConnectedAccountController.php
@@ -0,0 +1,49 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Controllers\App\Settings;
+
+use App\Enums\Auth\SocialAuthProvider;
+use App\Http\Controllers\App\Controller;
+use Illuminate\Http\RedirectResponse;
+use Illuminate\Http\Request;
+use Laravel\Socialite\Facades\Socialite;
+
+class ConnectedAccountController extends Controller
+{
+ public function connect(string $provider): RedirectResponse
+ {
+ $socialProvider = SocialAuthProvider::tryFrom($provider);
+
+ abort_unless($socialProvider?->isEnabled(), 404);
+
+ return match ($socialProvider) {
+ SocialAuthProvider::Google => Socialite::driver('google-auth')->redirect(),
+ SocialAuthProvider::GitHub => Socialite::driver('github')->scopes(['read:user', 'user:email'])->redirect(),
+ };
+ }
+
+ public function destroy(Request $request, string $provider): RedirectResponse
+ {
+ $socialProvider = SocialAuthProvider::tryFrom($provider);
+
+ abort_unless($socialProvider !== null, 404);
+
+ $user = $request->user();
+
+ if (! $user->isConnectedTo($socialProvider)) {
+ return back();
+ }
+
+ if (! $user->canDisconnectFrom($socialProvider)) {
+ return back()->with('flash.error', __('settings.profile.providers.flash_cannot_disconnect'));
+ }
+
+ $user->update(["{$socialProvider->value}_id" => null]);
+
+ return back()->with('flash.success', __('settings.profile.providers.flash_disconnected', [
+ 'provider' => $socialProvider->label(),
+ ]));
+ }
+}
diff --git a/app/Http/Controllers/App/Settings/PasswordController.php b/app/Http/Controllers/App/Settings/PasswordController.php
new file mode 100644
index 000000000..0a7d5830c
--- /dev/null
+++ b/app/Http/Controllers/App/Settings/PasswordController.php
@@ -0,0 +1,21 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Controllers\App\Settings;
+
+use App\Http\Controllers\App\Controller;
+use App\Http\Requests\App\Settings\UpdatePasswordRequest;
+use Illuminate\Http\RedirectResponse;
+
+class PasswordController extends Controller
+{
+ public function update(UpdatePasswordRequest $request): RedirectResponse
+ {
+ $request->user()->update([
+ 'password' => $request->password,
+ ]);
+
+ return back()->with('flash.success', __('settings.flash.password_updated'));
+ }
+}
diff --git a/app/Http/Controllers/App/Settings/ProfileController.php b/app/Http/Controllers/App/Settings/ProfileController.php
index 6f9819e5b..50e5f4c27 100644
--- a/app/Http/Controllers/App/Settings/ProfileController.php
+++ b/app/Http/Controllers/App/Settings/ProfileController.php
@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace App\Http\Controllers\App\Settings;
+use App\Actions\Auth\ListActiveSessions;
+use App\Actions\Auth\ListConnectedAccounts;
use App\Actions\User\DeleteUser;
use App\Http\Controllers\Controller;
use App\Http\Requests\App\Settings\ProfileDeleteRequest;
@@ -12,6 +14,7 @@ use App\Http\Requests\App\Settings\UpdateLanguageRequest;
use App\Http\Requests\App\Settings\UploadPhotoRequest;
use App\Jobs\PostHog\SyncUser;
use App\Services\PostHogService;
+use App\Support\Auth\PasswordRequirements;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
@@ -22,9 +25,14 @@ class ProfileController extends Controller
{
public function edit(Request $request): Response
{
+ $user = $request->user();
+
return Inertia::render('settings/profile/Profile', [
- 'mustVerifyEmail' => $request->user() instanceof MustVerifyEmail,
- 'status' => $request->session()->get('status'),
+ 'mustVerifyEmail' => $user instanceof MustVerifyEmail,
+ 'hasPassword' => (bool) $user->password,
+ 'passwordRequirements' => PasswordRequirements::checklist(),
+ 'connectedAccounts' => ListConnectedAccounts::execute($user),
+ 'sessions' => ListActiveSessions::execute($user, $request->session()->getId()),
]);
}
diff --git a/app/Http/Controllers/App/Settings/SessionController.php b/app/Http/Controllers/App/Settings/SessionController.php
new file mode 100644
index 000000000..48dc19d88
--- /dev/null
+++ b/app/Http/Controllers/App/Settings/SessionController.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Controllers\App\Settings;
+
+use App\Actions\Auth\LogoutOtherSessions;
+use App\Http\Controllers\App\Controller;
+use Illuminate\Http\RedirectResponse;
+use Illuminate\Http\Request;
+
+class SessionController extends Controller
+{
+ public function destroyOthers(Request $request): RedirectResponse
+ {
+ LogoutOtherSessions::execute($request->user(), $request->session()->getId());
+
+ return back()->with('flash.success', __('settings.profile.sessions.flash_logged_out'));
+ }
+}
diff --git a/app/Http/Controllers/Auth/EmailVerificationNotificationController.php b/app/Http/Controllers/Auth/EmailVerificationNotificationController.php
index 4b28463b6..17dd66ea8 100644
--- a/app/Http/Controllers/Auth/EmailVerificationNotificationController.php
+++ b/app/Http/Controllers/Auth/EmailVerificationNotificationController.php
@@ -21,6 +21,8 @@ class EmailVerificationNotificationController extends Controller
$request->user()->sendEmailVerificationNotification();
- return back()->with('status', 'verification-link-sent');
+ return back()
+ ->with('status', 'verification-link-sent')
+ ->with('flash.success', __('settings.profile.verification_sent'));
}
}
diff --git a/app/Http/Controllers/Auth/GitHubController.php b/app/Http/Controllers/Auth/GitHubController.php
index e81917760..d6a2a4b91 100644
--- a/app/Http/Controllers/Auth/GitHubController.php
+++ b/app/Http/Controllers/Auth/GitHubController.php
@@ -72,16 +72,16 @@ class GitHubController extends Controller
->first();
if ($existing) {
- return redirect()->route('app.authentication.edit')
- ->with('flash.error', __('settings.authentication.providers.flash_already_linked', ['provider' => 'GitHub']));
+ return redirect()->route('app.profile.edit', ['tab' => 'login'])
+ ->with('flash.error', __('settings.profile.providers.flash_already_linked', ['provider' => 'GitHub']));
}
if ($user->github_id !== $githubId) {
$user->update(['github_id' => $githubId]);
}
- return redirect()->route('app.authentication.edit')
- ->with('flash.success', __('settings.authentication.providers.flash_connected', ['provider' => 'GitHub']));
+ return redirect()->route('app.profile.edit', ['tab' => 'login'])
+ ->with('flash.success', __('settings.profile.providers.flash_connected', ['provider' => 'GitHub']));
}
private function loginExistingUser(User $user, string $githubId): RedirectResponse
diff --git a/app/Http/Controllers/Auth/GoogleBusinessController.php b/app/Http/Controllers/Auth/GoogleBusinessController.php
index 8deabe711..b15e3a0ff 100644
--- a/app/Http/Controllers/Auth/GoogleBusinessController.php
+++ b/app/Http/Controllers/Auth/GoogleBusinessController.php
@@ -40,7 +40,6 @@ class GoogleBusinessController extends SocialController
return $this->redirectToProvider($request, $this->driver, $this->scopes, [
'access_type' => 'offline',
'prompt' => $this->switchingAccount($request) ? 'select_account consent' : 'consent',
- 'include_granted_scopes' => 'true',
]);
}
diff --git a/app/Http/Controllers/Auth/GoogleController.php b/app/Http/Controllers/Auth/GoogleController.php
index 2443c3b5c..f231390a1 100644
--- a/app/Http/Controllers/Auth/GoogleController.php
+++ b/app/Http/Controllers/Auth/GoogleController.php
@@ -64,16 +64,16 @@ class GoogleController extends Controller
->first();
if ($existing) {
- return redirect()->route('app.authentication.edit')
- ->with('flash.error', __('settings.authentication.providers.flash_already_linked', ['provider' => 'Google']));
+ return redirect()->route('app.profile.edit', ['tab' => 'login'])
+ ->with('flash.error', __('settings.profile.providers.flash_already_linked', ['provider' => 'Google']));
}
if ($user->google_id !== $googleId) {
$user->update(['google_id' => $googleId]);
}
- return redirect()->route('app.authentication.edit')
- ->with('flash.success', __('settings.authentication.providers.flash_connected', ['provider' => 'Google']));
+ return redirect()->route('app.profile.edit', ['tab' => 'login'])
+ ->with('flash.success', __('settings.profile.providers.flash_connected', ['provider' => 'Google']));
}
private function loginExistingUser(User $user, string $googleId): RedirectResponse
diff --git a/app/Http/Controllers/Auth/InstagramController.php b/app/Http/Controllers/Auth/InstagramController.php
index 1d6f62297..c9a45bf25 100644
--- a/app/Http/Controllers/Auth/InstagramController.php
+++ b/app/Http/Controllers/Auth/InstagramController.php
@@ -70,6 +70,7 @@ class InstagramController extends SocialController
'scopes' => $scopes,
'meta' => [
'account_type' => data_get($socialUser->user, 'account_type'),
+ 'ig_user_id' => transform(data_get($socialUser->user, 'user_id'), fn (mixed $userId): string => (string) $userId),
],
],
),
diff --git a/app/Http/Controllers/Auth/SocialController.php b/app/Http/Controllers/Auth/SocialController.php
index 0540b0665..de989d318 100644
--- a/app/Http/Controllers/Auth/SocialController.php
+++ b/app/Http/Controllers/Auth/SocialController.php
@@ -306,23 +306,37 @@ class SocialController extends Controller
if ($reconnect !== null) {
return array_values(array_filter(
$identities,
- fn (array $identity): bool => data_get($identity, 'platform_user_id') === (string) $reconnect->platform_user_id,
+ fn (array $identity): bool => self::isIdentityOf($reconnect, $identity),
));
}
$seated = $workspace->socialAccounts()
->whereIn('platform', $this->platform->networkPlatformValues())
- ->get(['platform', 'platform_user_id']);
+ ->get(['platform', 'platform_user_id', 'meta']);
return array_values(array_filter(
$identities,
fn (array $identity): bool => ! $seated->contains(
- fn (SocialAccount $account): bool => (string) $account->platform_user_id === data_get($identity, 'platform_user_id')
- && $account->platform->value !== data_get($identity, 'platform'),
+ fn (SocialAccount $account): bool => $account->platform->value !== data_get($identity, 'platform')
+ && self::isIdentityOf($account, $identity),
),
));
}
+ /**
+ * Whether an offered identity is this account (see SocialAccount::isIdentity()).
+ *
+ * @param array<string, mixed> $identity
+ */
+ private static function isIdentityOf(SocialAccount $account, array $identity): bool
+ {
+ return $account->isIdentity(
+ SocialPlatform::from((string) data_get($identity, 'platform')),
+ (string) data_get($identity, 'platform_user_id'),
+ data_get($identity, 'attributes.meta.ig_user_id'),
+ );
+ }
+
/**
* Sends the user to the confirmation page with the reason the connection
* stopped. The tokens are dropped; where to return is kept for "Try again".
diff --git a/app/Http/Controllers/Auth/YouTubeController.php b/app/Http/Controllers/Auth/YouTubeController.php
index 13785a937..9aeec0680 100644
--- a/app/Http/Controllers/Auth/YouTubeController.php
+++ b/app/Http/Controllers/Auth/YouTubeController.php
@@ -99,7 +99,6 @@ class YouTubeController extends SocialController
->with([
'access_type' => 'offline',
'prompt' => 'select_account consent',
- 'include_granted_scopes' => 'true',
])
->redirect()
->getTargetUrl()
diff --git a/app/Http/Requests/Api/Post/AttachMediaFromUploadRequest.php b/app/Http/Requests/Api/Post/AttachMediaFromUploadRequest.php
index fd57e5992..bcd7702e7 100644
--- a/app/Http/Requests/Api/Post/AttachMediaFromUploadRequest.php
+++ b/app/Http/Requests/Api/Post/AttachMediaFromUploadRequest.php
@@ -6,6 +6,7 @@ namespace App\Http\Requests\Api\Post;
use App\Actions\Media\ResolveWorkspaceMedia;
use App\Models\Media;
+use App\Support\PostMediaRules;
use App\Support\Requests\Post\PostMediaRequestRules;
use Illuminate\Auth\Access\Response;
use Illuminate\Foundation\Http\FormRequest;
@@ -26,7 +27,10 @@ class AttachMediaFromUploadRequest extends FormRequest
*/
public function rules(): array
{
- return PostMediaRequestRules::attachFromUpload();
+ return [
+ ...PostMediaRequestRules::attachFromUpload(),
+ 'meta' => PostMediaRules::metaRules(),
+ ];
}
public function withValidator(Validator $validator): void
diff --git a/app/Http/Requests/Api/Post/AttachMediaFromUrlRequest.php b/app/Http/Requests/Api/Post/AttachMediaFromUrlRequest.php
index 8ffbb0d4a..af2398bc8 100644
--- a/app/Http/Requests/Api/Post/AttachMediaFromUrlRequest.php
+++ b/app/Http/Requests/Api/Post/AttachMediaFromUrlRequest.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Http\Requests\Api\Post;
+use App\Support\PostMediaRules;
use App\Support\Requests\Post\PostMediaRequestRules;
use Illuminate\Auth\Access\Response;
use Illuminate\Foundation\Http\FormRequest;
@@ -21,6 +22,9 @@ class AttachMediaFromUrlRequest extends FormRequest
*/
public function rules(): array
{
- return PostMediaRequestRules::attachFromUrl();
+ return [
+ ...PostMediaRequestRules::attachFromUrl(),
+ 'urls.*.meta' => PostMediaRules::metaRules(),
+ ];
}
}
diff --git a/app/Http/Requests/Api/SocialAccount/IndexInstagramAudioRequest.php b/app/Http/Requests/Api/SocialAccount/IndexInstagramAudioRequest.php
new file mode 100644
index 000000000..70784694b
--- /dev/null
+++ b/app/Http/Requests/Api/SocialAccount/IndexInstagramAudioRequest.php
@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Requests\Api\SocialAccount;
+
+use App\Support\Social\InstagramAudio;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+class IndexInstagramAudioRequest extends FormRequest
+{
+ public function authorize(): bool
+ {
+ return true;
+ }
+
+ /**
+ * @return array<string, mixed>
+ */
+ public function rules(): array
+ {
+ return [
+ 'q' => ['nullable', 'string', 'max:100'],
+ 'type' => ['nullable', 'string', Rule::in(InstagramAudio::TYPES)],
+ ];
+ }
+}
diff --git a/app/Http/Requests/App/Instagram/IndexInstagramAudioRequest.php b/app/Http/Requests/App/Instagram/IndexInstagramAudioRequest.php
new file mode 100644
index 000000000..99028d1e5
--- /dev/null
+++ b/app/Http/Requests/App/Instagram/IndexInstagramAudioRequest.php
@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Requests\App\Instagram;
+
+use App\Support\Social\InstagramAudio;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Rule;
+
+class IndexInstagramAudioRequest extends FormRequest
+{
+ public function authorize(): bool
+ {
+ return true;
+ }
+
+ /**
+ * @return array<string, mixed>
+ */
+ public function rules(): array
+ {
+ return [
+ 'q' => ['nullable', 'string', 'max:100'],
+ 'type' => ['nullable', 'string', Rule::in(InstagramAudio::TYPES)],
+ ];
+ }
+}
diff --git a/app/Http/Requests/App/Post/UpdatePostRequest.php b/app/Http/Requests/App/Post/UpdatePostRequest.php
index 22382d3a7..cf71492df 100644
--- a/app/Http/Requests/App/Post/UpdatePostRequest.php
+++ b/app/Http/Requests/App/Post/UpdatePostRequest.php
@@ -106,7 +106,7 @@ class UpdatePostRequest extends FormRequest
return;
}
- PostPlatformMetaRules::addRequiredOnPublishErrors($validator, $post->socialAccount ?? $post->platform, $this->effectiveMeta());
+ PostPlatformMetaRules::addRequiredOnPublishErrors($validator, $post->socialAccount ?? $post->platform, $this->effectiveMeta(), contentType: $this->input('content_type') ?? $post->content_type);
});
}
diff --git a/app/Http/Requests/App/Settings/AuthenticationPasswordRequest.php b/app/Http/Requests/App/Settings/UpdatePasswordRequest.php
similarity index 91%
rename from app/Http/Requests/App/Settings/AuthenticationPasswordRequest.php
rename to app/Http/Requests/App/Settings/UpdatePasswordRequest.php
index 0157ffada..84fc1f09f 100644
--- a/app/Http/Requests/App/Settings/AuthenticationPasswordRequest.php
+++ b/app/Http/Requests/App/Settings/UpdatePasswordRequest.php
@@ -8,7 +8,7 @@ use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rules\Password;
-class AuthenticationPasswordRequest extends FormRequest
+class UpdatePasswordRequest extends FormRequest
{
/**
* @return array<string, ValidationRule|array<mixed>|string>
diff --git a/app/Http/Resources/Api/InstagramAudioResource.php b/app/Http/Resources/Api/InstagramAudioResource.php
new file mode 100644
index 000000000..a929ea51b
--- /dev/null
+++ b/app/Http/Resources/Api/InstagramAudioResource.php
@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Resources\Api;
+
+use Illuminate\Http\Request;
+use Illuminate\Http\Resources\Json\JsonResource;
+
+class InstagramAudioResource extends JsonResource
+{
+ /**
+ * @return array{id: string, type: string|null, title: string, artist: string|null, cover_url: string|null, duration_ms: int|null, preview_url: string|null}
+ */
+ public function toArray(Request $request): array
+ {
+ return [
+ 'id' => (string) data_get($this->resource, 'id'),
+ 'type' => data_get($this->resource, 'type'),
+ 'title' => (string) data_get($this->resource, 'title'),
+ 'artist' => data_get($this->resource, 'artist'),
+ 'cover_url' => data_get($this->resource, 'cover_url'),
+ 'duration_ms' => data_get($this->resource, 'duration_ms'),
+ 'preview_url' => data_get($this->resource, 'preview_url'),
+ ];
+ }
+}
diff --git a/app/Http/Resources/App/InstagramAudioResource.php b/app/Http/Resources/App/InstagramAudioResource.php
new file mode 100644
index 000000000..c3ea664cd
--- /dev/null
+++ b/app/Http/Resources/App/InstagramAudioResource.php
@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Resources\App;
+
+use Illuminate\Http\Request;
+use Illuminate\Http\Resources\Json\JsonResource;
+
+class InstagramAudioResource extends JsonResource
+{
+ /**
+ * @return array{id: string, type: string|null, title: string, artist: string|null, cover_url: string|null, duration_ms: int|null, preview_url: string|null}
+ */
+ public function toArray(Request $request): array
+ {
+ return [
+ 'id' => (string) data_get($this->resource, 'id'),
+ 'type' => data_get($this->resource, 'type'),
+ 'title' => (string) data_get($this->resource, 'title'),
+ 'artist' => data_get($this->resource, 'artist'),
+ 'cover_url' => data_get($this->resource, 'cover_url'),
+ 'duration_ms' => data_get($this->resource, 'duration_ms'),
+ 'preview_url' => data_get($this->resource, 'preview_url'),
+ ];
+ }
+}
diff --git a/app/Mcp/Servers/TryPostServer.php b/app/Mcp/Servers/TryPostServer.php
index 0d3bc24b8..9e3ef7f9c 100644
--- a/app/Mcp/Servers/TryPostServer.php
+++ b/app/Mcp/Servers/TryPostServer.php
@@ -66,6 +66,7 @@ use App\Mcp\Tools\Signature\UpdateSignatureTool;
use App\Mcp\Tools\SocialAccount\CopyPostingScheduleTool;
use App\Mcp\Tools\SocialAccount\CreatePinterestBoardTool;
use App\Mcp\Tools\SocialAccount\GeneratePostingScheduleTool;
+use App\Mcp\Tools\SocialAccount\GetInstagramAudioTool;
use App\Mcp\Tools\SocialAccount\GetPostingScheduleTool;
use App\Mcp\Tools\SocialAccount\GetTikTokCreatorInfoTool;
use App\Mcp\Tools\SocialAccount\ListDiscordChannelsTool;
@@ -74,6 +75,7 @@ use App\Mcp\Tools\SocialAccount\ListPinterestBoardsTool;
use App\Mcp\Tools\SocialAccount\ListSocialAccountsTool;
use App\Mcp\Tools\SocialAccount\MovePostToSlotTool;
use App\Mcp\Tools\SocialAccount\ReorderQueueTool;
+use App\Mcp\Tools\SocialAccount\SearchInstagramAudioTool;
use App\Mcp\Tools\SocialAccount\UpdatePostingScheduleTool;
use App\Mcp\Tools\Webhook\CreateWebhookTool;
use App\Mcp\Tools\Webhook\DeleteWebhookTool;
@@ -163,6 +165,8 @@ class TryPostServer extends Server
ListPinterestBoardsTool::class,
CreatePinterestBoardTool::class,
ListDiscordChannelsTool::class,
+ SearchInstagramAudioTool::class,
+ GetInstagramAudioTool::class,
GetTikTokCreatorInfoTool::class,
ListRepurposesTool::class,
CreateRepurposeTool::class,
diff --git a/app/Mcp/Tools/Post/AttachMediaFromUploadTool.php b/app/Mcp/Tools/Post/AttachMediaFromUploadTool.php
index 30a365b99..53899b56d 100644
--- a/app/Mcp/Tools/Post/AttachMediaFromUploadTool.php
+++ b/app/Mcp/Tools/Post/AttachMediaFromUploadTool.php
@@ -6,11 +6,12 @@ namespace App\Mcp\Tools\Post;
use App\Actions\Media\ResolveWorkspaceMedia;
use App\Actions\Post\AppendPostMedia;
-use App\Dto\MediaItem;
+use App\Actions\Post\HostInlineMedia;
use App\Exceptions\Post\QueueBusyException;
use App\Http\Resources\Api\PostResource;
use App\Mcp\Concerns\AuthorizesMcpTool;
use App\Models\Post;
+use App\Support\PostMediaRules;
use App\Support\Requests\Post\PostMediaRequestRules;
use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Mcp\Request;
@@ -41,7 +42,10 @@ class AttachMediaFromUploadTool extends Tool
return $denied;
}
- $validated = $request->validate(PostMediaRequestRules::attachFromUpload());
+ $validated = $request->validate([
+ ...PostMediaRequestRules::attachFromUpload(),
+ 'meta' => PostMediaRules::metaRules(),
+ ]);
$media = ResolveWorkspaceMedia::byUploadTokens($post->workspace, [(string) data_get($validated, 'upload_token')])->first();
@@ -54,7 +58,7 @@ class AttachMediaFromUploadTool extends Tool
}
try {
- AppendPostMedia::execute($post, [MediaItem::fromMedia($media, data_get($validated, 'alt'))->toArray()], $request->user());
+ AppendPostMedia::execute($post, [HostInlineMedia::item($media, $validated)], $request->user());
} catch (QueueBusyException) {
return Response::error(__('posts.errors.queue_busy'));
}
@@ -72,6 +76,7 @@ class AttachMediaFromUploadTool extends Tool
'post_id' => $schema->string()->required()->description('UUID of the post to attach the uploaded media to.'),
'upload_token' => $schema->string()->required()->description('upload_token returned by request-media-upload-tool, after the file was sent to its upload_url.'),
'alt' => $schema->string()->description('Optional accessibility alt text for the media (applies to images).'),
+ 'meta' => $schema->object()->description('Optional per-item settings: user_tags (Instagram feed images only: up to 20 of {username, x, y}, x and y between 0 and 1 from the top-left corner), cover_offset_ms (video cover frame in milliseconds, for content types with supports_video_cover).'),
];
}
}
diff --git a/app/Mcp/Tools/Post/AttachMediaFromUrlTool.php b/app/Mcp/Tools/Post/AttachMediaFromUrlTool.php
index ca8a606eb..02c7b9c46 100644
--- a/app/Mcp/Tools/Post/AttachMediaFromUrlTool.php
+++ b/app/Mcp/Tools/Post/AttachMediaFromUrlTool.php
@@ -9,6 +9,7 @@ use App\Http\Resources\Api\PostResource;
use App\Mcp\Concerns\AuthorizesMcpTool;
use App\Models\Post;
use App\Services\Post\MediaAttacher;
+use App\Support\PostMediaRules;
use App\Support\Requests\Post\PostMediaRequestRules;
use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Mcp\Request;
@@ -35,7 +36,10 @@ class AttachMediaFromUrlTool extends Tool
return $denied;
}
- $validated = $request->validate(PostMediaRequestRules::attachFromUrl());
+ $validated = $request->validate([
+ ...PostMediaRequestRules::attachFromUrl(),
+ 'urls.*.meta' => PostMediaRules::metaRules(),
+ ]);
try {
$result = app(MediaAttacher::class)->attachFromUrls(
@@ -65,6 +69,7 @@ class AttachMediaFromUrlTool extends Tool
->items($schema->object(fn ($u) => [
'url' => $u->string()->required()->description('Public HTTP/HTTPS URL of an image, video, or PDF.'),
'alt' => $u->string()->description('Optional accessibility alt text for the image (ignored for video/PDF, which have no alt text).'),
+ 'meta' => $u->object()->description('Optional per-item settings: user_tags (Instagram feed images only: up to 20 of {username, x, y}, x and y between 0 and 1 from the top-left corner), cover_offset_ms (video cover frame in milliseconds, for content types with supports_video_cover).'),
]))
->required()
->description('Media to attach. Max 10 per call. Allowed types: image/jpeg, image/png, image/gif, image/webp, video/mp4, video/quicktime, application/pdf. The server per-type size ceilings apply on download; stricter per-network caps apply at schedule/publish.'),
diff --git a/app/Mcp/Tools/SocialAccount/GetInstagramAudioTool.php b/app/Mcp/Tools/SocialAccount/GetInstagramAudioTool.php
new file mode 100644
index 000000000..adc30606d
--- /dev/null
+++ b/app/Mcp/Tools/SocialAccount/GetInstagramAudioTool.php
@@ -0,0 +1,75 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Mcp\Tools\SocialAccount;
+
+use App\Actions\SocialAccount\GetInstagramAudio;
+use App\Enums\SocialAccount\Platform;
+use App\Mcp\Concerns\AuthorizesMcpTool;
+use App\Models\SocialAccount;
+use App\Models\Workspace;
+use Illuminate\Contracts\JsonSchema\JsonSchema;
+use Illuminate\Http\Client\ConnectionException;
+use Illuminate\Http\Client\RequestException;
+use Illuminate\Http\Exceptions\ThrottleRequestsException;
+use Laravel\Mcp\Request;
+use Laravel\Mcp\Response;
+use Laravel\Mcp\ResponseFactory;
+use Laravel\Mcp\Server\Attributes\Description;
+use Laravel\Mcp\Server\Tool;
+
+#[Description('Get one Instagram audio asset by id (the meta.audio.id of a reel, or an id from search-instagram-audio-tool): title, artist, duration and fresh cover and preview links, which Instagram expires. Fails when the track is no longer available. Requires an Instagram account connected through Facebook.')]
+class GetInstagramAudioTool extends Tool
+{
+ use AuthorizesMcpTool;
+
+ public function handle(Request $request): Response|ResponseFactory
+ {
+ $workspace = $this->authorizeCurrentWorkspace($request, 'createPost');
+
+ if (! $workspace instanceof Workspace) {
+ return $workspace;
+ }
+
+ $validated = $request->validate(['account_id' => ['required', 'string', 'uuid']]);
+
+ $account = SocialAccount::where('workspace_id', $workspace->id)->find(data_get($validated, 'account_id'));
+
+ if (! $account) {
+ return Response::error('Social account not found.');
+ }
+
+ if ($denied = $this->denyUnlessCan($request, 'view', $account, 'Social account not found.')) {
+ return $denied;
+ }
+
+ if (! in_array($account->platform, [Platform::Instagram, Platform::InstagramFacebook], true)) {
+ return Response::error('This tool only works with Instagram social accounts.');
+ }
+
+ if ($account->platform !== Platform::InstagramFacebook) {
+ return Response::error(__('posts.form.instagram.music.requires_facebook'));
+ }
+
+ $audioId = (string) data_get($request->validate([
+ 'audio_id' => ['required', 'string', 'regex:/^[0-9]+$/'],
+ ]), 'audio_id');
+
+ try {
+ return Response::structured(GetInstagramAudio::execute($account, $audioId));
+ } catch (ThrottleRequestsException $e) {
+ return Response::error($e->getMessage());
+ } catch (ConnectionException|RequestException) {
+ return Response::error(__('posts.form.instagram.music.search_failed'));
+ }
+ }
+
+ public function schema(JsonSchema $schema): array
+ {
+ return [
+ 'account_id' => $schema->string()->required()->description('The UUID of an Instagram account connected through Facebook.'),
+ 'audio_id' => $schema->string()->required()->description('The Instagram audio asset id.'),
+ ];
+ }
+}
diff --git a/app/Mcp/Tools/SocialAccount/SearchInstagramAudioTool.php b/app/Mcp/Tools/SocialAccount/SearchInstagramAudioTool.php
new file mode 100644
index 000000000..77dd77822
--- /dev/null
+++ b/app/Mcp/Tools/SocialAccount/SearchInstagramAudioTool.php
@@ -0,0 +1,80 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Mcp\Tools\SocialAccount;
+
+use App\Actions\SocialAccount\SearchInstagramAudio;
+use App\Enums\SocialAccount\Platform;
+use App\Mcp\Concerns\AuthorizesMcpTool;
+use App\Models\SocialAccount;
+use App\Models\Workspace;
+use App\Support\Social\InstagramAudio;
+use Illuminate\Contracts\JsonSchema\JsonSchema;
+use Illuminate\Http\Client\ConnectionException;
+use Illuminate\Http\Client\RequestException;
+use Illuminate\Http\Exceptions\ThrottleRequestsException;
+use Illuminate\Validation\Rule;
+use Laravel\Mcp\Request;
+use Laravel\Mcp\Response;
+use Laravel\Mcp\ResponseFactory;
+use Laravel\Mcp\Server\Attributes\Description;
+use Laravel\Mcp\Server\Tool;
+
+#[Description('Search Instagram audio (licensed music and original sounds) to attach to a reel, for an Instagram account connected through Facebook. Omit q for what is trending. Use a returned id as meta.audio.id (with optional title, artist, audio_volume and video_volume from 0 to 100) on an instagram_reel post. Results are cached for ten minutes; a workspace may make '.InstagramAudio::LOOKUPS_PER_MINUTE.' uncached lookups per minute.')]
+class SearchInstagramAudioTool extends Tool
+{
+ use AuthorizesMcpTool;
+
+ public function handle(Request $request): Response|ResponseFactory
+ {
+ $workspace = $this->authorizeCurrentWorkspace($request, 'createPost');
+
+ if (! $workspace instanceof Workspace) {
+ return $workspace;
+ }
+
+ $validated = $request->validate([
+ 'account_id' => ['required', 'string', 'uuid'],
+ 'q' => ['nullable', 'string', 'max:100'],
+ 'type' => ['nullable', 'string', Rule::in(InstagramAudio::TYPES)],
+ ]);
+
+ $account = SocialAccount::where('workspace_id', $workspace->id)->find(data_get($validated, 'account_id'));
+
+ if (! $account) {
+ return Response::error('Social account not found.');
+ }
+
+ if ($denied = $this->denyUnlessCan($request, 'view', $account, 'Social account not found.')) {
+ return $denied;
+ }
+
+ if (! in_array($account->platform, [Platform::Instagram, Platform::InstagramFacebook], true)) {
+ return Response::error('This tool only works with Instagram social accounts.');
+ }
+
+ if ($account->platform !== Platform::InstagramFacebook) {
+ return Response::error(__('posts.form.instagram.music.requires_facebook'));
+ }
+
+ try {
+ return Response::structured([
+ 'audio' => SearchInstagramAudio::execute($account, data_get($validated, 'q'), data_get($validated, 'type')),
+ ]);
+ } catch (ThrottleRequestsException $e) {
+ return Response::error($e->getMessage());
+ } catch (ConnectionException|RequestException) {
+ return Response::error(__('posts.form.instagram.music.search_failed'));
+ }
+ }
+
+ public function schema(JsonSchema $schema): array
+ {
+ return [
+ 'account_id' => $schema->string()->required()->description('The UUID of an Instagram account connected through Facebook.'),
+ 'q' => $schema->string()->description('Search words. Omit for trending audio.'),
+ 'type' => $schema->string()->enum(InstagramAudio::TYPES)->description('music or original_sound. Omit for both, music first.'),
+ ];
+ }
+}
diff --git a/app/Models/SocialAccount.php b/app/Models/SocialAccount.php
index e74c1edfe..c6923ee8f 100644
--- a/app/Models/SocialAccount.php
+++ b/app/Models/SocialAccount.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Models;
use App\Actions\Analytics\DispatchAccountAnalytics;
+use App\Actions\Analytics\MoveAnalyticsIdentity;
use App\Actions\SocialAccount\ApplyChannelDefaults;
use App\Casts\PostingScheduleCast;
use App\Enums\Notification\Type;
@@ -196,19 +197,24 @@ class SocialAccount extends Model
$reconnect?->workspace_id === $workspace->id
&& $reconnect->platform->network() === $platform->network()
) {
- if ((string) $reconnect->platform_user_id !== $platformUserId) {
+ if (! $reconnect->isIdentity($platform, $platformUserId, data_get($values, 'meta.ig_user_id'))) {
throw NetworkAlreadyConnectedException::identityMismatch($platform);
}
$previousPlatform = $reconnect->platform;
+ $previousPlatformUserId = (string) $reconnect->platform_user_id;
try {
// The card and the targets that still have to publish through it
// move together or not at all.
- DB::transaction(function () use ($reconnect, $values, $previousPlatform, $platform): void {
+ DB::transaction(function () use ($reconnect, $values, $previousPlatform, $previousPlatformUserId, $platform): void {
$reconnect->update($values);
static::realignUnpublishedTargets($reconnect, $previousPlatform, $platform);
+
+ if ($previousPlatform !== $platform) {
+ app(MoveAnalyticsIdentity::class)->handle($reconnect, $previousPlatformUserId);
+ }
});
} catch (UniqueConstraintViolationException) {
throw new NetworkAlreadyConnectedException($platform);
@@ -233,6 +239,46 @@ class SocialAccount extends Model
return $account;
}
+ /**
+ * Whether an identity a provider returned is this account: the same
+ * platform user id, or, across the two Instagram platforms, the same
+ * Instagram professional account id, since Instagram Login reports an
+ * app-scoped id where Facebook reports the account id.
+ */
+ public function isIdentity(SocialPlatform $platform, string $platformUserId, mixed $instagramUserId = null): bool
+ {
+ if ((string) $this->platform_user_id === $platformUserId) {
+ return true;
+ }
+
+ if ($platform === $this->platform) {
+ return false;
+ }
+
+ $identityAccountId = match ($platform) {
+ SocialPlatform::InstagramFacebook => $platformUserId,
+ SocialPlatform::Instagram => filled($instagramUserId) ? (string) $instagramUserId : null,
+ default => null,
+ };
+
+ return filled($identityAccountId) && $identityAccountId === $this->instagramAccountId();
+ }
+
+ /**
+ * The Instagram professional account id: the platform user id when
+ * connected through Facebook, `meta.ig_user_id` when connected through
+ * Instagram Login (stored on connect, and filled in for older accounts by
+ * the daily connection check).
+ */
+ private function instagramAccountId(): ?string
+ {
+ return match ($this->platform) {
+ SocialPlatform::InstagramFacebook => (string) $this->platform_user_id,
+ SocialPlatform::Instagram => transform(data_get($this->meta, 'ig_user_id'), fn (mixed $id): string => (string) $id),
+ default => null,
+ };
+ }
+
/**
* A new channel starts in its connector's time zone (the workspace owner's
* when connected by webhook, UTC as a last resort) with a three-a-week goal
diff --git a/app/Models/User.php b/app/Models/User.php
index e14a41688..b978a960e 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -177,4 +177,19 @@ class User extends Authenticatable implements HasLocalePreference, MustVerifyEma
{
return (bool) $this->{"{$provider->value}_id"};
}
+
+ /**
+ * Whether unlinking this provider still leaves the user a way to sign in:
+ * a password or another connected provider.
+ */
+ public function canDisconnectFrom(SocialAuthProvider $provider): bool
+ {
+ if ($this->password) {
+ return true;
+ }
+
+ return collect(SocialAuthProvider::cases())
+ ->reject(fn (SocialAuthProvider $other): bool => $other === $provider)
+ ->contains(fn (SocialAuthProvider $other): bool => $this->isConnectedTo($other));
+ }
}
diff --git a/app/Services/Post/MediaAttacher.php b/app/Services/Post/MediaAttacher.php
index c84ed7747..f9d4eb772 100644
--- a/app/Services/Post/MediaAttacher.php
+++ b/app/Services/Post/MediaAttacher.php
@@ -5,8 +5,8 @@ declare(strict_types=1);
namespace App\Services\Post;
use App\Actions\Post\AppendPostMedia;
+use App\Actions\Post\HostInlineMedia;
use App\Dto\ImportedFile;
-use App\Dto\MediaItem;
use App\Dto\RemoteFile;
use App\Enums\Media\Type as MediaType;
use App\Models\Media;
@@ -34,7 +34,7 @@ class MediaAttacher
public function __construct(private readonly RemoteMediaImporter $importer) {}
/**
- * @param array<int, array{url: string, alt?: ?string}> $urls
+ * @param array<int, array{url: string, alt?: ?string, meta?: ?array<string, mixed>}> $urls
* @return array{attached: array<int, array<string, mixed>>, failed: array<int, string>, failures: array<int, array{url: string, reason: string, message: string}>}
*/
public function attachFromUrls(Post $post, array $urls, ?User $actor = null): array
@@ -55,14 +55,7 @@ class MediaAttacher
continue;
}
- $item = MediaItem::fromMedia($hosted)->toArray();
-
- if (($alt = data_get($entry, 'alt')) !== null
- && MediaType::classify(data_get($item, 'mime_type'), data_get($item, 'path')) === MediaType::Image) {
- $item['meta'] = [...data_get($item, 'meta', []), 'alt_text' => $alt];
- }
-
- $attached[] = $item;
+ $attached[] = HostInlineMedia::item($hosted, $entry);
}
if ($attached !== []) {
diff --git a/app/Services/Social/ConnectionVerifier.php b/app/Services/Social/ConnectionVerifier.php
index 54ed6ca77..53daeb0e9 100644
--- a/app/Services/Social/ConnectionVerifier.php
+++ b/app/Services/Social/ConnectionVerifier.php
@@ -27,6 +27,7 @@ use App\Support\GoogleBusinessResourceName;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
class ConnectionVerifier
@@ -206,7 +207,8 @@ class ConnectionVerifier
Platform::LinkedIn => $this->verifyLinkedIn($account),
Platform::LinkedInPage => $this->verifyLinkedInPage($account),
Platform::X => $this->verifyX($account),
- Platform::Instagram, Platform::InstagramFacebook => $this->verifyInstagram($account),
+ Platform::Instagram => $this->verifyInstagram($account),
+ Platform::InstagramFacebook => $this->verifyInstagramFacebook($account),
Platform::Facebook => $this->verifyFacebook($account),
Platform::Threads => $this->verifyThreads($account),
Platform::TikTok => $this->verifyTikTok($account),
@@ -575,14 +577,14 @@ class ConnectionVerifier
$account->refresh();
}
+ /**
+ * The OpenID Connect userinfo endpoint lives under `/v2`, not the versioned
+ * `/rest` API, so it takes no LinkedIn-Version header.
+ */
private function verifyLinkedIn(SocialAccount $account): bool
{
$response = Http::withToken($account->access_token)
- ->withHeaders([
- 'X-Restli-Protocol-Version' => '2.0.0',
- 'LinkedIn-Version' => '202601',
- ])
- ->get(config('trypost.platforms.linkedin.api').'/rest/userinfo');
+ ->get(config('trypost.platforms.linkedin.api').'/v2/userinfo');
if (LinkedInPublishException::isConfirmedDeadToken($response)) {
throw new TokenExpiredException('LinkedIn access token is invalid or expired');
@@ -644,15 +646,35 @@ class ConnectionVerifier
);
}
+ /**
+ * An Instagram Login token, checked on graph.instagram.com. Its `user_id`
+ * is the professional account id, kept for matching the same account
+ * connected through Facebook.
+ */
private function verifyInstagram(SocialAccount $account): bool
{
- // Basic Instagram tokens hit graph.instagram.com; Instagram via
- // Facebook Business uses a Facebook Page token, which only validates
- // against graph.facebook.com — using the wrong endpoint produces a
- // false-positive "token expired".
- $baseUrl = $account->platform->instagramGraphBaseUrl();
+ $response = Http::get("{$account->platform->instagramGraphBaseUrl()}/me", [
+ 'fields' => 'id,username,user_id',
+ 'access_token' => $account->access_token,
+ ]);
+
+ if ($response->successful()) {
+ $this->rememberInstagramAccountId($account, $response->json('user_id'));
- $response = Http::get("{$baseUrl}/me", [
+ return true;
+ }
+
+ throw GraphError::classifyVerifyFailure($response, 'Instagram');
+ }
+
+ /**
+ * An Instagram account connected through Facebook holds a Page token, which
+ * only validates on graph.facebook.com (graph.instagram.com reports it as
+ * expired). Its `/me` is the Page, which has no `user_id`.
+ */
+ private function verifyInstagramFacebook(SocialAccount $account): bool
+ {
+ $response = Http::get("{$account->platform->instagramGraphBaseUrl()}/me", [
'fields' => 'id,username',
'access_token' => $account->access_token,
]);
@@ -664,6 +686,31 @@ class ConnectionVerifier
throw GraphError::classifyVerifyFailure($response, 'Instagram');
}
+ /**
+ * Keeps the Instagram professional account id of an Instagram Login
+ * account (older accounts were connected before it was stored), so a
+ * reconnect through Facebook matches it without asking Instagram. The key
+ * is added to the meta read again under a row lock, so meta saved
+ * meanwhile (a reconnect) is kept, and `updated_at` does not move.
+ */
+ private function rememberInstagramAccountId(SocialAccount $account, mixed $instagramAccountId): void
+ {
+ $id = (string) $instagramAccountId;
+
+ if (blank($id) || data_get($account->meta, 'ig_user_id') === $id) {
+ return;
+ }
+
+ $account->meta = DB::transaction(function () use ($account, $id): array {
+ $stored = SocialAccount::query()->lockForUpdate()->findOrFail($account->getKey());
+ $stored->meta = [...$stored->meta ?? [], 'ig_user_id' => $id];
+ SocialAccount::withoutTimestamps(fn () => $stored->saveQuietly());
+
+ return $stored->meta;
+ });
+ $account->syncOriginalAttribute('meta');
+ }
+
private function verifyFacebook(SocialAccount $account): bool
{
$response = Http::get(config('trypost.platforms.facebook.graph_api').'/me', [
diff --git a/app/Services/Social/Discord/DiscordClient.php b/app/Services/Social/Discord/DiscordClient.php
index ac83a2439..49c22d081 100644
--- a/app/Services/Social/Discord/DiscordClient.php
+++ b/app/Services/Social/Discord/DiscordClient.php
@@ -38,6 +38,19 @@ class DiscordClient
return (string) config('trypost.platforms.discord.api');
}
+ /**
+ * The guild's channels when a recent `channels()` call left them in the
+ * cache, without asking Discord: null when they are not cached.
+ *
+ * @return list<array{id: string, name: string}>|null
+ */
+ public function cachedChannels(string $guildId): ?array
+ {
+ $channels = Cache::get($this->channelsCacheKey($guildId));
+
+ return is_array($channels) ? $channels : null;
+ }
+
/**
* The channels of a guild the bot can actually post into: postable type
* (text/announcement) AND the bot has VIEW_CHANNEL + SEND_MESSAGES there.
@@ -54,7 +67,7 @@ class DiscordClient
// both in the composer picker and on every publish (the channel guard),
// all against the shared, rate-limited bot token. A transient failure
// throws and is NOT cached, so the next call retries.
- return Cache::remember("discord:channels:{$guildId}", self::CHANNELS_TTL, function () use ($guildId) {
+ return Cache::remember($this->channelsCacheKey($guildId), self::CHANNELS_TTL, function () use ($guildId) {
$response = $this->bot()->get("{$this->baseUrl()}/guilds/{$guildId}/channels");
if ($response->failed()) {
@@ -82,6 +95,11 @@ class DiscordClient
});
}
+ private function channelsCacheKey(string $guildId): string
+ {
+ return "discord:channels:{$guildId}";
+ }
+
/**
* Whether the bot has VIEW_CHANNEL + SEND_MESSAGES in a channel, computed from
* its roles' base permissions and the channel's permission overwrites (Discord's
diff --git a/app/Services/Social/InstagramPublisher.php b/app/Services/Social/InstagramPublisher.php
index 319ada9e1..bf9efb2fb 100644
--- a/app/Services/Social/InstagramPublisher.php
+++ b/app/Services/Social/InstagramPublisher.php
@@ -6,6 +6,7 @@ namespace App\Services\Social;
use App\Dto\MediaItem;
use App\Enums\Instagram\ContainerStatus;
+use App\Enums\Instagram\TrialGraduation;
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
use App\Exceptions\PlatformUnavailableException;
@@ -16,6 +17,7 @@ use App\Models\Post;
use App\Services\Social\Concerns\FitsImageToCanvas;
use App\Services\Social\Concerns\HasSocialHttpClient;
use App\Services\Social\Meta\GraphError;
+use App\Support\PostPlatformMetaRules;
use App\Support\Social\PublishCheckpoint;
use Closure;
use Illuminate\Http\Client\ConnectionException;
@@ -115,7 +117,7 @@ class InstagramPublisher
$params['alt_text'] = $alt;
}
- $params = [...$params, ...$this->userTagsParam($media->userTags()), ...$this->sharedOptions()];
+ $params = [...$params, ...$this->jsonListParam('user_tags', $media->userTags()), ...$this->sharedOptions(), ...$this->collaboratorsParam()];
$containerId = $this->createContainer($instagramId, $params, 'container');
@@ -131,6 +133,7 @@ class InstagramPublisher
'access_token' => $accessToken,
...$this->thumbOffsetParam($media),
...$this->sharedOptions(),
+ ...$this->collaboratorsParam(),
...$this->reelOptions(),
], 'reel container');
@@ -152,7 +155,7 @@ class InstagramPublisher
} else {
$dimensions = ContentType::InstagramStory->preferredImageDimensions();
$params['image_url'] = $this->fitImageToCanvas($media->url, data_get($dimensions, 'width'), data_get($dimensions, 'height'));
- $params = [...$params, ...$this->userTagsParam(array_map(
+ $params = [...$params, ...$this->jsonListParam('user_tags', array_map(
fn (array $tag): array => ['username' => $tag['username']],
$media->userTags(),
))];
@@ -190,7 +193,7 @@ class InstagramPublisher
$params['alt_text'] = $alt;
}
- $params = [...$params, ...$this->userTagsParam($media->userTags())];
+ $params = [...$params, ...$this->jsonListParam('user_tags', $media->userTags())];
}
$containerResponse = $this->socialHttp()->post("{$this->baseUrl}/{$instagramId}/media", $params);
@@ -229,15 +232,15 @@ class InstagramPublisher
}
/**
- * Instagram reads `user_tags` as a JSON array. Stories place the mention
- * without a sticker, so their entries carry only the username.
+ * Instagram reads list parameters (`user_tags`, `collaborators`) as JSON
+ * arrays, and an empty one is left out.
*
- * @param list<array<string, string|float>> $tags
+ * @param list<mixed> $values
* @return array<string, string>
*/
- private function userTagsParam(array $tags): array
+ private function jsonListParam(string $name, array $values): array
{
- return $tags === [] ? [] : ['user_tags' => (string) json_encode($tags)];
+ return $values === [] ? [] : [$name => (string) json_encode($values)];
}
/**
@@ -265,9 +268,64 @@ class InstagramPublisher
return [];
}
- return [
+ return array_filter([
'share_to_feed' => data_get($this->post->meta, 'share_to_feed', true) ? 'true' : 'false',
- ];
+ 'trial_params' => $this->trialParams(),
+ 'audio_configuration' => $this->audioConfiguration(),
+ ]);
+ }
+
+ /**
+ * A trial reel is shown to non-followers first, then graduated by hand
+ * or by Instagram when it performs well.
+ */
+ private function trialParams(): ?string
+ {
+ return transform(
+ TrialGraduation::tryFrom((string) data_get($this->post->meta, 'trial_graduation')),
+ fn (TrialGraduation $graduation): string => (string) json_encode(['graduation_strategy' => $graduation->value]),
+ );
+ }
+
+ /**
+ * The picked music, which the Audio API only takes from an account
+ * connected through Facebook. A volume left out is Instagram's default.
+ */
+ private function audioConfiguration(): ?string
+ {
+ $audioId = data_get($this->post->meta, 'audio.id');
+
+ if (blank($audioId)) {
+ return null;
+ }
+
+ if ($this->post->socialAccount?->platform !== Platform::InstagramFacebook) {
+ throw new InstagramPublishException(
+ userMessage: __('posts.form.instagram.music.requires_facebook'),
+ category: ErrorCategory::ContentPolicy,
+ );
+ }
+
+ $volume = fn (string $key): ?int => transform(data_get($this->post->meta, "audio.{$key}"), fn (mixed $value): int => (int) $value);
+
+ return (string) json_encode(array_filter([
+ 'audio_id' => (string) $audioId,
+ 'audio_volume' => $volume('audio_volume'),
+ 'video_volume' => $volume('video_volume'),
+ ], fn (mixed $value): bool => $value !== null));
+ }
+
+ /**
+ * Instagram reads `collaborators` as a JSON array of usernames. Stories and
+ * carousel children take none.
+ *
+ * @return array{collaborators?: string}
+ */
+ private function collaboratorsParam(): array
+ {
+ return $this->jsonListParam('collaborators', PostPlatformMetaRules::instagramCollaborators(
+ (array) data_get($this->post->meta, 'collaborators', []),
+ ));
}
/**
@@ -302,6 +360,7 @@ class InstagramPublisher
'children' => implode(',', $childContainers),
'access_token' => $accessToken,
...$this->sharedOptions(),
+ ...$this->collaboratorsParam(),
], 'carousel container');
return $this->finishContainer($instagramId, $accessToken, $carouselId);
diff --git a/app/Socialite/InstagramProvider.php b/app/Socialite/InstagramProvider.php
index 72f8f2b12..d63ee4b22 100644
--- a/app/Socialite/InstagramProvider.php
+++ b/app/Socialite/InstagramProvider.php
@@ -41,7 +41,7 @@ class InstagramProvider extends AbstractProvider implements ProviderInterface
$response = $this->getHttpClient()->get(config('trypost.platforms.instagram.graph_api').'/me', [
RequestOptions::QUERY => [
'access_token' => $token,
- 'fields' => 'id,username,account_type,name,profile_picture_url',
+ 'fields' => 'id,user_id,username,account_type,name,profile_picture_url',
],
]);
diff --git a/app/Support/PostCompositionValidator.php b/app/Support/PostCompositionValidator.php
index d032b249c..8c8fba33d 100644
--- a/app/Support/PostCompositionValidator.php
+++ b/app/Support/PostCompositionValidator.php
@@ -219,7 +219,7 @@ class PostCompositionValidator
$validator->errors()->add("{$key}.content", trans('posts.edit.compliance.requires_content_or_media'));
}
- $metaViolation = PostPlatformMetaRules::requiredMetaViolation($account, $destination['meta'] ?? [])
+ $metaViolation = PostPlatformMetaRules::requiredMetaViolation($account, $destination['meta'] ?? [], $destination['content_type'] ?? null)
?? PostPlatformMetaRules::contentMetaViolation($account->platform, $destination['meta'] ?? [], (string) $destination['content']);
if ($metaViolation !== null && $metaViolation !== $formatViolation) {
[$field, $message] = $metaViolation;
diff --git a/app/Support/PostMediaRules.php b/app/Support/PostMediaRules.php
index 91552d62b..7fded87b1 100644
--- a/app/Support/PostMediaRules.php
+++ b/app/Support/PostMediaRules.php
@@ -88,7 +88,7 @@ class PostMediaRules
/**
* @return array<int, mixed>
*/
- private static function metaRules(): array
+ public static function metaRules(): array
{
return ['sometimes', 'nullable', 'array', static function (string $attribute, mixed $value, Closure $fail): void {
self::validateAltText(data_get($value, 'alt_text'), $fail);
diff --git a/app/Support/PostMeta.php b/app/Support/PostMeta.php
new file mode 100644
index 000000000..ea0525849
--- /dev/null
+++ b/app/Support/PostMeta.php
@@ -0,0 +1,66 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Support;
+
+use App\Enums\SocialAccount\Platform;
+use App\Models\SocialAccount;
+use App\Services\Social\Discord\DiscordClient;
+use Illuminate\Support\Arr;
+
+/**
+ * The meta a post stores for its channel, on every create and update: the
+ * format cleaned up (`PostPlatformMetaRules::normalize`), the system keys the
+ * post already had (Telegram `reactions`), then what the meta names from the
+ * channel's own data filled in, so the web, the API and MCP store the same
+ * thing from an id alone. One arm per network that needs it.
+ *
+ * A lookup that does not find the id leaves the derived value out: saving
+ * never fails over a display name.
+ */
+class PostMeta
+{
+ /**
+ * @param array<string, mixed> $meta
+ * @param array<string, mixed> $stored the meta the post had before this save
+ * @return array<string, mixed>
+ */
+ public static function forChannel(SocialAccount $account, array $meta, array $stored = []): array
+ {
+ $meta = [
+ ...PostPlatformMetaRules::normalize($meta),
+ ...Arr::only($stored, PostPlatformMetaRules::SYSTEM_KEYS),
+ ];
+
+ return match ($account->platform) {
+ Platform::Discord => self::withDiscordChannelName($account, $meta),
+ default => $meta,
+ };
+ }
+
+ /**
+ * The Discord channel name the preview shows. It is never taken from the
+ * request: only `channel_id` is, and the name is read from the server's
+ * channel list cached by the composer, the API, MCP or a publish. Saving
+ * never asks Discord, since it runs inside the post's transaction and
+ * queue lock, so without a cached list the post has no name.
+ *
+ * @param array<string, mixed> $meta
+ * @return array<string, mixed>
+ */
+ private static function withDiscordChannelName(SocialAccount $account, array $meta): array
+ {
+ $meta = Arr::except($meta, 'channel_name');
+ $channelId = data_get($meta, 'channel_id');
+
+ if (blank($channelId)) {
+ return $meta;
+ }
+
+ $name = data_get(collect(app(DiscordClient::class)->cachedChannels((string) $account->platform_user_id) ?? [])
+ ->firstWhere('id', (string) $channelId), 'name');
+
+ return filled($name) ? [...$meta, 'channel_name' => $name] : $meta;
+ }
+}
diff --git a/app/Support/PostPlatformMetaRules.php b/app/Support/PostPlatformMetaRules.php
index cff025377..45adf5e9b 100644
--- a/app/Support/PostPlatformMetaRules.php
+++ b/app/Support/PostPlatformMetaRules.php
@@ -6,6 +6,8 @@ namespace App\Support;
use App\Enums\GoogleBusiness\CtaAction;
use App\Enums\GoogleBusiness\TopicType;
+use App\Enums\Instagram\TrialGraduation;
+use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
use App\Enums\TikTok\PrivacyLevel;
use App\Enums\YouTube\Category;
@@ -16,6 +18,7 @@ use App\Models\SocialAccount;
use App\Rules\ValidYouTubeDescription;
use App\Services\Social\ContentSanitizer;
use Closure;
+use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Validation\Rule;
use Illuminate\Validation\ValidationException;
@@ -35,6 +38,15 @@ class PostPlatformMetaRules
*/
public const SYSTEM_KEYS = ['reactions'];
+ /** What an Instagram music pick stores; anything else sent with it is dropped. */
+ private const array INSTAGRAM_AUDIO_FIELDS = ['id', 'title', 'artist', 'cover_url', 'preview_url', 'audio_volume', 'video_volume'];
+
+ /** Instagram takes up to three collaborators on a feed post, carousel or reel. */
+ public const INSTAGRAM_MAX_COLLABORATORS = 3;
+
+ /** An Instagram username, with or without its leading @. */
+ public const INSTAGRAM_USERNAME_PATTERN = '/^@?[A-Za-z0-9._]{1,30}$/';
+
/**
* Validation rules for the post's meta and all its per-platform sub-keys,
* under `$prefix` (`meta`, or `destinations.*.meta` for a list of channels).
@@ -48,6 +60,17 @@ class PostPlatformMetaRules
"{$prefix}" => ['sometimes', 'nullable', 'array'],
"{$prefix}.share_to_feed" => ['sometimes', 'boolean'],
+ "{$prefix}.collaborators" => ['sometimes', 'nullable', 'array', 'max:'.self::INSTAGRAM_MAX_COLLABORATORS],
+ "{$prefix}.collaborators.*" => ['string', 'regex:'.self::INSTAGRAM_USERNAME_PATTERN],
+ "{$prefix}.trial_graduation" => ['sometimes', 'nullable', 'string', Rule::enum(TrialGraduation::class)],
+ "{$prefix}.audio" => ['sometimes', 'nullable', 'array'],
+ "{$prefix}.audio.id" => ['sometimes', 'nullable', 'string', 'max:64', 'regex:/^[0-9]+$/'],
+ "{$prefix}.audio.title" => ['sometimes', 'nullable', 'string', 'max:255'],
+ "{$prefix}.audio.artist" => ['sometimes', 'nullable', 'string', 'max:255'],
+ "{$prefix}.audio.cover_url" => ['sometimes', 'nullable', 'url:http,https', 'max:2048'],
+ "{$prefix}.audio.preview_url" => ['sometimes', 'nullable', 'url:http,https', 'max:4096'],
+ "{$prefix}.audio.audio_volume" => ['sometimes', 'nullable', 'integer', 'between:0,100'],
+ "{$prefix}.audio.video_volume" => ['sometimes', 'nullable', 'integer', 'between:0,100'],
"{$prefix}.spoiler_text" => ['sometimes', 'nullable', 'string', 'max:500'],
@@ -103,7 +126,6 @@ class PostPlatformMetaRules
}],
"{$prefix}.channel_id" => ['sometimes', 'nullable', 'string'],
- "{$prefix}.channel_name" => ['sometimes', 'nullable', 'string'],
"{$prefix}.mentions" => ['sometimes', 'nullable', 'array'],
"{$prefix}.mentions.*.token" => ['required', 'string'],
"{$prefix}.mentions.*.label" => ['sometimes', 'nullable', 'string'],
@@ -148,22 +170,6 @@ class PostPlatformMetaRules
return array_intersect_key($meta, array_flip($known));
}
- /**
- * The meta to store on an edited target: the known keys of `$meta` plus the
- * system keys already stored on the target.
- *
- * @param array<string, mixed> $stored
- * @param array<string, mixed> $meta
- * @return array<string, mixed>
- */
- public static function forStorage(array $stored, array $meta): array
- {
- return [
- ...self::onlyKnown($meta),
- ...array_intersect_key($stored, array_flip(self::SYSTEM_KEYS)),
- ];
- }
-
/**
* Custom validation messages for meta fields shown in the UI.
*
@@ -175,6 +181,8 @@ class PostPlatformMetaRules
"{$prefix}.link.url" => __('posts.form.pinterest.link_invalid'),
"{$prefix}.link.max" => __('posts.form.pinterest.link_max'),
"{$prefix}.title.max" => __('posts.form.pinterest.title_max'),
+ "{$prefix}.collaborators.max" => __('posts.form.instagram.collaborators.max', ['max' => self::INSTAGRAM_MAX_COLLABORATORS]),
+ "{$prefix}.collaborators.*.regex" => __('posts.form.instagram.collaborators.invalid'),
"{$prefix}.event.end_date.after_or_equal" => __('posts.form.google_business.event_end_date_before_start'),
"{$prefix}.event.title.max" => __('posts.form.google_business.title_max'),
];
@@ -207,9 +215,9 @@ class PostPlatformMetaRules
'TikTok: privacy_level PUBLIC_TO_EVERYONE|MUTUAL_FOLLOW_FRIENDS|FOLLOWER_OF_CREATOR|SELF_ONLY (required to publish; call get-tiktok-creator-info-tool first and pick one of its privacy_level_options, and keep allow_comments/allow_duet/allow_stitch false when it reports them disabled) + flags allow_comments, disclose (commercial content), brand_content_toggle (paid partnership), brand_organic_toggle (your own brand); on tiktok_video also allow_duet, allow_stitch and is_aigc (AI-generated content label), on tiktok_photo also auto_add_music. SELF_ONLY cannot be combined with brand_content_toggle.',
'Mastodon: spoiler_text (content warning, ≤500; counts toward the 500-character post limit).',
'Pinterest: board_id (required to publish — call list-pinterest-boards-tool first, or create-pinterest-board-tool), title (≤100), link (destination URL). Pin description comes from the post content; a video pin cover frame is the media item meta.cover_offset_ms.',
- 'Discord: channel_id (required to publish — call list-discord-channels-tool first), channel_name (the channel name shown in the app), mentions ([{token,label}], e.g. {token: "@everyone"} or {token: "<@&roleId>"}), embeds (up to 10 [{title ≤256, description ≤4096, url, image (URL), color (#RRGGBB)}]).',
+ 'Discord: channel_id (required to publish — call list-discord-channels-tool first), mentions ([{token,label}], e.g. {token: "@everyone"} or {token: "<@&roleId>"}), embeds (up to 10 [{title ≤256, description ≤4096, url, image (URL), color (#RRGGBB)}]).',
'YouTube Shorts: title (≤100, no < or >; omitted, it is derived from the first non-empty line of the content with < and > removed, cut to 100 characters), description (plain text, at most 5000 bytes; omit or null to use the content), category_id (YouTube category id: '.collect(Category::cases())->map(fn (Category $category): string => "{$category->value}=".__($category->labelKey(), [], 'en'))->implode(', ').'; default '.Category::DEFAULT->value.'), privacy_status (public|unlisted|private, default public), license (youtube|creativeCommon), notify_subscribers (default true), embeddable (default true), made_for_kids (default false), is_ai_generated (discloses altered or synthetic content).',
- 'Instagram: is_ai_generated (feed, reels, stories, carousels), share_to_feed (instagram_reel only, default true). An instagram_feed post with a single video publishes as a Reel. People tags are the media item meta.user_tags and a video cover frame is meta.cover_offset_ms.',
+ 'Instagram: is_ai_generated (feed, reels, stories, carousels), share_to_feed (instagram_reel only, default true), collaborators (up to '.self::INSTAGRAM_MAX_COLLABORATORS.' Instagram usernames invited as co-authors; feed, reels and carousels, not stories), trial_graduation (instagram_reel only: MANUAL|SS_PERFORMANCE publishes a trial reel shown only to non-followers, graduated by hand in the app or by Instagram when it performs well; not with collaborators, and only on accounts where Instagram offers trial reels), audio (instagram_reel only, Instagram connected through Facebook: {id} of an Instagram audio track from search-instagram-audio-tool, with optional title, artist, cover_url and preview_url copied from that result so the app can show the track, and audio_volume and video_volume from 0 to 100, default 100). An instagram_feed post with a single video publishes as a Reel. People tags are the media item meta.user_tags and a video cover frame is meta.cover_offset_ms.',
'X: is_ai_generated (sent as made_with_ai, discloses AI-generated media on the post).',
'Threads: topic_tag (1-50 characters after a leading # is dropped, no . or &). Use content_type threads_ghost_post for a text-only post archived after 24 hours (no media, no topic).',
'Facebook, Bluesky, LinkedIn: link_preview (default true; false publishes a text post with a link without its preview card).',
@@ -224,9 +232,9 @@ class PostPlatformMetaRules
* Adds the validation error for meta that becomes mandatory once a post is
* published or scheduled (TikTok privacy, Pinterest board, Discord channel).
*/
- public static function addRequiredOnPublishErrors(Validator $validator, Platform|SocialAccount|null $target, mixed $meta, string $prefix = 'meta'): void
+ public static function addRequiredOnPublishErrors(Validator $validator, Platform|SocialAccount|null $target, mixed $meta, string $prefix = 'meta', mixed $contentType = null): void
{
- $violation = self::requiredMetaViolation($target, $meta);
+ $violation = self::requiredMetaViolation($target, $meta, $contentType);
if (blank($violation)) {
return;
@@ -254,7 +262,7 @@ class PostPlatformMetaRules
return;
}
- $violation = self::requiredMetaViolation($post->socialAccount ?? $post->platform, $post->meta)
+ $violation = self::requiredMetaViolation($post->socialAccount ?? $post->platform, $post->meta, $post->content_type)
?? self::contentMetaViolation($post->platform, $post->meta, (string) $post->content);
if (filled($violation)) {
@@ -286,9 +294,33 @@ class PostPlatformMetaRules
$meta['thread_replies'] = ThreadReplies::of($meta);
}
+ if (is_array(data_get($meta, 'collaborators'))) {
+ $meta['collaborators'] = self::instagramCollaborators($meta['collaborators']);
+ }
+
+ if (is_array(data_get($meta, 'audio'))) {
+ $meta['audio'] = Arr::only($meta['audio'], self::INSTAGRAM_AUDIO_FIELDS);
+ }
+
return $meta;
}
+ /**
+ * Instagram usernames as the API takes them: without the @, each once.
+ *
+ * @param array<int, mixed> $collaborators
+ * @return list<string>
+ */
+ public static function instagramCollaborators(array $collaborators): array
+ {
+ return collect($collaborators)
+ ->map(fn (mixed $username): string => ltrim(Str::trim((string) $username), '@'))
+ ->filter()
+ ->unique(fn (string $username): string => Str::lower($username))
+ ->values()
+ ->all();
+ }
+
/**
* A Threads topic as the API takes it: trimmed, without a leading #.
*/
@@ -321,12 +353,15 @@ class PostPlatformMetaRules
/**
* The missing required meta field for a platform about to publish, or null when
* nothing is missing. Single source of "what each platform requires to publish".
+ * Instagram music and trial reels only exist on reels, so their rules apply
+ * only when `$contentType` is a reel.
*
* @return array{0: string, 1: string}|null [field, message]
*/
- public static function requiredMetaViolation(Platform|SocialAccount|null $target, mixed $meta): ?array
+ public static function requiredMetaViolation(Platform|SocialAccount|null $target, mixed $meta, mixed $contentType = null): ?array
{
$platform = $target instanceof SocialAccount ? $target->platform : $target;
+ $isInstagramReel = ($contentType instanceof ContentType ? $contentType : ContentType::tryFrom(is_string($contentType) ? $contentType : '')) === ContentType::InstagramReel;
$threadViolation = ThreadReplies::violation($target, $meta);
if ($threadViolation !== null) {
@@ -340,6 +375,7 @@ class PostPlatformMetaRules
return match (true) {
$platform === Platform::YouTube => self::youtubeDescriptionViolation($meta) ?? self::formatViolation($platform, $meta),
$platform === Platform::TikTok => self::tiktokPrivacyViolation($meta),
+ $isInstagramReel => self::instagramReelViolation($platform, $meta),
$platform === Platform::Pinterest && blank(data_get($meta, 'board_id')) => ['board_id', trans('posts.form.pinterest.board_required')],
$platform === Platform::Discord && blank(data_get($meta, 'channel_id')) => ['channel_id', trans('posts.form.discord.channel_required')],
$needsGoogleBusinessEvent
@@ -466,6 +502,22 @@ class PostPlatformMetaRules
: ['event.end_date', trans('posts.form.google_business.event_end_date_before_start')];
}
+ /**
+ * Music needs a track id and an Instagram account connected through
+ * Facebook, and Instagram refuses a trial reel that has collaborators.
+ *
+ * @return array{0: string, 1: string}|null
+ */
+ private static function instagramReelViolation(?Platform $platform, mixed $meta): ?array
+ {
+ return match (true) {
+ $platform === Platform::Instagram && filled(data_get($meta, 'audio.id')) => ['audio', trans('posts.form.instagram.music.requires_facebook')],
+ filled(data_get($meta, 'audio')) && blank(data_get($meta, 'audio.id')) => ['audio.id', trans('validation.required', ['attribute' => 'audio id'])],
+ filled(data_get($meta, 'trial_graduation')) && filled(data_get($meta, 'collaborators')) => ['trial_graduation', trans('posts.form.instagram.trial_reel.no_collaborators')],
+ default => null,
+ };
+ }
+
/**
* @return array{0: string, 1: string}|null
*/
diff --git a/app/Support/Repurpose/DestinationMetaRules.php b/app/Support/Repurpose/DestinationMetaRules.php
index 57a7121fc..7418897ae 100644
--- a/app/Support/Repurpose/DestinationMetaRules.php
+++ b/app/Support/Repurpose/DestinationMetaRules.php
@@ -63,6 +63,7 @@ class DestinationMetaRules
$violation = PostPlatformMetaRules::requiredMetaViolation(
$platforms->get(data_get($destination, 'social_account_id')),
data_get($destination, 'meta'),
+ data_get($destination, 'content_type'),
);
if ($violation !== null) {
diff --git a/app/Support/Requests/Post/PostRequestRules.php b/app/Support/Requests/Post/PostRequestRules.php
index eba2959eb..8447304cf 100644
--- a/app/Support/Requests/Post/PostRequestRules.php
+++ b/app/Support/Requests/Post/PostRequestRules.php
@@ -169,7 +169,7 @@ class PostRequestRules
self::addMediaCompatibilityErrors($validator, $post, $input);
if (array_key_exists('meta', $input)) {
- PostPlatformMetaRules::addRequiredOnPublishErrors($validator, $post->socialAccount ?? $post->platform, self::effectiveMeta($post, $input));
+ PostPlatformMetaRules::addRequiredOnPublishErrors($validator, $post->socialAccount ?? $post->platform, self::effectiveMeta($post, $input), contentType: data_get($input, 'content_type') ?? $post->content_type);
}
}
diff --git a/app/Support/Social/InstagramAudio.php b/app/Support/Social/InstagramAudio.php
new file mode 100644
index 000000000..5ec964a8b
--- /dev/null
+++ b/app/Support/Social/InstagramAudio.php
@@ -0,0 +1,66 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Support\Social;
+
+use App\Models\SocialAccount;
+use Illuminate\Http\Exceptions\ThrottleRequestsException;
+use Illuminate\Support\Facades\RateLimiter;
+
+/**
+ * What the Instagram Audio API lookups share: the track shape every surface
+ * returns and the per-workspace allowance of lookups. A lookup that reaches
+ * Meta spends one, whatever number of calls it makes; answers served from the
+ * cache spend none.
+ *
+ * @see https://developers.facebook.com/docs/instagram-platform/content-publishing/audio-api/
+ */
+class InstagramAudio
+{
+ /** Uncached audio lookups a workspace may make per minute, across web, API and MCP. */
+ public const int LOOKUPS_PER_MINUTE = 30;
+
+ public const array TYPES = ['music', 'original_sound'];
+
+ /**
+ * Counts one uncached lookup for the account's workspace.
+ *
+ * @throws ThrottleRequestsException when the workspace already spent its minute.
+ */
+ public static function spend(SocialAccount $account): void
+ {
+ $key = "instagram-audio:{$account->workspace_id}";
+
+ if (RateLimiter::hit($key, 60) > self::LOOKUPS_PER_MINUTE) {
+ throw new ThrottleRequestsException(
+ __('posts.form.instagram.music.too_many_searches'),
+ headers: ['Retry-After' => RateLimiter::availableIn($key)],
+ );
+ }
+ }
+
+ /**
+ * An audio asset as TryPost returns it. Original sounds carry the creator
+ * instead of an artist and their profile picture instead of a cover.
+ *
+ * @return array{id: string, type: string|null, title: string, artist: string|null, cover_url: string|null, duration_ms: int|null, preview_url: string|null}
+ */
+ public static function present(mixed $track): array
+ {
+ $duration = data_get($track, 'duration_in_ms');
+ $username = data_get($track, 'ig_username');
+
+ return [
+ 'id' => (string) data_get($track, 'audio_id', data_get($track, 'id', '')),
+ 'type' => data_get($track, 'audio_type'),
+ 'title' => (string) data_get($track, 'title', ''),
+ 'artist' => data_get($track, 'display_artist') ?? (filled($username) ? (string) $username : null),
+ 'cover_url' => data_get($track, 'cover_artwork_thumbnail_uri')
+ ?? data_get($track, 'cover_artwork_thumbnail_url')
+ ?? data_get($track, 'profile_picture_url'),
+ 'duration_ms' => is_numeric($duration) ? (int) $duration : null,
+ 'preview_url' => data_get($track, 'download_url'),
+ ];
+ }
+}
diff --git a/lang/ar/accounts.php b/lang/ar/accounts.php
index 39eb84706..3bf8963a2 100644
--- a/lang/ar/accounts.php
+++ b/lang/ar/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'تعتمد الميزات على نوع حسابك على Instagram وطريقة الربط التي تختارها.',
'professional_title' => 'احترافي',
'professional_types' => '(نشاط تجاري وصانع محتوى)',
+ 'facebook_types' => '(مرتبط بصفحة على Facebook)',
'badge' => 'نشر تلقائي',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'مقاييس المنشورات المرسلة',
'description' => 'اطّلع على أداء المنشورات السابقة',
],
+ 'music' => [
+ 'title' => 'موسيقى في مقاطع ريلز',
+ 'description' => 'أضف مقطعًا موسيقيًا من مكتبة Instagram',
+ ],
],
'connect' => 'الربط مع Instagram',
'convert_hint' => 'سيطلب منك Instagram التحويل بسهولة إلى حساب احترافي عند الحاجة.',
- 'facebook_link' => 'اربط Instagram عبر Facebook',
- 'facebook_suffix' => 'إذا كان حسابك على Instagram مرتبطًا حاليًا بـ Facebook.',
'help' => [
'account_type' => 'معرفة نوع حسابك على Instagram',
'convert' => 'تحويل حسابك على Instagram إلى حساب احترافي',
diff --git a/lang/ar/channels.php b/lang/ar/channels.php
index b2f7a9ef3..4a15951f8 100644
--- a/lang/ar/channels.php
+++ b/lang/ar/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'أعد ربط هذه القناة لمتابعة النشر.',
'reconnect' => 'إعادة الربط',
'refresh_connection' => 'تحديث الاتصال',
+ 'link_facebook_page' => 'الربط بصفحة فيسبوك',
'view_profile' => 'عرض الملف الشخصي',
'disconnect' => 'فصل',
'actions' => 'إجراءات القناة',
'reorder' => [
'handle' => 'اسحب لإعادة ترتيب :name',
- 'move_up' => 'نقل لأعلى',
- 'move_down' => 'نقل لأسفل',
'failed' => 'تعذّرت إعادة ترتيب قنواتك. حاول مرة أخرى.',
'stale' => 'تغيّرت قنواتك منذ تحميل الصفحة. حدّث الصفحة وحاول مرة أخرى.',
],
diff --git a/lang/ar/common.php b/lang/ar/common.php
index e32f542c7..4eba50cf0 100644
--- a/lang/ar/common.php
+++ b/lang/ar/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'رجوع',
+ 'unsaved_changes' => [
+
+ 'title' => 'تجاهل التغييرات؟',
+
+ 'description' => 'لم يتم حفظ تغييراتك على هذا المنشور. إذا غادرت الآن فستفقدها.',
+
+ 'discard' => 'تجاهل',
+
+ ],
+
'confirm_modal' => [
'type' => 'اكتب',
'to_confirm' => 'للتأكيد.',
diff --git a/lang/ar/notes.php b/lang/ar/notes.php
index ce2d307a6..4ede94313 100644
--- a/lang/ar/notes.php
+++ b/lang/ar/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'اكتب ملاحظة...',
'title' => 'ملاحظات',
+ 'show' => 'عرض الملاحظات',
+ 'hide' => 'إخفاء الملاحظات',
'edit' => 'تعديل',
'delete' => 'حذف',
'edited' => 'تم التعديل',
'save' => 'حفظ',
'cancel' => 'إلغاء',
'send' => 'إرسال',
- 'empty_title' => 'لا توجد ملاحظات بعد',
- 'empty_description' => 'ابدأ المحادثة.',
+ 'empty' => 'لا توجد ملاحظات بعد. فريقك فقط يراها.',
'actions' => 'إجراءات الملاحظة',
'load_more' => 'تحميل الملاحظات الأقدم',
];
diff --git a/lang/ar/posts.php b/lang/ar/posts.php
index 359071350..c17e2c9ed 100644
--- a/lang/ar/posts.php
+++ b/lang/ar/posts.php
@@ -193,8 +193,8 @@ return [
'title' => 'تعديل الوسائط',
'description' => 'قص صور هذا المنشور وضبطها ووصفها والإشارة إلى الأشخاص فيها.',
'edit_tab' => 'تعديل',
- 'alt_tab' => 'النص البديل',
- 'tags_tab' => 'الإشارة إلى أشخاص',
+ 'alt_tab' => 'الوصف',
+ 'tags_tab' => 'الإشارات',
'crop_tab' => 'قص',
'appearance_tab' => 'المظهر',
'crop_heading' => 'القص والتحويل',
@@ -240,8 +240,11 @@ return [
'tags_save' => 'حفظ الإشارة',
'tags_cancel' => 'إلغاء',
'tags_remove' => 'إزالة @:username',
+ 'tags_move' => 'نقل',
+ 'tags_move_pill' => 'اختر موضعًا جديدًا',
+ 'tags_move_hint' => 'انقر على الصورة لوضع @:username.',
'tags_invalid' => 'أدخل اسم مستخدم صالحًا على Instagram.',
- 'thumbnail_tab' => 'الصورة المصغرة',
+ 'thumbnail_tab' => 'الغلاف',
'thumbnail_heading' => 'اختر صورة مصغرة',
'thumbnail_hint' => 'اسحب شريط التمرير لاختيار الإطار الذي يظهر كغلاف للفيديو.',
'thumbnail_value' => ':seconds ثانية',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'المشاركة في الخلاصة',
+ 'music' => [
+ 'label' => 'الموسيقى',
+ 'add' => 'إضافة موسيقى',
+ 'search_placeholder' => 'ابحث عن موسيقى',
+ 'empty' => 'لم يتم العثور على مقاطع',
+ 'play' => 'تشغيل المعاينة',
+ 'pause' => 'إيقاف المعاينة',
+ 'remove' => 'إزالة الموسيقى',
+ 'part_hint' => 'لا يسمح Instagram لـ TryPost باختيار الجزء الذي يتم تشغيله من المقطع.',
+ 'volume' => 'مستوى الصوت',
+ 'video_volume' => 'الفيديو',
+ 'audio_volume' => 'الموسيقى',
+ 'limited' => 'النتائج محدودة وقد تختلف عن Instagram.',
+ 'search_failed' => 'تعذر تحميل الموسيقى من Instagram. حاول مرة أخرى.',
+ 'too_many_searches' => 'عدد كبير جدًا من عمليات البحث عن الموسيقى. انتظر دقيقة وحاول مرة أخرى.',
+ 'requires_facebook' => 'تتطلب الموسيقى حساب Instagram متصلًا عبر Facebook.',
+ 'link_title' => 'اتصل عبر Facebook لنشر مقاطع ريلز مع موسيقى',
+ 'link_body' => 'لنشر مقاطع ريلز مع موسيقى، اربط Instagram بصفحتك على Facebook. سنحفظ منشورك كمسودة أولًا. بعد ذلك افتحه من المسودات لإضافة الموسيقى.',
+ 'maybe_later' => 'لاحقًا',
+ 'save_and_link' => 'حفظ وربط',
+ 'save_and_link_blocked' => 'لا يمكن حفظ هذا المنشور بعد. انتظر حتى تنتهي عمليات الرفع وصحّح ما هو مميز، ثم حاول مرة أخرى.',
+ 'save_and_link_pending' => 'هذا المنشور بانتظار الموافقة. وافق عليه أو انقله إلى المسودات قبل ربط Facebook.',
+ ],
+ 'collaborators' => [
+ 'label' => 'المتعاونون',
+ 'placeholder' => 'اسم مستخدم Instagram',
+ 'add' => 'إضافة متعاون',
+ 'remove' => 'إزالة :username',
+ 'max' => 'أضف حتى :max متعاونين.',
+ 'invalid' => 'أدخل اسم مستخدم Instagram صالحًا.',
+ 'no_trial' => 'غير متاح في ريلز تجريبي',
+ 'notice' => 'لا يؤكد Instagram اسم المستخدم لنا. افتح الملف الشخصي للتحقق من أنه الحساب الصحيح.',
+ 'got_it' => 'فهمت',
+ ],
+ 'trial_reel' => [
+ 'label' => 'ريلز تجريبي',
+ 'off' => 'إيقاف',
+ 'auto' => 'تلقائي',
+ 'manual' => 'يدوي',
+ 'badge' => 'تجريبي',
+ 'auto_hint' => 'يُعرض الريلز التجريبي أولًا لغير المتابعين. إذا حقق أداءً جيدًا، يشاركه Instagram مع متابعيك تلقائيًا بعد 72 ساعة. وإلا فلن تتم مشاركته إلا إذا شاركته بنفسك.',
+ 'manual_hint' => 'يراه غير المتابعين أولًا. تشاركه مع متابعيك عندما تكون جاهزًا.',
+ 'no_collaborators' => 'غير متاح مع المتعاونين',
+ 'check_title' => 'هل تتوفر مقاطع ريلز التجريبية عند إنشاء ريلز في تطبيق Instagram؟',
+ 'check_body' => 'يعمل هذا فقط إذا كانت مقاطع ريلز التجريبية متاحة لحسابك. تحقق من ذلك في تطبيق Instagram.',
+ 'checked' => 'نعم، تحققت',
+ 'not_checked' => 'لا',
+ ],
],
'threads' => [
'topic' => 'الموضوع',
@@ -941,10 +992,19 @@ return [
'move_up' => 'نقل للأعلى',
'move_down' => 'نقل للأسفل',
'duplicate' => 'تكرار المنشور',
+ 'share_link' => 'مشاركة في منشور',
+ 'copy_link' => 'نسخ الرابط',
'move_to_drafts' => 'نقل إلى المسودات',
'delete' => 'حذف المنشور',
'add_to_queue' => 'إضافة إلى قائمة الانتظار',
- 'add_to_queue_disabled' => 'أضف أوقات نشر إلى هذه القناة لاستخدام قائمة الانتظار.',
+ 'add_to_queue_hint' => 'يضيف إلى أقرب وقت نشر متاح في القناة.',
+ 'queue_setup' => [
+ 'title' => 'لم تضبط قائمة انتظار هذه القناة بعد',
+ 'body' => 'لإضافة منشورات إلى قائمة الانتظار، حدّد أوقات نشر القناة. يُنشر كل منشور في القائمة في أقرب وقت متاح.',
+ 'body_member' => 'لإضافة منشورات إلى قائمة الانتظار، يجب أن يحدّد مسؤول مساحة العمل أوقات نشر هذه القناة.',
+ 'not_now' => 'ليس الآن',
+ 'action' => 'تحديد الأوقات',
+ ],
'more' => 'إجراءات أخرى',
'open_on_network' => 'فتح المنشور على :network',
'see_insights' => 'عرض إحصاءات المنشور',
diff --git a/lang/ar/settings.php b/lang/ar/settings.php
index eb327b876..e7ec52bbc 100644
--- a/lang/ar/settings.php
+++ b/lang/ar/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'الملف الشخصي',
- 'authentication' => 'المصادقة',
'notifications' => 'الإشعارات',
'preferences' => 'التفضيلات',
'general' => 'عام',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'انقر هنا لإعادة إرسال بريد التأكيد.',
'verification_sent' => 'تم إرسال رابط تأكيد جديد إلى بريدك الإلكتروني.',
'save' => 'حفظ',
- ],
-
- 'authentication' => [
- 'title' => 'المصادقة',
- 'page_title' => 'إعدادات المصادقة',
+ 'tabs' => [
+ 'profile' => 'الملف الشخصي',
+ 'login' => 'كلمة المرور وتسجيل الدخول',
+ 'sessions' => 'الجلسات',
+ ],
'sessions' => [
'title' => 'الجلسات النشطة',
'description' => 'إذا لاحظت أي شيء مريب، سجّل الخروج من الأجهزة الأخرى.',
'unknown_browser' => 'متصفح غير معروف',
- 'unknown_ip' => 'عنوان IP غير معروف',
'on' => 'على',
'active_now' => 'نشط الآن',
+ 'last_activity' => 'آخر نشاط :time',
'log_out_others' => 'تسجيل الخروج من الأجهزة الأخرى',
'modal_title' => 'تسجيل الخروج من الأجهزة الأخرى',
- 'modal_description_password' => 'أدخل كلمة المرور الحالية لتأكيد رغبتك في تسجيل الخروج من جلسات المتصفح الأخرى.',
- 'modal_description_email' => 'اكتب بريدك الإلكتروني لتأكيد رغبتك في تسجيل الخروج من جلسات المتصفح الأخرى.',
- 'password_placeholder' => 'كلمة المرور الحالية',
- 'email_placeholder' => 'بريد حسابك الإلكتروني',
+ 'modal_description' => 'سيتم تسجيل الخروج من جميع الأجهزة الأخرى المتصلة بحسابك. تبقى هذه الجلسة نشطة.',
'cancel' => 'إلغاء',
'submit' => 'تسجيل الخروج من الأجهزة الأخرى',
- 'email_mismatch' => 'البريد الإلكتروني لا يطابق حسابك.',
'flash_logged_out' => 'تم تسجيل خروجك من الأجهزة الأخرى.',
],
'password' => [
diff --git a/lang/ar/welcome.php b/lang/ar/welcome.php
index 9fc76a6af..a9178e0a5 100644
--- a/lang/ar/welcome.php
+++ b/lang/ar/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'اربط ذكاءك الاصطناعي',
'pick_ai' => 'أين تريد استخدام TryPost؟',
'connect_other' => 'ربط تطبيق آخر',
- 'composer' => 'اسأل عن أي شيء',
'connected' => 'تم ربط :client',
'benefits' => [
'schedule' => [
diff --git a/lang/de/accounts.php b/lang/de/accounts.php
index cc84b3342..35d5dc62a 100644
--- a/lang/de/accounts.php
+++ b/lang/de/accounts.php
@@ -56,6 +56,7 @@ return [
'description' => 'Die Funktionen hängen von der Art deines Instagram-Kontos und der gewählten Verbindung ab.',
'professional_title' => 'Professionell',
'professional_types' => '(Unternehmen & Creator)',
+ 'facebook_types' => '(mit einer Facebook-Seite verknüpft)',
'badge' => 'Automatisches Posten',
'features' => [
'automatic' => [
@@ -66,11 +67,13 @@ return [
'title' => 'Metriken gesendeter Beiträge',
'description' => 'Leistung früherer Beiträge ansehen',
],
+ 'music' => [
+ 'title' => 'Musik in Reels',
+ 'description' => 'Füge einen Titel aus der Instagram-Bibliothek hinzu',
+ ],
],
'connect' => 'Mit Instagram verbinden',
'convert_hint' => 'Instagram fordert dich bei Bedarf auf, ganz einfach zu einem professionellen Konto zu wechseln.',
- 'facebook_link' => 'Instagram über Facebook verbinden',
- 'facebook_suffix' => '(wenn dein Instagram-Konto derzeit mit Facebook verknüpft ist).',
'help' => [
'account_type' => 'Den Typ deines Instagram-Kontos herausfinden',
'convert' => 'Dein Instagram-Konto in ein professionelles Konto umwandeln',
diff --git a/lang/de/channels.php b/lang/de/channels.php
index fc05258d2..e753b7bb9 100644
--- a/lang/de/channels.php
+++ b/lang/de/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Verbinde diesen Kanal erneut, um weiter zu veröffentlichen.',
'reconnect' => 'Erneut verbinden',
'refresh_connection' => 'Verbindung aktualisieren',
+ 'link_facebook_page' => 'Mit einer Facebook-Seite verknüpfen',
'view_profile' => 'Profil ansehen',
'disconnect' => 'Trennen',
'actions' => 'Kanalaktionen',
'reorder' => [
'handle' => ':name per Drag-and-drop verschieben',
- 'move_up' => 'Nach oben',
- 'move_down' => 'Nach unten',
'failed' => 'Deine Kanäle konnten nicht neu sortiert werden. Versuche es erneut.',
'stale' => 'Deine Kanäle haben sich seit dem Laden der Seite geändert. Lade die Seite neu und versuche es erneut.',
],
diff --git a/lang/de/common.php b/lang/de/common.php
index 5161e5bf9..ab5a22c02 100644
--- a/lang/de/common.php
+++ b/lang/de/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Zurück',
+ 'unsaved_changes' => [
+
+ 'title' => 'Änderungen verwerfen?',
+
+ 'description' => 'Deine Änderungen an diesem Beitrag wurden nicht gespeichert. Wenn du jetzt gehst, gehen sie verloren.',
+
+ 'discard' => 'Verwerfen',
+
+ ],
+
'confirm_modal' => [
'type' => 'Gib',
'to_confirm' => 'zur Bestätigung ein.',
diff --git a/lang/de/notes.php b/lang/de/notes.php
index 85e827bb3..d456a0d01 100644
--- a/lang/de/notes.php
+++ b/lang/de/notes.php
@@ -5,14 +5,15 @@ declare(strict_types=1);
return [
'placeholder' => 'Schreibe eine Notiz...',
'title' => 'Notizen',
+ 'show' => 'Notizen anzeigen',
+ 'hide' => 'Notizen ausblenden',
'edit' => 'Bearbeiten',
'delete' => 'Löschen',
'edited' => 'bearbeitet',
'save' => 'Speichern',
'cancel' => 'Abbrechen',
'send' => 'Senden',
- 'empty_title' => 'Noch keine Notizen',
- 'empty_description' => 'Starte die Unterhaltung.',
+ 'empty' => 'Noch keine Notizen. Nur dein Team sieht sie.',
'actions' => 'Notizaktionen',
'load_more' => 'Ältere Notizen laden',
];
diff --git a/lang/de/posts.php b/lang/de/posts.php
index 34fdd6f91..e35f9df0c 100644
--- a/lang/de/posts.php
+++ b/lang/de/posts.php
@@ -195,8 +195,8 @@ return [
'title' => 'Medien bearbeiten',
'description' => 'Bilder dieses Beitrags zuschneiden, anpassen, beschreiben und Personen markieren.',
'edit_tab' => 'Bearbeiten',
- 'alt_tab' => 'Alternativtext',
- 'tags_tab' => 'Personen markieren',
+ 'alt_tab' => 'Alt-Text',
+ 'tags_tab' => 'Markieren',
'crop_tab' => 'Zuschneiden',
'appearance_tab' => 'Darstellung',
'crop_heading' => 'Zuschneiden und transformieren',
@@ -242,8 +242,11 @@ return [
'tags_save' => 'Markierung speichern',
'tags_cancel' => 'Abbrechen',
'tags_remove' => '@:username entfernen',
+ 'tags_move' => 'Verschieben',
+ 'tags_move_pill' => 'Neue Position wählen',
+ 'tags_move_hint' => 'Klicke auf das Bild, um @:username zu platzieren.',
'tags_invalid' => 'Gib einen gültigen Instagram-Benutzernamen ein.',
- 'thumbnail_tab' => 'Vorschaubild',
+ 'thumbnail_tab' => 'Vorschau',
'thumbnail_heading' => 'Vorschaubild auswählen',
'thumbnail_hint' => 'Ziehe den Regler, um das Bild auszuwählen, das als Titelbild des Videos angezeigt wird.',
'thumbnail_value' => ':seconds Sekunden',
@@ -349,6 +352,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Im Feed teilen',
+ 'music' => [
+ 'label' => 'Musik',
+ 'add' => 'Hinzufügen',
+ 'search_placeholder' => 'Musik suchen',
+ 'empty' => 'Keine Titel gefunden',
+ 'play' => 'Vorschau abspielen',
+ 'pause' => 'Vorschau pausieren',
+ 'remove' => 'Musik entfernen',
+ 'part_hint' => 'Instagram lässt TryPost nicht auswählen, welcher Teil des Titels läuft.',
+ 'volume' => 'Lautstärke',
+ 'video_volume' => 'Video',
+ 'audio_volume' => 'Musik',
+ 'limited' => 'Die Ergebnisse sind begrenzt und können von Instagram abweichen.',
+ 'search_failed' => 'Musik von Instagram konnte nicht geladen werden. Versuche es erneut.',
+ 'too_many_searches' => 'Zu viele Musiksuchen. Warte eine Minute und versuche es erneut.',
+ 'requires_facebook' => 'Musik erfordert ein über Facebook verbundenes Instagram-Konto.',
+ 'link_title' => 'Über Facebook verbinden, um Reels mit Musik zu posten',
+ 'link_body' => 'Um Reels mit Musik zu posten, verknüpfe Instagram mit deiner Facebook-Seite. Wir speichern deinen Beitrag vorher als Entwurf. Öffne ihn danach unter Entwürfe, um Musik hinzuzufügen.',
+ 'maybe_later' => 'Später',
+ 'save_and_link' => 'Verknüpfen',
+ 'save_and_link_blocked' => 'Dieser Post kann noch nicht gespeichert werden. Warte, bis die Uploads fertig sind, behebe das Markierte und versuche es erneut.',
+ 'save_and_link_pending' => 'Dieser Post wartet auf Freigabe. Gib ihn frei oder verschiebe ihn in die Entwürfe, bevor du Facebook verknüpfst.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Mitwirkende',
+ 'placeholder' => 'Instagram-Nutzername',
+ 'add' => 'Hinzufügen',
+ 'remove' => ':username entfernen',
+ 'max' => 'Füge bis zu :max Mitwirkende hinzu.',
+ 'invalid' => 'Gib einen gültigen Instagram-Nutzernamen ein.',
+ 'no_trial' => 'Bei Test-Reels nicht verfügbar',
+ 'notice' => 'Instagram bestätigt uns keinen Nutzernamen. Öffne das Profil, um zu prüfen, ob es das richtige Konto ist.',
+ 'got_it' => 'Verstanden',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Test-Reel',
+ 'off' => 'Aus',
+ 'auto' => 'Auto',
+ 'manual' => 'Manuell',
+ 'badge' => 'Test',
+ 'auto_hint' => 'Dein Test-Reel wird zuerst Nicht-Followern gezeigt. Kommt es gut an, teilt Instagram es nach 72 Stunden automatisch mit deinen Followern. Sonst wird es nur geteilt, wenn du es selbst teilst.',
+ 'manual_hint' => 'Nicht-Follower sehen es zuerst. Du teilst es mit deinen Followern, wenn du so weit bist.',
+ 'no_collaborators' => 'Nicht mit Mitwirkenden verfügbar',
+ 'check_title' => 'Gibt es Test-Reels, wenn du in der Instagram-App ein Reel erstellst?',
+ 'check_body' => 'Das funktioniert nur, wenn dein Konto Test-Reels hat. Prüfe es in der Instagram-App.',
+ 'checked' => 'Ja, geprüft',
+ 'not_checked' => 'Nein',
+ ],
],
'threads' => [
'topic' => 'Thema',
@@ -943,10 +994,19 @@ return [
'move_up' => 'Nach oben',
'move_down' => 'Nach unten',
'duplicate' => 'Beitrag duplizieren',
+ 'share_link' => 'In einem Beitrag teilen',
+ 'copy_link' => 'Link kopieren',
'move_to_drafts' => 'In Entwürfe verschieben',
'delete' => 'Beitrag löschen',
'add_to_queue' => 'Zur Warteschlange hinzufügen',
- 'add_to_queue_disabled' => 'Füge diesem Kanal Veröffentlichungszeiten hinzu, um die Warteschlange zu nutzen.',
+ 'add_to_queue_hint' => 'Fügt zum nächsten freien Termin des Kanals hinzu.',
+ 'queue_setup' => [
+ 'title' => 'Du hast die Warteschlange dieses Kanals noch nicht eingerichtet',
+ 'body' => 'Um Posts zur Warteschlange hinzuzufügen, leg die Posting-Zeiten des Kanals fest. Jeder Post in der Warteschlange geht zum nächsten freien Termin raus.',
+ 'body_member' => 'Um Posts zur Warteschlange hinzuzufügen, muss ein Workspace-Admin die Posting-Zeiten dieses Kanals festlegen.',
+ 'not_now' => 'Nicht jetzt',
+ 'action' => 'Zeiten festlegen',
+ ],
'more' => 'Weitere Aktionen',
'open_on_network' => 'Beitrag auf :network öffnen',
'see_insights' => 'Beitragsstatistiken ansehen',
diff --git a/lang/de/settings.php b/lang/de/settings.php
index 2c8906f1f..dd542a013 100644
--- a/lang/de/settings.php
+++ b/lang/de/settings.php
@@ -16,7 +16,6 @@ return [
],
'items' => [
'profile' => 'Profil',
- 'authentication' => 'Authentifizierung',
'notifications' => 'Benachrichtigungen',
'preferences' => 'Präferenzen',
'general' => 'Allgemein',
@@ -101,27 +100,23 @@ return [
'resend_verification' => 'Klicke hier, um die Bestätigungs-E-Mail erneut zu senden.',
'verification_sent' => 'Ein neuer Bestätigungslink wurde an deine E-Mail-Adresse gesendet.',
'save' => 'Speichern',
- ],
-
- 'authentication' => [
- 'title' => 'Authentifizierung',
- 'page_title' => 'Authentifizierungseinstellungen',
+ 'tabs' => [
+ 'profile' => 'Profil',
+ 'login' => 'Anmeldung',
+ 'sessions' => 'Sitzungen',
+ ],
'sessions' => [
'title' => 'Aktive Sitzungen',
'description' => 'Wenn dir etwas Verdächtiges auffällt, melde dich von anderen Geräten ab.',
'unknown_browser' => 'Unbekannter Browser',
- 'unknown_ip' => 'Unbekannte IP',
'on' => 'am',
'active_now' => 'Jetzt aktiv',
+ 'last_activity' => 'Letzte Aktivität :time',
'log_out_others' => 'Andere Geräte abmelden',
'modal_title' => 'Andere Geräte abmelden',
- 'modal_description_password' => 'Gib dein aktuelles Passwort ein, um zu bestätigen, dass du andere Browser-Sitzungen abmelden möchtest.',
- 'modal_description_email' => 'Gib deine E-Mail-Adresse ein, um zu bestätigen, dass du andere Browser-Sitzungen abmelden möchtest.',
- 'password_placeholder' => 'Aktuelles Passwort',
- 'email_placeholder' => 'E-Mail deines Kontos',
+ 'modal_description' => 'Alle anderen Geräte, die bei deinem Konto angemeldet sind, werden abgemeldet. Diese Sitzung bleibt aktiv.',
'cancel' => 'Abbrechen',
'submit' => 'Andere Geräte abmelden',
- 'email_mismatch' => 'Die E-Mail-Adresse stimmt nicht mit deinem Konto überein.',
'flash_logged_out' => 'Du wurdest von anderen Geräten abgemeldet.',
],
'password' => [
diff --git a/lang/de/welcome.php b/lang/de/welcome.php
index 902626924..38c55cefa 100644
--- a/lang/de/welcome.php
+++ b/lang/de/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Deine KI verbinden',
'pick_ai' => 'Wo willst du TryPost nutzen?',
'connect_other' => 'Andere App verbinden',
- 'composer' => 'Frag mich alles',
'connected' => ':client ist verbunden',
'benefits' => [
'schedule' => [
diff --git a/lang/el/accounts.php b/lang/el/accounts.php
index 4957225ba..454823fc2 100644
--- a/lang/el/accounts.php
+++ b/lang/el/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Οι λειτουργίες εξαρτώνται από τον τύπο του λογαριασμού σας στο Instagram και τη σύνδεση που θα επιλέξετε.',
'professional_title' => 'Επαγγελματικός',
'professional_types' => '(Επιχείρηση & Δημιουργός)',
+ 'facebook_types' => '(συνδεδεμένος με σελίδα Facebook)',
'badge' => 'Αυτόματη δημοσίευση',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Μετρήσεις δημοσιεύσεων',
'description' => 'Δείτε την απόδοση προηγούμενων δημοσιεύσεων',
],
+ 'music' => [
+ 'title' => 'Μουσική στα reels',
+ 'description' => 'Πρόσθεσε ένα κομμάτι από τη βιβλιοθήκη του Instagram',
+ ],
],
'connect' => 'Σύνδεση με το Instagram',
'convert_hint' => 'Το Instagram θα σας ζητήσει να μετατρέψετε εύκολα τον λογαριασμό σε επαγγελματικό, αν χρειαστεί.',
- 'facebook_link' => 'Συνδέστε το Instagram μέσω Facebook',
- 'facebook_suffix' => 'αν ο λογαριασμός σας στο Instagram είναι συνδεδεμένος με το Facebook.',
'help' => [
'account_type' => 'Βρείτε τον τύπο του λογαριασμού σας στο Instagram',
'convert' => 'Μετατροπή του λογαριασμού σας στο Instagram σε επαγγελματικό',
diff --git a/lang/el/channels.php b/lang/el/channels.php
index 6e1afcee4..3e43a6ce7 100644
--- a/lang/el/channels.php
+++ b/lang/el/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Επανασυνδέστε αυτό το κανάλι για να συνεχίσετε τη δημοσίευση.',
'reconnect' => 'Επανασύνδεση',
'refresh_connection' => 'Ανανέωση σύνδεσης',
+ 'link_facebook_page' => 'Σύνδεση με σελίδα Facebook',
'view_profile' => 'Προβολή προφίλ',
'disconnect' => 'Αποσύνδεση',
'actions' => 'Ενέργειες καναλιού',
'reorder' => [
'handle' => 'Σύρετε για αναδιάταξη: :name',
- 'move_up' => 'Μετακίνηση πάνω',
- 'move_down' => 'Μετακίνηση κάτω',
'failed' => 'Δεν ήταν δυνατή η αναδιάταξη των καναλιών σας. Δοκιμάστε ξανά.',
'stale' => 'Τα κανάλια σας άλλαξαν από τη φόρτωση της σελίδας. Ανανεώστε και δοκιμάστε ξανά.',
],
diff --git a/lang/el/common.php b/lang/el/common.php
index f32dabf14..a94898158 100644
--- a/lang/el/common.php
+++ b/lang/el/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Πίσω',
+ 'unsaved_changes' => [
+
+ 'title' => 'Απόρριψη αλλαγών;',
+
+ 'description' => 'Οι αλλαγές σε αυτή την ανάρτηση δεν αποθηκεύτηκαν. Αν φύγεις τώρα, θα χαθούν.',
+
+ 'discard' => 'Απόρριψη',
+
+ ],
+
'confirm_modal' => [
'type' => 'Πληκτρολογήστε',
'to_confirm' => 'για επιβεβαίωση.',
diff --git a/lang/el/notes.php b/lang/el/notes.php
index 491556161..40485cb32 100644
--- a/lang/el/notes.php
+++ b/lang/el/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'Γράψτε μια σημείωση...',
'title' => 'Σημειώσεις',
+ 'show' => 'Εμφάνιση σημειώσεων',
+ 'hide' => 'Απόκρυψη σημειώσεων',
'edit' => 'Επεξεργασία',
'delete' => 'Διαγραφή',
'edited' => 'επεξεργάστηκε',
'save' => 'Αποθήκευση',
'cancel' => 'Ακύρωση',
'send' => 'Αποστολή',
- 'empty_title' => 'Δεν υπάρχουν σημειώσεις ακόμη',
- 'empty_description' => 'Ξεκινήστε τη συζήτηση.',
+ 'empty' => 'Δεν υπάρχουν σημειώσεις ακόμη. Τις βλέπει μόνο η ομάδα σου.',
'actions' => 'Ενέργειες σημείωσης',
'load_more' => 'Φόρτωση παλαιότερων σημειώσεων',
];
diff --git a/lang/el/posts.php b/lang/el/posts.php
index 40a5fd543..833fe88b1 100644
--- a/lang/el/posts.php
+++ b/lang/el/posts.php
@@ -192,9 +192,9 @@ return [
'media_editor' => [
'title' => 'Επεξεργασία πολυμέσων',
'description' => 'Περικόψτε, προσαρμόστε, περιγράψτε και επισημάνετε άτομα στις εικόνες αυτής της ανάρτησης.',
- 'edit_tab' => 'Επεξεργασία',
- 'alt_tab' => 'Εναλλακτικό κείμενο',
- 'tags_tab' => 'Επισήμανση ατόμων',
+ 'edit_tab' => 'Επεξ/σία',
+ 'alt_tab' => 'Περιγραφή',
+ 'tags_tab' => 'Ετικέτες',
'crop_tab' => 'Περικοπή',
'appearance_tab' => 'Εμφάνιση',
'crop_heading' => 'Περικοπή και μετασχηματισμός',
@@ -240,8 +240,11 @@ return [
'tags_save' => 'Αποθήκευση επισήμανσης',
'tags_cancel' => 'Ακύρωση',
'tags_remove' => 'Αφαίρεση @:username',
+ 'tags_move' => 'Μετακίνηση',
+ 'tags_move_pill' => 'Επίλεξε νέα θέση',
+ 'tags_move_hint' => 'Κάνε κλικ στην εικόνα για να τοποθετήσεις τον/την @:username.',
'tags_invalid' => 'Εισαγάγετε έγκυρο όνομα χρήστη Instagram.',
- 'thumbnail_tab' => 'Μικρογραφία',
+ 'thumbnail_tab' => 'Εξώφυλλο',
'thumbnail_heading' => 'Επιλέξτε μικρογραφία',
'thumbnail_hint' => 'Σύρετε το ρυθμιστικό για να επιλέξετε το καρέ που θα εμφανίζεται ως εξώφυλλο του βίντεο.',
'thumbnail_value' => ':seconds δευτερόλεπτα',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Και στη ροή',
+ 'music' => [
+ 'label' => 'Μουσική',
+ 'add' => 'Προσθήκη',
+ 'search_placeholder' => 'Αναζήτηση μουσικής',
+ 'empty' => 'Δεν βρέθηκαν κομμάτια',
+ 'play' => 'Αναπαραγωγή',
+ 'pause' => 'Παύση',
+ 'remove' => 'Αφαίρεση μουσικής',
+ 'part_hint' => 'Το Instagram δεν επιτρέπει στο TryPost να επιλέξει ποιο μέρος του κομματιού παίζει.',
+ 'volume' => 'Ένταση',
+ 'video_volume' => 'Βίντεο',
+ 'audio_volume' => 'Μουσική',
+ 'limited' => 'Τα αποτελέσματα είναι περιορισμένα και μπορεί να διαφέρουν από το Instagram.',
+ 'search_failed' => 'Δεν ήταν δυνατή η φόρτωση μουσικής από το Instagram. Δοκίμασε ξανά.',
+ 'too_many_searches' => 'Πάρα πολλές αναζητήσεις μουσικής. Περίμενε ένα λεπτό και δοκίμασε ξανά.',
+ 'requires_facebook' => 'Η μουσική απαιτεί λογαριασμό Instagram συνδεδεμένο μέσω Facebook.',
+ 'link_title' => 'Σύνδεσε μέσω Facebook για reels με μουσική',
+ 'link_body' => 'Για να δημοσιεύεις reels με μουσική, σύνδεσε το Instagram με τη Σελίδα σου στο Facebook. Πρώτα θα αποθηκεύσουμε την ανάρτηση ως πρόχειρο. Μετά άνοιξέ τη από τα Πρόχειρα για να προσθέσεις μουσική.',
+ 'maybe_later' => 'Αργότερα',
+ 'save_and_link' => 'Σύνδεση',
+ 'save_and_link_blocked' => 'Αυτή η ανάρτηση δεν μπορεί να αποθηκευτεί ακόμη. Περίμενε να ολοκληρωθούν οι μεταφορτώσεις, διόρθωσε ό,τι επισημαίνεται και δοκίμασε ξανά.',
+ 'save_and_link_pending' => 'Αυτή η ανάρτηση περιμένει έγκριση. Ενέκρινέ την ή μετακίνησέ την στα πρόχειρα πριν συνδέσεις το Facebook.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Συνεργάτες',
+ 'placeholder' => 'Όνομα χρήστη Instagram',
+ 'add' => 'Προσθήκη',
+ 'remove' => 'Αφαίρεση :username',
+ 'max' => 'Πρόσθεσε έως :max συνεργάτες.',
+ 'invalid' => 'Γράψε ένα έγκυρο όνομα χρήστη Instagram.',
+ 'no_trial' => 'Μη διαθέσιμο σε δοκιμαστικό reel',
+ 'notice' => 'Το Instagram δεν μας επιβεβαιώνει το όνομα χρήστη. Άνοιξε το προφίλ για να ελέγξεις ότι είναι ο σωστός λογαριασμός.',
+ 'got_it' => 'Εντάξει',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Δοκιμαστικό reel',
+ 'off' => 'Όχι',
+ 'auto' => 'Αυτόματα',
+ 'manual' => 'Χειροκίνητα',
+ 'badge' => 'Δοκιμή',
+ 'auto_hint' => 'Το δοκιμαστικό reel εμφανίζεται πρώτα σε όσους δεν σε ακολουθούν. Αν πάει καλά, το Instagram το κοινοποιεί αυτόματα στους ακόλουθούς σου μετά από 72 ώρες. Αν όχι, δεν κοινοποιείται εκτός αν το κοινοποιήσεις εσύ.',
+ 'manual_hint' => 'Το βλέπουν πρώτα όσοι δεν σε ακολουθούν. Το κοινοποιείς στους ακόλουθούς σου όταν είσαι έτοιμος.',
+ 'no_collaborators' => 'Μη διαθέσιμο με συνεργάτες',
+ 'check_title' => 'Υπάρχουν δοκιμαστικά reels όταν δημιουργείς reel στην εφαρμογή Instagram;',
+ 'check_body' => 'Λειτουργεί μόνο αν ο λογαριασμός σου έχει δοκιμαστικά reels. Έλεγξέ το στην εφαρμογή Instagram.',
+ 'checked' => 'Ναι, το έλεγξα',
+ 'not_checked' => 'Όχι',
+ ],
],
'threads' => [
'topic' => 'Θέμα',
@@ -941,10 +992,19 @@ return [
'move_up' => 'Μετακίνηση πάνω',
'move_down' => 'Μετακίνηση κάτω',
'duplicate' => 'Διπλασιασμός δημοσίευσης',
+ 'share_link' => 'Κοινοποίηση σε ανάρτηση',
+ 'copy_link' => 'Αντιγραφή συνδέσμου',
'move_to_drafts' => 'Μετακίνηση στα πρόχειρα',
'delete' => 'Διαγραφή δημοσίευσης',
'add_to_queue' => 'Προσθήκη στην ουρά',
- 'add_to_queue_disabled' => 'Προσθέστε ώρες δημοσίευσης σε αυτό το κανάλι για να χρησιμοποιήσετε την ουρά.',
+ 'add_to_queue_hint' => 'Προσθέτει στην επόμενη ελεύθερη ώρα του καναλιού.',
+ 'queue_setup' => [
+ 'title' => 'Δεν έχεις ρυθμίσει ακόμη την ουρά αυτού του καναλιού',
+ 'body' => 'Για να προσθέτεις αναρτήσεις στην ουρά, όρισε τις ώρες δημοσίευσης του καναλιού. Κάθε ανάρτηση της ουράς βγαίνει την επόμενη ελεύθερη ώρα.',
+ 'body_member' => 'Για να προσθέτεις αναρτήσεις στην ουρά, ένας admin του workspace πρέπει να ορίσει τις ώρες δημοσίευσης αυτού του καναλιού.',
+ 'not_now' => 'Όχι τώρα',
+ 'action' => 'Ορισμός ωρών',
+ ],
'more' => 'Περισσότερες ενέργειες',
'open_on_network' => 'Άνοιγμα ανάρτησης στο :network',
'see_insights' => 'Στατιστικά ανάρτησης',
diff --git a/lang/el/settings.php b/lang/el/settings.php
index af4528cae..9e3b79e6b 100644
--- a/lang/el/settings.php
+++ b/lang/el/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Προφίλ',
- 'authentication' => 'Ταυτοποίηση',
'notifications' => 'Ειδοποιήσεις',
'preferences' => 'Προτιμήσεις',
'general' => 'Γενικά',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Κάντε κλικ εδώ για επαναποστολή του email επαλήθευσης.',
'verification_sent' => 'Ένας νέος σύνδεσμος επαλήθευσης στάλθηκε στη διεύθυνση email σας.',
'save' => 'Αποθήκευση',
- ],
-
- 'authentication' => [
- 'title' => 'Ταυτοποίηση',
- 'page_title' => 'Ρυθμίσεις ταυτοποίησης',
+ 'tabs' => [
+ 'profile' => 'Προφίλ',
+ 'login' => 'Σύνδεση',
+ 'sessions' => 'Συνεδρίες',
+ ],
'sessions' => [
'title' => 'Ενεργές συνεδρίες',
'description' => 'Αν παρατηρήσετε κάτι ύποπτο, αποσυνδεθείτε από τις άλλες συσκευές.',
'unknown_browser' => 'Άγνωστο πρόγραμμα περιήγησης',
- 'unknown_ip' => 'Άγνωστη IP',
'on' => 'στις',
'active_now' => 'Ενεργό τώρα',
+ 'last_activity' => 'Τελευταία δραστηριότητα :time',
'log_out_others' => 'Αποσύνδεση από άλλες συσκευές',
'modal_title' => 'Αποσύνδεση από άλλες συσκευές',
- 'modal_description_password' => 'Εισάγετε τον τρέχοντα κωδικό πρόσβασής σας για να επιβεβαιώσετε ότι θέλετε να αποσυνδεθείτε από άλλες συνεδρίες περιήγησης.',
- 'modal_description_email' => 'Πληκτρολογήστε τη διεύθυνση email σας για να επιβεβαιώσετε ότι θέλετε να αποσυνδεθείτε από άλλες συνεδρίες περιήγησης.',
- 'password_placeholder' => 'Τρέχων κωδικός πρόσβασης',
- 'email_placeholder' => 'Το email του λογαριασμού σας',
+ 'modal_description' => 'Όλες οι άλλες συσκευές που είναι συνδεδεμένες στον λογαριασμό σας θα αποσυνδεθούν. Αυτή η συνεδρία παραμένει ενεργή.',
'cancel' => 'Ακύρωση',
'submit' => 'Αποσύνδεση από άλλες συσκευές',
- 'email_mismatch' => 'Η διεύθυνση email δεν ταιριάζει με τον λογαριασμό σας.',
'flash_logged_out' => 'Αποσυνδεθήκατε από τις άλλες συσκευές.',
],
'password' => [
diff --git a/lang/el/welcome.php b/lang/el/welcome.php
index 20f96fe56..515353d7d 100644
--- a/lang/el/welcome.php
+++ b/lang/el/welcome.php
@@ -58,11 +58,10 @@ return [
'connect_ai' => 'Συνδέστε την AI σας',
'pick_ai' => 'Πού θα χρησιμοποιήσετε το TryPost;',
'connect_other' => 'Σύνδεση άλλης εφαρμογής',
- 'composer' => 'Ρωτήστε οτιδήποτε',
'connected' => 'Το :client συνδέθηκε',
'benefits' => [
'schedule' => [
- 'title' => 'Δημιουργία και προγραμματισμός από το chat',
+ 'title' => 'Φτιάξτε και προγραμματίστε στο chat',
'hint' => 'Carousel, threads και βίντεο',
'ask' => 'Πάρε την επόμενη ιδέα από τον πίνακά μου, κάν’ την carousel και προγραμμάτισέ το για Τρίτη στις :time σε Instagram και LinkedIn.',
'reply' => 'Έγινε. Το carousel σου είναι προγραμματισμένο σε Instagram και LinkedIn.',
@@ -81,7 +80,7 @@ return [
],
'ideas' => [
'title' => 'Οργανώστε τις ιδέες σας',
- 'hint' => 'Από το brainstorming στο πλάνο περιεχομένου',
+ 'hint' => 'Από τις ιδέες στο πλάνο περιεχομένου',
'ask' => 'Δώσε μου 8 ιδέες για posts για την επόμενη εβδομάδα και αποθήκευσέ τες στον πίνακά μου.',
'reply' => 'Αποθήκευσα 8 ιδέες στον πίνακά σου, έτοιμες να γίνουν posts.',
],
diff --git a/lang/en/accounts.php b/lang/en/accounts.php
index 45181f1a8..7eec47f24 100644
--- a/lang/en/accounts.php
+++ b/lang/en/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Features depend on the type of Instagram account you have and the connection you choose.',
'professional_title' => 'Professional',
'professional_types' => '(Business & Creator)',
+ 'facebook_types' => '(linked to a Facebook Page)',
'badge' => 'Automatic posting',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Sent post metrics',
'description' => 'View past post performance',
],
+ 'music' => [
+ 'title' => 'Music on reels',
+ 'description' => 'Add a track from Instagram\'s library',
+ ],
],
'connect' => 'Connect to Instagram',
'convert_hint' => 'Instagram will prompt you to easily convert to a professional account if needed.',
- 'facebook_link' => 'Connect Instagram through Facebook',
- 'facebook_suffix' => 'if your Instagram account is currently linked to Facebook.',
'help' => [
'account_type' => 'Finding your Instagram account type',
'convert' => 'Converting your Instagram account to a Professional account',
diff --git a/lang/en/channels.php b/lang/en/channels.php
index 26fe5bcfc..2b245522a 100644
--- a/lang/en/channels.php
+++ b/lang/en/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Reconnect this channel to keep publishing.',
'reconnect' => 'Reconnect',
'refresh_connection' => 'Refresh connection',
+ 'link_facebook_page' => 'Link to a Facebook Page',
'view_profile' => 'View profile',
'disconnect' => 'Disconnect',
'actions' => 'Channel actions',
'reorder' => [
'handle' => 'Drag to reorder :name',
- 'move_up' => 'Move up',
- 'move_down' => 'Move down',
'failed' => 'Could not reorder your channels. Try again.',
'stale' => 'Your channels changed since you loaded the page. Refresh and try again.',
],
diff --git a/lang/en/common.php b/lang/en/common.php
index 8c5944020..a9d31881b 100644
--- a/lang/en/common.php
+++ b/lang/en/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Back',
+ 'unsaved_changes' => [
+
+ 'title' => 'Discard changes?',
+
+ 'description' => 'Your changes to this post haven\'t been saved. If you leave now, they\'ll be lost.',
+
+ 'discard' => 'Discard',
+
+ ],
+
'confirm_modal' => [
'type' => 'Type',
'to_confirm' => 'to confirm.',
diff --git a/lang/en/notes.php b/lang/en/notes.php
index 9ecfd304d..036afe674 100644
--- a/lang/en/notes.php
+++ b/lang/en/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'Write a note...',
'title' => 'Notes',
+ 'show' => 'Show notes',
+ 'hide' => 'Hide notes',
'edit' => 'Edit',
'delete' => 'Delete',
'edited' => 'edited',
'save' => 'Save',
'cancel' => 'Cancel',
'send' => 'Send',
- 'empty_title' => 'No notes yet',
- 'empty_description' => 'Start the conversation.',
+ 'empty' => 'No notes yet. Only your team sees them.',
'actions' => 'Note actions',
'load_more' => 'Load older notes',
];
diff --git a/lang/en/posts.php b/lang/en/posts.php
index d469dee19..4b7f5a5b0 100644
--- a/lang/en/posts.php
+++ b/lang/en/posts.php
@@ -240,6 +240,9 @@ return [
'tags_save' => 'Save tag',
'tags_cancel' => 'Cancel',
'tags_remove' => 'Remove @:username',
+ 'tags_move' => 'Move',
+ 'tags_move_pill' => 'Choose a new position',
+ 'tags_move_hint' => 'Click the image to place @:username.',
'tags_invalid' => 'Enter a valid Instagram username.',
'thumbnail_tab' => 'Thumbnail',
'thumbnail_heading' => 'Choose a thumbnail',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Share to feed',
+ 'music' => [
+ 'label' => 'Music',
+ 'add' => 'Add music',
+ 'search_placeholder' => 'Search music',
+ 'empty' => 'No tracks found',
+ 'play' => 'Play preview',
+ 'pause' => 'Pause preview',
+ 'remove' => 'Remove music',
+ 'part_hint' => 'Instagram doesn\'t let TryPost choose which part of a track plays.',
+ 'volume' => 'Volume',
+ 'video_volume' => 'Video',
+ 'audio_volume' => 'Music',
+ 'limited' => 'Results are limited and may differ from Instagram.',
+ 'search_failed' => 'Couldn\'t load music from Instagram. Try again.',
+ 'too_many_searches' => 'Too many music searches. Wait a minute and try again.',
+ 'requires_facebook' => 'Music needs an Instagram account connected through Facebook.',
+ 'link_title' => 'Connect through Facebook to publish reels with music',
+ 'link_body' => 'To publish Instagram reels with music, link Instagram to your Facebook Page. We\'ll save your post as a draft before linking. Reopen it from Drafts afterward to add music.',
+ 'maybe_later' => 'Maybe later',
+ 'save_and_link' => 'Save & link',
+ 'save_and_link_blocked' => 'This post can\'t be saved yet. Wait for uploads to finish and fix what\'s highlighted, then try again.',
+ 'save_and_link_pending' => 'This post is waiting for approval. Approve it or move it to drafts before linking Facebook.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Collaborators',
+ 'placeholder' => 'Enter an Instagram username',
+ 'add' => 'Add collaborator',
+ 'remove' => 'Remove :username',
+ 'max' => 'Add up to :max collaborators.',
+ 'invalid' => 'Enter a valid Instagram username.',
+ 'no_trial' => 'Not available on a trial reel',
+ 'notice' => 'Instagram can\'t confirm a username for us. Open one to check it\'s the right account.',
+ 'got_it' => 'Got it',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Trial reel',
+ 'off' => 'Off',
+ 'auto' => 'Auto',
+ 'manual' => 'Manual',
+ 'badge' => 'Trial',
+ 'auto_hint' => 'Your trial reel is shown to non-followers first. If it performs well, Instagram shares it with your followers automatically after 72 hours. If it doesn\'t, it won\'t be shared unless you share it yourself.',
+ 'manual_hint' => 'Non-followers see it first. You share it with your followers when you\'re ready.',
+ 'no_collaborators' => 'Not available with collaborators',
+ 'check_title' => 'Are trial reels available when you create a reel in the Instagram app?',
+ 'check_body' => 'This only works if trial reels are available on your account. Use the Instagram mobile app to check.',
+ 'checked' => 'Yes, I\'ve checked',
+ 'not_checked' => 'No',
+ ],
],
'threads' => [
'topic' => 'Topic',
@@ -941,10 +992,19 @@ return [
'move_up' => 'Move up',
'move_down' => 'Move down',
'duplicate' => 'Duplicate Post',
+ 'share_link' => 'Share link in a post',
+ 'copy_link' => 'Copy link',
'move_to_drafts' => 'Move to Drafts',
'delete' => 'Delete Post',
'add_to_queue' => 'Add to queue',
- 'add_to_queue_disabled' => 'Add posting times to this channel to use the queue.',
+ 'add_to_queue_hint' => 'Add to the channel\'s next free posting time.',
+ 'queue_setup' => [
+ 'title' => 'You haven\'t set up this channel\'s queue yet',
+ 'body' => 'To add posts to the queue, set this channel\'s posting times. Each queued post goes out at the next open time.',
+ 'body_member' => 'To add posts to the queue, a workspace admin needs to set this channel\'s posting times.',
+ 'not_now' => 'Not now',
+ 'action' => 'Set posting times',
+ ],
'more' => 'More actions',
'open_on_network' => 'Open post on :network',
'see_insights' => 'See post insights',
diff --git a/lang/en/settings.php b/lang/en/settings.php
index eb0f60b8b..cff92b961 100644
--- a/lang/en/settings.php
+++ b/lang/en/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Profile',
- 'authentication' => 'Authentication',
'notifications' => 'Notifications',
'preferences' => 'Preferences',
'general' => 'General',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Click here to resend the verification email.',
'verification_sent' => 'A new verification link has been sent to your email address.',
'save' => 'Save',
- ],
-
- 'authentication' => [
- 'title' => 'Authentication',
- 'page_title' => 'Authentication settings',
+ 'tabs' => [
+ 'profile' => 'Profile',
+ 'login' => 'Password & login',
+ 'sessions' => 'Sessions',
+ ],
'sessions' => [
'title' => 'Active sessions',
'description' => 'If you notice anything suspicious, sign out of other devices.',
'unknown_browser' => 'Unknown browser',
- 'unknown_ip' => 'Unknown IP',
'on' => 'on',
'active_now' => 'Active now',
+ 'last_activity' => 'Last activity :time',
'log_out_others' => 'Log out other devices',
'modal_title' => 'Log out other devices',
- 'modal_description_password' => 'Enter your current password to confirm you want to log out other browser sessions.',
- 'modal_description_email' => 'Type your email address to confirm you want to log out other browser sessions.',
- 'password_placeholder' => 'Current password',
- 'email_placeholder' => 'Your account email',
+ 'modal_description' => 'Every other device signed in to your account will be signed out. This session stays active.',
'cancel' => 'Cancel',
'submit' => 'Log out other devices',
- 'email_mismatch' => 'The email address does not match your account.',
'flash_logged_out' => 'You have been logged out from other devices.',
],
'password' => [
diff --git a/lang/en/welcome.php b/lang/en/welcome.php
index 47bf16b03..3737cd2db 100644
--- a/lang/en/welcome.php
+++ b/lang/en/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Connect your AI',
'pick_ai' => 'Where do you want to use TryPost?',
'connect_other' => 'Connect another app',
- 'composer' => 'Ask anything',
'connected' => ':client is connected',
'benefits' => [
'schedule' => [
diff --git a/lang/es/accounts.php b/lang/es/accounts.php
index b18daf7a9..fbfdf276f 100644
--- a/lang/es/accounts.php
+++ b/lang/es/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Las funciones dependen del tipo de cuenta de Instagram que tengas y de la conexión que elijas.',
'professional_title' => 'Profesional',
'professional_types' => '(Empresa y Creador)',
+ 'facebook_types' => '(vinculado a una página de Facebook)',
'badge' => 'Publicación automática',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Métricas de publicaciones enviadas',
'description' => 'Consulta el rendimiento de publicaciones anteriores',
],
+ 'music' => [
+ 'title' => 'Música en los reels',
+ 'description' => 'Añade una canción de la biblioteca de Instagram',
+ ],
],
'connect' => 'Conectar con Instagram',
'convert_hint' => 'Instagram te pedirá que conviertas fácilmente tu cuenta en profesional si es necesario.',
- 'facebook_link' => 'Conecta Instagram a través de Facebook',
- 'facebook_suffix' => 'si tu cuenta de Instagram está vinculada a Facebook.',
'help' => [
'account_type' => 'Cómo saber el tipo de tu cuenta de Instagram',
'convert' => 'Convertir tu cuenta de Instagram en una cuenta profesional',
diff --git a/lang/es/channels.php b/lang/es/channels.php
index 4f93c9599..77049de36 100644
--- a/lang/es/channels.php
+++ b/lang/es/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Vuelve a conectar este canal para seguir publicando.',
'reconnect' => 'Reconectar',
'refresh_connection' => 'Actualizar conexión',
+ 'link_facebook_page' => 'Vincular a una página de Facebook',
'view_profile' => 'Ver perfil',
'disconnect' => 'Desconectar',
'actions' => 'Acciones del canal',
'reorder' => [
'handle' => 'Arrastra para reordenar :name',
- 'move_up' => 'Mover arriba',
- 'move_down' => 'Mover abajo',
'failed' => 'No se pudieron reordenar tus canales. Inténtalo de nuevo.',
'stale' => 'Tus canales cambiaron desde que cargaste la página. Actualiza e inténtalo de nuevo.',
],
diff --git a/lang/es/common.php b/lang/es/common.php
index cc269bab8..c7bf4be9b 100644
--- a/lang/es/common.php
+++ b/lang/es/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Volver',
+ 'unsaved_changes' => [
+
+ 'title' => '¿Descartar los cambios?',
+
+ 'description' => 'Los cambios de esta publicación no se han guardado. Si sales ahora, se perderán.',
+
+ 'discard' => 'Descartar',
+
+ ],
+
'confirm_modal' => [
'type' => 'Escribe',
'to_confirm' => 'para confirmar.',
diff --git a/lang/es/notes.php b/lang/es/notes.php
index 6907a8531..30e58159b 100644
--- a/lang/es/notes.php
+++ b/lang/es/notes.php
@@ -5,14 +5,15 @@ declare(strict_types=1);
return [
'placeholder' => 'Escribe una nota...',
'title' => 'Notas',
+ 'show' => 'Mostrar notas',
+ 'hide' => 'Ocultar notas',
'edit' => 'Editar',
'delete' => 'Eliminar',
'edited' => 'editado',
'save' => 'Guardar',
'cancel' => 'Cancelar',
'send' => 'Enviar',
- 'empty_title' => 'Todavía no hay notas',
- 'empty_description' => 'Inicia la conversación.',
+ 'empty' => 'Todavía no hay notas. Solo tu equipo las ve.',
'actions' => 'Acciones de la nota',
'load_more' => 'Cargar notas anteriores',
];
diff --git a/lang/es/posts.php b/lang/es/posts.php
index a699ac95f..a2d229f47 100644
--- a/lang/es/posts.php
+++ b/lang/es/posts.php
@@ -193,8 +193,8 @@ return [
'title' => 'Editar multimedia',
'description' => 'Recorta, ajusta, describe y etiqueta las imágenes de esta publicación.',
'edit_tab' => 'Editar',
- 'alt_tab' => 'Texto alternativo',
- 'tags_tab' => 'Etiquetar personas',
+ 'alt_tab' => 'Texto alt',
+ 'tags_tab' => 'Etiquetas',
'crop_tab' => 'Recortar',
'appearance_tab' => 'Apariencia',
'crop_heading' => 'Recortar y transformar',
@@ -240,6 +240,9 @@ return [
'tags_save' => 'Guardar etiqueta',
'tags_cancel' => 'Cancelar',
'tags_remove' => 'Quitar @:username',
+ 'tags_move' => 'Mover',
+ 'tags_move_pill' => 'Elige la nueva posición',
+ 'tags_move_hint' => 'Haz clic en la imagen para colocar a @:username.',
'tags_invalid' => 'Introduce un usuario de Instagram válido.',
'thumbnail_tab' => 'Miniatura',
'thumbnail_heading' => 'Elige una miniatura',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Compartir en el feed',
+ 'music' => [
+ 'label' => 'Música',
+ 'add' => 'Añadir música',
+ 'search_placeholder' => 'Buscar música',
+ 'empty' => 'No se encontraron canciones',
+ 'play' => 'Escuchar',
+ 'pause' => 'Pausar',
+ 'remove' => 'Quitar música',
+ 'part_hint' => 'Instagram no permite que TryPost elija qué parte de la canción suena.',
+ 'volume' => 'Volumen',
+ 'video_volume' => 'Video',
+ 'audio_volume' => 'Música',
+ 'limited' => 'Los resultados son limitados y pueden diferir de Instagram.',
+ 'search_failed' => 'No se pudo cargar la música de Instagram. Inténtalo de nuevo.',
+ 'too_many_searches' => 'Demasiadas búsquedas de música. Espera un minuto e inténtalo de nuevo.',
+ 'requires_facebook' => 'La música requiere una cuenta de Instagram conectada mediante Facebook.',
+ 'link_title' => 'Conecta con Facebook para publicar reels con música',
+ 'link_body' => 'Para publicar reels con música, vincula Instagram a tu página de Facebook. Guardaremos tu publicación como borrador antes. Después, ábrela desde Borradores para añadir la música.',
+ 'maybe_later' => 'Ahora no',
+ 'save_and_link' => 'Guardar y vincular',
+ 'save_and_link_blocked' => 'Todavía no se puede guardar este post. Espera a que terminen las subidas y corrige lo marcado, luego inténtalo de nuevo.',
+ 'save_and_link_pending' => 'Este post está esperando aprobación. Apruébalo o muévelo a borradores antes de vincular Facebook.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Colaboradores',
+ 'placeholder' => 'Escribe un usuario de Instagram',
+ 'add' => 'Añadir colaborador',
+ 'remove' => 'Quitar :username',
+ 'max' => 'Añade hasta :max colaboradores.',
+ 'invalid' => 'Escribe un usuario de Instagram válido.',
+ 'no_trial' => 'No disponible en un reel de prueba',
+ 'notice' => 'Instagram no nos confirma el usuario. Abre el perfil para comprobar que es la cuenta correcta.',
+ 'got_it' => 'Entendido',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Reel de prueba',
+ 'off' => 'No',
+ 'auto' => 'Auto',
+ 'manual' => 'Manual',
+ 'badge' => 'Prueba',
+ 'auto_hint' => 'Tu reel de prueba se muestra primero a quienes no te siguen. Si funciona bien, Instagram lo comparte con tus seguidores automáticamente después de 72 horas. Si no, no se comparte a menos que lo compartas tú.',
+ 'manual_hint' => 'Quienes no te siguen lo ven primero. Lo compartes con tus seguidores cuando quieras.',
+ 'no_collaborators' => 'No disponible con colaboradores',
+ 'check_title' => '¿Ves los reels de prueba al crear un reel en la app de Instagram?',
+ 'check_body' => 'Solo funciona si tu cuenta tiene reels de prueba. Compruébalo en la app de Instagram.',
+ 'checked' => 'Sí, lo comprobé',
+ 'not_checked' => 'No',
+ ],
],
'threads' => [
'topic' => 'Tema',
@@ -942,10 +993,19 @@ return [
'move_up' => 'Subir',
'move_down' => 'Bajar',
'duplicate' => 'Duplicar post',
+ 'share_link' => 'Compartir en una publicación',
+ 'copy_link' => 'Copiar enlace',
'move_to_drafts' => 'Mover a borradores',
'delete' => 'Eliminar post',
'add_to_queue' => 'Añadir a la cola',
- 'add_to_queue_disabled' => 'Añade horarios de publicación a este canal para usar la cola.',
+ 'add_to_queue_hint' => 'Añade al siguiente horario libre del canal.',
+ 'queue_setup' => [
+ 'title' => 'Aún no configuraste la cola de este canal',
+ 'body' => 'Para agregar posts a la cola, define los horarios de publicación del canal. Cada post de la cola sale en el siguiente horario libre.',
+ 'body_member' => 'Para agregar posts a la cola, un admin del workspace tiene que definir los horarios de publicación de este canal.',
+ 'not_now' => 'Ahora no',
+ 'action' => 'Definir horarios',
+ ],
'more' => 'Más acciones',
'open_on_network' => 'Abrir publicación en :network',
'see_insights' => 'Ver insights de la publicación',
diff --git a/lang/es/settings.php b/lang/es/settings.php
index 2e81f05eb..c527baa07 100644
--- a/lang/es/settings.php
+++ b/lang/es/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Perfil',
- 'authentication' => 'Autenticación',
'notifications' => 'Notificaciones',
'preferences' => 'Preferencias',
'general' => 'General',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Haz clic aquí para reenviar el correo de verificación.',
'verification_sent' => 'Se ha enviado un nuevo enlace de verificación a tu correo electrónico.',
'save' => 'Guardar',
- ],
-
- 'authentication' => [
- 'title' => 'Autenticación',
- 'page_title' => 'Configuración de autenticación',
+ 'tabs' => [
+ 'profile' => 'Perfil',
+ 'login' => 'Contraseña y acceso',
+ 'sessions' => 'Sesiones',
+ ],
'sessions' => [
'title' => 'Sesiones activas',
'description' => 'Si notas algo sospechoso, cierra sesión en otros dispositivos.',
'unknown_browser' => 'Navegador desconocido',
- 'unknown_ip' => 'IP desconocida',
'on' => 'en',
'active_now' => 'Activa ahora',
+ 'last_activity' => 'Última actividad :time',
'log_out_others' => 'Cerrar otras sesiones',
'modal_title' => 'Cerrar otras sesiones',
- 'modal_description_password' => 'Introduce tu contraseña actual para confirmar el cierre de las demás sesiones.',
- 'modal_description_email' => 'Escribe tu correo electrónico para confirmar el cierre de las demás sesiones.',
- 'password_placeholder' => 'Contraseña actual',
- 'email_placeholder' => 'Tu correo',
+ 'modal_description' => 'Se cerrará la sesión en todos los demás dispositivos con acceso a tu cuenta. Esta sesión sigue activa.',
'cancel' => 'Cancelar',
'submit' => 'Cerrar otras sesiones',
- 'email_mismatch' => 'El correo electrónico no coincide con tu cuenta.',
'flash_logged_out' => 'Has cerrado sesión en los demás dispositivos.',
],
'password' => [
diff --git a/lang/es/welcome.php b/lang/es/welcome.php
index 96fdd3ef5..4193c2416 100644
--- a/lang/es/welcome.php
+++ b/lang/es/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Conectar tu IA',
'pick_ai' => '¿Dónde quieres usar TryPost?',
'connect_other' => 'Conectar otra app',
- 'composer' => 'Pregunta lo que quieras',
'connected' => ':client está conectado',
'benefits' => [
'schedule' => [
diff --git a/lang/fr/accounts.php b/lang/fr/accounts.php
index dd7d493d7..c30d8de6a 100644
--- a/lang/fr/accounts.php
+++ b/lang/fr/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Les fonctionnalités dépendent du type de compte Instagram que vous avez et de la connexion choisie.',
'professional_title' => 'Professionnel',
'professional_types' => '(Entreprise et Créateur)',
+ 'facebook_types' => '(lié à une page Facebook)',
'badge' => 'Publication automatique',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Statistiques des publications envoyées',
'description' => 'Consultez les performances des publications passées',
],
+ 'music' => [
+ 'title' => 'Musique sur les reels',
+ 'description' => 'Ajoutez un morceau de la bibliothèque d\'Instagram',
+ ],
],
'connect' => 'Se connecter à Instagram',
'convert_hint' => 'Instagram vous proposera de passer facilement à un compte professionnel si nécessaire.',
- 'facebook_link' => 'Connectez Instagram via Facebook',
- 'facebook_suffix' => 'si votre compte Instagram est actuellement lié à Facebook.',
'help' => [
'account_type' => 'Connaître le type de votre compte Instagram',
'convert' => 'Convertir votre compte Instagram en compte professionnel',
diff --git a/lang/fr/channels.php b/lang/fr/channels.php
index 17730a401..017e4563b 100644
--- a/lang/fr/channels.php
+++ b/lang/fr/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Reconnectez ce canal pour continuer à publier.',
'reconnect' => 'Reconnecter',
'refresh_connection' => 'Actualiser la connexion',
+ 'link_facebook_page' => 'Associer à une Page Facebook',
'view_profile' => 'Voir le profil',
'disconnect' => 'Déconnecter',
'actions' => 'Actions du canal',
'reorder' => [
'handle' => 'Glisser pour réorganiser :name',
- 'move_up' => 'Monter',
- 'move_down' => 'Descendre',
'failed' => 'Impossible de réorganiser vos canaux. Réessayez.',
'stale' => 'Vos canaux ont changé depuis le chargement de la page. Actualisez et réessayez.',
],
diff --git a/lang/fr/common.php b/lang/fr/common.php
index 27d8c1acc..6e6149eb1 100644
--- a/lang/fr/common.php
+++ b/lang/fr/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Retour',
+ 'unsaved_changes' => [
+
+ 'title' => 'Abandonner les modifications ?',
+
+ 'description' => 'Les modifications de cette publication n\'ont pas été enregistrées. Si vous quittez maintenant, elles seront perdues.',
+
+ 'discard' => 'Abandonner',
+
+ ],
+
'confirm_modal' => [
'type' => 'Saisissez',
'to_confirm' => 'pour confirmer.',
diff --git a/lang/fr/notes.php b/lang/fr/notes.php
index ca1b4cbc1..aecb6f19a 100644
--- a/lang/fr/notes.php
+++ b/lang/fr/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'Écrire une note...',
'title' => 'Notes',
+ 'show' => 'Afficher les notes',
+ 'hide' => 'Masquer les notes',
'edit' => 'Modifier',
'delete' => 'Supprimer',
'edited' => 'modifié',
'save' => 'Enregistrer',
'cancel' => 'Annuler',
'send' => 'Envoyer',
- 'empty_title' => 'Aucune note pour le moment',
- 'empty_description' => 'Lancez la conversation.',
+ 'empty' => 'Aucune note pour le moment. Seule votre équipe les voit.',
'actions' => 'Actions de la note',
'load_more' => 'Charger les notes plus anciennes',
];
diff --git a/lang/fr/posts.php b/lang/fr/posts.php
index 721c6040c..882a779ea 100644
--- a/lang/fr/posts.php
+++ b/lang/fr/posts.php
@@ -193,8 +193,8 @@ return [
'title' => 'Modifier le média',
'description' => 'Recadrez, ajustez, décrivez et identifiez les images de cette publication.',
'edit_tab' => 'Modifier',
- 'alt_tab' => 'Texte alternatif',
- 'tags_tab' => 'Identifier des personnes',
+ 'alt_tab' => 'Texte alt',
+ 'tags_tab' => 'Identifier',
'crop_tab' => 'Recadrer',
'appearance_tab' => 'Apparence',
'crop_heading' => 'Recadrer et transformer',
@@ -240,6 +240,9 @@ return [
'tags_save' => 'Enregistrer',
'tags_cancel' => 'Annuler',
'tags_remove' => 'Retirer @:username',
+ 'tags_move' => 'Déplacer',
+ 'tags_move_pill' => 'Choisissez la position',
+ 'tags_move_hint' => 'Cliquez sur l\'image pour placer @:username.',
'tags_invalid' => 'Saisissez un nom d\'utilisateur Instagram valide.',
'thumbnail_tab' => 'Miniature',
'thumbnail_heading' => 'Choisissez une miniature',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Partager sur le fil',
+ 'music' => [
+ 'label' => 'Musique',
+ 'add' => 'Ajouter',
+ 'search_placeholder' => 'Rechercher',
+ 'empty' => 'Aucun morceau trouvé',
+ 'play' => 'Écouter',
+ 'pause' => 'Pause',
+ 'remove' => 'Retirer la musique',
+ 'part_hint' => 'Instagram ne permet pas à TryPost de choisir quel passage du morceau est joué.',
+ 'volume' => 'Volume',
+ 'video_volume' => 'Vidéo',
+ 'audio_volume' => 'Musique',
+ 'limited' => 'Les résultats sont limités et peuvent différer d\'Instagram.',
+ 'search_failed' => 'Impossible de charger la musique d\'Instagram. Réessayez.',
+ 'too_many_searches' => 'Trop de recherches de musique. Patientez une minute et réessayez.',
+ 'requires_facebook' => 'La musique nécessite un compte Instagram connecté via Facebook.',
+ 'link_title' => 'Connectez via Facebook pour publier des reels avec musique',
+ 'link_body' => 'Pour publier des reels avec musique, liez Instagram à votre Page Facebook. Nous enregistrerons d\'abord votre publication en brouillon. Rouvrez-la ensuite depuis Brouillons pour ajouter la musique.',
+ 'maybe_later' => 'Plus tard',
+ 'save_and_link' => 'Lier',
+ 'save_and_link_blocked' => 'Ce post ne peut pas encore être enregistré. Attendez la fin des envois et corrigez ce qui est signalé, puis réessayez.',
+ 'save_and_link_pending' => 'Ce post attend une approbation. Approuvez-le ou déplacez-le dans les brouillons avant de lier Facebook.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Collaborateurs',
+ 'placeholder' => 'Nom d\'utilisateur Instagram',
+ 'add' => 'Ajouter',
+ 'remove' => 'Retirer :username',
+ 'max' => 'Ajoutez jusqu\'à :max collaborateurs.',
+ 'invalid' => 'Saisissez un nom d\'utilisateur Instagram valide.',
+ 'no_trial' => 'Indisponible sur un reel test',
+ 'notice' => 'Instagram ne nous confirme pas le nom d\'utilisateur. Ouvrez le profil pour vérifier que c\'est le bon compte.',
+ 'got_it' => 'Compris',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Reel test',
+ 'off' => 'Non',
+ 'auto' => 'Auto',
+ 'manual' => 'Manuel',
+ 'badge' => 'Test',
+ 'auto_hint' => 'Votre reel test est d\'abord montré aux personnes qui ne vous suivent pas. S\'il fonctionne bien, Instagram le partage automatiquement avec vos abonnés après 72 heures. Sinon, il n\'est partagé que si vous le partagez vous-même.',
+ 'manual_hint' => 'Les non-abonnés le voient d\'abord. Vous le partagez avec vos abonnés quand vous le souhaitez.',
+ 'no_collaborators' => 'Indisponible avec collaborateurs',
+ 'check_title' => 'Les reels test sont-ils proposés quand vous créez un reel dans l\'app Instagram ?',
+ 'check_body' => 'Cela ne fonctionne que si votre compte a accès aux reels test. Vérifiez dans l\'app Instagram.',
+ 'checked' => 'Oui, c\'est vérifié',
+ 'not_checked' => 'Non',
+ ],
],
'threads' => [
'topic' => 'Sujet',
@@ -941,10 +992,19 @@ return [
'move_up' => 'Monter',
'move_down' => 'Descendre',
'duplicate' => 'Dupliquer la publication',
+ 'share_link' => 'Partager dans une publication',
+ 'copy_link' => 'Copier le lien',
'move_to_drafts' => 'Déplacer vers les brouillons',
'delete' => 'Supprimer la publication',
'add_to_queue' => 'Ajouter à la file d\'attente',
- 'add_to_queue_disabled' => 'Ajoutez des horaires de publication à ce canal pour utiliser la file d\'attente.',
+ 'add_to_queue_hint' => 'Ajoute au prochain créneau libre de la chaîne.',
+ 'queue_setup' => [
+ 'title' => 'Vous n\'avez pas encore configuré la file de cette chaîne',
+ 'body' => 'Pour ajouter des posts à la file, définissez les horaires de publication de la chaîne. Chaque post de la file part au prochain créneau libre.',
+ 'body_member' => 'Pour ajouter des posts à la file, un admin du workspace doit définir les horaires de publication de cette chaîne.',
+ 'not_now' => 'Plus tard',
+ 'action' => 'Définir les horaires',
+ ],
'more' => 'Plus d\'actions',
'open_on_network' => 'Ouvrir le post sur :network',
'see_insights' => 'Voir les statistiques du post',
diff --git a/lang/fr/settings.php b/lang/fr/settings.php
index b5594b5f6..fa064352c 100644
--- a/lang/fr/settings.php
+++ b/lang/fr/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Profil',
- 'authentication' => 'Authentification',
'notifications' => 'Notifications',
'preferences' => 'Préférences',
'general' => 'Général',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Cliquez ici pour renvoyer l\'e-mail de vérification.',
'verification_sent' => 'Un nouveau lien de vérification a été envoyé à votre adresse e-mail.',
'save' => 'Enregistrer',
- ],
-
- 'authentication' => [
- 'title' => 'Authentification',
- 'page_title' => 'Paramètres d\'authentification',
+ 'tabs' => [
+ 'profile' => 'Profil',
+ 'login' => 'Connexion',
+ 'sessions' => 'Sessions',
+ ],
'sessions' => [
'title' => 'Sessions actives',
'description' => 'Si vous remarquez quelque chose de suspect, déconnectez les autres appareils.',
'unknown_browser' => 'Navigateur inconnu',
- 'unknown_ip' => 'IP inconnue',
'on' => 'le',
'active_now' => 'Actif maintenant',
+ 'last_activity' => 'Dernière activité :time',
'log_out_others' => 'Déconnecter les autres appareils',
'modal_title' => 'Déconnecter les autres appareils',
- 'modal_description_password' => 'Saisissez votre mot de passe actuel pour confirmer que vous souhaitez déconnecter les autres sessions de navigateur.',
- 'modal_description_email' => 'Saisissez votre adresse e-mail pour confirmer que vous souhaitez déconnecter les autres sessions de navigateur.',
- 'password_placeholder' => 'Mot de passe actuel',
- 'email_placeholder' => 'L\'e-mail de votre compte',
+ 'modal_description' => 'Tous les autres appareils connectés à votre compte seront déconnectés. Cette session reste active.',
'cancel' => 'Annuler',
'submit' => 'Déconnecter les autres appareils',
- 'email_mismatch' => 'L\'adresse e-mail ne correspond pas à votre compte.',
'flash_logged_out' => 'Vous avez été déconnecté des autres appareils.',
],
'password' => [
diff --git a/lang/fr/welcome.php b/lang/fr/welcome.php
index 317453456..9accff043 100644
--- a/lang/fr/welcome.php
+++ b/lang/fr/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Connecter votre IA',
'pick_ai' => 'Où voulez-vous utiliser TryPost ?',
'connect_other' => 'Connecter une autre app',
- 'composer' => 'Posez votre question',
'connected' => ':client est connecté',
'benefits' => [
'schedule' => [
diff --git a/lang/it/accounts.php b/lang/it/accounts.php
index 829199875..fe1d15dc5 100644
--- a/lang/it/accounts.php
+++ b/lang/it/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Le funzionalità dipendono dal tipo di account Instagram che hai e dal collegamento che scegli.',
'professional_title' => 'Professionale',
'professional_types' => '(Azienda e Creator)',
+ 'facebook_types' => '(collegato a una Pagina Facebook)',
'badge' => 'Pubblicazione automatica',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Metriche dei post inviati',
'description' => 'Visualizza il rendimento dei post passati',
],
+ 'music' => [
+ 'title' => 'Musica nei reel',
+ 'description' => 'Aggiungi un brano dalla libreria di Instagram',
+ ],
],
'connect' => 'Collega a Instagram',
'convert_hint' => 'Se necessario, Instagram ti chiederà di passare facilmente a un account professionale.',
- 'facebook_link' => 'Collega Instagram tramite Facebook',
- 'facebook_suffix' => 'se il tuo account Instagram è attualmente collegato a Facebook.',
'help' => [
'account_type' => 'Scoprire il tipo del tuo account Instagram',
'convert' => 'Convertire il tuo account Instagram in un account professionale',
diff --git a/lang/it/channels.php b/lang/it/channels.php
index ffd9b6c35..9cdd4b65a 100644
--- a/lang/it/channels.php
+++ b/lang/it/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Ricollega questo canale per continuare a pubblicare.',
'reconnect' => 'Ricollega',
'refresh_connection' => 'Aggiorna connessione',
+ 'link_facebook_page' => 'Collega a una Pagina Facebook',
'view_profile' => 'Visualizza profilo',
'disconnect' => 'Scollega',
'actions' => 'Azioni del canale',
'reorder' => [
'handle' => 'Trascina per riordinare :name',
- 'move_up' => 'Sposta su',
- 'move_down' => 'Sposta giù',
'failed' => 'Impossibile riordinare i tuoi canali. Riprova.',
'stale' => 'I tuoi canali sono cambiati da quando hai caricato la pagina. Aggiorna e riprova.',
],
diff --git a/lang/it/common.php b/lang/it/common.php
index 5c8b29535..d2d112897 100644
--- a/lang/it/common.php
+++ b/lang/it/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Indietro',
+ 'unsaved_changes' => [
+
+ 'title' => 'Annullare le modifiche?',
+
+ 'description' => 'Le modifiche a questo post non sono state salvate. Se esci ora, andranno perse.',
+
+ 'discard' => 'Annulla modifiche',
+
+ ],
+
'confirm_modal' => [
'type' => 'Digita',
'to_confirm' => 'per confermare.',
diff --git a/lang/it/notes.php b/lang/it/notes.php
index c8ca04017..8b54e25ea 100644
--- a/lang/it/notes.php
+++ b/lang/it/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'Scrivi una nota...',
'title' => 'Note',
+ 'show' => 'Mostra note',
+ 'hide' => 'Nascondi note',
'edit' => 'Modifica',
'delete' => 'Elimina',
'edited' => 'modificato',
'save' => 'Salva',
'cancel' => 'Annulla',
'send' => 'Invia',
- 'empty_title' => 'Ancora nessuna nota',
- 'empty_description' => 'Inizia la conversazione.',
+ 'empty' => 'Ancora nessuna nota. Le vede solo il tuo team.',
'actions' => 'Azioni della nota',
'load_more' => 'Carica note meno recenti',
];
diff --git a/lang/it/posts.php b/lang/it/posts.php
index 4a48423f9..da1128772 100644
--- a/lang/it/posts.php
+++ b/lang/it/posts.php
@@ -193,8 +193,8 @@ return [
'title' => 'Modifica media',
'description' => 'Ritaglia, regola, descrivi e tagga le immagini di questo post.',
'edit_tab' => 'Modifica',
- 'alt_tab' => 'Testo alternativo',
- 'tags_tab' => 'Tagga persone',
+ 'alt_tab' => 'Testo alt',
+ 'tags_tab' => 'Tagga',
'crop_tab' => 'Ritaglia',
'appearance_tab' => 'Aspetto',
'crop_heading' => 'Ritaglia e trasforma',
@@ -240,6 +240,9 @@ return [
'tags_save' => 'Salva tag',
'tags_cancel' => 'Annulla',
'tags_remove' => 'Rimuovi @:username',
+ 'tags_move' => 'Sposta',
+ 'tags_move_pill' => 'Scegli la nuova posizione',
+ 'tags_move_hint' => 'Fai clic sull\'immagine per posizionare @:username.',
'tags_invalid' => 'Inserisci un nome utente Instagram valido.',
'thumbnail_tab' => 'Miniatura',
'thumbnail_heading' => 'Scegli una miniatura',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Condividi nel feed',
+ 'music' => [
+ 'label' => 'Musica',
+ 'add' => 'Aggiungi musica',
+ 'search_placeholder' => 'Cerca musica',
+ 'empty' => 'Nessun brano trovato',
+ 'play' => 'Ascolta',
+ 'pause' => 'Pausa',
+ 'remove' => 'Rimuovi musica',
+ 'part_hint' => 'Instagram non permette a TryPost di scegliere quale parte del brano viene riprodotta.',
+ 'volume' => 'Volume',
+ 'video_volume' => 'Video',
+ 'audio_volume' => 'Musica',
+ 'limited' => 'I risultati sono limitati e possono differire da Instagram.',
+ 'search_failed' => 'Impossibile caricare la musica di Instagram. Riprova.',
+ 'too_many_searches' => 'Troppe ricerche di musica. Attendi un minuto e riprova.',
+ 'requires_facebook' => 'La musica richiede un account Instagram collegato tramite Facebook.',
+ 'link_title' => 'Collega tramite Facebook per pubblicare reel con musica',
+ 'link_body' => 'Per pubblicare reel con musica, collega Instagram alla tua Pagina Facebook. Salveremo prima il post come bozza. Poi riaprilo da Bozze per aggiungere la musica.',
+ 'maybe_later' => 'Più tardi',
+ 'save_and_link' => 'Salva e collega',
+ 'save_and_link_blocked' => 'Questo post non può ancora essere salvato. Attendi la fine dei caricamenti e correggi ciò che è evidenziato, poi riprova.',
+ 'save_and_link_pending' => 'Questo post è in attesa di approvazione. Approvalo o spostalo nelle bozze prima di collegare Facebook.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Collaboratori',
+ 'placeholder' => 'Nome utente Instagram',
+ 'add' => 'Aggiungi',
+ 'remove' => 'Rimuovi :username',
+ 'max' => 'Aggiungi fino a :max collaboratori.',
+ 'invalid' => 'Inserisci un nome utente Instagram valido.',
+ 'no_trial' => 'Non disponibile in un reel di prova',
+ 'notice' => 'Instagram non ci conferma il nome utente. Apri il profilo per verificare che sia l\'account giusto.',
+ 'got_it' => 'Ho capito',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Reel di prova',
+ 'off' => 'No',
+ 'auto' => 'Auto',
+ 'manual' => 'Manuale',
+ 'badge' => 'Prova',
+ 'auto_hint' => 'Il tuo reel di prova viene mostrato prima a chi non ti segue. Se va bene, Instagram lo condivide automaticamente con i tuoi follower dopo 72 ore. Altrimenti non viene condiviso, a meno che non lo condivida tu.',
+ 'manual_hint' => 'Chi non ti segue lo vede per primo. Lo condividi con i tuoi follower quando vuoi.',
+ 'no_collaborators' => 'Non disponibile con collaboratori',
+ 'check_title' => 'I reel di prova sono disponibili quando crei un reel nell\'app Instagram?',
+ 'check_body' => 'Funziona solo se il tuo account ha i reel di prova. Controlla nell\'app Instagram.',
+ 'checked' => 'Sì, ho controllato',
+ 'not_checked' => 'No',
+ ],
],
'threads' => [
'topic' => 'Argomento',
@@ -941,10 +992,19 @@ return [
'move_up' => 'Sposta su',
'move_down' => 'Sposta giù',
'duplicate' => 'Duplica post',
+ 'share_link' => 'Condividi in un post',
+ 'copy_link' => 'Copia link',
'move_to_drafts' => 'Sposta nelle bozze',
'delete' => 'Elimina post',
'add_to_queue' => 'Aggiungi alla coda',
- 'add_to_queue_disabled' => 'Aggiungi orari di pubblicazione a questo canale per usare la coda.',
+ 'add_to_queue_hint' => 'Aggiunge al prossimo orario libero del canale.',
+ 'queue_setup' => [
+ 'title' => 'Non hai ancora configurato la coda di questo canale',
+ 'body' => 'Per aggiungere post alla coda, imposta gli orari di pubblicazione del canale. Ogni post in coda esce al prossimo orario libero.',
+ 'body_member' => 'Per aggiungere post alla coda, un admin del workspace deve impostare gli orari di pubblicazione di questo canale.',
+ 'not_now' => 'Non ora',
+ 'action' => 'Imposta orari',
+ ],
'more' => 'Altre azioni',
'open_on_network' => 'Apri il post su :network',
'see_insights' => 'Vedi gli insight del post',
diff --git a/lang/it/settings.php b/lang/it/settings.php
index 8943c497e..34b9936da 100644
--- a/lang/it/settings.php
+++ b/lang/it/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Profilo',
- 'authentication' => 'Autenticazione',
'notifications' => 'Notifiche',
'preferences' => 'Preferenze',
'general' => 'Generale',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Clicca qui per inviare di nuovo l\'email di verifica.',
'verification_sent' => 'Un nuovo link di verifica è stato inviato al tuo indirizzo email.',
'save' => 'Salva',
- ],
-
- 'authentication' => [
- 'title' => 'Autenticazione',
- 'page_title' => 'Impostazioni di autenticazione',
+ 'tabs' => [
+ 'profile' => 'Profilo',
+ 'login' => 'Password e accesso',
+ 'sessions' => 'Sessioni',
+ ],
'sessions' => [
'title' => 'Sessioni attive',
'description' => 'Se noti qualcosa di sospetto, disconnetti gli altri dispositivi.',
'unknown_browser' => 'Browser sconosciuto',
- 'unknown_ip' => 'IP sconosciuto',
'on' => 'su',
'active_now' => 'Attivo ora',
+ 'last_activity' => 'Ultima attività :time',
'log_out_others' => 'Disconnetti gli altri dispositivi',
'modal_title' => 'Disconnetti gli altri dispositivi',
- 'modal_description_password' => 'Inserisci la tua password attuale per confermare che vuoi disconnettere le altre sessioni del browser.',
- 'modal_description_email' => 'Digita il tuo indirizzo email per confermare che vuoi disconnettere le altre sessioni del browser.',
- 'password_placeholder' => 'Password attuale',
- 'email_placeholder' => 'L\'email del tuo account',
+ 'modal_description' => 'Tutti gli altri dispositivi collegati al tuo account verranno disconnessi. Questa sessione resta attiva.',
'cancel' => 'Annulla',
'submit' => 'Disconnetti gli altri dispositivi',
- 'email_mismatch' => 'L\'indirizzo email non corrisponde al tuo account.',
'flash_logged_out' => 'Sei stato disconnesso dagli altri dispositivi.',
],
'password' => [
diff --git a/lang/it/welcome.php b/lang/it/welcome.php
index 2ffd765a1..47dd97ca8 100644
--- a/lang/it/welcome.php
+++ b/lang/it/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Collega la tua IA',
'pick_ai' => 'Dove vuoi usare TryPost?',
'connect_other' => 'Collega un\'altra app',
- 'composer' => 'Chiedi qualsiasi cosa',
'connected' => ':client è collegato',
'benefits' => [
'schedule' => [
diff --git a/lang/ja/accounts.php b/lang/ja/accounts.php
index 2c9abb051..e3acbcfba 100644
--- a/lang/ja/accounts.php
+++ b/lang/ja/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => '利用できる機能は、Instagram アカウントの種類と選択した接続方法によって異なります。',
'professional_title' => 'プロアカウント',
'professional_types' => '(ビジネス・クリエイター)',
+ 'facebook_types' => '(Facebook ページにリンク)',
'badge' => '自動投稿',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => '投稿済みのメトリクス',
'description' => '過去の投稿のパフォーマンスを確認',
],
+ 'music' => [
+ 'title' => 'リールに音楽',
+ 'description' => 'Instagram のライブラリから曲を追加',
+ ],
],
'connect' => 'Instagram に接続',
'convert_hint' => '必要に応じて、Instagram からプロアカウントへの簡単な切り替えを案内されます。',
- 'facebook_link' => 'Facebook 経由で Instagram を接続',
- 'facebook_suffix' => '(Instagram アカウントが Facebook にリンクされている場合)',
'help' => [
'account_type' => 'Instagram アカウントの種類を確認する',
'convert' => 'Instagram アカウントをプロアカウントに切り替える',
diff --git a/lang/ja/channels.php b/lang/ja/channels.php
index 2bd6c1d80..e0d6198c3 100644
--- a/lang/ja/channels.php
+++ b/lang/ja/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => '投稿を続けるには、このチャンネルを再接続してください。',
'reconnect' => '再接続',
'refresh_connection' => '接続を更新',
+ 'link_facebook_page' => 'Facebookページにリンク',
'view_profile' => 'プロフィールを表示',
'disconnect' => '接続解除',
'actions' => 'チャンネルの操作',
'reorder' => [
'handle' => 'ドラッグして:nameを並べ替え',
- 'move_up' => '上へ移動',
- 'move_down' => '下へ移動',
'failed' => 'チャンネルを並べ替えられませんでした。もう一度お試しください。',
'stale' => 'ページを読み込んだ後にチャンネルが変更されました。更新してもう一度お試しください。',
],
diff --git a/lang/ja/common.php b/lang/ja/common.php
index bc8586d71..be9e9501f 100644
--- a/lang/ja/common.php
+++ b/lang/ja/common.php
@@ -7,6 +7,16 @@ return [
'back' => '戻る',
+ 'unsaved_changes' => [
+
+ 'title' => '変更を破棄しますか?',
+
+ 'description' => 'この投稿の変更は保存されていません。今移動すると変更は失われます。',
+
+ 'discard' => '破棄',
+
+ ],
+
'confirm_modal' => [
'type' => '入力',
'to_confirm' => 'で確認してください。',
diff --git a/lang/ja/notes.php b/lang/ja/notes.php
index d1f8f4352..b0b6ec36b 100644
--- a/lang/ja/notes.php
+++ b/lang/ja/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'メモを書く...',
'title' => 'メモ',
+ 'show' => 'メモを表示',
+ 'hide' => 'メモを非表示',
'edit' => '編集',
'delete' => '削除',
'edited' => '編集済み',
'save' => '保存',
'cancel' => 'キャンセル',
'send' => '送信',
- 'empty_title' => 'まだメモがありません',
- 'empty_description' => '会話を始めましょう。',
+ 'empty' => 'まだメモがありません。チームメンバーだけが見られます。',
'actions' => 'メモの操作',
'load_more' => '過去のメモを読み込む',
];
diff --git a/lang/ja/posts.php b/lang/ja/posts.php
index 5b76c7947..5ee94ab71 100644
--- a/lang/ja/posts.php
+++ b/lang/ja/posts.php
@@ -240,6 +240,9 @@ return [
'tags_save' => 'タグを保存',
'tags_cancel' => 'キャンセル',
'tags_remove' => '@:usernameを削除',
+ 'tags_move' => '移動',
+ 'tags_move_pill' => '新しい位置を選択',
+ 'tags_move_hint' => '画像をクリックして @:username を配置します。',
'tags_invalid' => '有効なInstagramのユーザーネームを入力してください。',
'thumbnail_tab' => 'サムネイル',
'thumbnail_heading' => 'サムネイルを選択',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'フィードにも共有',
+ 'music' => [
+ 'label' => '音楽',
+ 'add' => '音楽を追加',
+ 'search_placeholder' => '音楽を検索',
+ 'empty' => '曲が見つかりません',
+ 'play' => '試聴',
+ 'pause' => '一時停止',
+ 'remove' => '音楽を削除',
+ 'part_hint' => 'Instagramでは、曲のどの部分を再生するかをTryPostで選べません。',
+ 'volume' => '音量',
+ 'video_volume' => '動画',
+ 'audio_volume' => '音楽',
+ 'limited' => '結果は限られており、Instagramと異なる場合があります。',
+ 'search_failed' => 'Instagramの音楽を読み込めませんでした。もう一度お試しください。',
+ 'too_many_searches' => '音楽の検索が多すぎます。1分待ってからもう一度お試しください。',
+ 'requires_facebook' => '音楽にはFacebook経由で接続したInstagramアカウントが必要です。',
+ 'link_title' => '音楽付きリールを投稿するにはFacebook経由で接続',
+ 'link_body' => '音楽付きのリールを投稿するには、InstagramをFacebookページにリンクしてください。リンクの前に投稿を下書きとして保存します。その後、下書きから開いて音楽を追加してください。',
+ 'maybe_later' => 'あとで',
+ 'save_and_link' => '保存してリンク',
+ 'save_and_link_blocked' => 'この投稿はまだ保存できません。アップロードの完了を待ち、強調表示された箇所を修正してから、もう一度お試しください。',
+ 'save_and_link_pending' => 'この投稿は承認待ちです。Facebookを連携する前に、承認するか下書きに移動してください。',
+ ],
+ 'collaborators' => [
+ 'label' => 'コラボレーター',
+ 'placeholder' => 'Instagramのユーザーネーム',
+ 'add' => '追加',
+ 'remove' => ':usernameを削除',
+ 'max' => 'コラボレーターは最大:max人までです。',
+ 'invalid' => '有効なInstagramのユーザーネームを入力してください。',
+ 'no_trial' => 'トライアルリールでは利用できません',
+ 'notice' => 'Instagramはユーザーネームを確認してくれません。プロフィールを開いて正しいアカウントか確認してください。',
+ 'got_it' => 'OK',
+ ],
+ 'trial_reel' => [
+ 'label' => 'トライアルリール',
+ 'off' => 'オフ',
+ 'auto' => '自動',
+ 'manual' => '手動',
+ 'badge' => 'トライアル',
+ 'auto_hint' => 'トライアルリールはまずフォロワー以外に表示されます。反応が良ければ、72時間後にInstagramが自動的にフォロワーにシェアします。そうでなければ、自分でシェアしない限りシェアされません。',
+ 'manual_hint' => 'まずフォロワー以外に表示されます。準備ができたらフォロワーにシェアしてください。',
+ 'no_collaborators' => 'コラボレーターとは併用できません',
+ 'check_title' => 'Instagramアプリでリールを作成するときにトライアルリールを使えますか?',
+ 'check_body' => 'アカウントでトライアルリールが利用できる場合のみ機能します。Instagramアプリで確認してください。',
+ 'checked' => 'はい、確認しました',
+ 'not_checked' => 'いいえ',
+ ],
],
'threads' => [
'topic' => 'トピック',
@@ -941,10 +992,19 @@ return [
'move_up' => '上に移動',
'move_down' => '下に移動',
'duplicate' => '投稿を複製',
+ 'share_link' => '投稿でリンクを共有',
+ 'copy_link' => 'リンクをコピー',
'move_to_drafts' => '下書きに移動',
'delete' => '投稿を削除',
'add_to_queue' => 'キューに追加',
- 'add_to_queue_disabled' => 'キューを使用するには、このチャンネルに投稿時間を追加してください。',
+ 'add_to_queue_hint' => 'チャンネルの次の空き投稿時間に追加します。',
+ 'queue_setup' => [
+ 'title' => 'このチャンネルのキューはまだ設定されていません',
+ 'body' => 'キューに投稿を追加するには、チャンネルの投稿時間を設定してください。キューの投稿は次の空き時間に公開されます。',
+ 'body_member' => 'キューに投稿を追加するには、ワークスペースの管理者がこのチャンネルの投稿時間を設定する必要があります。',
+ 'not_now' => '今はしない',
+ 'action' => '投稿時間を設定',
+ ],
'more' => 'その他の操作',
'open_on_network' => ':networkで投稿を開く',
'see_insights' => '投稿のインサイトを見る',
diff --git a/lang/ja/settings.php b/lang/ja/settings.php
index fc0c97065..e10fa6958 100644
--- a/lang/ja/settings.php
+++ b/lang/ja/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'プロフィール',
- 'authentication' => '認証',
'notifications' => '通知',
'preferences' => '環境設定',
'general' => '一般',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'こちらをクリックして確認メールを再送信してください。',
'verification_sent' => '新しい確認リンクをメールアドレスに送信しました。',
'save' => '保存',
- ],
-
- 'authentication' => [
- 'title' => '認証',
- 'page_title' => '認証設定',
+ 'tabs' => [
+ 'profile' => 'プロフィール',
+ 'login' => 'パスワードとログイン',
+ 'sessions' => 'セッション',
+ ],
'sessions' => [
'title' => 'アクティブなセッション',
'description' => '不審な点に気づいた場合は、他のデバイスからログアウトしてください。',
'unknown_browser' => '不明なブラウザ',
- 'unknown_ip' => '不明な IP',
'on' => '·',
'active_now' => '現在アクティブ',
+ 'last_activity' => '最終アクティビティ::time',
'log_out_others' => '他のデバイスからログアウト',
'modal_title' => '他のデバイスからログアウト',
- 'modal_description_password' => '他のブラウザセッションからログアウトすることを確認するため、現在のパスワードを入力してください。',
- 'modal_description_email' => '他のブラウザセッションからログアウトすることを確認するため、メールアドレスを入力してください。',
- 'password_placeholder' => '現在のパスワード',
- 'email_placeholder' => 'アカウントのメールアドレス',
+ 'modal_description' => 'アカウントにログインしている他のすべてのデバイスからログアウトします。このセッションはそのまま使えます。',
'cancel' => 'キャンセル',
'submit' => '他のデバイスからログアウト',
- 'email_mismatch' => 'メールアドレスがアカウントと一致しません。',
'flash_logged_out' => '他のデバイスからログアウトしました。',
],
'password' => [
diff --git a/lang/ja/welcome.php b/lang/ja/welcome.php
index 58c151704..c6973a89a 100644
--- a/lang/ja/welcome.php
+++ b/lang/ja/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'AIを接続',
'pick_ai' => 'どこでTryPostを使いますか?',
'connect_other' => '他のアプリを接続',
- 'composer' => '何でも聞いてください',
'connected' => ':clientに接続しました',
'benefits' => [
'schedule' => [
diff --git a/lang/ko/accounts.php b/lang/ko/accounts.php
index 609f9d0d6..dea35fa7b 100644
--- a/lang/ko/accounts.php
+++ b/lang/ko/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => '사용 가능한 기능은 Instagram 계정 유형과 선택한 연결 방식에 따라 다릅니다.',
'professional_title' => '프로페셔널',
'professional_types' => '(비즈니스 및 크리에이터)',
+ 'facebook_types' => '(Facebook 페이지에 연결됨)',
'badge' => '자동 게시',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => '게시된 게시물 지표',
'description' => '지난 게시물의 성과 확인',
],
+ 'music' => [
+ 'title' => '릴스에 음악 추가',
+ 'description' => 'Instagram 라이브러리에서 음악을 추가하세요',
+ ],
],
'connect' => 'Instagram에 연결',
'convert_hint' => '필요한 경우 Instagram에서 프로페셔널 계정으로 쉽게 전환하도록 안내합니다.',
- 'facebook_link' => 'Facebook을 통해 Instagram 연결',
- 'facebook_suffix' => '(Instagram 계정이 현재 Facebook에 연결되어 있는 경우)',
'help' => [
'account_type' => 'Instagram 계정 유형 확인하기',
'convert' => 'Instagram 계정을 프로페셔널 계정으로 전환하기',
diff --git a/lang/ko/channels.php b/lang/ko/channels.php
index 40fc52a84..b69ac8738 100644
--- a/lang/ko/channels.php
+++ b/lang/ko/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => '계속 게시하려면 이 채널을 다시 연결하세요.',
'reconnect' => '재연결',
'refresh_connection' => '연결 새로고침',
+ 'link_facebook_page' => 'Facebook 페이지에 연결',
'view_profile' => '프로필 보기',
'disconnect' => '연결 해제',
'actions' => '채널 작업',
'reorder' => [
'handle' => '드래그하여 :name 순서 변경',
- 'move_up' => '위로 이동',
- 'move_down' => '아래로 이동',
'failed' => '채널 순서를 변경하지 못했습니다. 다시 시도하세요.',
'stale' => '페이지를 불러온 후 채널이 변경되었습니다. 새로고침한 후 다시 시도하세요.',
],
diff --git a/lang/ko/common.php b/lang/ko/common.php
index fb45e5ec2..d8c621f20 100644
--- a/lang/ko/common.php
+++ b/lang/ko/common.php
@@ -7,6 +7,16 @@ return [
'back' => '뒤로',
+ 'unsaved_changes' => [
+
+ 'title' => '변경 사항을 삭제할까요?',
+
+ 'description' => '이 게시물의 변경 사항이 저장되지 않았습니다. 지금 나가면 사라집니다.',
+
+ 'discard' => '삭제',
+
+ ],
+
'confirm_modal' => [
'type' => '입력',
'to_confirm' => '하여 확인하세요.',
diff --git a/lang/ko/notes.php b/lang/ko/notes.php
index 04186bc5a..4895af59f 100644
--- a/lang/ko/notes.php
+++ b/lang/ko/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => '메모를 작성하세요...',
'title' => '메모',
+ 'show' => '메모 보기',
+ 'hide' => '메모 숨기기',
'edit' => '편집',
'delete' => '삭제',
'edited' => '수정됨',
'save' => '저장',
'cancel' => '취소',
'send' => '보내기',
- 'empty_title' => '아직 메모가 없습니다',
- 'empty_description' => '대화를 시작하세요.',
+ 'empty' => '아직 메모가 없습니다. 팀원만 볼 수 있습니다.',
'actions' => '메모 작업',
'load_more' => '이전 메모 불러오기',
];
diff --git a/lang/ko/posts.php b/lang/ko/posts.php
index bc3b61238..3c70e1d2c 100644
--- a/lang/ko/posts.php
+++ b/lang/ko/posts.php
@@ -240,6 +240,9 @@ return [
'tags_save' => '태그 저장',
'tags_cancel' => '취소',
'tags_remove' => '@:username 삭제',
+ 'tags_move' => '이동',
+ 'tags_move_pill' => '새 위치 선택',
+ 'tags_move_hint' => '이미지를 클릭해 @:username 님을 배치하세요.',
'tags_invalid' => '유효한 Instagram 사용자 이름을 입력하세요.',
'thumbnail_tab' => '썸네일',
'thumbnail_heading' => '썸네일 선택',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => '피드에 공유',
+ 'music' => [
+ 'label' => '음악',
+ 'add' => '음악 추가',
+ 'search_placeholder' => '음악 검색',
+ 'empty' => '트랙을 찾을 수 없습니다',
+ 'play' => '미리듣기',
+ 'pause' => '일시정지',
+ 'remove' => '음악 삭제',
+ 'part_hint' => 'Instagram은 TryPost가 트랙의 어느 부분을 재생할지 선택하도록 허용하지 않습니다.',
+ 'volume' => '볼륨',
+ 'video_volume' => '동영상',
+ 'audio_volume' => '음악',
+ 'limited' => '결과가 제한적이며 Instagram과 다를 수 있습니다.',
+ 'search_failed' => 'Instagram 음악을 불러오지 못했습니다. 다시 시도하세요.',
+ 'too_many_searches' => '음악 검색이 너무 많습니다. 1분 후에 다시 시도하세요.',
+ 'requires_facebook' => '음악을 쓰려면 Facebook으로 연결된 Instagram 계정이 필요합니다.',
+ 'link_title' => '음악이 있는 릴스를 게시하려면 Facebook으로 연결하세요',
+ 'link_body' => '음악이 있는 릴스를 게시하려면 Instagram을 Facebook 페이지에 연결하세요. 연결 전에 게시물을 임시저장합니다. 그다음 임시저장에서 열어 음악을 추가하세요.',
+ 'maybe_later' => '나중에',
+ 'save_and_link' => '저장 후 연결',
+ 'save_and_link_blocked' => '이 게시물은 아직 저장할 수 없습니다. 업로드가 끝날 때까지 기다리고 표시된 부분을 고친 뒤 다시 시도하세요.',
+ 'save_and_link_pending' => '이 게시물은 승인을 기다리고 있습니다. Facebook을 연결하기 전에 승인하거나 임시 저장으로 옮기세요.',
+ ],
+ 'collaborators' => [
+ 'label' => '공동 작업자',
+ 'placeholder' => 'Instagram 사용자 이름',
+ 'add' => '추가',
+ 'remove' => ':username 삭제',
+ 'max' => '공동 작업자는 최대 :max명까지 추가할 수 있습니다.',
+ 'invalid' => '올바른 Instagram 사용자 이름을 입력하세요.',
+ 'no_trial' => '체험판 릴스에서는 사용할 수 없음',
+ 'notice' => 'Instagram은 사용자 이름을 확인해 주지 않습니다. 프로필을 열어 올바른 계정인지 확인하세요.',
+ 'got_it' => '확인',
+ ],
+ 'trial_reel' => [
+ 'label' => '체험판 릴스',
+ 'off' => '끄기',
+ 'auto' => '자동',
+ 'manual' => '수동',
+ 'badge' => '체험판',
+ 'auto_hint' => '체험판 릴스는 먼저 팔로워가 아닌 사람에게 표시됩니다. 반응이 좋으면 72시간 후 Instagram이 자동으로 팔로워에게 공유합니다. 그렇지 않으면 직접 공유하기 전까지 공유되지 않습니다.',
+ 'manual_hint' => '팔로워가 아닌 사람이 먼저 봅니다. 준비되면 팔로워에게 공유하세요.',
+ 'no_collaborators' => '공동 작업자와 함께 사용할 수 없음',
+ 'check_title' => 'Instagram 앱에서 릴스를 만들 때 체험판 릴스를 사용할 수 있나요?',
+ 'check_body' => '계정에서 체험판 릴스를 사용할 수 있을 때만 작동합니다. Instagram 앱에서 확인하세요.',
+ 'checked' => '네, 확인했어요',
+ 'not_checked' => '아니요',
+ ],
],
'threads' => [
'topic' => '주제',
@@ -941,10 +992,19 @@ return [
'move_up' => '위로 이동',
'move_down' => '아래로 이동',
'duplicate' => '게시물 복제',
+ 'share_link' => '게시물에서 링크 공유',
+ 'copy_link' => '링크 복사',
'move_to_drafts' => '임시 저장으로 이동',
'delete' => '게시물 삭제',
'add_to_queue' => '대기열에 추가',
- 'add_to_queue_disabled' => '대기열을 사용하려면 이 채널에 게시 시간을 추가하세요.',
+ 'add_to_queue_hint' => '채널의 다음 빈 게시 시간에 추가합니다.',
+ 'queue_setup' => [
+ 'title' => '이 채널의 대기열을 아직 설정하지 않았습니다',
+ 'body' => '대기열에 게시물을 추가하려면 채널의 게시 시간을 설정하세요. 대기열의 게시물은 다음 빈 시간에 게시됩니다.',
+ 'body_member' => '대기열에 게시물을 추가하려면 워크스페이스 관리자가 이 채널의 게시 시간을 설정해야 합니다.',
+ 'not_now' => '나중에',
+ 'action' => '게시 시간 설정',
+ ],
'more' => '추가 작업',
'open_on_network' => ':network에서 게시물 열기',
'see_insights' => '게시물 인사이트 보기',
diff --git a/lang/ko/settings.php b/lang/ko/settings.php
index 556780bbd..50e627e74 100644
--- a/lang/ko/settings.php
+++ b/lang/ko/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => '프로필',
- 'authentication' => '인증',
'notifications' => '알림',
'preferences' => '환경설정',
'general' => '일반',
@@ -99,27 +98,23 @@ return [
'resend_verification' => '인증 이메일을 다시 보내려면 여기를 클릭하세요.',
'verification_sent' => '이메일 주소로 새 인증 링크를 보냈습니다.',
'save' => '저장',
- ],
-
- 'authentication' => [
- 'title' => '인증',
- 'page_title' => '인증 설정',
+ 'tabs' => [
+ 'profile' => '프로필',
+ 'login' => '비밀번호 및 로그인',
+ 'sessions' => '세션',
+ ],
'sessions' => [
'title' => '활성 세션',
'description' => '의심스러운 점이 발견되면 다른 기기에서 로그아웃하세요.',
'unknown_browser' => '알 수 없는 브라우저',
- 'unknown_ip' => '알 수 없는 IP',
'on' => '·',
'active_now' => '현재 활성',
+ 'last_activity' => '마지막 활동: :time',
'log_out_others' => '다른 기기에서 로그아웃',
'modal_title' => '다른 기기에서 로그아웃',
- 'modal_description_password' => '다른 브라우저 세션에서 로그아웃하려면 현재 비밀번호를 입력하여 확인하세요.',
- 'modal_description_email' => '다른 브라우저 세션에서 로그아웃하려면 이메일 주소를 입력하여 확인하세요.',
- 'password_placeholder' => '현재 비밀번호',
- 'email_placeholder' => '계정 이메일',
+ 'modal_description' => '계정에 로그인된 다른 모든 기기에서 로그아웃됩니다. 이 세션은 그대로 유지됩니다.',
'cancel' => '취소',
'submit' => '다른 기기에서 로그아웃',
- 'email_mismatch' => '이메일 주소가 계정과 일치하지 않습니다.',
'flash_logged_out' => '다른 기기에서 로그아웃되었습니다.',
],
'password' => [
diff --git a/lang/ko/welcome.php b/lang/ko/welcome.php
index ad3bb921f..2901f0ae5 100644
--- a/lang/ko/welcome.php
+++ b/lang/ko/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'AI 연결하기',
'pick_ai' => '어디에서 TryPost를 사용할까요?',
'connect_other' => '다른 앱 연결',
- 'composer' => '무엇이든 물어보세요',
'connected' => ':client 연결됨',
'benefits' => [
'schedule' => [
diff --git a/lang/nl/accounts.php b/lang/nl/accounts.php
index be7861198..1cfc09f1c 100644
--- a/lang/nl/accounts.php
+++ b/lang/nl/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Functies hangen af van het type Instagram-account dat je hebt en de koppeling die je kiest.',
'professional_title' => 'Professioneel',
'professional_types' => '(Bedrijf & Creator)',
+ 'facebook_types' => '(gekoppeld aan een Facebook-pagina)',
'badge' => 'Automatisch posten',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Statistieken van verzonden posts',
'description' => 'Bekijk de prestaties van eerdere posts',
],
+ 'music' => [
+ 'title' => 'Muziek in reels',
+ 'description' => 'Voeg een nummer uit de bibliotheek van Instagram toe',
+ ],
],
'connect' => 'Koppelen met Instagram',
'convert_hint' => 'Instagram vraagt je indien nodig om eenvoudig over te stappen naar een professioneel account.',
- 'facebook_link' => 'Koppel Instagram via Facebook',
- 'facebook_suffix' => 'als je Instagram-account momenteel aan Facebook is gekoppeld.',
'help' => [
'account_type' => 'Het type van je Instagram-account vinden',
'convert' => 'Je Instagram-account omzetten naar een professioneel account',
diff --git a/lang/nl/channels.php b/lang/nl/channels.php
index a060e475b..97bcdbebe 100644
--- a/lang/nl/channels.php
+++ b/lang/nl/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Koppel dit kanaal opnieuw om te blijven publiceren.',
'reconnect' => 'Opnieuw koppelen',
'refresh_connection' => 'Verbinding vernieuwen',
+ 'link_facebook_page' => 'Koppelen aan een Facebook-pagina',
'view_profile' => 'Profiel bekijken',
'disconnect' => 'Loskoppelen',
'actions' => 'Kanaalacties',
'reorder' => [
'handle' => 'Sleep om :name te verplaatsen',
- 'move_up' => 'Omhoog',
- 'move_down' => 'Omlaag',
'failed' => 'Je kanalen konden niet opnieuw worden geordend. Probeer het opnieuw.',
'stale' => 'Je kanalen zijn gewijzigd sinds je de pagina hebt geladen. Vernieuw en probeer het opnieuw.',
],
diff --git a/lang/nl/common.php b/lang/nl/common.php
index a45ac66c5..c125d19e8 100644
--- a/lang/nl/common.php
+++ b/lang/nl/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Terug',
+ 'unsaved_changes' => [
+
+ 'title' => 'Wijzigingen negeren?',
+
+ 'description' => 'Je wijzigingen in dit bericht zijn niet opgeslagen. Als je nu weggaat, gaan ze verloren.',
+
+ 'discard' => 'Negeren',
+
+ ],
+
'confirm_modal' => [
'type' => 'Typ',
'to_confirm' => 'om te bevestigen.',
diff --git a/lang/nl/notes.php b/lang/nl/notes.php
index a6bcbe279..3a514083d 100644
--- a/lang/nl/notes.php
+++ b/lang/nl/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'Schrijf een notitie...',
'title' => 'Notities',
+ 'show' => 'Notities tonen',
+ 'hide' => 'Notities verbergen',
'edit' => 'Bewerken',
'delete' => 'Verwijderen',
'edited' => 'bewerkt',
'save' => 'Opslaan',
'cancel' => 'Annuleren',
'send' => 'Verzenden',
- 'empty_title' => 'Nog geen notities',
- 'empty_description' => 'Begin het gesprek.',
+ 'empty' => 'Nog geen notities. Alleen je team ziet ze.',
'actions' => 'Notitieacties',
'load_more' => 'Oudere notities laden',
];
diff --git a/lang/nl/posts.php b/lang/nl/posts.php
index 6616a1edd..835a33815 100644
--- a/lang/nl/posts.php
+++ b/lang/nl/posts.php
@@ -193,8 +193,8 @@ return [
'title' => 'Media bewerken',
'description' => 'Bijsnijden, aanpassen, beschrijven en mensen taggen in de afbeeldingen van dit bericht.',
'edit_tab' => 'Bewerken',
- 'alt_tab' => 'Alternatieve tekst',
- 'tags_tab' => 'Mensen taggen',
+ 'alt_tab' => 'Alt-tekst',
+ 'tags_tab' => 'Taggen',
'crop_tab' => 'Bijsnijden',
'appearance_tab' => 'Weergave',
'crop_heading' => 'Bijsnijden en transformeren',
@@ -240,6 +240,9 @@ return [
'tags_save' => 'Tag opslaan',
'tags_cancel' => 'Annuleren',
'tags_remove' => '@:username verwijderen',
+ 'tags_move' => 'Verplaatsen',
+ 'tags_move_pill' => 'Kies een nieuwe positie',
+ 'tags_move_hint' => 'Klik op de afbeelding om @:username te plaatsen.',
'tags_invalid' => 'Voer een geldige Instagram-gebruikersnaam in.',
'thumbnail_tab' => 'Miniatuur',
'thumbnail_heading' => 'Kies een miniatuur',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Delen in feed',
+ 'music' => [
+ 'label' => 'Muziek',
+ 'add' => 'Muziek toevoegen',
+ 'search_placeholder' => 'Muziek zoeken',
+ 'empty' => 'Geen nummers gevonden',
+ 'play' => 'Voorbeeld afspelen',
+ 'pause' => 'Voorbeeld pauzeren',
+ 'remove' => 'Muziek verwijderen',
+ 'part_hint' => 'Instagram laat TryPost niet kiezen welk deel van het nummer speelt.',
+ 'volume' => 'Volume',
+ 'video_volume' => 'Video',
+ 'audio_volume' => 'Muziek',
+ 'limited' => 'De resultaten zijn beperkt en kunnen afwijken van Instagram.',
+ 'search_failed' => 'Kan muziek van Instagram niet laden. Probeer het opnieuw.',
+ 'too_many_searches' => 'Te veel zoekopdrachten naar muziek. Wacht een minuut en probeer het opnieuw.',
+ 'requires_facebook' => 'Muziek vereist een Instagram-account dat via Facebook is gekoppeld.',
+ 'link_title' => 'Koppel via Facebook om reels met muziek te plaatsen',
+ 'link_body' => 'Om reels met muziek te plaatsen, koppel je Instagram aan je Facebook-pagina. We slaan je bericht eerst op als concept. Open het daarna via Concepten om muziek toe te voegen.',
+ 'maybe_later' => 'Later',
+ 'save_and_link' => 'Opslaan en koppelen',
+ 'save_and_link_blocked' => 'Deze post kan nog niet worden opgeslagen. Wacht tot de uploads klaar zijn, los het gemarkeerde op en probeer het opnieuw.',
+ 'save_and_link_pending' => 'Deze post wacht op goedkeuring. Keur hem goed of zet hem in concepten voordat je Facebook koppelt.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Medewerkers',
+ 'placeholder' => 'Instagram-gebruikersnaam',
+ 'add' => 'Toevoegen',
+ 'remove' => ':username verwijderen',
+ 'max' => 'Voeg maximaal :max medewerkers toe.',
+ 'invalid' => 'Voer een geldige Instagram-gebruikersnaam in.',
+ 'no_trial' => 'Niet beschikbaar bij een test-reel',
+ 'notice' => 'Instagram bevestigt geen gebruikersnamen voor ons. Open het profiel om te controleren of het het juiste account is.',
+ 'got_it' => 'Begrepen',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Test-reel',
+ 'off' => 'Uit',
+ 'auto' => 'Auto',
+ 'manual' => 'Handmatig',
+ 'badge' => 'Test',
+ 'auto_hint' => 'Je test-reel wordt eerst aan niet-volgers getoond. Presteert hij goed, dan deelt Instagram hem na 72 uur automatisch met je volgers. Zo niet, dan wordt hij alleen gedeeld als je dat zelf doet.',
+ 'manual_hint' => 'Niet-volgers zien hem eerst. Je deelt hem met je volgers wanneer je er klaar voor bent.',
+ 'no_collaborators' => 'Niet beschikbaar met medewerkers',
+ 'check_title' => 'Zijn test-reels beschikbaar als je een reel maakt in de Instagram-app?',
+ 'check_body' => 'Dit werkt alleen als je account test-reels heeft. Controleer het in de Instagram-app.',
+ 'checked' => 'Ja, gecontroleerd',
+ 'not_checked' => 'Nee',
+ ],
],
'threads' => [
'topic' => 'Onderwerp',
@@ -941,10 +992,19 @@ return [
'move_up' => 'Omhoog',
'move_down' => 'Omlaag',
'duplicate' => 'Post dupliceren',
+ 'share_link' => 'Delen in een bericht',
+ 'copy_link' => 'Link kopiëren',
'move_to_drafts' => 'Naar concepten verplaatsen',
'delete' => 'Post verwijderen',
'add_to_queue' => 'Aan wachtrij toevoegen',
- 'add_to_queue_disabled' => 'Voeg publicatietijden toe aan dit kanaal om de wachtrij te gebruiken.',
+ 'add_to_queue_hint' => 'Voegt toe aan het volgende vrije tijdstip van het kanaal.',
+ 'queue_setup' => [
+ 'title' => 'Je hebt de wachtrij van dit kanaal nog niet ingesteld',
+ 'body' => 'Stel de posttijden van het kanaal in om posts aan de wachtrij toe te voegen. Elke post in de wachtrij gaat uit op het volgende vrije tijdstip.',
+ 'body_member' => 'Om posts aan de wachtrij toe te voegen, moet een workspace-admin de posttijden van dit kanaal instellen.',
+ 'not_now' => 'Niet nu',
+ 'action' => 'Tijden instellen',
+ ],
'more' => 'Meer acties',
'open_on_network' => 'Bericht openen op :network',
'see_insights' => 'Berichtinzichten bekijken',
diff --git a/lang/nl/settings.php b/lang/nl/settings.php
index f47dae560..0117832d5 100644
--- a/lang/nl/settings.php
+++ b/lang/nl/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Profiel',
- 'authentication' => 'Authenticatie',
'notifications' => 'Meldingen',
'preferences' => 'Voorkeuren',
'general' => 'Algemeen',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Klik hier om de verificatiemail opnieuw te versturen.',
'verification_sent' => 'Er is een nieuwe verificatielink naar je e-mailadres verstuurd.',
'save' => 'Opslaan',
- ],
-
- 'authentication' => [
- 'title' => 'Authenticatie',
- 'page_title' => 'Authenticatie-instellingen',
+ 'tabs' => [
+ 'profile' => 'Profiel',
+ 'login' => 'Inloggen',
+ 'sessions' => 'Sessies',
+ ],
'sessions' => [
'title' => 'Actieve sessies',
'description' => 'Als je iets verdachts opmerkt, log dan uit op andere apparaten.',
'unknown_browser' => 'Onbekende browser',
- 'unknown_ip' => 'Onbekend IP',
'on' => 'op',
'active_now' => 'Nu actief',
+ 'last_activity' => 'Laatste activiteit :time',
'log_out_others' => 'Uitloggen op andere apparaten',
'modal_title' => 'Uitloggen op andere apparaten',
- 'modal_description_password' => 'Voer je huidige wachtwoord in om te bevestigen dat je op andere browsersessies wilt uitloggen.',
- 'modal_description_email' => 'Typ je e-mailadres om te bevestigen dat je op andere browsersessies wilt uitloggen.',
- 'password_placeholder' => 'Huidig wachtwoord',
- 'email_placeholder' => 'Je account-e-mailadres',
+ 'modal_description' => 'Alle andere apparaten die op je account zijn ingelogd, worden uitgelogd. Deze sessie blijft actief.',
'cancel' => 'Annuleren',
'submit' => 'Uitloggen op andere apparaten',
- 'email_mismatch' => 'Het e-mailadres komt niet overeen met je account.',
'flash_logged_out' => 'Je bent uitgelogd op andere apparaten.',
],
'password' => [
diff --git a/lang/nl/welcome.php b/lang/nl/welcome.php
index 27d36ac7a..3e26c19ee 100644
--- a/lang/nl/welcome.php
+++ b/lang/nl/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Koppel je AI',
'pick_ai' => 'Waar wil je TryPost gebruiken?',
'connect_other' => 'Andere app koppelen',
- 'composer' => 'Vraag maar raak',
'connected' => ':client is gekoppeld',
'benefits' => [
'schedule' => [
diff --git a/lang/pl/accounts.php b/lang/pl/accounts.php
index a4ff4125b..76bd079f3 100644
--- a/lang/pl/accounts.php
+++ b/lang/pl/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Funkcje zależą od typu Twojego konta na Instagramie i wybranego sposobu połączenia.',
'professional_title' => 'Profesjonalne',
'professional_types' => '(Firma i Twórca)',
+ 'facebook_types' => '(połączone ze stroną na Facebooku)',
'badge' => 'Automatyczne publikowanie',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Statystyki wysłanych postów',
'description' => 'Sprawdzaj wyniki wcześniejszych postów',
],
+ 'music' => [
+ 'title' => 'Muzyka w rolkach',
+ 'description' => 'Dodaj utwór z biblioteki Instagrama',
+ ],
],
'connect' => 'Połącz z Instagramem',
'convert_hint' => 'W razie potrzeby Instagram poprosi Cię o łatwe przełączenie na konto profesjonalne.',
- 'facebook_link' => 'Połącz Instagram przez Facebooka',
- 'facebook_suffix' => '(jeśli Twoje konto na Instagramie jest obecnie połączone z Facebookiem).',
'help' => [
'account_type' => 'Jak sprawdzić typ konta na Instagramie',
'convert' => 'Jak przełączyć konto na Instagramie na profesjonalne',
diff --git a/lang/pl/channels.php b/lang/pl/channels.php
index 630a7abcf..684a3cceb 100644
--- a/lang/pl/channels.php
+++ b/lang/pl/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Połącz ten kanał ponownie, aby dalej publikować.',
'reconnect' => 'Połącz ponownie',
'refresh_connection' => 'Odśwież połączenie',
+ 'link_facebook_page' => 'Połącz ze stroną na Facebooku',
'view_profile' => 'Zobacz profil',
'disconnect' => 'Rozłącz',
'actions' => 'Akcje kanału',
'reorder' => [
'handle' => 'Przeciągnij, aby zmienić kolejność: :name',
- 'move_up' => 'Przenieś w górę',
- 'move_down' => 'Przenieś w dół',
'failed' => 'Nie udało się zmienić kolejności kanałów. Spróbuj ponownie.',
'stale' => 'Twoje kanały zmieniły się od załadowania strony. Odśwież i spróbuj ponownie.',
],
diff --git a/lang/pl/common.php b/lang/pl/common.php
index ae935b5de..8cab30535 100644
--- a/lang/pl/common.php
+++ b/lang/pl/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Wstecz',
+ 'unsaved_changes' => [
+
+ 'title' => 'Odrzucić zmiany?',
+
+ 'description' => 'Zmiany w tym poście nie zostały zapisane. Jeśli teraz wyjdziesz, zostaną utracone.',
+
+ 'discard' => 'Odrzuć',
+
+ ],
+
'confirm_modal' => [
'type' => 'Wpisz',
'to_confirm' => 'aby potwierdzić.',
diff --git a/lang/pl/notes.php b/lang/pl/notes.php
index dcc57f3bd..24b1ed241 100644
--- a/lang/pl/notes.php
+++ b/lang/pl/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'Napisz notatkę...',
'title' => 'Notatki',
+ 'show' => 'Pokaż notatki',
+ 'hide' => 'Ukryj notatki',
'edit' => 'Edytuj',
'delete' => 'Usuń',
'edited' => 'edytowano',
'save' => 'Zapisz',
'cancel' => 'Anuluj',
'send' => 'Wyślij',
- 'empty_title' => 'Brak notatek',
- 'empty_description' => 'Rozpocznij rozmowę.',
+ 'empty' => 'Brak notatek. Widzi je tylko Twój zespół.',
'actions' => 'Akcje notatki',
'load_more' => 'Wczytaj starsze notatki',
];
diff --git a/lang/pl/posts.php b/lang/pl/posts.php
index 24374ca05..eb01b782a 100644
--- a/lang/pl/posts.php
+++ b/lang/pl/posts.php
@@ -193,8 +193,8 @@ return [
'title' => 'Edytuj multimedia',
'description' => 'Przycinaj, dostosowuj, opisuj i oznaczaj osoby na zdjęciach w tym poście.',
'edit_tab' => 'Edytuj',
- 'alt_tab' => 'Tekst alternatywny',
- 'tags_tab' => 'Oznacz osoby',
+ 'alt_tab' => 'Tekst alt',
+ 'tags_tab' => 'Oznacz',
'crop_tab' => 'Przytnij',
'appearance_tab' => 'Wygląd',
'crop_heading' => 'Przycinanie i przekształcanie',
@@ -240,6 +240,9 @@ return [
'tags_save' => 'Zapisz oznaczenie',
'tags_cancel' => 'Anuluj',
'tags_remove' => 'Usuń @:username',
+ 'tags_move' => 'Przenieś',
+ 'tags_move_pill' => 'Wybierz nowe miejsce',
+ 'tags_move_hint' => 'Kliknij obraz, aby umieścić @:username.',
'tags_invalid' => 'Wpisz poprawną nazwę użytkownika Instagrama.',
'thumbnail_tab' => 'Miniatura',
'thumbnail_heading' => 'Wybierz miniaturę',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Pokaż w kanale',
+ 'music' => [
+ 'label' => 'Muzyka',
+ 'add' => 'Dodaj muzykę',
+ 'search_placeholder' => 'Szukaj muzyki',
+ 'empty' => 'Nie znaleziono utworów',
+ 'play' => 'Odtwórz',
+ 'pause' => 'Wstrzymaj',
+ 'remove' => 'Usuń muzykę',
+ 'part_hint' => 'Instagram nie pozwala TryPost wybrać, który fragment utworu jest odtwarzany.',
+ 'volume' => 'Głośność',
+ 'video_volume' => 'Wideo',
+ 'audio_volume' => 'Muzyka',
+ 'limited' => 'Wyniki są ograniczone i mogą różnić się od Instagrama.',
+ 'search_failed' => 'Nie udało się wczytać muzyki z Instagrama. Spróbuj ponownie.',
+ 'too_many_searches' => 'Zbyt wiele wyszukiwań muzyki. Odczekaj minutę i spróbuj ponownie.',
+ 'requires_facebook' => 'Muzyka wymaga konta Instagram połączonego przez Facebooka.',
+ 'link_title' => 'Połącz przez Facebooka, aby publikować rolki z muzyką',
+ 'link_body' => 'Aby publikować rolki z muzyką, połącz Instagram ze swoją stroną na Facebooku. Najpierw zapiszemy post jako wersję roboczą. Potem otwórz go w Wersjach roboczych, aby dodać muzykę.',
+ 'maybe_later' => 'Później',
+ 'save_and_link' => 'Zapisz i połącz',
+ 'save_and_link_blocked' => 'Tego posta nie można jeszcze zapisać. Poczekaj na zakończenie przesyłania i popraw zaznaczone elementy, a potem spróbuj ponownie.',
+ 'save_and_link_pending' => 'Ten post czeka na zatwierdzenie. Zatwierdź go lub przenieś do wersji roboczych przed połączeniem Facebooka.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Współtwórcy',
+ 'placeholder' => 'Nazwa użytkownika Instagram',
+ 'add' => 'Dodaj',
+ 'remove' => 'Usuń :username',
+ 'max' => 'Dodaj maksymalnie :max współtwórców.',
+ 'invalid' => 'Wpisz poprawną nazwę użytkownika Instagram.',
+ 'no_trial' => 'Niedostępne w rolce testowej',
+ 'notice' => 'Instagram nie potwierdza nam nazwy użytkownika. Otwórz profil, aby sprawdzić, czy to właściwe konto.',
+ 'got_it' => 'Rozumiem',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Rolka testowa',
+ 'off' => 'Wył.',
+ 'auto' => 'Auto',
+ 'manual' => 'Ręcznie',
+ 'badge' => 'Test',
+ 'auto_hint' => 'Twoja rolka testowa jest najpierw pokazywana osobom, które Cię nie obserwują. Jeśli dobrze się sprawdzi, Instagram po 72 godzinach automatycznie udostępni ją obserwującym. Jeśli nie, zostanie udostępniona tylko wtedy, gdy zrobisz to sam.',
+ 'manual_hint' => 'Najpierw widzą ją osoby, które Cię nie obserwują. Udostępniasz ją obserwującym, kiedy chcesz.',
+ 'no_collaborators' => 'Niedostępne ze współtwórcami',
+ 'check_title' => 'Czy rolki testowe są dostępne, gdy tworzysz rolkę w aplikacji Instagram?',
+ 'check_body' => 'Działa tylko, jeśli Twoje konto ma rolki testowe. Sprawdź w aplikacji Instagram.',
+ 'checked' => 'Tak, sprawdziłem',
+ 'not_checked' => 'Nie',
+ ],
],
'threads' => [
'topic' => 'Temat',
@@ -941,10 +992,19 @@ return [
'move_up' => 'Przenieś w górę',
'move_down' => 'Przenieś w dół',
'duplicate' => 'Duplikuj post',
+ 'share_link' => 'Udostępnij w poście',
+ 'copy_link' => 'Kopiuj link',
'move_to_drafts' => 'Przenieś do wersji roboczych',
'delete' => 'Usuń post',
'add_to_queue' => 'Dodaj do kolejki',
- 'add_to_queue_disabled' => 'Dodaj godziny publikacji do tego kanału, aby korzystać z kolejki.',
+ 'add_to_queue_hint' => 'Dodaje do najbliższego wolnego terminu kanału.',
+ 'queue_setup' => [
+ 'title' => 'Kolejka tego kanału nie jest jeszcze skonfigurowana',
+ 'body' => 'Aby dodawać posty do kolejki, ustaw godziny publikacji kanału. Każdy post z kolejki wychodzi w najbliższym wolnym terminie.',
+ 'body_member' => 'Aby dodawać posty do kolejki, admin workspace\'u musi ustawić godziny publikacji tego kanału.',
+ 'not_now' => 'Nie teraz',
+ 'action' => 'Ustaw godziny',
+ ],
'more' => 'Więcej działań',
'open_on_network' => 'Otwórz post w :network',
'see_insights' => 'Zobacz statystyki posta',
diff --git a/lang/pl/settings.php b/lang/pl/settings.php
index 3a3172013..e1de1219b 100644
--- a/lang/pl/settings.php
+++ b/lang/pl/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Profil',
- 'authentication' => 'Uwierzytelnianie',
'notifications' => 'Powiadomienia',
'preferences' => 'Preferencje',
'general' => 'Ogólne',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Kliknij tutaj, aby ponownie wysłać e-mail weryfikacyjny.',
'verification_sent' => 'Nowy link weryfikacyjny został wysłany na Twój adres e-mail.',
'save' => 'Zapisz',
- ],
-
- 'authentication' => [
- 'title' => 'Uwierzytelnianie',
- 'page_title' => 'Ustawienia uwierzytelniania',
+ 'tabs' => [
+ 'profile' => 'Profil',
+ 'login' => 'Hasło i logowanie',
+ 'sessions' => 'Sesje',
+ ],
'sessions' => [
'title' => 'Aktywne sesje',
'description' => 'Jeśli zauważysz coś podejrzanego, wyloguj się z innych urządzeń.',
'unknown_browser' => 'Nieznana przeglądarka',
- 'unknown_ip' => 'Nieznany adres IP',
'on' => 'w',
'active_now' => 'Aktywna teraz',
+ 'last_activity' => 'Ostatnia aktywność :time',
'log_out_others' => 'Wyloguj inne urządzenia',
'modal_title' => 'Wyloguj inne urządzenia',
- 'modal_description_password' => 'Wprowadź swoje aktualne hasło, aby potwierdzić chęć wylogowania innych sesji przeglądarki.',
- 'modal_description_email' => 'Wpisz swój adres e-mail, aby potwierdzić chęć wylogowania innych sesji przeglądarki.',
- 'password_placeholder' => 'Aktualne hasło',
- 'email_placeholder' => 'E-mail Twojego konta',
+ 'modal_description' => 'Wszystkie inne urządzenia zalogowane na Twoje konto zostaną wylogowane. Ta sesja pozostanie aktywna.',
'cancel' => 'Anuluj',
'submit' => 'Wyloguj inne urządzenia',
- 'email_mismatch' => 'Adres e-mail nie zgadza się z Twoim kontem.',
'flash_logged_out' => 'Zostałeś wylogowany z innych urządzeń.',
],
'password' => [
diff --git a/lang/pl/welcome.php b/lang/pl/welcome.php
index b9f339c47..a8d8f07f8 100644
--- a/lang/pl/welcome.php
+++ b/lang/pl/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Połącz swoją AI',
'pick_ai' => 'Gdzie chcesz używać TryPost?',
'connect_other' => 'Połącz inną aplikację',
- 'composer' => 'Zapytaj o cokolwiek',
'connected' => ':client jest połączony',
'benefits' => [
'schedule' => [
diff --git a/lang/pt-BR/accounts.php b/lang/pt-BR/accounts.php
index 3f6f7d332..048169011 100644
--- a/lang/pt-BR/accounts.php
+++ b/lang/pt-BR/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Os recursos dependem do tipo de conta do Instagram que você tem e da conexão que você escolher.',
'professional_title' => 'Profissional',
'professional_types' => '(Empresa e Criador de conteúdo)',
+ 'facebook_types' => '(vinculado a uma página do Facebook)',
'badge' => 'Publicação automática',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Métricas dos posts enviados',
'description' => 'Veja o desempenho dos posts anteriores',
],
+ 'music' => [
+ 'title' => 'Música nos reels',
+ 'description' => 'Adicione uma música da biblioteca do Instagram',
+ ],
],
'connect' => 'Conectar ao Instagram',
'convert_hint' => 'O Instagram vai pedir para você converter facilmente para uma conta profissional, se necessário.',
- 'facebook_link' => 'Conecte o Instagram pelo Facebook',
- 'facebook_suffix' => 'se a sua conta do Instagram estiver vinculada ao Facebook.',
'help' => [
'account_type' => 'Descobrir o tipo da sua conta do Instagram',
'convert' => 'Converter sua conta do Instagram em uma conta profissional',
diff --git a/lang/pt-BR/channels.php b/lang/pt-BR/channels.php
index 0bad0aa1d..c626785ce 100644
--- a/lang/pt-BR/channels.php
+++ b/lang/pt-BR/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Reconecte este canal para continuar publicando.',
'reconnect' => 'Reconectar',
'refresh_connection' => 'Atualizar conexão',
+ 'link_facebook_page' => 'Vincular a uma Página do Facebook',
'view_profile' => 'Ver perfil',
'disconnect' => 'Desconectar',
'actions' => 'Ações do canal',
'reorder' => [
'handle' => 'Arraste para reordenar :name',
- 'move_up' => 'Mover para cima',
- 'move_down' => 'Mover para baixo',
'failed' => 'Não foi possível reordenar seus canais. Tente novamente.',
'stale' => 'Seus canais mudaram desde que você abriu a página. Atualize e tente novamente.',
],
diff --git a/lang/pt-BR/common.php b/lang/pt-BR/common.php
index ca29ee7e0..8e19c2b5a 100644
--- a/lang/pt-BR/common.php
+++ b/lang/pt-BR/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Voltar',
+ 'unsaved_changes' => [
+
+ 'title' => 'Descartar alterações?',
+
+ 'description' => 'Suas alterações neste post não foram salvas. Se sair agora, elas serão perdidas.',
+
+ 'discard' => 'Descartar',
+
+ ],
+
'confirm_modal' => [
'type' => 'Digite',
'to_confirm' => 'para confirmar.',
diff --git a/lang/pt-BR/notes.php b/lang/pt-BR/notes.php
index 86b2948ce..8c28a08de 100644
--- a/lang/pt-BR/notes.php
+++ b/lang/pt-BR/notes.php
@@ -5,14 +5,15 @@ declare(strict_types=1);
return [
'placeholder' => 'Escreva uma nota...',
'title' => 'Notas',
+ 'show' => 'Mostrar notas',
+ 'hide' => 'Ocultar notas',
'edit' => 'Editar',
'delete' => 'Excluir',
'edited' => 'editado',
'save' => 'Salvar',
'cancel' => 'Cancelar',
'send' => 'Enviar',
- 'empty_title' => 'Nenhuma nota ainda',
- 'empty_description' => 'Comece a conversa.',
+ 'empty' => 'Nenhuma nota ainda. Só a sua equipe vê as notas.',
'actions' => 'Ações da nota',
'load_more' => 'Carregar notas antigas',
];
diff --git a/lang/pt-BR/posts.php b/lang/pt-BR/posts.php
index 7d6856cab..65df7297d 100644
--- a/lang/pt-BR/posts.php
+++ b/lang/pt-BR/posts.php
@@ -193,8 +193,8 @@ return [
'title' => 'Editar mídia',
'description' => 'Recorte, ajuste, descreva e marque as imagens deste post.',
'edit_tab' => 'Editar',
- 'alt_tab' => 'Texto alternativo',
- 'tags_tab' => 'Marcar pessoas',
+ 'alt_tab' => 'Descrição',
+ 'tags_tab' => 'Marcações',
'crop_tab' => 'Recorte',
'appearance_tab' => 'Aparência',
'crop_heading' => 'Recorte e transformação',
@@ -240,6 +240,9 @@ return [
'tags_save' => 'Salvar marcação',
'tags_cancel' => 'Cancelar',
'tags_remove' => 'Remover @:username',
+ 'tags_move' => 'Mover',
+ 'tags_move_pill' => 'Escolha a nova posição',
+ 'tags_move_hint' => 'Clique na imagem para posicionar @:username.',
'tags_invalid' => 'Digite um usuário válido do Instagram.',
'thumbnail_tab' => 'Miniatura',
'thumbnail_heading' => 'Escolha uma miniatura',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Enviar ao feed',
+ 'music' => [
+ 'label' => 'Música',
+ 'add' => 'Adicionar música',
+ 'search_placeholder' => 'Buscar música',
+ 'empty' => 'Nenhuma música encontrada',
+ 'play' => 'Ouvir prévia',
+ 'pause' => 'Pausar prévia',
+ 'remove' => 'Remover música',
+ 'part_hint' => 'O Instagram não deixa o TryPost escolher qual trecho da música toca.',
+ 'volume' => 'Volume',
+ 'video_volume' => 'Vídeo',
+ 'audio_volume' => 'Música',
+ 'limited' => 'Os resultados são limitados e podem ser diferentes do Instagram.',
+ 'search_failed' => 'Não foi possível carregar as músicas do Instagram. Tente de novo.',
+ 'too_many_searches' => 'Muitas buscas de música. Aguarde um minuto e tente de novo.',
+ 'requires_facebook' => 'Música exige uma conta do Instagram conectada pelo Facebook.',
+ 'link_title' => 'Conecte pelo Facebook para publicar reels com música',
+ 'link_body' => 'Para publicar reels com música, vincule o Instagram à sua Página do Facebook. Vamos salvar seu post como rascunho antes. Depois, abra-o em Rascunhos para adicionar a música.',
+ 'maybe_later' => 'Agora não',
+ 'save_and_link' => 'Salvar e vincular',
+ 'save_and_link_blocked' => 'Ainda não dá para salvar este post. Espere os envios terminarem e corrija o que está destacado, depois tente de novo.',
+ 'save_and_link_pending' => 'Este post está aguardando aprovação. Aprove ou mova para rascunhos antes de vincular o Facebook.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Colaboradores',
+ 'placeholder' => 'Digite um usuário do Instagram',
+ 'add' => 'Adicionar colaborador',
+ 'remove' => 'Remover :username',
+ 'max' => 'Adicione até :max colaboradores.',
+ 'invalid' => 'Digite um usuário válido do Instagram.',
+ 'no_trial' => 'Indisponível em reel de teste',
+ 'notice' => 'O Instagram não confirma o usuário para nós. Abra o perfil para conferir se é a conta certa.',
+ 'got_it' => 'Entendi',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Reel de teste',
+ 'off' => 'Não',
+ 'auto' => 'Auto',
+ 'manual' => 'Manual',
+ 'badge' => 'Teste',
+ 'auto_hint' => 'Seu reel de teste aparece primeiro para quem não te segue. Se for bem, o Instagram compartilha com seus seguidores automaticamente depois de 72 horas. Se não for, só é compartilhado se você mesmo compartilhar.',
+ 'manual_hint' => 'Quem não te segue vê primeiro. Você compartilha com seus seguidores quando quiser.',
+ 'no_collaborators' => 'Indisponível com colaboradores',
+ 'check_title' => 'Os reels de teste aparecem quando você cria um reel no app do Instagram?',
+ 'check_body' => 'Só funciona se os reels de teste estiverem liberados na sua conta. Confira no app do Instagram.',
+ 'checked' => 'Sim, conferi',
+ 'not_checked' => 'Não',
+ ],
],
'threads' => [
'topic' => 'Tópico',
@@ -941,10 +992,19 @@ return [
'move_up' => 'Mover para cima',
'move_down' => 'Mover para baixo',
'duplicate' => 'Duplicar post',
+ 'share_link' => 'Compartilhar em um post',
+ 'copy_link' => 'Copiar link',
'move_to_drafts' => 'Mover para rascunhos',
'delete' => 'Excluir post',
'add_to_queue' => 'Adicionar à fila',
- 'add_to_queue_disabled' => 'Adicione horários de postagem a este canal para usar a fila.',
+ 'add_to_queue_hint' => 'Adiciona no próximo horário livre do canal.',
+ 'queue_setup' => [
+ 'title' => 'Você ainda não configurou a fila deste canal',
+ 'body' => 'Para adicionar posts à fila, defina os horários de postagem do canal. Cada post da fila sai no próximo horário livre.',
+ 'body_member' => 'Para adicionar posts à fila, um admin do workspace precisa definir os horários de postagem deste canal.',
+ 'not_now' => 'Agora não',
+ 'action' => 'Definir horários',
+ ],
'more' => 'Mais ações',
'open_on_network' => 'Abrir post no :network',
'see_insights' => 'Ver insights do post',
diff --git a/lang/pt-BR/settings.php b/lang/pt-BR/settings.php
index 43d0fa9dd..94937cbcc 100644
--- a/lang/pt-BR/settings.php
+++ b/lang/pt-BR/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Perfil',
- 'authentication' => 'Autenticação',
'notifications' => 'Notificações',
'preferences' => 'Preferências',
'general' => 'Geral',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Clique aqui para reenviar o e-mail de verificação.',
'verification_sent' => 'Um novo link de verificação foi enviado para seu endereço de e-mail.',
'save' => 'Salvar',
- ],
-
- 'authentication' => [
- 'title' => 'Autenticação',
- 'page_title' => 'Configurações de autenticação',
+ 'tabs' => [
+ 'profile' => 'Perfil',
+ 'login' => 'Senha e login',
+ 'sessions' => 'Sessões',
+ ],
'sessions' => [
'title' => 'Sessões ativas',
'description' => 'Se você notar algo suspeito, encerre as sessões em outros dispositivos.',
'unknown_browser' => 'Navegador desconhecido',
- 'unknown_ip' => 'IP desconhecido',
'on' => 'em',
'active_now' => 'Ativa agora',
+ 'last_activity' => 'Última atividade :time',
'log_out_others' => 'Encerrar outras sessões',
'modal_title' => 'Encerrar outras sessões',
- 'modal_description_password' => 'Digite sua senha atual para confirmar o encerramento das outras sessões.',
- 'modal_description_email' => 'Digite seu e-mail para confirmar o encerramento das outras sessões.',
- 'password_placeholder' => 'Senha atual',
- 'email_placeholder' => 'Seu e-mail',
+ 'modal_description' => 'Todos os outros dispositivos com acesso à sua conta serão desconectados. Esta sessão continua ativa.',
'cancel' => 'Cancelar',
'submit' => 'Encerrar outras sessões',
- 'email_mismatch' => 'O e-mail não corresponde à sua conta.',
'flash_logged_out' => 'Outras sessões foram encerradas.',
],
'password' => [
diff --git a/lang/pt-BR/welcome.php b/lang/pt-BR/welcome.php
index 1a514fc5b..b74768449 100644
--- a/lang/pt-BR/welcome.php
+++ b/lang/pt-BR/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Conectar sua IA',
'pick_ai' => 'Onde você quer usar o TryPost?',
'connect_other' => 'Conectar outro app',
- 'composer' => 'Pergunte qualquer coisa',
'connected' => ':client está conectado',
'benefits' => [
'schedule' => [
diff --git a/lang/ru/accounts.php b/lang/ru/accounts.php
index ceaf3f000..a5d7a24d5 100644
--- a/lang/ru/accounts.php
+++ b/lang/ru/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Возможности зависят от типа вашего аккаунта Instagram и выбранного способа подключения.',
'professional_title' => 'Профессиональный',
'professional_types' => '(Бизнес и Автор)',
+ 'facebook_types' => '(связан со страницей Facebook)',
'badge' => 'Автоматическая публикация',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Метрики опубликованных постов',
'description' => 'Смотрите результаты прошлых постов',
],
+ 'music' => [
+ 'title' => 'Музыка в Reels',
+ 'description' => 'Добавьте трек из библиотеки Instagram',
+ ],
],
'connect' => 'Подключиться к Instagram',
'convert_hint' => 'При необходимости Instagram предложит легко перейти на профессиональный аккаунт.',
- 'facebook_link' => 'Подключите Instagram через Facebook',
- 'facebook_suffix' => '(если ваш аккаунт Instagram сейчас связан с Facebook).',
'help' => [
'account_type' => 'Как узнать тип аккаунта Instagram',
'convert' => 'Как перевести аккаунт Instagram в профессиональный',
diff --git a/lang/ru/channels.php b/lang/ru/channels.php
index f8d317cfe..6a0496a7d 100644
--- a/lang/ru/channels.php
+++ b/lang/ru/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Переподключите этот канал, чтобы продолжить публикации.',
'reconnect' => 'Переподключить',
'refresh_connection' => 'Обновить подключение',
+ 'link_facebook_page' => 'Связать со страницей Facebook',
'view_profile' => 'Открыть профиль',
'disconnect' => 'Отключить',
'actions' => 'Действия с каналом',
'reorder' => [
'handle' => 'Перетащите, чтобы изменить порядок: :name',
- 'move_up' => 'Переместить вверх',
- 'move_down' => 'Переместить вниз',
'failed' => 'Не удалось изменить порядок каналов. Попробуйте ещё раз.',
'stale' => 'Ваши каналы изменились после загрузки страницы. Обновите её и попробуйте ещё раз.',
],
diff --git a/lang/ru/common.php b/lang/ru/common.php
index dd79da718..544b05ee7 100644
--- a/lang/ru/common.php
+++ b/lang/ru/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Назад',
+ 'unsaved_changes' => [
+
+ 'title' => 'Отменить изменения?',
+
+ 'description' => 'Изменения в этом посте не сохранены. Если вы уйдёте сейчас, они будут потеряны.',
+
+ 'discard' => 'Отменить',
+
+ ],
+
'confirm_modal' => [
'type' => 'Введите',
'to_confirm' => 'для подтверждения.',
diff --git a/lang/ru/notes.php b/lang/ru/notes.php
index 35d2c2ba0..7e3313e9b 100644
--- a/lang/ru/notes.php
+++ b/lang/ru/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'Напишите заметку...',
'title' => 'Заметки',
+ 'show' => 'Показать заметки',
+ 'hide' => 'Скрыть заметки',
'edit' => 'Изменить',
'delete' => 'Удалить',
'edited' => 'изменено',
'save' => 'Сохранить',
'cancel' => 'Отмена',
'send' => 'Отправить',
- 'empty_title' => 'Пока нет заметок',
- 'empty_description' => 'Начните обсуждение.',
+ 'empty' => 'Пока нет заметок. Их видит только ваша команда.',
'actions' => 'Действия с заметкой',
'load_more' => 'Загрузить старые заметки',
];
diff --git a/lang/ru/posts.php b/lang/ru/posts.php
index 7c0d0b927..8f6df080e 100644
--- a/lang/ru/posts.php
+++ b/lang/ru/posts.php
@@ -193,8 +193,8 @@ return [
'title' => 'Редактировать медиа',
'description' => 'Обрежьте, настройте, опишите изображения этого поста и отметьте на них людей.',
'edit_tab' => 'Изменить',
- 'alt_tab' => 'Альтернативный текст',
- 'tags_tab' => 'Отметить людей',
+ 'alt_tab' => 'Альт-текст',
+ 'tags_tab' => 'Отметки',
'crop_tab' => 'Обрезка',
'appearance_tab' => 'Внешний вид',
'crop_heading' => 'Обрезка и трансформация',
@@ -240,6 +240,9 @@ return [
'tags_save' => 'Сохранить отметку',
'tags_cancel' => 'Отмена',
'tags_remove' => 'Удалить @:username',
+ 'tags_move' => 'Переместить',
+ 'tags_move_pill' => 'Выберите новое место',
+ 'tags_move_hint' => 'Нажмите на изображение, чтобы разместить @:username.',
'tags_invalid' => 'Введите корректное имя пользователя Instagram.',
'thumbnail_tab' => 'Обложка',
'thumbnail_heading' => 'Выберите обложку',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'В ленту',
+ 'music' => [
+ 'label' => 'Музыка',
+ 'add' => 'Добавить',
+ 'search_placeholder' => 'Поиск музыки',
+ 'empty' => 'Треки не найдены',
+ 'play' => 'Слушать',
+ 'pause' => 'Пауза',
+ 'remove' => 'Убрать музыку',
+ 'part_hint' => 'Instagram не позволяет TryPost выбрать, какой фрагмент трека звучит.',
+ 'volume' => 'Громкость',
+ 'video_volume' => 'Видео',
+ 'audio_volume' => 'Музыка',
+ 'limited' => 'Результаты ограничены и могут отличаться от Instagram.',
+ 'search_failed' => 'Не удалось загрузить музыку из Instagram. Попробуйте ещё раз.',
+ 'too_many_searches' => 'Слишком много поисков музыки. Подождите минуту и попробуйте снова.',
+ 'requires_facebook' => 'Для музыки нужен аккаунт Instagram, подключённый через Facebook.',
+ 'link_title' => 'Подключите через Facebook, чтобы публиковать Reels с музыкой',
+ 'link_body' => 'Чтобы публиковать Reels с музыкой, привяжите Instagram к своей странице Facebook. Сначала мы сохраним пост как черновик. Потом откройте его в Черновиках и добавьте музыку.',
+ 'maybe_later' => 'Позже',
+ 'save_and_link' => 'Привязать',
+ 'save_and_link_blocked' => 'Этот пост пока нельзя сохранить. Дождитесь окончания загрузок и исправьте отмеченное, затем попробуйте снова.',
+ 'save_and_link_pending' => 'Этот пост ждёт одобрения. Одобрите его или переместите в черновики, прежде чем подключать Facebook.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Соавторы',
+ 'placeholder' => 'Имя в Instagram',
+ 'add' => 'Добавить',
+ 'remove' => 'Убрать :username',
+ 'max' => 'Добавьте не более :max соавторов.',
+ 'invalid' => 'Введите корректное имя пользователя Instagram.',
+ 'no_trial' => 'Недоступно в пробном Reels',
+ 'notice' => 'Instagram не подтверждает нам имя пользователя. Откройте профиль и проверьте, что это нужный аккаунт.',
+ 'got_it' => 'Понятно',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Пробный Reels',
+ 'off' => 'Выкл.',
+ 'auto' => 'Авто',
+ 'manual' => 'Вручную',
+ 'badge' => 'Проба',
+ 'auto_hint' => 'Пробный Reels сначала показывается тем, кто на вас не подписан. Если он хорошо зайдёт, Instagram автоматически покажет его подписчикам через 72 часа. Если нет, он не будет показан, пока вы не поделитесь им сами.',
+ 'manual_hint' => 'Сначала его видят неподписчики. Вы показываете его подписчикам, когда будете готовы.',
+ 'no_collaborators' => 'Недоступно с соавторами',
+ 'check_title' => 'Доступны ли пробные Reels, когда вы создаёте Reels в приложении Instagram?',
+ 'check_body' => 'Работает, только если в вашем аккаунте есть пробные Reels. Проверьте в приложении Instagram.',
+ 'checked' => 'Да, проверил',
+ 'not_checked' => 'Нет',
+ ],
],
'threads' => [
'topic' => 'Тема',
@@ -941,10 +992,19 @@ return [
'move_up' => 'Переместить выше',
'move_down' => 'Переместить ниже',
'duplicate' => 'Дублировать пост',
+ 'share_link' => 'Поделиться в посте',
+ 'copy_link' => 'Копировать ссылку',
'move_to_drafts' => 'Переместить в черновики',
'delete' => 'Удалить пост',
'add_to_queue' => 'Добавить в очередь',
- 'add_to_queue_disabled' => 'Добавьте время публикаций для этого канала, чтобы использовать очередь.',
+ 'add_to_queue_hint' => 'Добавляет в ближайшее свободное время канала.',
+ 'queue_setup' => [
+ 'title' => 'Вы ещё не настроили очередь этого канала',
+ 'body' => 'Чтобы добавлять посты в очередь, задайте время публикаций канала. Каждый пост из очереди выходит в ближайшее свободное время.',
+ 'body_member' => 'Чтобы добавлять посты в очередь, админ workspace должен задать время публикаций этого канала.',
+ 'not_now' => 'Не сейчас',
+ 'action' => 'Задать время',
+ ],
'more' => 'Другие действия',
'open_on_network' => 'Открыть пост в :network',
'see_insights' => 'Статистика поста',
diff --git a/lang/ru/settings.php b/lang/ru/settings.php
index 51ac2de6b..decc71503 100644
--- a/lang/ru/settings.php
+++ b/lang/ru/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Профиль',
- 'authentication' => 'Аутентификация',
'notifications' => 'Уведомления',
'preferences' => 'Предпочтения',
'general' => 'Общие',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Нажмите здесь, чтобы отправить письмо для подтверждения повторно.',
'verification_sent' => 'Новая ссылка для подтверждения отправлена на ваш email.',
'save' => 'Сохранить',
- ],
-
- 'authentication' => [
- 'title' => 'Аутентификация',
- 'page_title' => 'Настройки аутентификации',
+ 'tabs' => [
+ 'profile' => 'Профиль',
+ 'login' => 'Пароль и вход',
+ 'sessions' => 'Сеансы',
+ ],
'sessions' => [
'title' => 'Активные сессии',
'description' => 'Если заметите что-то подозрительное, выйдите на других устройствах.',
'unknown_browser' => 'Неизвестный браузер',
- 'unknown_ip' => 'Неизвестный IP',
'on' => 'на',
'active_now' => 'Активна сейчас',
+ 'last_activity' => 'Последняя активность :time',
'log_out_others' => 'Выйти на других устройствах',
'modal_title' => 'Выйти на других устройствах',
- 'modal_description_password' => 'Введите текущий пароль, чтобы подтвердить выход из других сессий браузера.',
- 'modal_description_email' => 'Введите свой адрес email, чтобы подтвердить выход из других сессий браузера.',
- 'password_placeholder' => 'Текущий пароль',
- 'email_placeholder' => 'Email вашего аккаунта',
+ 'modal_description' => 'Будет выполнен выход на всех остальных устройствах, где открыт ваш аккаунт. Эта сессия останется активной.',
'cancel' => 'Отмена',
'submit' => 'Выйти на других устройствах',
- 'email_mismatch' => 'Адрес email не совпадает с вашим аккаунтом.',
'flash_logged_out' => 'Вы вышли на других устройствах.',
],
'password' => [
diff --git a/lang/ru/welcome.php b/lang/ru/welcome.php
index c7fa6a185..b7d40d03b 100644
--- a/lang/ru/welcome.php
+++ b/lang/ru/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Подключить ИИ',
'pick_ai' => 'Где вы хотите использовать TryPost?',
'connect_other' => 'Подключить другое приложение',
- 'composer' => 'Спросите что угодно',
'connected' => ':client подключён',
'benefits' => [
'schedule' => [
diff --git a/lang/tr/accounts.php b/lang/tr/accounts.php
index 9d82088de..3a1fbad9e 100644
--- a/lang/tr/accounts.php
+++ b/lang/tr/accounts.php
@@ -56,6 +56,7 @@ return [
'description' => 'Özellikler, sahip olduğunuz Instagram hesabı türüne ve seçtiğiniz bağlantıya bağlıdır.',
'professional_title' => 'Profesyonel',
'professional_types' => '(İşletme ve İçerik Üreticisi)',
+ 'facebook_types' => '(bir Facebook sayfasına bağlı)',
'badge' => 'Otomatik paylaşım',
'features' => [
'automatic' => [
@@ -66,11 +67,13 @@ return [
'title' => 'Gönderilen gönderi metrikleri',
'description' => 'Geçmiş gönderilerin performansını görün',
],
+ 'music' => [
+ 'title' => 'Reels\'te müzik',
+ 'description' => 'Instagram kitaplığından bir parça ekle',
+ ],
],
'connect' => 'Instagram\'a bağlan',
'convert_hint' => 'Gerekirse Instagram, hesabınızı kolayca profesyonel hesaba dönüştürmenizi isteyecek.',
- 'facebook_link' => 'Instagram\'ı Facebook üzerinden bağlayın',
- 'facebook_suffix' => '(Instagram hesabınız şu anda Facebook\'a bağlıysa).',
'help' => [
'account_type' => 'Instagram hesap türünüzü öğrenme',
'convert' => 'Instagram hesabınızı profesyonel hesaba dönüştürme',
diff --git a/lang/tr/channels.php b/lang/tr/channels.php
index 54deb794e..5e2f95e2e 100644
--- a/lang/tr/channels.php
+++ b/lang/tr/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Yayın yapmaya devam etmek için bu kanalı yeniden bağlayın.',
'reconnect' => 'Yeniden bağla',
'refresh_connection' => 'Bağlantıyı yenile',
+ 'link_facebook_page' => 'Bir Facebook Sayfasına bağla',
'view_profile' => 'Profili görüntüle',
'disconnect' => 'Bağlantıyı kes',
'actions' => 'Kanal işlemleri',
'reorder' => [
'handle' => ':name öğesini sürükleyerek sırala',
- 'move_up' => 'Yukarı taşı',
- 'move_down' => 'Aşağı taşı',
'failed' => 'Kanallarınız yeniden sıralanamadı. Tekrar deneyin.',
'stale' => 'Sayfayı yüklediğinizden beri kanallarınız değişti. Yenileyip tekrar deneyin.',
],
diff --git a/lang/tr/common.php b/lang/tr/common.php
index 98a6d2c75..56b7d8e0b 100644
--- a/lang/tr/common.php
+++ b/lang/tr/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Geri',
+ 'unsaved_changes' => [
+
+ 'title' => 'Değişiklikler silinsin mi?',
+
+ 'description' => 'Bu gönderideki değişiklikler kaydedilmedi. Şimdi çıkarsan kaybolacaklar.',
+
+ 'discard' => 'Sil',
+
+ ],
+
'confirm_modal' => [
'type' => 'Yazın:',
'to_confirm' => 'onaylamak için.',
diff --git a/lang/tr/notes.php b/lang/tr/notes.php
index b276720d4..485e5755c 100644
--- a/lang/tr/notes.php
+++ b/lang/tr/notes.php
@@ -5,14 +5,15 @@ declare(strict_types=1);
return [
'placeholder' => 'Bir not yazın...',
'title' => 'Notlar',
+ 'show' => 'Notları göster',
+ 'hide' => 'Notları gizle',
'edit' => 'Düzenle',
'delete' => 'Sil',
'edited' => 'düzenlendi',
'save' => 'Kaydet',
'cancel' => 'İptal',
'send' => 'Gönder',
- 'empty_title' => 'Henüz not yok',
- 'empty_description' => 'Sohbeti başlatın.',
+ 'empty' => 'Henüz not yok. Notları yalnızca ekibin görür.',
'actions' => 'Not işlemleri',
'load_more' => 'Daha eski notları yükle',
];
diff --git a/lang/tr/posts.php b/lang/tr/posts.php
index d45bd2a3a..ec4f183f3 100644
--- a/lang/tr/posts.php
+++ b/lang/tr/posts.php
@@ -195,8 +195,8 @@ return [
'title' => 'Medyayı düzenle',
'description' => 'Bu gönderideki görselleri kırpın, ayarlayın, açıklayın ve kişileri etiketleyin.',
'edit_tab' => 'Düzenle',
- 'alt_tab' => 'Alternatif metin',
- 'tags_tab' => 'Kişileri etiketle',
+ 'alt_tab' => 'Alt metin',
+ 'tags_tab' => 'Etiketle',
'crop_tab' => 'Kırp',
'appearance_tab' => 'Görünüm',
'crop_heading' => 'Kırp ve dönüştür',
@@ -242,8 +242,11 @@ return [
'tags_save' => 'Etiketi kaydet',
'tags_cancel' => 'İptal',
'tags_remove' => '@:username etiketini kaldır',
+ 'tags_move' => 'Taşı',
+ 'tags_move_pill' => 'Yeni konumu seç',
+ 'tags_move_hint' => '@:username kişisini yerleştirmek için görsele tıkla.',
'tags_invalid' => 'Geçerli bir Instagram kullanıcı adı girin.',
- 'thumbnail_tab' => 'Küçük resim',
+ 'thumbnail_tab' => 'Kapak',
'thumbnail_heading' => 'Küçük resim seçin',
'thumbnail_hint' => 'Videonun kapağı olarak gösterilecek kareyi seçmek için kaydırıcıyı sürükleyin.',
'thumbnail_value' => ':seconds saniye',
@@ -349,6 +352,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'Akışta paylaş',
+ 'music' => [
+ 'label' => 'Müzik',
+ 'add' => 'Müzik ekle',
+ 'search_placeholder' => 'Müzik ara',
+ 'empty' => 'Parça bulunamadı',
+ 'play' => 'Önizlemeyi çal',
+ 'pause' => 'Önizlemeyi duraklat',
+ 'remove' => 'Müziği kaldır',
+ 'part_hint' => 'Instagram, parçanın hangi kısmının çalacağını TryPost\'un seçmesine izin vermiyor.',
+ 'volume' => 'Ses',
+ 'video_volume' => 'Video',
+ 'audio_volume' => 'Müzik',
+ 'limited' => 'Sonuçlar sınırlıdır ve Instagram\'dan farklı olabilir.',
+ 'search_failed' => 'Instagram müzikleri yüklenemedi. Tekrar dene.',
+ 'too_many_searches' => 'Çok fazla müzik araması yapıldı. Bir dakika bekleyip tekrar dene.',
+ 'requires_facebook' => 'Müzik için Facebook üzerinden bağlanmış bir Instagram hesabı gerekir.',
+ 'link_title' => 'Müzikli Reels yayınlamak için Facebook ile bağlan',
+ 'link_body' => 'Müzikli Reels yayınlamak için Instagram\'ı Facebook Sayfana bağla. Önce gönderini taslak olarak kaydedeceğiz. Ardından müzik eklemek için Taslaklar\'dan aç.',
+ 'maybe_later' => 'Sonra',
+ 'save_and_link' => 'Kaydet ve bağla',
+ 'save_and_link_blocked' => 'Bu gönderi henüz kaydedilemiyor. Yüklemelerin bitmesini bekle, işaretlenenleri düzelt ve tekrar dene.',
+ 'save_and_link_pending' => 'Bu gönderi onay bekliyor. Facebook\'u bağlamadan önce onayla ya da taslaklara taşı.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Ortak çalışanlar',
+ 'placeholder' => 'Instagram kullanıcı adı',
+ 'add' => 'Ekle',
+ 'remove' => ':username kaldır',
+ 'max' => 'En fazla :max ortak çalışan ekle.',
+ 'invalid' => 'Geçerli bir Instagram kullanıcı adı gir.',
+ 'no_trial' => 'Deneme Reels\'te kullanılamaz',
+ 'notice' => 'Instagram kullanıcı adını bizim için doğrulamıyor. Doğru hesap olduğunu kontrol etmek için profili aç.',
+ 'got_it' => 'Anladım',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Deneme Reels',
+ 'off' => 'Kapalı',
+ 'auto' => 'Otomatik',
+ 'manual' => 'Manuel',
+ 'badge' => 'Deneme',
+ 'auto_hint' => 'Deneme Reels\'in önce seni takip etmeyenlere gösterilir. İyi performans gösterirse Instagram 72 saat sonra otomatik olarak takipçilerinle paylaşır. Göstermezse sen paylaşmadıkça paylaşılmaz.',
+ 'manual_hint' => 'Önce seni takip etmeyenler görür. Hazır olduğunda takipçilerinle paylaşırsın.',
+ 'no_collaborators' => 'Ortak çalışanlarla kullanılamaz',
+ 'check_title' => 'Instagram uygulamasında Reels oluştururken deneme Reels seçeneği var mı?',
+ 'check_body' => 'Yalnızca hesabında deneme Reels varsa çalışır. Instagram uygulamasından kontrol et.',
+ 'checked' => 'Evet, kontrol ettim',
+ 'not_checked' => 'Hayır',
+ ],
],
'threads' => [
'topic' => 'Konu',
@@ -943,10 +994,19 @@ return [
'move_up' => 'Yukarı taşı',
'move_down' => 'Aşağı taşı',
'duplicate' => 'Gönderiyi çoğalt',
+ 'share_link' => 'Bir gönderide paylaş',
+ 'copy_link' => 'Bağlantıyı kopyala',
'move_to_drafts' => 'Taslaklara taşı',
'delete' => 'Gönderiyi sil',
'add_to_queue' => 'Kuyruğa ekle',
- 'add_to_queue_disabled' => 'Kuyruğu kullanmak için bu kanala paylaşım saatleri ekleyin.',
+ 'add_to_queue_hint' => 'Kanalın bir sonraki boş saatine ekler.',
+ 'queue_setup' => [
+ 'title' => 'Bu kanalın kuyruğunu henüz ayarlamadın',
+ 'body' => 'Kuyruğa gönderi eklemek için kanalın paylaşım saatlerini belirle. Kuyruktaki her gönderi bir sonraki boş saatte yayınlanır.',
+ 'body_member' => 'Kuyruğa gönderi eklemek için bir workspace yöneticisinin bu kanalın paylaşım saatlerini belirlemesi gerekiyor.',
+ 'not_now' => 'Şimdi değil',
+ 'action' => 'Saatleri ayarla',
+ ],
'more' => 'Diğer işlemler',
'open_on_network' => ':network üzerinde gönderiyi aç',
'see_insights' => 'Gönderi istatistiklerini gör',
diff --git a/lang/tr/settings.php b/lang/tr/settings.php
index 97f3c7c3d..909b75771 100644
--- a/lang/tr/settings.php
+++ b/lang/tr/settings.php
@@ -16,7 +16,6 @@ return [
],
'items' => [
'profile' => 'Profil',
- 'authentication' => 'Kimlik Doğrulama',
'notifications' => 'Bildirimler',
'preferences' => 'Tercihler',
'general' => 'Genel',
@@ -101,27 +100,23 @@ return [
'resend_verification' => 'Doğrulama e-postasını yeniden göndermek için buraya tıklayın.',
'verification_sent' => 'E-posta adresinize yeni bir doğrulama bağlantısı gönderildi.',
'save' => 'Kaydet',
- ],
-
- 'authentication' => [
- 'title' => 'Kimlik Doğrulama',
- 'page_title' => 'Kimlik doğrulama ayarları',
+ 'tabs' => [
+ 'profile' => 'Profil',
+ 'login' => 'Şifre ve giriş',
+ 'sessions' => 'Oturumlar',
+ ],
'sessions' => [
'title' => 'Etkin oturumlar',
'description' => 'Şüpheli bir şey fark ederseniz diğer cihazlardan çıkış yapın.',
'unknown_browser' => 'Bilinmeyen tarayıcı',
- 'unknown_ip' => 'Bilinmeyen IP',
'on' => 'tarih:',
'active_now' => 'Şu anda etkin',
+ 'last_activity' => 'Son etkinlik :time',
'log_out_others' => 'Diğer cihazlardan çıkış yap',
'modal_title' => 'Diğer cihazlardan çıkış yap',
- 'modal_description_password' => 'Diğer tarayıcı oturumlarından çıkış yapmak istediğinizi onaylamak için mevcut parolanızı girin.',
- 'modal_description_email' => 'Diğer tarayıcı oturumlarından çıkış yapmak istediğinizi onaylamak için e-posta adresinizi yazın.',
- 'password_placeholder' => 'Mevcut parola',
- 'email_placeholder' => 'Hesap e-postanız',
+ 'modal_description' => 'Hesabınızda oturum açık olan diğer tüm cihazlardan çıkış yapılacak. Bu oturum açık kalır.',
'cancel' => 'İptal',
'submit' => 'Diğer cihazlardan çıkış yap',
- 'email_mismatch' => 'E-posta adresi hesabınızla eşleşmiyor.',
'flash_logged_out' => 'Diğer cihazlardan çıkış yapıldı.',
],
'password' => [
diff --git a/lang/tr/welcome.php b/lang/tr/welcome.php
index 968bcbcef..1690b068c 100644
--- a/lang/tr/welcome.php
+++ b/lang/tr/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Yapay zekânı bağla',
'pick_ai' => 'TryPost’u nerede kullanmak istersin?',
'connect_other' => 'Başka uygulama bağla',
- 'composer' => 'Bir şey sor',
'connected' => ':client bağlandı',
'benefits' => [
'schedule' => [
diff --git a/lang/uk/accounts.php b/lang/uk/accounts.php
index 0fce3c21d..1f33f437c 100644
--- a/lang/uk/accounts.php
+++ b/lang/uk/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => 'Можливості залежать від типу вашого акаунта Instagram і вибраного способу підключення.',
'professional_title' => 'Професійний',
'professional_types' => '(Бізнес і Автор)',
+ 'facebook_types' => '(пов’язаний зі сторінкою Facebook)',
'badge' => 'Автоматична публікація',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => 'Метрики опублікованих дописів',
'description' => 'Переглядайте результати минулих дописів',
],
+ 'music' => [
+ 'title' => 'Музика в Reels',
+ 'description' => 'Додайте трек із бібліотеки Instagram',
+ ],
],
'connect' => 'Підключитися до Instagram',
'convert_hint' => 'За потреби Instagram запропонує легко перейти на професійний акаунт.',
- 'facebook_link' => 'Підключіть Instagram через Facebook',
- 'facebook_suffix' => '(якщо ваш акаунт Instagram зараз пов’язаний із Facebook).',
'help' => [
'account_type' => 'Як дізнатися тип акаунта Instagram',
'convert' => 'Як перевести акаунт Instagram у професійний',
diff --git a/lang/uk/channels.php b/lang/uk/channels.php
index 1eca911f7..bfeb9bbd7 100644
--- a/lang/uk/channels.php
+++ b/lang/uk/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => 'Перепідключіть цей канал, щоб продовжити публікації.',
'reconnect' => 'Перепідключити',
'refresh_connection' => 'Оновити підключення',
+ 'link_facebook_page' => 'Пов’язати зі сторінкою Facebook',
'view_profile' => 'Переглянути профіль',
'disconnect' => 'Від’єднати',
'actions' => 'Дії з каналом',
'reorder' => [
'handle' => 'Перетягніть, щоб змінити порядок: :name',
- 'move_up' => 'Перемістити вгору',
- 'move_down' => 'Перемістити вниз',
'failed' => 'Не вдалося змінити порядок каналів. Спробуйте ще раз.',
'stale' => 'Ваші канали змінилися після завантаження сторінки. Оновіть її та спробуйте ще раз.',
],
diff --git a/lang/uk/common.php b/lang/uk/common.php
index 3cd0d7df9..b36c38724 100644
--- a/lang/uk/common.php
+++ b/lang/uk/common.php
@@ -7,6 +7,16 @@ return [
'back' => 'Назад',
+ 'unsaved_changes' => [
+
+ 'title' => 'Скасувати зміни?',
+
+ 'description' => 'Зміни в цьому дописі не збережено. Якщо ви підете зараз, їх буде втрачено.',
+
+ 'discard' => 'Скасувати',
+
+ ],
+
'confirm_modal' => [
'type' => 'Введіть',
'to_confirm' => 'для підтвердження.',
diff --git a/lang/uk/notes.php b/lang/uk/notes.php
index 7ba77174c..959964ecf 100644
--- a/lang/uk/notes.php
+++ b/lang/uk/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => 'Напишіть нотатку...',
'title' => 'Нотатки',
+ 'show' => 'Показати нотатки',
+ 'hide' => 'Сховати нотатки',
'edit' => 'Редагувати',
'delete' => 'Видалити',
'edited' => 'змінено',
'save' => 'Зберегти',
'cancel' => 'Скасувати',
'send' => 'Надіслати',
- 'empty_title' => 'Нотаток ще немає',
- 'empty_description' => 'Почніть розмову.',
+ 'empty' => 'Нотаток ще немає. Їх бачить лише ваша команда.',
'actions' => 'Дії з нотаткою',
'load_more' => 'Завантажити старіші нотатки',
];
diff --git a/lang/uk/posts.php b/lang/uk/posts.php
index 4783f3423..431d5574e 100644
--- a/lang/uk/posts.php
+++ b/lang/uk/posts.php
@@ -193,8 +193,8 @@ return [
'title' => 'Редагувати медіа',
'description' => 'Обріжте, налаштуйте, опишіть зображення цього допису та позначте на них людей.',
'edit_tab' => 'Редагувати',
- 'alt_tab' => 'Альтернативний текст',
- 'tags_tab' => 'Позначити людей',
+ 'alt_tab' => 'Альт-текст',
+ 'tags_tab' => 'Позначки',
'crop_tab' => 'Обрізання',
'appearance_tab' => 'Вигляд',
'crop_heading' => 'Обрізання та трансформація',
@@ -240,6 +240,9 @@ return [
'tags_save' => 'Зберегти позначку',
'tags_cancel' => 'Скасувати',
'tags_remove' => 'Видалити @:username',
+ 'tags_move' => 'Перемістити',
+ 'tags_move_pill' => 'Виберіть нове місце',
+ 'tags_move_hint' => 'Натисніть на зображення, щоб розмістити @:username.',
'tags_invalid' => 'Введіть коректне ім\'я користувача Instagram.',
'thumbnail_tab' => 'Обкладинка',
'thumbnail_heading' => 'Виберіть обкладинку',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => 'У стрічку',
+ 'music' => [
+ 'label' => 'Музика',
+ 'add' => 'Додати',
+ 'search_placeholder' => 'Пошук музики',
+ 'empty' => 'Треків не знайдено',
+ 'play' => 'Слухати',
+ 'pause' => 'Пауза',
+ 'remove' => 'Прибрати музику',
+ 'part_hint' => 'Instagram не дозволяє TryPost вибрати, який фрагмент треку звучить.',
+ 'volume' => 'Гучність',
+ 'video_volume' => 'Відео',
+ 'audio_volume' => 'Музика',
+ 'limited' => 'Результати обмежені й можуть відрізнятися від Instagram.',
+ 'search_failed' => 'Не вдалося завантажити музику з Instagram. Спробуйте ще раз.',
+ 'too_many_searches' => 'Забагато пошуків музики. Зачекайте хвилину й спробуйте ще раз.',
+ 'requires_facebook' => 'Для музики потрібен акаунт Instagram, підключений через Facebook.',
+ 'link_title' => 'Підключіть через Facebook, щоб публікувати Reels з музикою',
+ 'link_body' => 'Щоб публікувати Reels з музикою, привʼяжіть Instagram до своєї сторінки Facebook. Спершу ми збережемо допис як чернетку. Потім відкрийте його в Чернетках і додайте музику.',
+ 'maybe_later' => 'Пізніше',
+ 'save_and_link' => 'Привʼязати',
+ 'save_and_link_blocked' => 'Цей пост поки не можна зберегти. Дочекайтеся завершення завантажень і виправте позначене, потім спробуйте ще раз.',
+ 'save_and_link_pending' => 'Цей пост чекає на схвалення. Схваліть його або перемістіть у чернетки, перш ніж підключати Facebook.',
+ ],
+ 'collaborators' => [
+ 'label' => 'Співавтори',
+ 'placeholder' => 'Імʼя в Instagram',
+ 'add' => 'Додати',
+ 'remove' => 'Прибрати :username',
+ 'max' => 'Додайте не більше :max співавторів.',
+ 'invalid' => 'Введіть коректне імʼя користувача Instagram.',
+ 'no_trial' => 'Недоступно в пробному Reels',
+ 'notice' => 'Instagram не підтверджує нам імʼя користувача. Відкрийте профіль і перевірте, що це потрібний акаунт.',
+ 'got_it' => 'Зрозуміло',
+ ],
+ 'trial_reel' => [
+ 'label' => 'Пробний Reels',
+ 'off' => 'Вимк.',
+ 'auto' => 'Авто',
+ 'manual' => 'Вручну',
+ 'badge' => 'Проба',
+ 'auto_hint' => 'Пробний Reels спершу бачать ті, хто на вас не підписаний. Якщо він добре зайде, Instagram автоматично покаже його підписникам через 72 години. Якщо ні, його не буде показано, доки ви не поділитеся ним самі.',
+ 'manual_hint' => 'Спершу його бачать непідписники. Ви показуєте його підписникам, коли будете готові.',
+ 'no_collaborators' => 'Недоступно зі співавторами',
+ 'check_title' => 'Чи доступні пробні Reels, коли ви створюєте Reels у застосунку Instagram?',
+ 'check_body' => 'Працює, лише якщо у вашому акаунті є пробні Reels. Перевірте в застосунку Instagram.',
+ 'checked' => 'Так, перевірив',
+ 'not_checked' => 'Ні',
+ ],
],
'threads' => [
'topic' => 'Тема',
@@ -941,10 +992,19 @@ return [
'move_up' => 'Перемістити вище',
'move_down' => 'Перемістити нижче',
'duplicate' => 'Дублювати пост',
+ 'share_link' => 'Поділитися в дописі',
+ 'copy_link' => 'Копіювати посилання',
'move_to_drafts' => 'Перемістити до чернеток',
'delete' => 'Видалити пост',
'add_to_queue' => 'Додати до черги',
- 'add_to_queue_disabled' => 'Додайте час публікацій для цього каналу, щоб користуватися чергою.',
+ 'add_to_queue_hint' => 'Додає в найближчий вільний час каналу.',
+ 'queue_setup' => [
+ 'title' => 'Ви ще не налаштували чергу цього каналу',
+ 'body' => 'Щоб додавати пости в чергу, задайте час публікацій каналу. Кожен пост із черги виходить у найближчий вільний час.',
+ 'body_member' => 'Щоб додавати пости в чергу, адмін workspace має задати час публікацій цього каналу.',
+ 'not_now' => 'Не зараз',
+ 'action' => 'Задати час',
+ ],
'more' => 'Інші дії',
'open_on_network' => 'Відкрити допис у :network',
'see_insights' => 'Статистика допису',
diff --git a/lang/uk/settings.php b/lang/uk/settings.php
index 152181459..986e8b588 100644
--- a/lang/uk/settings.php
+++ b/lang/uk/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => 'Профіль',
- 'authentication' => 'Автентифікація',
'notifications' => 'Сповіщення',
'preferences' => 'Уподобання',
'general' => 'Загальні',
@@ -99,27 +98,23 @@ return [
'resend_verification' => 'Натисніть тут, щоб надіслати лист підтвердження ще раз.',
'verification_sent' => 'Нове посилання для підтвердження надіслано на вашу адресу email.',
'save' => 'Зберегти',
- ],
-
- 'authentication' => [
- 'title' => 'Автентифікація',
- 'page_title' => 'Налаштування автентифікації',
+ 'tabs' => [
+ 'profile' => 'Профіль',
+ 'login' => 'Пароль і вхід',
+ 'sessions' => 'Сеанси',
+ ],
'sessions' => [
'title' => 'Активні сесії',
'description' => 'Якщо помітили щось підозріле, вийдіть з інших пристроїв.',
'unknown_browser' => 'Невідомий браузер',
- 'unknown_ip' => 'Невідомий IP',
'on' => 'на',
'active_now' => 'Активна зараз',
+ 'last_activity' => 'Остання активність :time',
'log_out_others' => 'Вийти з інших пристроїв',
'modal_title' => 'Вийти з інших пристроїв',
- 'modal_description_password' => 'Введіть поточний пароль, щоб підтвердити вихід з інших сесій браузера.',
- 'modal_description_email' => 'Введіть адресу email, щоб підтвердити вихід з інших сесій браузера.',
- 'password_placeholder' => 'Поточний пароль',
- 'email_placeholder' => 'Email вашого облікового запису',
+ 'modal_description' => 'Буде виконано вихід на всіх інших пристроях, де відкрито ваш акаунт. Ця сесія залишиться активною.',
'cancel' => 'Скасувати',
'submit' => 'Вийти з інших пристроїв',
- 'email_mismatch' => 'Адреса email не збігається з вашим обліковим записом.',
'flash_logged_out' => 'Ви вийшли з інших пристроїв.',
],
'password' => [
diff --git a/lang/uk/welcome.php b/lang/uk/welcome.php
index 946dd661b..135b45ee2 100644
--- a/lang/uk/welcome.php
+++ b/lang/uk/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => 'Підключити ШІ',
'pick_ai' => 'Де ви хочете використовувати TryPost?',
'connect_other' => 'Підключити інший застосунок',
- 'composer' => 'Запитайте будь-що',
'connected' => ':client підключено',
'benefits' => [
'schedule' => [
diff --git a/lang/zh/accounts.php b/lang/zh/accounts.php
index 90ca4705a..10230f0e2 100644
--- a/lang/zh/accounts.php
+++ b/lang/zh/accounts.php
@@ -54,6 +54,7 @@ return [
'description' => '可用功能取决于你的 Instagram 账号类型以及所选的连接方式。',
'professional_title' => '专业账号',
'professional_types' => '(商家和创作者)',
+ 'facebook_types' => '(已关联 Facebook 公共主页)',
'badge' => '自动发布',
'features' => [
'automatic' => [
@@ -64,11 +65,13 @@ return [
'title' => '已发布帖子数据',
'description' => '查看过往帖子的表现',
],
+ 'music' => [
+ 'title' => 'Reels 配乐',
+ 'description' => '从 Instagram 曲库添加音乐',
+ ],
],
'connect' => '连接到 Instagram',
'convert_hint' => '如有需要,Instagram 会提示你轻松转换为专业账号。',
- 'facebook_link' => '通过 Facebook 连接 Instagram',
- 'facebook_suffix' => '(如果你的 Instagram 账号已关联 Facebook)。',
'help' => [
'account_type' => '查看你的 Instagram 账号类型',
'convert' => '将 Instagram 账号转换为专业账号',
diff --git a/lang/zh/channels.php b/lang/zh/channels.php
index 4a213956f..81670132b 100644
--- a/lang/zh/channels.php
+++ b/lang/zh/channels.php
@@ -16,14 +16,13 @@ return [
'connection_lost_hint' => '请重新连接此频道以继续发布。',
'reconnect' => '重新连接',
'refresh_connection' => '刷新连接',
+ 'link_facebook_page' => '关联 Facebook 主页',
'view_profile' => '查看主页',
'disconnect' => '断开连接',
'actions' => '频道操作',
'reorder' => [
'handle' => '拖动以重新排序 :name',
- 'move_up' => '上移',
- 'move_down' => '下移',
'failed' => '无法重新排序你的频道。请重试。',
'stale' => '加载页面后你的频道已发生变化。请刷新后重试。',
],
diff --git a/lang/zh/common.php b/lang/zh/common.php
index 32975277a..af7aa752e 100644
--- a/lang/zh/common.php
+++ b/lang/zh/common.php
@@ -7,6 +7,16 @@ return [
'back' => '返回',
+ 'unsaved_changes' => [
+
+ 'title' => '放弃更改?',
+
+ 'description' => '此帖子的更改尚未保存。如果现在离开,这些更改将会丢失。',
+
+ 'discard' => '放弃',
+
+ ],
+
'confirm_modal' => [
'type' => '输入',
'to_confirm' => '以确认。',
diff --git a/lang/zh/notes.php b/lang/zh/notes.php
index 8653bd928..5f019db3b 100644
--- a/lang/zh/notes.php
+++ b/lang/zh/notes.php
@@ -3,14 +3,15 @@
return [
'placeholder' => '写下备注…',
'title' => '备注',
+ 'show' => '显示备注',
+ 'hide' => '隐藏备注',
'edit' => '编辑',
'delete' => '删除',
'edited' => '已编辑',
'save' => '保存',
'cancel' => '取消',
'send' => '发送',
- 'empty_title' => '暂无备注',
- 'empty_description' => '快来开启对话吧。',
+ 'empty' => '暂无备注。只有你的团队能看到。',
'actions' => '备注操作',
'load_more' => '加载更早的备注',
];
diff --git a/lang/zh/posts.php b/lang/zh/posts.php
index 4de091b98..f5e33de90 100644
--- a/lang/zh/posts.php
+++ b/lang/zh/posts.php
@@ -240,6 +240,9 @@ return [
'tags_save' => '保存标记',
'tags_cancel' => '取消',
'tags_remove' => '移除 @:username',
+ 'tags_move' => '移动',
+ 'tags_move_pill' => '选择新位置',
+ 'tags_move_hint' => '点击图片以放置 @:username。',
'tags_invalid' => '请输入有效的 Instagram 用户名。',
'thumbnail_tab' => '缩略图',
'thumbnail_heading' => '选择缩略图',
@@ -347,6 +350,54 @@ return [
],
'instagram' => [
'share_to_feed' => '同时分享到动态',
+ 'music' => [
+ 'label' => '音乐',
+ 'add' => '添加音乐',
+ 'search_placeholder' => '搜索音乐',
+ 'empty' => '未找到曲目',
+ 'play' => '试听',
+ 'pause' => '暂停',
+ 'remove' => '移除音乐',
+ 'part_hint' => 'Instagram 不允许 TryPost 选择播放曲目的哪一段。',
+ 'volume' => '音量',
+ 'video_volume' => '视频',
+ 'audio_volume' => '音乐',
+ 'limited' => '结果有限,可能与 Instagram 中的不同。',
+ 'search_failed' => '无法加载 Instagram 音乐,请重试。',
+ 'too_many_searches' => '音乐搜索次数过多。请等待一分钟后重试。',
+ 'requires_facebook' => '音乐需要通过 Facebook 连接的 Instagram 账号。',
+ 'link_title' => '通过 Facebook 连接以发布带音乐的 Reels',
+ 'link_body' => '要发布带音乐的 Instagram Reels,请将 Instagram 关联到你的 Facebook 公共主页。关联前我们会先把帖子保存为草稿。之后从草稿中打开它来添加音乐。',
+ 'maybe_later' => '以后再说',
+ 'save_and_link' => '保存并关联',
+ 'save_and_link_blocked' => '此帖子暂时无法保存。请等待上传完成并修正标出的问题,然后重试。',
+ 'save_and_link_pending' => '此帖子正在等待审批。关联 Facebook 前,请先批准或将其移到草稿。',
+ ],
+ 'collaborators' => [
+ 'label' => '协作者',
+ 'placeholder' => '输入 Instagram 用户名',
+ 'add' => '添加协作者',
+ 'remove' => '移除 :username',
+ 'max' => '最多添加 :max 位协作者。',
+ 'invalid' => '请输入有效的 Instagram 用户名。',
+ 'no_trial' => '试播 Reels 不可用',
+ 'notice' => 'Instagram 无法为我们确认用户名。请打开主页确认是正确的账号。',
+ 'got_it' => '知道了',
+ ],
+ 'trial_reel' => [
+ 'label' => '试播 Reels',
+ 'off' => '关闭',
+ 'auto' => '自动',
+ 'manual' => '手动',
+ 'badge' => '试播',
+ 'auto_hint' => '试播 Reels 会先展示给非粉丝。如果表现良好,Instagram 会在 72 小时后自动分享给你的粉丝。否则,除非你自己分享,否则不会分享。',
+ 'manual_hint' => '非粉丝会先看到。准备好后再分享给你的粉丝。',
+ 'no_collaborators' => '有协作者时不可用',
+ 'check_title' => '在 Instagram 应用中创建 Reels 时,是否可以使用试播 Reels?',
+ 'check_body' => '仅当你的账号可以使用试播 Reels 时才有效。请在 Instagram 应用中确认。',
+ 'checked' => '是,已确认',
+ 'not_checked' => '否',
+ ],
],
'threads' => [
'topic' => '话题',
@@ -941,10 +992,19 @@ return [
'move_up' => '上移',
'move_down' => '下移',
'duplicate' => '复制帖子',
+ 'share_link' => '在帖子中分享链接',
+ 'copy_link' => '复制链接',
'move_to_drafts' => '移至草稿',
'delete' => '删除帖子',
'add_to_queue' => '加入队列',
- 'add_to_queue_disabled' => '请先为此频道添加发布时间,以使用队列。',
+ 'add_to_queue_hint' => '添加到该频道的下一个空闲发布时间。',
+ 'queue_setup' => [
+ 'title' => '你还没有设置这个频道的队列',
+ 'body' => '要把帖子加入队列,请设置频道的发布时间。队列中的每篇帖子都会在下一个空闲时间发出。',
+ 'body_member' => '要把帖子加入队列,需要工作区管理员设置这个频道的发布时间。',
+ 'not_now' => '以后再说',
+ 'action' => '设置发布时间',
+ ],
'more' => '更多操作',
'open_on_network' => '在 :network 上打开帖子',
'see_insights' => '查看帖子洞察',
diff --git a/lang/zh/settings.php b/lang/zh/settings.php
index a6bbacf10..528369312 100644
--- a/lang/zh/settings.php
+++ b/lang/zh/settings.php
@@ -14,7 +14,6 @@ return [
],
'items' => [
'profile' => '个人资料',
- 'authentication' => '身份验证',
'notifications' => '通知',
'preferences' => '偏好设置',
'general' => '常规',
@@ -99,27 +98,23 @@ return [
'resend_verification' => '点击此处重新发送验证邮件。',
'verification_sent' => '新的验证链接已发送至你的邮箱地址。',
'save' => '保存',
- ],
-
- 'authentication' => [
- 'title' => '身份验证',
- 'page_title' => '身份验证设置',
+ 'tabs' => [
+ 'profile' => '个人资料',
+ 'login' => '密码与登录',
+ 'sessions' => '会话',
+ ],
'sessions' => [
'title' => '活动会话',
'description' => '如果你发现任何可疑情况,请退出其他设备的登录。',
'unknown_browser' => '未知浏览器',
- 'unknown_ip' => '未知 IP',
'on' => '于',
'active_now' => '当前活动',
+ 'last_activity' => '最后活动::time',
'log_out_others' => '退出其他设备',
'modal_title' => '退出其他设备',
- 'modal_description_password' => '输入你当前的密码,以确认你要退出其他浏览器会话。',
- 'modal_description_email' => '输入你的邮箱地址,以确认你要退出其他浏览器会话。',
- 'password_placeholder' => '当前密码',
- 'email_placeholder' => '你的账户邮箱',
+ 'modal_description' => '登录你账户的所有其他设备都将退出登录。当前会话保持登录。',
'cancel' => '取消',
'submit' => '退出其他设备',
- 'email_mismatch' => '该邮箱地址与你的账户不匹配。',
'flash_logged_out' => '你已从其他设备退出登录。',
],
'password' => [
diff --git a/lang/zh/welcome.php b/lang/zh/welcome.php
index ee35b79bc..dfb4d08ab 100644
--- a/lang/zh/welcome.php
+++ b/lang/zh/welcome.php
@@ -58,7 +58,6 @@ return [
'connect_ai' => '连接你的 AI',
'pick_ai' => '你想在哪里使用 TryPost?',
'connect_other' => '连接其他应用',
- 'composer' => '有问题,尽管问',
'connected' => ':client 已连接',
'benefits' => [
'schedule' => [
diff --git a/public/images/browsers/chrome.svg b/public/images/browsers/chrome.svg
new file mode 100644
index 000000000..bf9993fb1
--- /dev/null
+++ b/public/images/browsers/chrome.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -10 276 276"><linearGradient id="a" x1="145" x2="34" y1="253" y2="61" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1e8e3e"/><stop offset="1" stop-color="#34a853"/></linearGradient><linearGradient id="b" x1="111" x2="222" y1="254" y2="62" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fcc934"/><stop offset="1" stop-color="#fbbc04"/></linearGradient><linearGradient id="c" x1="17" x2="239" y1="80" y2="80" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#d93025"/><stop offset="1" stop-color="#ea4335"/></linearGradient><circle cx="128" cy="128" r="64" fill="#fff"/><path fill="url(#a)" d="M96 183.4A63.7 63.7 0 0 1 72.6 160L17.2 64A128 128 0 0 0 128 256l55.4-96A64 64 0 0 1 96 183.4Z"/><path fill="url(#b)" d="M192 128a63.7 63.7 0 0 1-8.6 32L128 256A128 128 0 0 0 238.9 64h-111a64 64 0 0 1 64 64Z"/><circle cx="128" cy="128" r="52" fill="#1a73e8"/><path fill="url(#c)" d="M96 72.6a63.7 63.7 0 0 1 32-8.6h110.8a128 128 0 0 0-221.7 0l55.5 96A64 64 0 0 1 96 72.6Z"/></svg>
diff --git a/public/images/browsers/chromium.svg b/public/images/browsers/chromium.svg
new file mode 100644
index 000000000..f3adc1771
--- /dev/null
+++ b/public/images/browsers/chromium.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -10 276 276"><circle cx="128" cy="128" r="64" fill="#fff"/><path fill="#669df6" d="M96 183.4A63.7 63.7 0 0 1 72.6 160L17.2 64A128 128 0 0 0 128 256l55.4-96A64 64 0 0 1 96 183.4Z"/><path fill="#aecbfa" d="M192 128a63.7 63.7 0 0 1-8.6 32L128 256A128 128 0 0 0 238.9 64h-111a64 64 0 0 1 64 64Z"/><circle cx="128" cy="128" r="52" fill="#1a73e8"/><path fill="#1967d2" d="M96 72.6a63.7 63.7 0 0 1 32-8.6h110.8a128 128 0 0 0-221.7 0l55.5 96A64 64 0 0 1 96 72.6Z"/></svg>
diff --git a/public/images/browsers/curl.svg b/public/images/browsers/curl.svg
new file mode 100644
index 000000000..a864f342a
--- /dev/null
+++ b/public/images/browsers/curl.svg
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="343pt" height="103pt" version="1.1" viewBox="0 0 343 103" xmlns="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
+<title>curl logo</title>
+ <metadata>
+ <rdf:RDF>
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+ <dc:title/>
+ </rdf:RDF>
+ </metadata>
+ <defs>
+ <symbol id="vlpd" overflow="visible" style="overflow:visible">
+ <path d="m15-26.8c0 7.09 1.33 10.6 6.86 15.1l8.53 7.11c5.41 4.44 8.17 4.56 14.9 4.56h18.3c3.84 0 7.94-0.844 7.94-5.77 0-5.06-4.56-5.78-7.94-5.78h-20.3c-2.3 0-4.58-1.2-6.62-2.89l-6.97-5.89c-1.81-1.44-3.12-2.64-3.12-4.92v-14.3c0-2.28 1.31-3.48 3.12-4.94l6.97-5.89c2.05-1.67 4.33-2.88 6.62-2.88h20.3c3.38 0 7.94-0.734 7.94-5.78 0-4.92-4.09-5.77-7.94-5.77h-18.3c-6.73 0-9.5 0.125-14.9 4.56l-8.53 7.09c-5.53 4.58-6.86 8.06-6.86 15.2z"/>
+ </symbol>
+ <symbol id="vlpc" overflow="visible" style="overflow:visible">
+ <path d="m71.5-56.9c0-3.97-0.844-7.94-5.77-7.94-4.94 0-5.78 3.97-5.78 7.94v33.5l-17 10.7c-1.08 0.719-2.28 1.08-3.61 1.08h-3.84c-2.77 0-5.77-0.719-6.73-2.41-0.969-1.67-1.08-4.81-1.2-7.45l-1.2-35.5c-0.125-3.73-0.719-7.94-5.66-7.94-5.28 0-5.89 4.45-5.77 8.66l1.2 36.3c0.234 6.25 0.125 11.2 5.3 15.6 3.84 3.23 7.45 4.2 10.7 4.2h8.53c3.12 0 6.25-1.44 9.98-3.84l9.38-6.14v1.92c0 3.97 0.844 8.06 5.77 8.06 6.14 0 5.66-5.89 5.66-8.53z"/>
+ </symbol>
+ <symbol id="vlpb" overflow="visible" style="overflow:visible">
+ <path d="m15-7.94c0 3.97 0.844 7.94 5.77 7.94 4.94 0 5.78-3.97 5.78-7.94v-29.2l16.1-13.3c2.05-1.69 3.61-2.77 5.77-2.77h3.38c2.77 0 5.53 0 6.97 2.05 1.2 1.67 1.2 3.12 1.2 5.05 0 3.72 1.69 7.09 5.89 7.09 4.94 0 5.66-4.09 5.66-8.06 0-5.28-1.33-9.25-5.17-13.1-3.12-3.12-6.84-4.56-11.3-4.56h-9.27c-3.61 0-6.97 2.28-10.2 4.92l-9.02 7.47v-4.7c0-3.84-1.2-7.69-5.78-7.69-5.28 0-5.77 4.33-5.77 8.53z"/>
+ </symbol>
+ <symbol id="vlpa" overflow="visible" style="overflow:visible">
+ <path d="m49.3-80.6c0-6.86-1.92-8.06-8.53-8.06h-12.1c-3.86 0-7.94 0.844-7.94 5.77 0 5.06 4.56 5.78 7.94 5.78h9.14v65.5h-9.14c-3.86 0-7.94 0.844-7.94 5.78 0 5.05 4.56 5.77 7.94 5.77h29.3c3.38 0 7.94-0.719 7.94-5.77 0-4.94-4.08-5.78-7.94-5.78h-8.66z"/>
+ </symbol>
+ </defs>
+ <path d="m334 14c-2.74 0-4.96-2.22-4.96-4.96 0-2.74 2.22-4.96 4.96-4.96 2.74 0 4.96 2.22 4.96 4.96 0 2.74-2.22 4.96-4.96 4.96m-49.3 84.8c-2.74 0-4.96-2.22-4.96-4.96 0-2.74 2.22-4.96 4.96-4.96 2.74 0 4.96 2.22 4.96 4.96 0 2.74-2.22 4.96-4.96 4.96m49.3-98.8c-5.02 0-9.08 4.07-9.08 9.08 0 1.07 0.27 2.07 0.609 3.02l-42.6 73c-4.12 0.863-7.27 4.34-7.27 8.72 0 5.02 4.07 9.08 9.08 9.08 5.01 0 9.08-4.07 9.08-9.08 0-1.01-0.27-1.93-0.57-2.84l42.8-73.3c3.99-0.957 7.02-4.38 7.02-8.66 0-5.02-4.07-9.08-9.08-9.08" style="fill:#0c544c"/>
+ <path d="m297 14c-2.74 0-4.96-2.22-4.96-4.96 0-2.74 2.22-4.96 4.96-4.96 2.74 0 4.96 2.22 4.96 4.96 0 2.74-2.22 4.96-4.96 4.96m-49.3 84.8c-2.74 0-4.96-2.22-4.96-4.96 0-2.74 2.22-4.96 4.96-4.96 2.74 0 4.96 2.22 4.96 4.96 0 2.74-2.22 4.96-4.96 4.96m49.3-98.8c-5.02 0-9.08 4.07-9.08 9.08 0 1.07 0.27 2.07 0.609 3.02l-42.6 73c-4.12 0.863-7.28 4.34-7.28 8.72 0 5.02 4.07 9.08 9.08 9.08 5.02 0 9.08-4.07 9.08-9.08 0-1.01-0.27-1.93-0.57-2.84l42.8-73.3c3.99-0.957 7.02-4.38 7.02-8.66 0-5.02-4.07-9.08-9.08-9.08" style="fill:#073551"/>
+ <path d="m229 29.2c2.74 0 4.96 2.22 4.96 4.96s-2.22 4.96-4.96 4.96c-2.74 0-4.96-2.22-4.96-4.96s2.22-4.96 4.96-4.96m0 14c5.02 0 9.08-4.07 9.08-9.08 0-1-0.273-1.93-0.574-2.84-1.2-3.61-4.5-6.25-8.51-6.25-0.641 0-1.2 0.238-1.81 0.367-4.12 0.859-7.27 4.34-7.27 8.71 0 5.02 4.07 9.08 9.08 9.08" style="fill:#073551"/>
+ <path d="m224 65.9c0-2.74 2.22-4.96 4.96-4.96s4.96 2.22 4.96 4.96c0 2.74-2.22 4.96-4.96 4.96s-4.96-2.22-4.96-4.96m14 0c0-1.01-0.273-1.93-0.574-2.84-1.2-3.61-4.5-6.25-8.51-6.25-0.641 0-1.2 0.238-1.81 0.363-4.12 0.863-7.27 4.34-7.27 8.72 0 5.01 4.07 9.08 9.08 9.08 5.02 0 9.08-4.07 9.08-9.08" style="fill:#073551"/>
+ <use transform="translate(-86.2 -184)" x="71.179703" y="286.97659" width="100%" height="100%" style="fill:#073551" xlink:href="#vlpd"/>
+ <use transform="translate(-86.2 -184)" x="133.71095" y="286.97659" width="100%" height="100%" style="fill:#073551" xlink:href="#vlpc"/>
+ <use transform="translate(-86.2 -184)" x="196.2422" y="286.97659" width="100%" height="100%" style="fill:#073551" xlink:href="#vlpb"/>
+ <use transform="translate(-86.2 -184)" x="239.65331" y="286.97659" width="100%" height="100%" style="fill:#073551" xlink:href="#vlpa"/>
+</svg>
diff --git a/public/images/browsers/duckduckgo.svg b/public/images/browsers/duckduckgo.svg
new file mode 100644
index 000000000..690f653b0
--- /dev/null
+++ b/public/images/browsers/duckduckgo.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="64" height="64" viewBox="0 0 32 32"><g transform="matrix(.266667 0 0 .266667 -17.954934 -5.057333)"><circle cx="127.332" cy="78.966" r="51.15" fill="#de5833"/><defs><path id="A" d="M178.684 78.824c0 28.316-23.035 51.354-51.354 51.354-28.313 0-51.348-23.04-51.348-51.354s23.036-51.35 51.348-51.35c28.318 0 51.354 23.036 51.354 51.35z"/></defs><clipPath id="B"><use xlink:href="#A"/></clipPath><g clip-path="url(#B)"><path d="M148.293 155.158c-1.8-8.285-12.262-27.04-16.23-34.97s-7.938-19.1-6.13-26.322c.328-1.312-3.436-11.308-2.354-12.015 8.416-5.5 10.632.6 14.002-1.862 1.734-1.273 4.1 1.047 4.7-1.06 2.158-7.567-3.006-20.76-8.77-26.526-1.885-1.88-4.77-3.06-8.03-3.687-1.254-1.713-3.275-3.36-6.138-4.88-3.188-1.697-10.12-3.938-13.717-4.535-2.492-.4-3.055.287-4.12.46.992.088 5.7 2.414 6.615 2.55-.916.62-3.607-.028-5.324.742-.865.392-1.512 1.877-1.506 2.58 4.9-.496 12.574-.016 17.1 2-3.602.4-9.08.867-11.436 2.105-6.848 3.608-9.873 12.035-8.07 22.133 1.804 10.075 9.738 46.85 12.262 59.13 2.525 12.264-5.408 20.2-10.455 22.354l5.408.363-1.8 3.967c6.484.72 13.695-1.44 13.695-1.44-1.438 3.965-11.176 5.412-11.176 5.412s4.7 1.438 12.258-1.447l12.263-4.688 3.604 9.373 6.854-6.847 2.885 7.2c.014-.001 5.424-1.808 3.62-10.103z" fill="#d5d7d8"/><path d="M150.47 153.477c-1.795-8.3-12.256-27.043-16.228-34.98s-7.935-19.112-6.13-26.32c.335-1.3.34-6.668 1.43-7.38 8.4-5.494 7.812-.184 11.187-2.645 1.74-1.27 3.133-2.806 3.738-4.912 2.164-7.572-3.006-20.76-8.773-26.53-1.88-1.88-4.768-3.062-8.023-3.686-1.252-1.718-3.27-3.36-6.13-4.882-5.4-2.862-12.074-4.006-18.266-2.883 1 .1 3.256 2.138 4.168 2.273-1.38.936-5.053.815-5.03 2.896 4.916-.492 10.303.285 14.834 2.297-3.602.4-6.955 1.3-9.3 2.543-6.854 3.603-8.656 10.812-6.854 20.914 1.807 10.097 9.742 46.873 12.256 59.126 2.527 12.26-5.402 20.188-10.45 22.354l5.408.36-1.8 3.973c6.484.72 13.695-1.44 13.695-1.44-1.438 3.974-11.176 5.406-11.176 5.406s4.686 1.44 12.258-1.445l12.27-4.688 3.604 9.373 6.852-6.85 2.9 7.215c-.016.007 5.388-1.797 3.58-10.088z" fill="#fff"/><path d="M109.02 70.69c0-2.093 1.693-3.787 3.79-3.787 2.1 0 3.785 1.694 3.785 3.787s-1.695 3.786-3.785 3.786c-2.096.001-3.79-1.692-3.79-3.786z" fill="#2d4f8e"/><path d="M113.507 69.43a.98.98 0 0 1 .98-.983c.543 0 .984.438.984.983s-.44.984-.984.984c-.538.001-.98-.44-.98-.984z" fill="#fff"/><path d="M134.867 68.445c0-1.793 1.46-3.25 3.252-3.25 1.8 0 3.256 1.457 3.256 3.25 0 1.8-1.455 3.258-3.256 3.258a3.26 3.26 0 0 1-3.252-3.258z" fill="#2d4f8e"/><path d="M138.725 67.363c0-.463.38-.843.838-.843a.84.84 0 0 1 .846.843c0 .47-.367.842-.846.842a.84.84 0 0 1-.838-.842z" fill="#fff"/><linearGradient id="C" gradientUnits="userSpaceOnUse" x1="105.318" y1="60.979" x2="113.887" y2="60.979"><stop offset=".006" stop-color="#6176b9"/><stop offset=".691" stop-color="#394a9f"/></linearGradient><path d="M113.886 59.718s-2.854-1.3-5.63.453-2.668 3.523-2.668 3.523-1.473-3.283 2.453-4.892 5.844.916 5.844.916z" fill="url(#C)"/><linearGradient id="D" gradientUnits="userSpaceOnUse" x1="132.273" y1="58.371" x2="140.078" y2="58.371"><stop offset=".006" stop-color="#6176b9"/><stop offset=".691" stop-color="#394a9f"/></linearGradient><path d="M140.078 59.458s-2.05-1.172-3.643-1.152c-3.27.043-4.162 1.488-4.162 1.488s.55-3.445 4.732-2.754c2.268.377 3.073 2.418 3.073 2.418z" fill="url(#D)"/></g><path d="M124.4 85.295c.38-2.3 6.3-6.625 10.5-6.887 4.2-.265 5.5-.205 9-1.043s12.535-3.088 15.033-4.242c2.504-1.156 13.104.572 5.63 4.738-3.232 1.8-11.943 5.13-18.172 6.987-6.22 1.86-10-1.776-12.06 1.28-1.646 2.432-.334 5.762 7.1 6.453 10.037.93 19.66-4.52 20.72-1.625s-8.625 6.508-14.525 6.623c-5.893.1-17.77-3.896-19.555-5.137s-4.165-4.13-3.67-7.148z" fill="#fdd20a"/><path d="M128.943 115.592s-14.102-7.52-14.332-4.47c-.238 3.056 0 15.5 1.643 16.45s13.396-6.108 13.396-6.108zm5.403-.474s9.635-7.285 11.754-6.815c2.1.48 2.582 15.5.7 16.23-1.88.7-12.908-3.813-12.908-3.813z" fill="#65bc46"/><path d="M125.53 116.4c0 4.932-.7 7.05 1.4 7.52s6.104 0 7.518-.938.232-7.28-.232-8.465c-.477-1.174-8.696-.232-8.696 1.884z" fill="#43a244"/><path d="M126.426 115.292c0 4.933-.707 7.05 1.4 7.52 2.106.48 6.104 0 7.52-.938 1.4-.94.23-7.28-.236-8.466-.473-1.173-8.692-.227-8.692 1.885z" fill="#65bc46"/><circle cx="127.331" cy="78.965" r="57.5" fill="none" stroke="#de5833" stroke-width="5"/></g></svg>
diff --git a/public/images/browsers/ecosia.png b/public/images/browsers/ecosia.png
new file mode 100644
index 000000000..b4c779a89
Binary files /dev/null and b/public/images/browsers/ecosia.png differ
diff --git a/public/images/browsers/edge.svg b/public/images/browsers/edge.svg
new file mode 100644
index 000000000..2b1301eb5
--- /dev/null
+++ b/public/images/browsers/edge.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/1999/xlink" viewBox="0 0 27600 27600"><linearGradient id="a" gradientUnits="userSpaceOnUse"/><linearGradient id="b" x1="6870" x2="24704" y1="18705" y2="18705" x:href="#a"><stop offset="0" stop-color="#0c59a4"/><stop offset="1" stop-color="#114a8b"/></linearGradient><linearGradient id="c" x1="16272" x2="5133" y1="10968" y2="23102" x:href="#a"><stop offset="0" stop-color="#1b9de2"/><stop offset=".16" stop-color="#1595df"/><stop offset=".67" stop-color="#0680d7"/><stop offset="1" stop-color="#0078d4"/></linearGradient><radialGradient id="d" cx="16720" cy="18747" r="9538" x:href="#a"><stop offset=".72" stop-opacity="0"/><stop offset=".95" stop-opacity=".53"/><stop offset="1"/></radialGradient><radialGradient id="e" cx="7130" cy="19866" r="14324" gradientTransform="matrix(.14843 -.98892 .79688 .1196 -8759 25542)" x:href="#a"><stop offset=".76" stop-opacity="0"/><stop offset=".95" stop-opacity=".5"/><stop offset="1"/></radialGradient><radialGradient id="f" cx="2523" cy="4680" r="20243" gradientTransform="matrix(-.03715 .99931 -2.12836 -.07913 13579 3530)" x:href="#a"><stop offset="0" stop-color="#35c1f1"/><stop offset=".11" stop-color="#34c1ed"/><stop offset=".23" stop-color="#2fc2df"/><stop offset=".31" stop-color="#2bc3d2"/><stop offset=".67" stop-color="#36c752"/></radialGradient><radialGradient id="g" cx="24247" cy="7758" r="9734" gradientTransform="matrix(.28109 .95968 -.78353 .22949 24510 -16292)" x:href="#a"><stop offset="0" stop-color="#66eb6e"/><stop offset="1" stop-color="#66eb6e" stop-opacity="0"/></radialGradient><path id="h" d="M24105 20053a9345 9345 0 01-1053 472 10202 10202 0 01-3590 646c-4732 0-8855-3255-8855-7432 0-1175 680-2193 1643-2729-4280 180-5380 4640-5380 7253 0 7387 6810 8137 8276 8137 791 0 1984-230 2704-456l130-44a12834 12834 0 006660-5282c220-350-168-757-535-565z"/><path id="i" d="M11571 25141a7913 7913 0 01-2273-2137 8145 8145 0 01-1514-4740 8093 8093 0 013093-6395 8082 8082 0 011373-859c312-148 846-414 1554-404a3236 3236 0 012569 1297 3184 3184 0 01636 1866c0-21 2446-7960-8005-7960-4390 0-8004 4166-8004 7820 0 2319 538 4170 1212 5604a12833 12833 0 007684 6757 12795 12795 0 003908 610c1414 0 2774-233 4045-656a7575 7575 0 01-6278-803z"/><path id="j" d="M16231 15886c-80 105-330 250-330 566 0 260 170 512 472 723 1438 1003 4149 868 4156 868a5954 5954 0 003027-839 6147 6147 0 001133-850 6180 6180 0 001910-4437c26-2242-796-3732-1133-4392-2120-4141-6694-6525-11668-6525-7011 0-12703 5635-12798 12620 47-3654 3679-6605 7996-6605 350 0 2346 34 4200 1007 1634 858 2490 1894 3086 2921 618 1067 728 2415 728 2952s-271 1333-780 1990z"/><use fill="url(#b)" x:href="#h"/><use fill="url(#d)" opacity=".35" x:href="#h"/><use fill="url(#c)" x:href="#i"/><use fill="url(#e)" opacity=".4" x:href="#i"/><use fill="url(#f)" x:href="#j"/><use fill="url(#g)" x:href="#j"/></svg>
diff --git a/public/images/browsers/fallback.svg b/public/images/browsers/fallback.svg
new file mode 100644
index 000000000..4cd3e78e9
--- /dev/null
+++ b/public/images/browsers/fallback.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#64748b" class="size-6">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418" />
+</svg>
diff --git a/public/images/browsers/firefox.svg b/public/images/browsers/firefox.svg
new file mode 100644
index 000000000..01b4bd9e0
--- /dev/null
+++ b/public/images/browsers/firefox.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:x="http://www.w3.org/1999/xlink" viewBox="0 0 51500 51500"><radialGradient id="b" cx="87.4%" cy="-12.9%" r="128%" gradientTransform="matrix(.8 0 0 1 .18 .13)"><stop offset=".13" stop-color="#ffbd4f"/><stop offset=".28" stop-color="#ff980e"/><stop offset=".47" stop-color="#ff3750"/><stop offset=".78" stop-color="#eb0878"/><stop offset=".86" stop-color="#e50080"/></radialGradient><radialGradient id="d" cx="49%" cy="40%" r="128%" gradientTransform="matrix(.82 0 0 1 .09 0)"><stop offset=".3" stop-color="#960e18"/><stop offset=".35" stop-color="#b11927" stop-opacity=".74"/><stop offset=".43" stop-color="#db293d" stop-opacity=".34"/><stop offset=".5" stop-color="#f5334b" stop-opacity=".1"/><stop offset=".53" stop-color="#ff3750" stop-opacity="0"/></radialGradient><radialGradient id="e" cx="48%" cy="-12%" r="140%"><stop offset=".13" stop-color="#fff44f"/><stop offset=".53" stop-color="#ff980e"/></radialGradient><radialGradient id="f" cx="22.76%" cy="110.11%" r="100%"><stop offset=".35" stop-color="#3a8ee6"/><stop offset=".67" stop-color="#9059ff"/><stop offset="1" stop-color="#c139e6"/></radialGradient><radialGradient id="h" cx="52%" cy="33%" r="59%" gradientTransform="scale(.9 1)"><stop offset=".21" stop-color="#9059ff" stop-opacity="0"/><stop offset=".97" stop-color="#6e008b" stop-opacity=".6"/></radialGradient><radialGradient id="i" cx="210%" cy="-100%" r="290%"><stop offset=".1" stop-color="#ffe226"/><stop offset=".79" stop-color="#ff7139"/></radialGradient><radialGradient id="j" cx="84%" cy="-41%" r="180%"><stop offset=".11" stop-color="#fff44f"/><stop offset=".46" stop-color="#ff980e"/><stop offset=".72" stop-color="#ff3647"/><stop offset=".9" stop-color="#e31587"/></radialGradient><radialGradient id="k" cx="16.1%" cy="-18.6%" r="348.8%" gradientTransform="matrix(.10453 .46743 -.99452 .04913 -.05 -.26)"><stop offset="0" stop-color="#fff44f"/><stop offset=".3" stop-color="#ff980e"/><stop offset=".57" stop-color="#ff3647"/><stop offset=".74" stop-color="#e31587"/></radialGradient><radialGradient id="l" cx="18.9%" cy="-42.5%" r="238.4%"><stop offset=".14" stop-color="#fff44f"/><stop offset=".48" stop-color="#ff980e"/><stop offset=".66" stop-color="#ff3647"/><stop offset=".9" stop-color="#e31587"/></radialGradient><radialGradient id="m" cx="159.3%" cy="-44.72%" r="313.1%"><stop offset=".09" stop-color="#fff44f"/><stop offset=".63" stop-color="#ff980e"/></radialGradient><linearGradient id="a" x1="87.25%" x2="9.4%" y1="15.5%" y2="93.1%"><stop offset=".05" stop-color="#fff44f"/><stop offset=".37" stop-color="#ff980e"/><stop offset=".53" stop-color="#ff3647"/><stop offset=".7" stop-color="#e31587"/></linearGradient><linearGradient id="n" x1="80%" x2="18%" y1="14%" y2="84%"><stop offset=".17" stop-color="#fff44f" stop-opacity=".8"/><stop offset=".6" stop-color="#fff44f" stop-opacity="0"/></linearGradient><path id="c" d="M47870 16735c-1044-2512-3160-5224-4820-6082 1352 2650 2134 5310 2433 7294 0-6 2 5 4 22l4 26c2268 6147 1032 12398-748 16218-2754 5910-9420 11967-19857 11670-11276-318-21210-8683-23064-19643-338-1728 0-2605 170-4008-207 1080-286 1394-390 3315l-2 123c0 13270 10760 24030 24032 24030 11887 0 21756-8630 23690-19963l110-927c477-4120-53-8453-1560-12075z"/><path id="g" d="M25677 21050c-40 598-2150 2660-2890 2660-6834 0-7943 4133-7943 4133 303 3480 2726 6348 5660 7865 134 70 270 130 405 193a13277 13277 0 00706 289 10674 10674 0 003127 603c11978 562 14300-14320 5655-18640 2213-385 4510 505 5794 1407-2100-3672-6025-6150-10530-6150-285 0-564 24-844 43a12025 12025 0 00-6614 2549c366 310 780 724 1650 1583 1630 1606 5813 3270 5822 3465z"/><path fill="url(#a)" d="M47870 16735c-1044-2512-3160-5224-4820-6082 1352 2650 2134 5310 2433 7294l5 40c-2718-6773-7325-9505-11088-15452l-566-920a7372 7372 0 01-265-497 4370 4370 0 01-359-950 63 63 0 00-55-65 82 82 0 00-45 0l-12 7-17 10 10-14c-6037 3536-8085 10076-8274 13350a12025 12025 0 00-6614 2548 7136 7136 0 00-622-470 11134 11134 0 01-68-5873c-2468 1124-4390 2900-5785 4470h-10c-953-1206-886-5187-832-6018-10-52-710 363-802 425a17507 17507 0 00-2349 2012 21048 21048 0 00-2244 2692l-1 3v-3a20284 20284 0 00-3225 7280l-32 160a39700 39700 0 00-237 1500l-5 52a22907 22907 0 00-390 3316l-1 120c0 13270 10760 24030 24032 24030 11887 0 21756-8630 23690-19963l110-927c477-4120-53-8453-1560-12075zM20170 35545c113 53 220 112 334 164l16 10a12620 12620 0 01-350-174zm5506-14493zm19813-3060l-3-23 4 26z"/><use fill="url(#b)" x:href="#c"/><use fill="url(#d)" x:href="#c"/><path fill="url(#e)" d="M36192 19560l150 110a13070 13070 0 00-2231-2911C26640 9290 32150 563 33080 120l10-13c-6037 3535-8085 10076-8273 13348 280-20 560-43 844-43 4505 0 8430 2477 10530 6150z"/><use fill="url(#f)" x:href="#g"/><use fill="url(#h)" x:href="#g"/><path fill="url(#i)" d="M17083 15204a24404 24404 0 01498 330 11134 11134 0 01-67-5874c-2470 1125-4390 2900-5785 4470 115-3 3600-66 5354 1074z"/><path fill="url(#j)" d="M1822 26240c1855 10960 11788 19325 23063 19644 10437 296 17104-5762 19858-11670 1780-3820 3016-10070 748-16218v-2l-4-24c-2-17-4-28-4-22l5 40c853 5566-1980 10958-6405 14604l-13 30c-8625 7023-16878 4237-18550 3097a14410 14410 0 01-350-174c-5028-2403-7105-6984-6660-10913-4245 0-5693-3580-5693-3580s3812-2718 8836-355c4653 2190 9023 355 9023 354-10-195-4192-1860-5822-3465-872-860-1285-1272-1652-1583a7136 7136 0 00-622-470 28293 28293 0 00-498-330c-1753-1140-5240-1076-5355-1073h-10c-953-1207-886-5188-832-6020-10-50-710 363-802 426a17507 17507 0 00-2349 2012 21048 21048 0 00-2244 2692l-1 3v-3a20284 20284 0 00-3225 7280c-10 52-865 3784-444 5720z"/><path fill="url(#k)" d="M34110 16760a13070 13070 0 012231 2910l360 296c5450 5020 2594 12120 2380 12626 4426-3646 7258-9038 6405-14604-2716-6774-7323-9506-11086-15453l-566-920a7372 7372 0 01-265-497 4370 4370 0 01-359-950 63 63 0 00-55-65 82 82 0 00-45 0l-12 7-17 10c-930 443-6440 9170 1030 16640z"/><path fill="url(#l)" d="M36702 19965a4743 4743 0 00-360-295l-150-110c-1283-900-3580-1792-5794-1407 8644 4322 6323 19203-5655 18640a10674 10674 0 01-3127-603 13451 13451 0 01-706-289 9064 9064 0 01-405-193l16 10c1670 1140 9924 3925 18550-3097l13-30c213-506 3068-7606-2380-12626z"/><path fill="url(#m)" d="M14844 27844s1110-4133 7943-4133c740 0 2850-2062 2890-2660s-4370 1836-9023-354c-5024-2363-8836 354-8836 354s1448 3580 5693 3580c-445 3930 1632 8510 6660 10913 113 53 218 112 334 164-2935-1517-5358-4384-5660-7865z"/><path fill="url(#n)" d="M47870 16735c-1044-2512-3160-5224-4820-6082 1352 2650 2134 5310 2433 7294l5 40c-2718-6773-7325-9505-11088-15452l-566-920a7372 7372 0 01-265-497 4370 4370 0 01-359-950 63 63 0 00-55-65 82 82 0 00-45 0l-12 7-17 10 10-14c-6037 3536-8085 10076-8274 13350 280-20 560-43 845-43 4505 0 8430 2477 10530 6148-1284-900-3580-1792-5795-1407 8644 4322 6323 19203-5655 18640a10674 10674 0 01-3127-603 13451 13451 0 01-706-289 9064 9064 0 01-405-193l17 10a14410 14410 0 01-350-174c112 53 218 112 333 164-2935-1517-5358-4384-5660-7865 0 0 1108-4133 7942-4133 740 0 2850-2062 2890-2660-10-195-4190-1860-5822-3465-870-860-1285-1272-1650-1583a7136 7136 0 00-623-470 11134 11134 0 01-67-5873c-2470 1124-4390 2900-5785 4470h-10c-953-1207-886-5187-832-6020-10-50-710 363-802 426a17507 17507 0 00-2349 2012 21048 21048 0 00-2243 2692l-1 3v-3a20284 20284 0 00-3225 7280l-32 160a39787 39787 0 00-277 1515c-2 18 2-17 0 0a27956 27956 0 00-355 3353l-3 122c0 13270 10760 24030 24032 24030 11887 0 21756-8630 23690-19963l110-927c477-4120-53-8453-1560-12075zm-2384 1234l4 26v-2l-4-24z"/></svg>
diff --git a/public/images/browsers/huawei.png b/public/images/browsers/huawei.png
new file mode 100644
index 000000000..ea754d752
Binary files /dev/null and b/public/images/browsers/huawei.png differ
diff --git a/public/images/browsers/opera.svg b/public/images/browsers/opera.svg
new file mode 100644
index 000000000..20d8fc7eb
--- /dev/null
+++ b/public/images/browsers/opera.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1090 1090"><linearGradient id="a" x1="461" x2="461" y1="59" y2="1033" gradientUnits="userSpaceOnUse"><stop offset=".6" stop-color="#ff1b2d"/><stop offset="1" stop-color="#a70014"/></linearGradient><linearGradient id="b" x1="714" x2="714" y1="116" y2="978" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#9c0000"/><stop offset=".7" stop-color="#ff4b4b"/></linearGradient><path fill="url(#a)" d="M545 42.5a502.5 502.5 0 10334.9 877.1 362.4 362.4 0 01-201.4 61.5c-119.7 0-226.8-59.4-299-153-55.6-65.6-91.5-162.5-94-271.3V533c2.5-108.8 38.4-205.8 94-271.3 72-93.6 179.3-153 299-153 73.6 0 142.5 22.5 201.4 61.6a500.8 500.8 0 00-333-127.9h-2z"/><path fill="url(#b)" d="M379.6 261.8c46-54.4 105.7-87.3 170.7-87.3 146.3 0 265 166 265 370.4 0 204.6-118.6 370.4-265 370.4-65 0-124.6-32.8-170.7-87.2 72 93.6 179.2 153 299 153A363 363 0 00880 919.6 501 501 0 001047.5 545a501.1 501.1 0 00-167.6-374.6 362.4 362.4 0 00-201.4-61.5c-119.7 0-226.8 59.4-299 153"/></svg>
diff --git a/public/images/browsers/qq.png b/public/images/browsers/qq.png
new file mode 100644
index 000000000..34d9d1aeb
Binary files /dev/null and b/public/images/browsers/qq.png differ
diff --git a/public/images/browsers/safari.png b/public/images/browsers/safari.png
new file mode 100644
index 000000000..0ec59640d
Binary files /dev/null and b/public/images/browsers/safari.png differ
diff --git a/public/images/browsers/samsung-internet.svg b/public/images/browsers/samsung-internet.svg
new file mode 100644
index 000000000..ab415d91d
--- /dev/null
+++ b/public/images/browsers/samsung-internet.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 525 525"><path fill="#7882ff" d="M203 0h120c111 0 202 90 202 203v120c0 111-90 202-203 202H202C92 525 0 435 0 322V202C0 92 90 0 203 0z"/><path fill="#4d5cc1" d="M402 263l-1-17-5-10c33 30 50 62 40 87-8 23-36 36-74 38-37 2-83-6-130-24a323 323 0 01-113-69c-27-27-39-55-30-78 9-24 40-36 81-37h1a142 142 0 00-42 55c9 25 44 55 113 84 56 23 122 35 151 16h2c4-15 7-30 7-45z"/><path fill="#fff" d="M401 246a143 143 0 01-6 61c-29 20-96 9-153-15-69-30-104-59-112-84a142 142 0 0141-55l1-1a142 142 0 01229 94zM261 404a142 142 0 01-142-136 344 344 0 00243 93 141 141 0 01-102 43z"/></svg>
diff --git a/public/images/browsers/uc.svg b/public/images/browsers/uc.svg
new file mode 100644
index 000000000..7fcd2a1cf
--- /dev/null
+++ b/public/images/browsers/uc.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" fill="#fff" viewBox="0 0 36600 36600"><linearGradient id="a" x1="18300" x2="18300" y1="36551" y2="50" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ff780b"/><stop offset="1" stop-color="#ffa322"/></linearGradient><path fill="url(#a)" d="M28539 36550H8061A8011 8011 0 0150 28539V8061A8011 8011 0 018061 50h20479a8011 8011 0 018011 8011v20479a8011 8011 0 01-8012 8010z"/><path d="M14177 31857l-134-40c-3768-1063-5541-5252-4515-8650 539-1785 1698-3109 3211-4140 1016-694 2071-1331 3087-2023 1454-993 2554-2278 3100-3977 669-2078 448-4026-1038-5690-1562-1750-3575-2432-5886-2134-2964 382-5181 1950-6789 4427-66 101-114 212-170 319 667-431 1358-708 2128-801 1560-190 3060 843 3354 2341 226 1152-73 2206-759 3118-732 973-1537 1894-2334 2818-1837 2133-2782 4553-2387 7394 332 2386 1552 4251 3533 5587 1679 1131 3602 1460 5599 1451m5012-15353c1080-10 2135 197 3175 496a16676 16676 0 014187 1883c1241 771 2573 990 3994 753 279-46 554-137 815-243 92-38 195-178 201-277 21-342 24-687-6-1028a6592 6592 0 00-1129-3188c-798-1166-1916-1904-3239-2347-224-75-309-189-355-400-64-297-145-594-249-878-201-545-472-1050-925-1473-84 103-156 182-217 269-630 904-877 1925-878 3008 0 310-89 537-338 701-689 453-1354 953-2080 1337-960 510-1969 930-2956 1387m3759 13112a8349 8349 0 00483-2834c-8-1253-234-2465-864-3540-1426-2435-3570-3713-6418-3693-1409 10-2662 492-3687 1489a5046 5046 0 00-1178 1776c2679-2832 7031-1981 8688 571 1006 1550 1261 3208 663 4958-602 1764-1900 2855-3609 3521 3188-9 6362-52 9610-347-790-1563-2196-1785-3688-1901"/><path d="M31689 22976c-32-580-319-968-753-1258-533-355-1146-445-1768-502-1129-102-2214-369-3211-921-852-472-1669-1012-2543-1438-1375-670-2851-1003-4374-1141-1044-96-2062-10-3059 314-117 38-226 100-339 151 131 49 240 51 347 49 1174-27 2319 136 3418 554 2282 866 3938 2447 5115 4554 112 201 247 348 459 369 534 51 1074 123 1607 92 686-39 1302-353 1920-640 726-337 1489-507 2295-375 278 42 553 117 886 192m-17512 8881c-1998 9-3921-320-5600-1454-1981-1336-3201-3201-3533-5587-395-2841 550-5261 2387-7394 796-923 1601-1844 2334-2818 686-911 985-1966 759-3118-294-1498-1795-2531-3354-2341-770 94-1461 371-2128 801 56-106 106-218 170-319 1608-2477 3824-4045 6788-4427 2312-298 4324 384 5886 2134 1486 1663 1707 3612 1038 5690-546 1700-1646 2986-3100 3977-1016 694-2071 1331-3087 2023-1512 1032-2672 2356-3211 4140-1027 3398 746 7587 4515 8650 47 17 92 30 136 43m5012-15353c985-457 1994-876 2955-1386 726-386 1391-885 2080-1337 249-164 338-391 338-701 1-1083 247-2104 878-3008 61-86 133-165 217-269 453 422 724 928 925 1473 105 285 185 582 249 878 46 212 131 325 355 400 1323 443 2441 1181 3239 2347a6588 6588 0 011129 3188c30 341 28 686 6 1028a384 384 0 01-201 277 3914 3914 0 01-815 243c-1421 236-2753 18-3994-753a16625 16625 0 00-4187-1883c-1037-301-2093-507-3174-497m3759 13112c1493 114 2898 337 3691 1902-3249 294-6423 338-9610 347 1708-666 3006-1757 3609-3521 597-1750 343-3408-663-4958-1657-2550-6008-3403-8688-571a5037 5037 0 011178-1776c1024-996 2278-1478 3686-1489 2848-21 4992 1258 6418 3693 630 1076 855 2287 864 3540 4 955-153 1874-485 2833"/><path d="M31689 22976l-888-196c-805-131-1568 38-2295 375-618 287-1234 601-1920 640-533 29-1073-41-1607-92-212-21-347-168-459-369-1178-2106-2832-3686-5115-4554-1099-417-2243-580-3418-554-107 2-215 0-347-49 113-51 223-113 339-151 996-324 2015-409 3059-314 1523 140 2999 471 4374 1141 874 426 1691 966 2543 1438 998 554 2082 820 3211 921 622 56 1235 147 1768 502 437 293 724 681 755 1262m-16354-286a3895 3895 0 00-3903 3878 3879 3879 0 003909 3893 3868 3868 0 003882-3886 3878 3878 0 00-3888-3885zm-26 5677c-981-4-1782-807-1785-1787-1-984 819-1797 1813-1797s1804 820 1790 1812c-12 1008-799 1775-1818 1772z"/></svg>
diff --git a/public/images/browsers/vivaldi.svg b/public/images/browsers/vivaldi.svg
new file mode 100644
index 000000000..4d023cc02
--- /dev/null
+++ b/public/images/browsers/vivaldi.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1900 1900"><path fill="#ef3939" d="M944 1830c386 0 600 0 740-140s140-354 140-740 0-600-140-740S1330 70 944 70s-600 0-740 140S64 564 64 950s0 600 140 740 354 140 740 140z"/><linearGradient id="a" x1="61.24" x2="145.33" y1="37.94" y2="183.58" gradientUnits="userSpaceOnUse"><stop offset="0" stop-opacity=".2"/><stop offset=".79" stop-opacity=".05"/></linearGradient><path fill="url(#a)" d="M151.6 62.4A66 66 0 0030.5 78a65.57 65.57 0 006.8 50.4c.1.2.2.4.4.6l31 53.8 25.5.2c17.1 0 30.9 0 42.2-1.2 14-1.5 24.1-5 31.9-12.8 11.3-11.3 13.5-27.6 13.9-53.8l-30.6-52.8z" transform="scale(10)"/><path fill="#fff" d="M1407 484a657.9 657.9 0 00-932 0 660.9 660.9 0 000 933 657.9 657.9 0 00932 0 660.9 660.9 0 000-933zm-39 304l-326 567c-20 35-49 56-90 59-45 3-80-16-103-55L519 786c-42-73 5-162 89-166 44-2 78 18 101 57 31 52 61 105 91 158l66 114c33 55 80 85 144 89 90 5 174-60 185-156 1-7 1-14 2-18 0-31-6-57-19-82-34-68 2-143 75-160 60-13 121 31 129 91 4 27-1 52-14 75z"/></svg>
diff --git a/public/images/browsers/vivo.png b/public/images/browsers/vivo.png
new file mode 100644
index 000000000..08f8c4997
Binary files /dev/null and b/public/images/browsers/vivo.png differ
diff --git a/public/images/browsers/yandex.png b/public/images/browsers/yandex.png
new file mode 100644
index 000000000..7c0757949
Binary files /dev/null and b/public/images/browsers/yandex.png differ
diff --git a/public/images/os/android.png b/public/images/os/android.png
new file mode 100644
index 000000000..6fad820fb
Binary files /dev/null and b/public/images/os/android.png differ
diff --git a/public/images/os/chrome_os.png b/public/images/os/chrome_os.png
new file mode 100644
index 000000000..42606450c
Binary files /dev/null and b/public/images/os/chrome_os.png differ
diff --git a/public/images/os/fallback.svg b/public/images/os/fallback.svg
new file mode 100644
index 000000000..fd01eec9e
--- /dev/null
+++ b/public/images/os/fallback.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#64748b" class="size-6">
+ <path stroke-linecap="round" stroke-linejoin="round" d="M21.75 17.25v-.228a4.5 4.5 0 0 0-.12-1.03l-2.268-9.64a3.375 3.375 0 0 0-3.285-2.602H7.923a3.375 3.375 0 0 0-3.285 2.602l-2.268 9.64a4.5 4.5 0 0 0-.12 1.03v.228m19.5 0a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3m19.5 0a3 3 0 0 0-3-3H5.25a3 3 0 0 0-3 3m16.5 0h.008v.008h-.008v-.008Zm-3 0h.008v.008h-.008v-.008Z" />
+</svg>
diff --git a/public/images/os/fedora.png b/public/images/os/fedora.png
new file mode 100644
index 000000000..6c6896002
Binary files /dev/null and b/public/images/os/fedora.png differ
diff --git a/public/images/os/fire_os.png b/public/images/os/fire_os.png
new file mode 100644
index 000000000..9936154d5
Binary files /dev/null and b/public/images/os/fire_os.png differ
diff --git a/public/images/os/freebsd.png b/public/images/os/freebsd.png
new file mode 100644
index 000000000..a330ab244
Binary files /dev/null and b/public/images/os/freebsd.png differ
diff --git a/public/images/os/gnu_linux.png b/public/images/os/gnu_linux.png
new file mode 100644
index 000000000..37358e00d
Binary files /dev/null and b/public/images/os/gnu_linux.png differ
diff --git a/public/images/os/harmony_os.png b/public/images/os/harmony_os.png
new file mode 100644
index 000000000..f68063655
Binary files /dev/null and b/public/images/os/harmony_os.png differ
diff --git a/public/images/os/ios.png b/public/images/os/ios.png
new file mode 100644
index 000000000..77f6d153f
Binary files /dev/null and b/public/images/os/ios.png differ
diff --git a/public/images/os/ipad_os.png b/public/images/os/ipad_os.png
new file mode 100644
index 000000000..42402ad2b
Binary files /dev/null and b/public/images/os/ipad_os.png differ
diff --git a/public/images/os/kai_os.png b/public/images/os/kai_os.png
new file mode 100644
index 000000000..cbcf492eb
Binary files /dev/null and b/public/images/os/kai_os.png differ
diff --git a/public/images/os/mac.png b/public/images/os/mac.png
new file mode 100644
index 000000000..8e821f935
Binary files /dev/null and b/public/images/os/mac.png differ
diff --git a/public/images/os/playstation.png b/public/images/os/playstation.png
new file mode 100644
index 000000000..22c468d59
Binary files /dev/null and b/public/images/os/playstation.png differ
diff --git a/public/images/os/tizen.png b/public/images/os/tizen.png
new file mode 100644
index 000000000..f32b415f7
Binary files /dev/null and b/public/images/os/tizen.png differ
diff --git a/public/images/os/ubuntu.png b/public/images/os/ubuntu.png
new file mode 100644
index 000000000..6878759aa
Binary files /dev/null and b/public/images/os/ubuntu.png differ
diff --git a/public/images/os/windows.png b/public/images/os/windows.png
new file mode 100644
index 000000000..2451fb16d
Binary files /dev/null and b/public/images/os/windows.png differ
diff --git a/resources/css/app.css b/resources/css/app.css
index 6059349fa..8401f87f8 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -657,3 +657,20 @@ html {
animation: motion-progress-sweep 1.6s ease-in-out infinite;
}
}
+
+@keyframes motion-sound-wave {
+ 0%,
+ 100% {
+ transform: scaleY(0.35);
+ }
+ 50% {
+ transform: scaleY(1);
+ }
+}
+
+@media (prefers-reduced-motion: no-preference) {
+ .motion-sound-wave > span {
+ transform-origin: center;
+ animation: motion-sound-wave 0.9s ease-in-out infinite;
+ }
+}
diff --git a/resources/js/app.ts b/resources/js/app.ts
index 985d7b32b..8111e9625 100644
--- a/resources/js/app.ts
+++ b/resources/js/app.ts
@@ -11,6 +11,7 @@ import { createApp, h } from 'vue';
import { initializeDataLayer } from './datalayer';
import { bootLocale, i18nConfig, syncLocale, textDirection } from './language';
import { syncContentTypeMediaRules } from './lib/contentTypeMediaRules';
+import { trackInAppPushes } from './lib/inAppHistory';
import { capturePageview, initializePostHog, syncPostHogContext } from './posthog';
import { syncPreferences } from './preferences';
import type { Auth } from './types';
@@ -57,6 +58,8 @@ createInertiaApp({
syncPreferences(event.detail.page.props);
});
+ trackInAppPushes();
+
router.on('navigate', (event) => {
syncPostHogContext(event.detail.page);
syncContentTypeMediaRules(event.detail.page);
diff --git a/resources/js/components/AppHeaderActions.vue b/resources/js/components/AppHeaderActions.vue
index bf4c43f43..ff7ae6dd6 100644
--- a/resources/js/components/AppHeaderActions.vue
+++ b/resources/js/components/AppHeaderActions.vue
@@ -1,11 +1,18 @@
<script setup lang="ts">
+import { computed } from 'vue';
+
import { useBelowBreakpoint } from '@/composables/useBreakpoint';
+const props = withDefaults(defineProps<{ onPhones?: boolean }>(), {
+ onPhones: false,
+});
+
const compact = useBelowBreakpoint('md');
+const inline = computed(() => compact.value && !props.onPhones);
</script>
<template>
- <Teleport defer to="#app-header-actions" :disabled="compact">
+ <Teleport defer to="#app-header-actions" :disabled="inline">
<slot />
</Teleport>
</template>
diff --git a/resources/js/components/DeleteUser.vue b/resources/js/components/DeleteUser.vue
index d5c990b28..66cbf0ca5 100644
--- a/resources/js/components/DeleteUser.vue
+++ b/resources/js/components/DeleteUser.vue
@@ -45,123 +45,125 @@ const focusFirstInput = () => {
:title="$t('settings.delete_account.heading')"
:description="$t('settings.delete_account.description')"
>
- <template #actions>
- <Dialog>
- <DialogTrigger as-child>
- <Button
- variant="destructive"
- data-test="delete-user-button"
- >
- {{ $t('settings.delete_account.button') }}
- </Button>
- </DialogTrigger>
- <DialogContent>
- <Form
- v-bind="ProfileController.destroy.form()"
- reset-on-success
- @error="focusFirstInput"
- :options="{
- preserveScroll: true,
- }"
- class="space-y-6"
- v-slot="{ errors, processing, reset, clearErrors }"
- >
- <DialogHeader class="space-y-3">
- <DialogTitle>{{
- $t('settings.delete_account.modal_title')
- }}</DialogTitle>
- <DialogDescription>
- {{
- hasPassword
- ? $t(
- 'settings.delete_account.modal_description_password',
- )
- : trans(
- 'settings.delete_account.modal_description_email',
- { email: userEmail },
- )
- }}
- </DialogDescription>
- </DialogHeader>
+ <div
+ class="flex items-start gap-3 rounded-xl border border-destructive/30 bg-destructive/5 p-3 text-sm text-foreground"
+ data-testid="delete-account-warning"
+ >
+ <IconAlertTriangle
+ class="mt-0.5 size-4 shrink-0 text-destructive"
+ />
+ <div class="grid gap-0.5">
+ <p class="font-emphasis">
+ {{ $t('settings.delete_account.warning') }}
+ </p>
+ <p class="text-muted-foreground">
+ {{ $t('settings.delete_account.warning_message') }}
+ </p>
+ </div>
+ </div>
- <div v-if="hasPassword" class="grid gap-2">
- <Label for="password" class="sr-only">
- {{ $t('settings.delete_account.password') }}
- </Label>
- <Input
- id="password"
- type="password"
- name="password"
- ref="passwordInput"
- :placeholder="
- trans(
- 'settings.delete_account.password_placeholder',
- )
- "
- />
- <InputError :message="errors.password" />
- </div>
+ <Dialog>
+ <DialogTrigger as-child>
+ <Button
+ variant="destructive"
+ class="self-start"
+ data-test="delete-user-button"
+ >
+ {{ $t('settings.delete_account.button') }}
+ </Button>
+ </DialogTrigger>
+ <DialogContent>
+ <Form
+ v-bind="ProfileController.destroy.form()"
+ reset-on-success
+ @error="focusFirstInput"
+ :options="{
+ preserveScroll: true,
+ }"
+ class="space-y-6"
+ v-slot="{ errors, processing, reset, clearErrors }"
+ >
+ <DialogHeader class="space-y-3">
+ <DialogTitle>{{
+ $t('settings.delete_account.modal_title')
+ }}</DialogTitle>
+ <DialogDescription>
+ {{
+ hasPassword
+ ? $t(
+ 'settings.delete_account.modal_description_password',
+ )
+ : trans(
+ 'settings.delete_account.modal_description_email',
+ { email: userEmail },
+ )
+ }}
+ </DialogDescription>
+ </DialogHeader>
- <div v-else class="grid gap-2">
- <Label for="email_confirmation" class="sr-only">{{
- $t('settings.profile.email')
- }}</Label>
- <Input
- id="email_confirmation"
- type="email"
- name="email_confirmation"
- ref="emailInput"
- :placeholder="
- trans(
- 'settings.delete_account.email_placeholder',
- )
- "
- autocomplete="off"
- />
- <InputError :message="errors.email_confirmation" />
- </div>
+ <div v-if="hasPassword" class="grid gap-2">
+ <Label for="password" class="sr-only">
+ {{ $t('settings.delete_account.password') }}
+ </Label>
+ <Input
+ id="password"
+ type="password"
+ name="password"
+ ref="passwordInput"
+ :placeholder="
+ trans(
+ 'settings.delete_account.password_placeholder',
+ )
+ "
+ />
+ <InputError :message="errors.password" />
+ </div>
- <DialogFooter>
- <DialogClose as-child>
- <Button
- variant="ghost"
- @click="
- () => {
- clearErrors();
- reset();
- }
- "
- >
- {{ $t('settings.delete_account.cancel') }}
- </Button>
- </DialogClose>
+ <div v-else class="grid gap-2">
+ <Label for="email_confirmation" class="sr-only">{{
+ $t('settings.profile.email')
+ }}</Label>
+ <Input
+ id="email_confirmation"
+ type="email"
+ name="email_confirmation"
+ ref="emailInput"
+ :placeholder="
+ trans(
+ 'settings.delete_account.email_placeholder',
+ )
+ "
+ autocomplete="off"
+ />
+ <InputError :message="errors.email_confirmation" />
+ </div>
+ <DialogFooter>
+ <DialogClose as-child>
<Button
- type="submit"
- variant="destructive"
- :disabled="processing"
- data-test="confirm-delete-user-button"
+ variant="ghost"
+ @click="
+ () => {
+ clearErrors();
+ reset();
+ }
+ "
>
- {{ $t('settings.delete_account.confirm') }}
+ {{ $t('settings.delete_account.cancel') }}
</Button>
- </DialogFooter>
- </Form>
- </DialogContent>
- </Dialog>
- </template>
+ </DialogClose>
- <div
- class="flex items-start gap-2 rounded-xl bg-critical-subtle p-4 text-sm text-foreground"
- >
- <IconAlertTriangle
- class="mt-0.5 size-4 shrink-0 text-destructive-text"
- />
- <p>
- <span class="font-emphasis">{{
- $t('settings.delete_account.warning')
- }}</span>
- {{ $t('settings.delete_account.warning_message') }}
- </p>
- </div>
+ <Button
+ type="submit"
+ variant="destructive"
+ :disabled="processing"
+ data-test="confirm-delete-user-button"
+ >
+ {{ $t('settings.delete_account.confirm') }}
+ </Button>
+ </DialogFooter>
+ </Form>
+ </DialogContent>
+ </Dialog>
</SettingsSection>
</template>
diff --git a/resources/js/components/LanguageSelect.vue b/resources/js/components/LanguageSelect.vue
index 19e505856..04a4da7f3 100644
--- a/resources/js/components/LanguageSelect.vue
+++ b/resources/js/components/LanguageSelect.vue
@@ -16,6 +16,7 @@ import {
TooltipTrigger,
} from '@/components/ui/tooltip';
import { detectBrowserLanguage } from '@/lib/detectPreferences';
+import { matchesSearch } from '@/lib/search';
import { cn } from '@/lib/utils';
import type { Language } from '@/types';
@@ -35,14 +36,8 @@ const selected = computed(() =>
props.languages.find((language) => language.code === model.value),
);
-const matches = (language: Language): boolean => {
- const term = search.value.trim().toLocaleLowerCase();
-
- return (
- term === '' ||
- `${language.name} ${language.code}`.toLocaleLowerCase().includes(term)
- );
-};
+const matches = (language: Language): boolean =>
+ matchesSearch(search.value, [language.name, language.code]);
const browserLanguage = computed(() =>
props.languages.find(
diff --git a/resources/js/components/MultiSelectFilter.vue b/resources/js/components/MultiSelectFilter.vue
index 7122fcb59..681bc32c0 100644
--- a/resources/js/components/MultiSelectFilter.vue
+++ b/resources/js/components/MultiSelectFilter.vue
@@ -13,6 +13,7 @@ import {
PopoverTrigger,
} from '@/components/ui/popover';
import { useBelowBreakpoint } from '@/composables/useBreakpoint';
+import { filterBySearch } from '@/lib/search';
interface FilterOption {
id: string;
@@ -68,13 +69,11 @@ watch(open, (isOpen) => {
}
});
-const visibleOptions = computed(() => {
- const query = search.value.trim().toLocaleLowerCase();
-
- return props.options.filter((option) =>
- (option.searchText ?? option.label).toLocaleLowerCase().includes(query),
- );
-});
+const visibleOptions = computed(() =>
+ filterBySearch(props.options, search.value, (option) => [
+ option.searchText ?? option.label,
+ ]),
+);
const toggle = (id: string): void => {
selectedIds.value = selectedIds.value.includes(id)
diff --git a/resources/js/components/NavChannels.vue b/resources/js/components/NavChannels.vue
index e97882fe2..5f0597676 100644
--- a/resources/js/components/NavChannels.vue
+++ b/resources/js/components/NavChannels.vue
@@ -60,7 +60,6 @@ const { vSortableChannel, vSortableChannelList, onHandleKeydown, dragPreview } =
useChannelOrder({
list: 'sidebar',
order: () => channels.value.map((channel) => channel.id),
- placeholder: true,
});
const reorderable = computed(
() => canManageAccounts.value && channels.value.length > 1,
diff --git a/resources/js/components/TimezoneSelect.vue b/resources/js/components/TimezoneSelect.vue
index 17f466177..1eb09c52b 100644
--- a/resources/js/components/TimezoneSelect.vue
+++ b/resources/js/components/TimezoneSelect.vue
@@ -9,6 +9,7 @@ import { Input } from '@/components/ui/input';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
import { orderChannels } from '@/composables/useChannelOrder';
+import { matchesSearch } from '@/lib/search';
import { cn } from '@/lib/utils';
import type { User } from '@/types';
import { channelName, type SidebarChannel } from '@/types/channel';
@@ -80,11 +81,8 @@ const suggestions = computed<Suggestion[]>(() => {
return [...rows.values()];
});
-const matches = (option: TimezoneOption): boolean => {
- const term = search.value.trim().toLowerCase();
-
- return term === '' || `${option.label} ${option.value} ${option.offset}`.toLowerCase().includes(term);
-};
+const matches = (option: TimezoneOption): boolean =>
+ matchesSearch(search.value, [option.label, option.value, option.offset]);
const suggestedValues = computed(() => new Set(suggestions.value.map((suggestion) => suggestion.option.value)));
const visibleSuggestions = computed(() => suggestions.value.filter((suggestion) => matches(suggestion.option)));
diff --git a/resources/js/components/channels/ChannelListItem.vue b/resources/js/components/channels/ChannelListItem.vue
index 9e6e58d55..eaaec6b33 100644
--- a/resources/js/components/channels/ChannelListItem.vue
+++ b/resources/js/components/channels/ChannelListItem.vue
@@ -2,8 +2,7 @@
import { Link } from '@inertiajs/vue3';
import {
IconAlertCircle,
- IconArrowDown,
- IconArrowUp,
+ IconBrandFacebook,
IconDotsVertical,
IconExternalLink,
IconRefresh,
@@ -33,16 +32,18 @@ const props = withDefaults(
defineProps<{
channel: ConnectedAccount;
showSettings?: boolean;
- canMoveUp?: boolean;
- canMoveDown?: boolean;
+ canLinkFacebook?: boolean;
}>(),
- { showSettings: true, canMoveUp: false, canMoveDown: false },
+ {
+ showSettings: true,
+ canLinkFacebook: false,
+ },
);
const emit = defineEmits<{
reconnect: [channel: ConnectedAccount];
+ linkFacebook: [channel: ConnectedAccount];
disconnect: [channel: ConnectedAccount];
- move: [channel: ConnectedAccount, offset: -1 | 1];
}>();
const lost = computed(() => isConnectionLost(props.channel));
@@ -55,8 +56,6 @@ const typeKey = computed(() => accountTypeKey(props.channel));
class="flex items-center gap-3 rounded-xl border border-border bg-card p-4"
:data-testid="`channel-row-${channel.id}`"
>
- <slot name="handle" />
-
<ChannelAvatar
:status="channel.status"
:account-id="channel.id"
@@ -143,6 +142,14 @@ const typeKey = computed(() => accountTypeKey(props.channel));
{{ $t('channels.view_profile') }}
</a>
</DropdownMenuItem>
+ <DropdownMenuItem
+ v-if="canLinkFacebook"
+ :data-testid="`channel-menu-link-facebook-${channel.id}`"
+ @click="emit('linkFacebook', channel)"
+ >
+ <IconBrandFacebook class="size-4" />
+ {{ $t('channels.link_facebook_page') }}
+ </DropdownMenuItem>
<DropdownMenuItem
:data-testid="`channel-menu-reconnect-${channel.id}`"
@click="emit('reconnect', channel)"
@@ -150,25 +157,6 @@ const typeKey = computed(() => accountTypeKey(props.channel));
<IconRefresh class="size-4" />
{{ $t('channels.refresh_connection') }}
</DropdownMenuItem>
- <template v-if="canMoveUp || canMoveDown">
- <DropdownMenuSeparator />
- <DropdownMenuItem
- :disabled="!canMoveUp"
- :data-testid="`channel-menu-move-up-${channel.id}`"
- @click="emit('move', channel, -1)"
- >
- <IconArrowUp class="size-4" />
- {{ $t('channels.reorder.move_up') }}
- </DropdownMenuItem>
- <DropdownMenuItem
- :disabled="!canMoveDown"
- :data-testid="`channel-menu-move-down-${channel.id}`"
- @click="emit('move', channel, 1)"
- >
- <IconArrowDown class="size-4" />
- {{ $t('channels.reorder.move_down') }}
- </DropdownMenuItem>
- </template>
<DropdownMenuSeparator />
<DropdownMenuItem
variant="destructive"
diff --git a/resources/js/components/channels/ConnectChannelFlow.vue b/resources/js/components/channels/ConnectChannelFlow.vue
index f7675e91b..df1830ac2 100644
--- a/resources/js/components/channels/ConnectChannelFlow.vue
+++ b/resources/js/components/channels/ConnectChannelFlow.vue
@@ -57,21 +57,14 @@ const selectPlatform = (platform: string): void => {
openConnect(platform);
};
-
-
const connectInstagramFacebook = (): void => {
emit('close');
- openConnect(Platform.InstagramFacebook);
+ openConnect(Platform.InstagramFacebook, props.state.reconnectId);
};
const selectInstagramMethod = (method: string): void => {
- if (method === Platform.InstagramFacebook) {
- goTo('instagram-facebook');
- return;
- }
-
emit('close');
- openConnect(method);
+ openConnect(method, props.state.reconnectId);
};
</script>
diff --git a/resources/js/components/channels/InstagramConnectStep.vue b/resources/js/components/channels/InstagramConnectStep.vue
index b577fb5d4..179940837 100644
--- a/resources/js/components/channels/InstagramConnectStep.vue
+++ b/resources/js/components/channels/InstagramConnectStep.vue
@@ -1,13 +1,21 @@
<script setup lang="ts">
import {
IconCheck,
+ IconChevronDown,
IconInfoCircle,
IconRefresh,
} from '@tabler/icons-vue';
+import { computed, ref } from 'vue';
+import InstagramFacebookRequirementsList from '@/components/channels/InstagramFacebookRequirementsList.vue';
import InstagramHelpMenu from '@/components/channels/InstagramHelpMenu.vue';
import PlatformLogo from '@/components/PlatformLogo.vue';
import { Button } from '@/components/ui/button';
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from '@/components/ui/collapsible';
import { DialogDescription, DialogTitle } from '@/components/ui/dialog';
import { Platform } from '@/types/platform';
@@ -19,17 +27,33 @@ const emit = defineEmits<{
select: [method: string];
}>();
-const FEATURES = ['automatic', 'metrics'] as const;
+const STANDALONE_FEATURES = ['automatic', 'metrics'] as const;
+const FACEBOOK_FEATURES = ['automatic', 'metrics', 'music'] as const;
+
+const showsStandalone = computed(() =>
+ props.methods.includes(Platform.Instagram),
+);
+const showsFacebook = computed(() =>
+ props.methods.includes(Platform.InstagramFacebook),
+);
+const showsBoth = computed(() => showsStandalone.value && showsFacebook.value);
+const standaloneRequirementsOpen = ref(true);
+const facebookRequirementsOpen = ref(true);
+
+const connectStandalone = (): void => {
+ emit('select', Platform.Instagram);
+};
-const showsStandalone = () => props.methods.includes(Platform.Instagram);
-const showsFacebook = () => props.methods.includes(Platform.InstagramFacebook);
+const connectFacebook = (): void => {
+ emit('select', Platform.InstagramFacebook);
+};
</script>
<template>
<div class="flex min-h-0 flex-1 flex-col">
<div class="min-h-0 flex-1 overflow-y-auto">
<div
- class="mx-auto flex w-full max-w-[720px] flex-col gap-8 px-4 pt-2 pb-8 sm:px-6"
+ class="mx-auto flex w-full max-w-[800px] flex-col gap-8 px-4 pt-2 pb-8 sm:px-6"
>
<header class="flex flex-col gap-2 text-center max-sm:px-10">
<DialogTitle
@@ -42,91 +66,223 @@ const showsFacebook = () => props.methods.includes(Platform.InstagramFacebook);
</DialogDescription>
</header>
- <section
- v-if="showsStandalone()"
- class="mx-auto flex w-full max-w-[432px] flex-col gap-5 rounded-xl border border-border bg-card p-6"
- data-testid="instagram-connect-professional"
+ <div
+ class="mx-auto grid w-full gap-x-4 gap-y-4"
+ :class="showsBoth ? 'sm:grid-cols-2' : 'max-w-[432px]'"
+ data-testid="instagram-connect-options"
>
- <div class="flex flex-col items-start gap-2">
- <h3 class="text-lg leading-tight text-foreground">
- <span class="font-medium">{{
- $t('accounts.instagram_connect.professional_title')
- }}</span>
- {{ $t('accounts.instagram_connect.professional_types') }}
- </h3>
- <span
- class="inline-flex items-center gap-1 rounded-md bg-primary-subtle px-1.5 py-0.5 text-xs text-primary-text"
- >
- <IconRefresh class="size-3.5" aria-hidden="true" />
- {{ $t('accounts.instagram_connect.badge') }}
- </span>
- </div>
-
- <ul class="flex flex-col gap-3">
- <li
- v-for="feature in FEATURES"
- :key="feature"
- class="flex gap-3 text-sm leading-[21px] text-foreground"
- >
- <IconCheck
- class="mt-[2.5px] size-4 shrink-0 text-success"
- aria-hidden="true"
- />
- <span>
+ <section
+ v-if="showsStandalone"
+ class="row-span-4 grid grid-rows-subgrid gap-5 rounded-xl border border-border bg-card p-6"
+ data-testid="instagram-connect-professional"
+ >
+ <div class="flex flex-col items-start gap-2">
+ <PlatformLogo platform="instagram" :size="24" />
+ <h3 class="text-lg leading-tight text-foreground">
<span class="font-medium">{{
- $t(`accounts.instagram_connect.features.${feature}.title`)
+ $t(
+ 'accounts.instagram_connect.professional_title',
+ )
}}</span>
- -
{{
$t(
- `accounts.instagram_connect.features.${feature}.description`,
+ 'accounts.instagram_connect.professional_types',
)
}}
+ </h3>
+ <span
+ class="inline-flex items-center gap-1 rounded-md bg-primary-subtle px-1.5 py-0.5 text-xs text-primary-text"
+ >
+ <IconRefresh class="size-3.5" aria-hidden="true" />
+ {{ $t('accounts.instagram_connect.badge') }}
</span>
- </li>
- </ul>
-
- <Button
- size="lg"
- class="w-full"
- data-testid="instagram-connect-standalone"
- @click="emit('select', Platform.Instagram)"
- >
- {{ $t('accounts.instagram_connect.connect') }}
- </Button>
+ </div>
+
+ <ul class="flex flex-col gap-3">
+ <li
+ v-for="feature in STANDALONE_FEATURES"
+ :key="feature"
+ class="flex gap-3 text-sm leading-[21px] text-foreground"
+ >
+ <IconCheck
+ class="mt-[2.5px] size-4 shrink-0 text-success"
+ aria-hidden="true"
+ />
+ <span>
+ <span class="font-medium">{{
+ $t(
+ `accounts.instagram_connect.features.${feature}.title`,
+ )
+ }}</span>
+ -
+ {{
+ $t(
+ `accounts.instagram_connect.features.${feature}.description`,
+ )
+ }}
+ </span>
+ </li>
+ </ul>
+
+ <Button
+ size="lg"
+ class="w-full"
+ data-testid="instagram-connect-standalone"
+ @click="connectStandalone"
+ >
+ {{ $t('accounts.instagram_connect.connect') }}
+ </Button>
+
+ <Collapsible
+ v-model:open="standaloneRequirementsOpen"
+ class="border-t border-border pt-5"
+ >
+ <CollapsibleTrigger
+ class="flex w-full items-center gap-3 text-start text-sm leading-[21px] font-medium text-foreground"
+ data-testid="instagram-connect-standalone-requirements-toggle"
+ >
+ <IconInfoCircle
+ class="size-4 shrink-0"
+ aria-hidden="true"
+ />
+ <span class="flex-1">{{
+ $t(
+ 'accounts.instagram_facebook_requirements.heading',
+ )
+ }}</span>
+ <IconChevronDown
+ class="size-4 shrink-0 text-muted-foreground transition-transform"
+ :class="{
+ 'rotate-180': standaloneRequirementsOpen,
+ }"
+ aria-hidden="true"
+ />
+ </CollapsibleTrigger>
+ <CollapsibleContent
+ class="pt-3"
+ data-testid="instagram-connect-standalone-requirements"
+ >
+ <p
+ class="flex gap-2 text-xs leading-[18px] text-foreground"
+ >
+ <IconCheck
+ class="mt-px size-3.5 shrink-0 text-success"
+ aria-hidden="true"
+ />
+ {{
+ $t(
+ 'accounts.instagram_connect.convert_hint',
+ )
+ }}
+ </p>
+ </CollapsibleContent>
+ </Collapsible>
+ </section>
- <div
- class="flex gap-3 border-t border-border pt-5 text-sm leading-[21px] font-medium text-foreground"
+ <section
+ v-if="showsFacebook"
+ class="row-span-4 grid grid-rows-subgrid gap-5 rounded-xl border border-border bg-card p-6"
+ data-testid="instagram-connect-facebook-card"
>
- <IconInfoCircle
- class="mt-[2.5px] size-4 shrink-0"
- aria-hidden="true"
- />
- <p>{{ $t('accounts.instagram_connect.convert_hint') }}</p>
- </div>
- </section>
-
- <p
- v-if="showsFacebook()"
- class="flex items-start justify-center gap-2 text-center text-sm leading-[21px] text-foreground"
- >
- <PlatformLogo
- platform="facebook"
- :size="16"
- class="mt-[2.5px] shrink-0"
- />
- <span>
- <button
- type="button"
- class="cursor-pointer underline underline-offset-2 hover:text-primary-text focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring"
+ <div class="flex flex-col items-start gap-2">
+ <span
+ class="flex items-center gap-1 text-foreground"
+ aria-hidden="true"
+ >
+ <PlatformLogo platform="instagram" :size="24" />
+ <span class="text-xs">+</span>
+ <PlatformLogo platform="facebook" :size="24" />
+ </span>
+ <h3 class="text-lg leading-tight text-foreground">
+ <span class="font-medium">{{
+ $t(
+ 'accounts.instagram_connect.professional_title',
+ )
+ }}</span>
+ {{
+ $t('accounts.instagram_connect.facebook_types')
+ }}
+ </h3>
+ <span
+ class="inline-flex items-center gap-1 rounded-md bg-primary-subtle px-1.5 py-0.5 text-xs text-primary-text"
+ >
+ <IconRefresh class="size-3.5" aria-hidden="true" />
+ {{ $t('accounts.instagram_connect.badge') }}
+ </span>
+ </div>
+
+ <ul class="flex flex-col gap-3">
+ <li
+ v-for="feature in FACEBOOK_FEATURES"
+ :key="feature"
+ class="flex gap-3 text-sm leading-[21px] text-foreground"
+ :data-testid="`instagram-connect-facebook-feature-${feature}`"
+ >
+ <IconCheck
+ class="mt-[2.5px] size-4 shrink-0 text-success"
+ aria-hidden="true"
+ />
+ <span>
+ <span class="font-medium">{{
+ $t(
+ `accounts.instagram_connect.features.${feature}.title`,
+ )
+ }}</span>
+ -
+ {{
+ $t(
+ `accounts.instagram_connect.features.${feature}.description`,
+ )
+ }}
+ </span>
+ </li>
+ </ul>
+
+ <Button
+ size="lg"
+ class="w-full"
data-testid="instagram-connect-facebook"
- @click="emit('select', Platform.InstagramFacebook)"
+ @click="connectFacebook"
+ >
+ {{
+ $t(
+ 'accounts.instagram_facebook_requirements.connect',
+ )
+ }}
+ </Button>
+
+ <Collapsible
+ v-model:open="facebookRequirementsOpen"
+ class="border-t border-border pt-5"
>
- {{ $t('accounts.instagram_connect.facebook_link') }}
- </button>
- {{ $t('accounts.instagram_connect.facebook_suffix') }}
- </span>
- </p>
+ <CollapsibleTrigger
+ class="flex w-full items-center gap-3 text-start text-sm leading-[21px] font-medium text-foreground"
+ data-testid="instagram-connect-facebook-requirements-toggle"
+ >
+ <IconInfoCircle
+ class="size-4 shrink-0"
+ aria-hidden="true"
+ />
+ <span class="flex-1">{{
+ $t(
+ 'accounts.instagram_facebook_requirements.heading',
+ )
+ }}</span>
+ <IconChevronDown
+ class="size-4 shrink-0 text-muted-foreground transition-transform"
+ :class="{ 'rotate-180': facebookRequirementsOpen }"
+ aria-hidden="true"
+ />
+ </CollapsibleTrigger>
+ <CollapsibleContent
+ class="pt-3"
+ data-testid="instagram-connect-facebook-requirements"
+ >
+ <InstagramFacebookRequirementsList compact />
+ </CollapsibleContent>
+ </Collapsible>
+ </section>
+ </div>
</div>
</div>
diff --git a/resources/js/components/channels/InstagramFacebookRequirementsList.vue b/resources/js/components/channels/InstagramFacebookRequirementsList.vue
new file mode 100644
index 000000000..4e7805ac8
--- /dev/null
+++ b/resources/js/components/channels/InstagramFacebookRequirementsList.vue
@@ -0,0 +1,57 @@
+<script setup lang="ts">
+import { IconCheck, IconExternalLink } from '@tabler/icons-vue';
+
+withDefaults(defineProps<{ compact?: boolean }>(), { compact: false });
+
+const REQUIREMENTS = ['account_type', 'page', 'admin', 'permissions'] as const;
+
+const LINK_PAGE_HELP_URL =
+ 'https://www.facebook.com/business/help/connect-instagram-to-page';
+</script>
+
+<template>
+ <ul class="flex flex-col" :class="compact ? 'gap-2' : 'gap-3'">
+ <li
+ v-for="requirement in REQUIREMENTS"
+ :key="requirement"
+ class="flex text-foreground"
+ :class="
+ compact
+ ? 'gap-2 text-xs leading-[18px]'
+ : 'gap-3 text-sm leading-[21px]'
+ "
+ >
+ <IconCheck
+ class="shrink-0 text-success"
+ :class="compact ? 'mt-px size-3.5' : 'mt-[2.5px] size-4'"
+ aria-hidden="true"
+ />
+ <span>
+ <strong class="font-medium">{{
+ $t(
+ `accounts.instagram_facebook_requirements.items.${requirement}.lead`,
+ )
+ }}</strong>
+ {{
+ $t(
+ `accounts.instagram_facebook_requirements.items.${requirement}.rest`,
+ )
+ }}
+ <a
+ v-if="requirement === 'page'"
+ :href="LINK_PAGE_HELP_URL"
+ target="_blank"
+ rel="noopener noreferrer"
+ class="inline-flex items-center gap-1 text-primary-text underline underline-offset-2 hover:text-primary-text-hover"
+ data-testid="instagram-facebook-requirements-learn-how"
+ >
+ {{ $t('accounts.instagram_facebook_requirements.learn_how') }}
+ <IconExternalLink
+ :class="compact ? 'size-3' : 'size-3.5'"
+ aria-hidden="true"
+ />
+ </a>
+ </span>
+ </li>
+ </ul>
+</template>
diff --git a/resources/js/components/channels/InstagramFacebookRequirementsStep.vue b/resources/js/components/channels/InstagramFacebookRequirementsStep.vue
index 91e3218e1..96c95591a 100644
--- a/resources/js/components/channels/InstagramFacebookRequirementsStep.vue
+++ b/resources/js/components/channels/InstagramFacebookRequirementsStep.vue
@@ -1,9 +1,5 @@
<script setup lang="ts">
-import {
- IconCheck,
- IconExternalLink,
-} from '@tabler/icons-vue';
-
+import InstagramFacebookRequirementsList from '@/components/channels/InstagramFacebookRequirementsList.vue';
import InstagramHelpMenu from '@/components/channels/InstagramHelpMenu.vue';
import PlatformLogo from '@/components/PlatformLogo.vue';
import { Button } from '@/components/ui/button';
@@ -12,11 +8,6 @@ import { DialogDescription, DialogTitle } from '@/components/ui/dialog';
const emit = defineEmits<{
connect: [];
}>();
-
-const REQUIREMENTS = ['account_type', 'page', 'admin', 'permissions'] as const;
-
-const LINK_PAGE_HELP_URL =
- 'https://www.facebook.com/business/help/connect-instagram-to-page';
</script>
<template>
@@ -54,48 +45,7 @@ const LINK_PAGE_HELP_URL =
{{ $t('accounts.instagram_facebook_requirements.heading') }}
</h3>
- <ul class="flex flex-col gap-3">
- <li
- v-for="requirement in REQUIREMENTS"
- :key="requirement"
- class="flex gap-3 text-sm leading-[21px] text-foreground"
- >
- <IconCheck
- class="mt-[2.5px] size-4 shrink-0 text-success"
- aria-hidden="true"
- />
- <span>
- <strong class="font-medium">{{
- $t(
- `accounts.instagram_facebook_requirements.items.${requirement}.lead`,
- )
- }}</strong>
- {{
- $t(
- `accounts.instagram_facebook_requirements.items.${requirement}.rest`,
- )
- }}
- <a
- v-if="requirement === 'page'"
- :href="LINK_PAGE_HELP_URL"
- target="_blank"
- rel="noopener noreferrer"
- class="inline-flex items-center gap-1 text-primary-text underline underline-offset-2 hover:text-primary-text-hover"
- data-testid="instagram-facebook-requirements-learn-how"
- >
- {{
- $t(
- 'accounts.instagram_facebook_requirements.learn_how',
- )
- }}
- <IconExternalLink
- class="size-3.5"
- aria-hidden="true"
- />
- </a>
- </span>
- </li>
- </ul>
+ <InstagramFacebookRequirementsList />
<p
class="border-t border-border pt-4 text-xs text-muted-foreground"
diff --git a/resources/js/components/command-palette/CommandPalette.vue b/resources/js/components/command-palette/CommandPalette.vue
index 989a4c395..c154192cd 100644
--- a/resources/js/components/command-palette/CommandPalette.vue
+++ b/resources/js/components/command-palette/CommandPalette.vue
@@ -7,7 +7,7 @@ import CommandPaletteContent from '@/components/command-palette/CommandPaletteCo
import InviteMemberDialog from '@/components/members/InviteMemberDialog.vue';
import { CommandDialog } from '@/components/ui/command';
import { useCommandPalette } from '@/composables/useCommandPalette';
-import { postComposerRequest } from '@/composables/useGlobalPostComposer';
+import { isPostComposerOpen } from '@/composables/useGlobalPostComposer';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import type { CommandPaletteEntry } from '@/types/command-palette';
@@ -83,7 +83,7 @@ useEventListener(window, 'keydown', (event: KeyboardEvent) => {
return;
}
- if (postComposerRequest.value !== null && !isOpen.value) {
+ if (isPostComposerOpen.value && !isOpen.value) {
return;
}
diff --git a/resources/js/components/create/ideas/IdeaEditorDialog.vue b/resources/js/components/create/ideas/IdeaEditorDialog.vue
index 37d30a556..71afad8e5 100644
--- a/resources/js/components/create/ideas/IdeaEditorDialog.vue
+++ b/resources/js/components/create/ideas/IdeaEditorDialog.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { router, useForm, usePage } from '@inertiajs/vue3';
+import { router, useForm } from '@inertiajs/vue3';
import {
IconCheck,
IconChevronDown,
@@ -39,12 +39,12 @@ import {
type MediaImportStarted,
useMediaImport,
} from '@/composables/useMediaImport';
-import { useMediaUpload } from '@/composables/useMediaUpload';
+import { mediaUploadLimits, useMediaUpload } from '@/composables/useMediaUpload';
import { editorTabsFor, rulesFor } from '@/lib/mediaEditor';
import { isGooglePickerOpen } from '@/lib/mediaSources/googleDrive';
import { acceptAttribute } from '@/lib/mediaType';
+import { filterBySearch, matchesSearch } from '@/lib/search';
import { store, update } from '@/routes/app/create/ideas';
-import type { MediaUploadLimits, SharedData } from '@/types';
import {
columnKey,
type IdeaDraft,
@@ -80,14 +80,6 @@ const form = useForm({
const media = ref<MediaItem[]>([...(idea?.media ?? [])]);
const submittedMediaIds = ref<string[]>([]);
-const page = usePage<SharedData>();
-const mediaUploadLimits = (): MediaUploadLimits =>
- page.props.mediaUploadLimits ?? {
- max_bytes: { image: 0, video: 0, document: 0 },
- extensions: { image: [], video: [], document: [] },
- upload_retention_hours: 0,
- heic: false,
- };
const appendMedia = (
item: MediaItem,
_key?: string,
@@ -195,15 +187,9 @@ const currentStage = computed(
props.stages.find((stage) => stage.id === form.idea_stage_id) ?? null,
);
-const filteredStages = computed(() => {
- const query = stageSearch.value.trim().toLocaleLowerCase();
-
- return query
- ? props.stages.filter((stage) =>
- stage.name.toLocaleLowerCase().includes(query),
- )
- : props.stages;
-});
+const filteredStages = computed(() =>
+ filterBySearch(props.stages, stageSearch.value, (stage) => [stage.name]),
+);
const availableLabels = ref([...props.labels]);
@@ -445,6 +431,7 @@ const iconButtonClass =
<input
v-model="stageSearch"
type="search"
+ data-testid="idea-editor-stage-search"
:aria-label="$t('create.ideas.stages_search')"
:placeholder="
$t('create.ideas.stages_search')
@@ -461,7 +448,11 @@ const iconButtonClass =
>
<button
v-for="option in [
- null,
+ ...(matchesSearch(stageSearch, [
+ $t('create.ideas.unassigned'),
+ ])
+ ? [null]
+ : []),
...filteredStages.map(
(stage) => stage.id,
),
diff --git a/resources/js/components/create/ideas/IdeasToolbar.vue b/resources/js/components/create/ideas/IdeasToolbar.vue
index 93f89d839..1e529373a 100644
--- a/resources/js/components/create/ideas/IdeasToolbar.vue
+++ b/resources/js/components/create/ideas/IdeasToolbar.vue
@@ -9,6 +9,7 @@ import { computed } from 'vue';
import LabelFilter from '@/components/labels/LabelFilter.vue';
import MultiSelectFilter from '@/components/MultiSelectFilter.vue';
import { Checkbox } from '@/components/ui/checkbox';
+import { matchesSearch } from '@/lib/search';
import type { IdeaStage, IdeaLabel, IdeasView } from '@/types/idea';
const props = defineProps<{
@@ -34,9 +35,6 @@ const clearUnassigned = (): void => {
unassigned.value = false;
};
-const matches = (text: string, search: string): boolean =>
- text.toLocaleLowerCase().includes(search.trim().toLocaleLowerCase());
-
const stageOptions = computed(() =>
props.stages.map((stage) => ({ id: stage.id, label: stage.name })),
);
@@ -69,7 +67,7 @@ const views: { key: IdeasView; label: string; icon: typeof IconColumns3 }[] = [
</template>
<template #before-options="{ search }">
<label
- v-if="matches($t('create.ideas.unassigned'), search)"
+ v-if="matchesSearch(search, [$t('create.ideas.unassigned')])"
class="flex min-h-8 cursor-pointer items-center gap-3 rounded-lg px-2 py-1.5 text-sm leading-5 transition-control hover:bg-accent"
:class="{ 'bg-accent': unassigned }"
data-testid="ideas-filter-stages-unassigned"
diff --git a/resources/js/components/labels/LabelFilter.vue b/resources/js/components/labels/LabelFilter.vue
index 243cc2826..bbcb3cf82 100644
--- a/resources/js/components/labels/LabelFilter.vue
+++ b/resources/js/components/labels/LabelFilter.vue
@@ -8,6 +8,7 @@ import LabelForm from '@/components/labels/LabelForm.vue';
import MultiSelectFilter from '@/components/MultiSelectFilter.vue';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
+import { matchesSearch } from '@/lib/search';
import {
index as labelsIndex,
store as labelsStore,
@@ -49,9 +50,6 @@ const labelsById = computed(
const labelFor = (id: string): Label => labelsById.value.get(id)!;
-const matches = (text: string, search: string): boolean =>
- text.toLocaleLowerCase().includes(search.trim().toLocaleLowerCase());
-
const DEFAULT_COLOR = '#7c3aed';
const creating = ref(false);
@@ -172,7 +170,7 @@ const clear = (): void => {
<template #before-options="{ search }">
<div v-if="showUntagged && labels.length > 0" class="pt-2">
<label
- v-if="matches($t('posts.label_filter_untagged'), search)"
+ v-if="matchesSearch(search, [$t('posts.label_filter_untagged')])"
class="flex min-h-8 cursor-pointer items-center gap-3 rounded-lg px-2 py-1.5 text-sm leading-5 transition-control hover:bg-accent"
:class="{ 'bg-accent': untagged }"
:data-testid="`${testId}-untagged`"
diff --git a/resources/js/components/media/MediaTray.vue b/resources/js/components/media/MediaTray.vue
index 27541bb85..6bc832063 100644
--- a/resources/js/components/media/MediaTray.vue
+++ b/resources/js/components/media/MediaTray.vue
@@ -33,7 +33,7 @@ import {
import { cancelDragOnEscape } from '@/lib/dragPlaceholder';
import { editorTabsFor, rulesFor, type EditorTab } from '@/lib/mediaEditor';
import { canvaDesignId, editInCanva } from '@/lib/mediaSources/canva';
-import { acceptAttribute, isImage, isVideo } from '@/lib/mediaType';
+import { acceptAttribute, isImage, isVideo, mediaKey } from '@/lib/mediaType';
import type { MediaUploadLimits, SharedData } from '@/types';
import type { MediaItem } from '@/types/media';
@@ -193,7 +193,7 @@ const tileKeys = computed(() => {
const seen = new Map<string, number>();
return props.items.map((item) => {
- const id = item.upload_token ?? item.id;
+ const id = mediaKey(item);
const occurrence = seen.get(id) ?? 0;
seen.set(id, occurrence + 1);
@@ -556,7 +556,7 @@ const vSortableTile: Directive<HTMLElement> = {
<div class="flex flex-wrap gap-2">
<button
v-for="(item, index) in suggested"
- :key="`${item.upload_token ?? item.id}-${index}`"
+ :key="`${mediaKey(item)}-${index}`"
type="button"
class="size-16 shrink-0 overflow-hidden rounded-md border border-border bg-background transition-control hover:opacity-80 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring disabled:opacity-50"
:aria-label="item.original_filename ?? $t('posts.composer.suggested_media')"
diff --git a/resources/js/components/posts/PostNotesPopover.vue b/resources/js/components/posts/PostNotesPopover.vue
deleted file mode 100644
index 70517113a..000000000
--- a/resources/js/components/posts/PostNotesPopover.vue
+++ /dev/null
@@ -1,116 +0,0 @@
-<script setup lang="ts">
-import {
- IconMessageCircle,
- IconMessageCircleFilled,
- IconX,
-} from '@tabler/icons-vue';
-import { ref, watch } from 'vue';
-
-import PostNotesPanel from '@/components/posts/editor/PostNotesPanel.vue';
-import ResponsivePopover from '@/components/ResponsivePopover.vue';
-import { Button } from '@/components/ui/button';
-
-const props = withDefaults(
- defineProps<{
- postId: string;
- count: number;
- currentUserId: string;
- initialOpen?: boolean;
- highlightNoteId?: string | null;
- }>(),
- {
- initialOpen: false,
- highlightNoteId: null,
- },
-);
-
-const open = ref(props.initialOpen);
-
-const closePopover = (): void => {
- open.value = false;
-};
-
-const noteCount = ref(props.count);
-
-const changeNoteCount = (delta: number): void => {
- noteCount.value = Math.max(0, noteCount.value + delta);
-};
-
-watch(
- () => props.count,
- (count) => {
- noteCount.value = count;
- },
-);
-
-watch(
- () => props.initialOpen,
- (initialOpen) => {
- open.value = initialOpen;
- },
-);
-</script>
-
-<template>
- <ResponsivePopover
- v-model:open="open"
- :title="$t('notes.title')"
- test-id="post-notes-popover"
- content-class="flex w-[min(23.75rem,calc(100vw-2rem))] flex-col p-0"
- >
- <template #trigger>
- <Button
- type="button"
- variant="outline"
- size="icon"
- class="size-10 data-[state=open]:bg-accent"
- :aria-label="$t('notes.title')"
- :aria-expanded="open"
- :data-testid="`post-notes-trigger-${postId}`"
- >
- <IconMessageCircleFilled
- v-if="noteCount > 0"
- class="size-4 text-foreground"
- :data-testid="`post-notes-filled-icon-${postId}`"
- />
- <IconMessageCircle
- v-else
- class="size-4 text-muted-foreground"
- :data-testid="`post-notes-outline-icon-${postId}`"
- />
- </Button>
- </template>
- <div class="flex flex-col">
- <div
- class="flex items-center gap-2 border-b border-border py-2 ps-4 pe-2"
- >
- <h3 class="text-sm font-emphasis text-foreground">
- {{ $t('notes.title') }}
- </h3>
- <span
- v-if="noteCount > 0"
- class="flex h-5 min-w-5 items-center justify-center rounded-full bg-accent px-1.5 text-xs font-medium text-muted-foreground tabular-nums"
- data-testid="post-notes-count"
- >{{ noteCount }}</span
- >
- <Button
- type="button"
- variant="ghost"
- size="icon"
- class="ms-auto size-8 text-muted-foreground"
- :aria-label="$t('common.close')"
- @click="closePopover"
- >
- <IconX class="size-4" />
- </Button>
- </div>
- <PostNotesPanel
- v-if="open"
- :post-id="postId"
- :current-user-id="currentUserId"
- :highlight-note-id="highlightNoteId"
- @count-change="changeNoteCount($event)"
- />
- </div>
- </ResponsivePopover>
-</template>
diff --git a/resources/js/components/posts/composer/ComposerAccountOptions.vue b/resources/js/components/posts/composer/ComposerAccountOptions.vue
index 05f327fd2..ae3fccf42 100644
--- a/resources/js/components/posts/composer/ComposerAccountOptions.vue
+++ b/resources/js/components/posts/composer/ComposerAccountOptions.vue
@@ -1,8 +1,11 @@
<script setup lang="ts">
import { IconCheck, IconSearch } from '@tabler/icons-vue';
+import { computed } from 'vue';
import ChannelAvatar from '@/components/ChannelAvatar.vue';
+import { getPlatformLabel } from '@/composables/usePlatformLogo';
import type { ComposerAccount } from '@/composables/usePostComposition';
+import { filterBySearch } from '@/lib/search';
const props = defineProps<{
accounts: ComposerAccount[];
@@ -16,10 +19,18 @@ const emit = defineEmits<{
(event: 'toggle-all', accounts: ComposerAccount[]): void;
}>();
+const visibleAccounts = computed(() =>
+ filterBySearch(props.accounts, search.value, (account) => [
+ account.display_name,
+ account.username,
+ getPlatformLabel(account.platform),
+ ]),
+);
+
const isSelected = (account: ComposerAccount): boolean =>
props.selectedIds.includes(account.id);
-const allSelected = (): boolean => props.accounts.every(isSelected);
+const allSelected = (): boolean => visibleAccounts.value.every(isSelected);
</script>
<template>
@@ -35,8 +46,8 @@ const allSelected = (): boolean => props.accounts.every(isSelected);
v-model="search"
type="search"
data-testid="composer-account-search"
- :aria-label="$t('posts.form.discord.search_channel')"
- :placeholder="$t('posts.form.discord.search_channel')"
+ :aria-label="$t('posts.channel_search_placeholder')"
+ :placeholder="$t('posts.channel_search_placeholder')"
class="min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-subtle-foreground"
/>
</div>
@@ -46,11 +57,11 @@ const allSelected = (): boolean => props.accounts.every(isSelected);
>
<span>{{ $t('posts.edit.tabs.channels') }}</span>
<button
- v-if="accounts.length"
+ v-if="visibleAccounts.length"
type="button"
class="rounded-sm hover:underline focus-visible:outline-2 focus-visible:outline-ring"
data-testid="composer-select-all"
- @click="emit('toggle-all', accounts)"
+ @click="emit('toggle-all', visibleAccounts)"
>
{{
allSelected()
@@ -61,7 +72,7 @@ const allSelected = (): boolean => props.accounts.every(isSelected);
</div>
<div class="max-h-72 space-y-1 overflow-y-auto">
<button
- v-for="account in accounts"
+ v-for="account in visibleAccounts"
:key="account.id"
type="button"
:data-testid="`composer-account-option-${account.id}`"
@@ -97,10 +108,10 @@ const allSelected = (): boolean => props.accounts.every(isSelected);
</span>
</button>
<p
- v-if="!accounts.length"
+ v-if="!visibleAccounts.length"
class="px-2 py-4 text-center text-sm text-muted-foreground"
>
- {{ $t('posts.form.discord.no_channels') }}
+ {{ $t('posts.no_channels') }}
</p>
</div>
</div>
diff --git a/resources/js/components/posts/composer/ComposerDiscardDialog.vue b/resources/js/components/posts/composer/ComposerDiscardDialog.vue
new file mode 100644
index 000000000..4983ec8f7
--- /dev/null
+++ b/resources/js/components/posts/composer/ComposerDiscardDialog.vue
@@ -0,0 +1,65 @@
+<script setup lang="ts">
+import {
+ AlertDialog,
+ AlertDialogCancel,
+ AlertDialogContent,
+ AlertDialogDescription,
+ AlertDialogFooter,
+ AlertDialogHeader,
+ AlertDialogTitle,
+} from '@/components/ui/alert-dialog';
+import { Button } from '@/components/ui/button';
+
+defineProps<{
+ title: string;
+ description: string;
+ action: string;
+ testId: string;
+ cancelTestId: string;
+ actionTestId: string;
+}>();
+
+const open = defineModel<boolean>('open', { required: true });
+
+const emit = defineEmits<{ confirm: []; cancel: [] }>();
+
+const onOpenChange = (value: boolean): void => {
+ open.value = value;
+ if (!value) emit('cancel');
+};
+
+const confirm = (): void => {
+ emit('confirm');
+};
+</script>
+
+<template>
+ <AlertDialog :open="open" @update:open="onOpenChange">
+ <AlertDialogContent
+ class="gap-0 px-0 pt-6 pb-0 sm:max-w-[512px]"
+ :data-testid="testId"
+ >
+ <AlertDialogHeader class="gap-3 px-6 pb-4 text-left">
+ <AlertDialogTitle class="font-sans text-base font-medium">
+ {{ title }}
+ </AlertDialogTitle>
+ <AlertDialogDescription class="text-sm text-foreground">
+ {{ description }}
+ </AlertDialogDescription>
+ </AlertDialogHeader>
+ <AlertDialogFooter class="mx-2 mb-2">
+ <AlertDialogCancel :data-testid="cancelTestId">
+ {{ $t('common.cancel') }}
+ </AlertDialogCancel>
+ <Button
+ variant="destructive"
+ size="lg"
+ :data-testid="actionTestId"
+ @click="confirm"
+ >
+ {{ action }}
+ </Button>
+ </AlertDialogFooter>
+ </AlertDialogContent>
+ </AlertDialog>
+</template>
diff --git a/resources/js/components/posts/composer/ComposerNetworkSettings.vue b/resources/js/components/posts/composer/ComposerNetworkSettings.vue
index 078999d53..d9d8e2a2c 100644
--- a/resources/js/components/posts/composer/ComposerNetworkSettings.vue
+++ b/resources/js/components/posts/composer/ComposerNetworkSettings.vue
@@ -42,7 +42,10 @@ const props = withDefaults(
},
);
-const emit = defineEmits<{ 'update:meta': [value: Record<string, any>] }>();
+const emit = defineEmits<{
+ 'update:meta': [value: Record<string, any>];
+ 'link-facebook': [];
+}>();
const { accountLoaded } = useComposerLiveState();
@@ -62,6 +65,7 @@ const videoDurationSec = computed(
);
const update = (meta: Record<string, any>): void => emit('update:meta', meta);
+const linkFacebook = (): void => emit('link-facebook');
const AI_GENERATED_ROWS: Partial<
Record<string, { metaKey: string; testId: string }>
@@ -109,10 +113,14 @@ const aiGenerated = computed({
account.platform === Platform.Instagram ||
account.platform === Platform.InstagramFacebook
"
+ :account-id="account.id"
+ :platform="account.platform"
+ :platform-index="platformIndex"
:content-type="destination.content_type"
:meta="destination.meta"
:disabled="disabled"
@update:meta="update"
+ @link-facebook="linkFacebook"
/>
<ThreadsSettings
v-else-if="
diff --git a/resources/js/components/posts/composer/GlobalPostComposer.vue b/resources/js/components/posts/composer/GlobalPostComposer.vue
index 69f14a48c..0bf0a9a2b 100644
--- a/resources/js/components/posts/composer/GlobalPostComposer.vue
+++ b/resources/js/components/posts/composer/GlobalPostComposer.vue
@@ -70,6 +70,7 @@ const onOpenChange = (open: boolean): void => {
const submitComposition = (
composition: PostComposition,
createAnother: boolean,
+ onSaved?: () => void,
): void => {
submitting.value = true;
const payload: Record<string, any> = { ...composition };
@@ -90,6 +91,7 @@ const submitComposition = (
);
}
if (createAnother) openPostComposer();
+ onSaved?.();
},
onFinish: () => {
submitting.value = false;
diff --git a/resources/js/components/posts/composer/MediaEditorDialog.vue b/resources/js/components/posts/composer/MediaEditorDialog.vue
index b12617d2a..63293419e 100644
--- a/resources/js/components/posts/composer/MediaEditorDialog.vue
+++ b/resources/js/components/posts/composer/MediaEditorDialog.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { IconX } from '@tabler/icons-vue';
+import { IconCrosshair, IconX } from '@tabler/icons-vue';
import { computed, ref, watch } from 'vue';
import { show as showMediaFile } from '@/actions/App/Http/Controllers/App/MediaFileController';
@@ -97,6 +97,7 @@ const onSectionChange = (value: string | number): void => {
const pendingPoint = ref<{ x: number; y: number } | null>(null);
const tagging = ref(false);
+const movingIndex = ref<number | null>(null);
const applying = ref(false);
const failed = ref(false);
const imageErrors = ref<Record<number, boolean>>({});
@@ -198,19 +199,27 @@ const selectItem = (index: number): void => {
activeIndex.value = index;
pendingPoint.value = null;
tagging.value = false;
+ movingIndex.value = null;
tab.value = tabFor(tab.value);
};
const onStagePress = (point: { x: number; y: number }): void => {
- if (
- tab.value !== 'tags' ||
- !tagging.value ||
- edit.value.userTags.length >= USER_TAGS_MAX
- )
- return;
+ if (tab.value !== 'tags' || !edit.value) return;
const round = (value: number): number =>
Math.round(Math.min(1, Math.max(0, value)) * 10000) / 10000;
- pendingPoint.value = { x: round(point.x), y: round(point.y) };
+ const placed = { x: round(point.x), y: round(point.y) };
+ const moving = movingIndex.value;
+
+ if (moving !== null) {
+ edit.value.userTags = edit.value.userTags.map((tag, index) =>
+ index === moving ? { ...tag, ...placed } : tag,
+ );
+ movingIndex.value = null;
+ return;
+ }
+
+ if (!tagging.value || edit.value.userTags.length >= USER_TAGS_MAX) return;
+ pendingPoint.value = placed;
};
const resetCrop = (): void => resetGeometry(basePreset.value);
@@ -301,6 +310,7 @@ watch(
section.value = 'crop';
pendingPoint.value = null;
tagging.value = false;
+ movingIndex.value = null;
failed.value = false;
},
);
@@ -310,6 +320,7 @@ watch(() => edit.value?.coverOffsetMs, seekStageVideo);
watch([tab, section], () => {
pendingPoint.value = null;
tagging.value = false;
+ movingIndex.value = null;
});
watch(tagging, (isTagging) => {
@@ -380,7 +391,8 @@ watch(tagging, (isTagging) => {
:resize-any-ratio="isPhoto"
test-id-prefix="media-editor"
:box-class="
- tab === 'tags' && tagging
+ tab === 'tags' &&
+ (tagging || movingIndex !== null)
? 'cursor-crosshair'
: ''
"
@@ -392,13 +404,31 @@ watch(tagging, (isTagging) => {
<span
v-for="(tag, tagIndex) in edit.userTags"
:key="`${tag.username}-${tagIndex}`"
- class="pointer-events-none absolute flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-foreground text-xs font-medium text-background shadow"
+ class="pointer-events-none absolute flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full text-xs font-medium tabular-nums shadow ring-2 ring-white transition-transform"
+ :class="
+ movingIndex === tagIndex
+ ? 'scale-125 bg-primary-strong text-primary-strong-foreground ring-primary-strong/30'
+ : 'bg-foreground text-background'
+ "
+ :data-testid="`media-editor-tag-marker-${tagIndex}`"
:style="{
left: `${tag.x * 100}%`,
top: `${tag.y * 100}%`,
}"
>{{ tagIndex + 1 }}</span
>
+ <span
+ v-if="movingIndex !== null"
+ class="pointer-events-none absolute bottom-3 left-1/2 flex -translate-x-1/2 items-center gap-1.5 rounded-full bg-foreground/85 px-3 py-1 text-xs whitespace-nowrap text-background shadow"
+ data-testid="media-editor-tag-move-pill"
+ >
+ <IconCrosshair class="size-3.5" />
+ {{
+ $t(
+ 'posts.composer.media_editor.tags_move_pill',
+ )
+ }}
+ </span>
<span
v-if="pendingPoint"
data-testid="media-editor-tag-point"
@@ -462,7 +492,7 @@ watch(tagging, (isTagging) => {
</div>
<aside
- class="flex w-full shrink-0 flex-col gap-4 lg:w-70 lg:overflow-y-auto"
+ class="flex w-full shrink-0 flex-col gap-4 lg:w-80 lg:overflow-y-auto"
>
<div
v-if="tabs.length > 1 || tabs[0] === 'thumbnail'"
@@ -545,6 +575,7 @@ watch(tagging, (isTagging) => {
v-model:edit="edit"
v-model:pending-point="pendingPoint"
v-model:tagging="tagging"
+ v-model:moving-index="movingIndex"
/>
</aside>
</div>
diff --git a/resources/js/components/posts/composer/MediaEditorTagsPanel.vue b/resources/js/components/posts/composer/MediaEditorTagsPanel.vue
index cac4a4909..52ff71a01 100644
--- a/resources/js/components/posts/composer/MediaEditorTagsPanel.vue
+++ b/resources/js/components/posts/composer/MediaEditorTagsPanel.vue
@@ -1,8 +1,14 @@
<script setup lang="ts">
-import { IconAt, IconUserPlus, IconX } from '@tabler/icons-vue';
+import {
+ IconAt,
+ IconExternalLink,
+ IconUserPlus,
+ IconX,
+} from '@tabler/icons-vue';
import { computed, nextTick, ref, watch } from 'vue';
import { Button } from '@/components/ui/button';
+import { instagramProfileUrl } from '@/lib/instagram';
import {
isValidInstagramUsername,
type MediaEdit,
@@ -21,11 +27,20 @@ const clearPendingPoint = (): void => {
};
const tagging = defineModel<boolean>('tagging', { required: true });
+const movingIndex = defineModel<number | null>('movingIndex', {
+ required: true,
+});
const toggleTagging = (): void => {
+ movingIndex.value = null;
tagging.value = !tagging.value;
};
+const toggleMove = (index: number): void => {
+ tagging.value = false;
+ movingIndex.value = movingIndex.value === index ? null : index;
+};
+
const username = ref('');
const invalid = ref(false);
@@ -65,18 +80,166 @@ const saveTag = (): void => {
};
const removeTag = (index: number): void => {
+ movingIndex.value = null;
edit.value.userTags = edit.value.userTags.filter(
(_, tagIndex) => tagIndex !== index,
);
};
+
+const movingUsername = computed(() =>
+ movingIndex.value === null
+ ? null
+ : (edit.value.userTags[movingIndex.value]?.username ?? null),
+);
</script>
<template>
<div class="space-y-4">
+ <div class="space-y-3">
+ <div class="flex items-baseline justify-between gap-2">
+ <h3 class="text-sm font-medium">
+ {{ $t('posts.composer.media_editor.tags_heading') }}
+ </h3>
+ <span
+ class="text-xs text-muted-foreground tabular-nums"
+ data-testid="media-editor-tags-count"
+ >{{ edit.userTags.length }} / {{ USER_TAGS_MAX }}</span
+ >
+ </div>
+
+ <form
+ v-if="pendingPoint"
+ class="space-y-2"
+ data-testid="media-editor-tag-form"
+ @submit.prevent="saveTag"
+ >
+ <div
+ class="flex items-center gap-2 rounded-lg border border-border bg-background px-3"
+ :class="invalid ? 'border-destructive' : ''"
+ >
+ <IconAt class="size-4 shrink-0 text-muted-foreground" />
+ <input
+ ref="input"
+ v-model="username"
+ data-testid="media-editor-tag-username"
+ class="h-9 w-full bg-transparent text-sm outline-none"
+ autocomplete="off"
+ :placeholder="
+ $t('posts.composer.media_editor.tags_placeholder')
+ "
+ :aria-invalid="invalid"
+ @input="clearInvalid"
+ />
+ </div>
+ <p v-if="invalid" class="text-xs text-destructive">
+ {{ $t('posts.composer.media_editor.tags_invalid') }}
+ </p>
+ <div class="flex justify-end gap-2">
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ @click="clearPendingPoint"
+ >
+ {{ $t('posts.composer.media_editor.tags_cancel') }}
+ </Button>
+ <Button
+ type="submit"
+ size="sm"
+ data-testid="media-editor-tag-save"
+ >
+ {{ $t('posts.composer.media_editor.tags_save') }}
+ </Button>
+ </div>
+ </form>
+
+ <ol
+ v-if="edit.userTags.length"
+ class="divide-y divide-border overflow-hidden rounded-lg border border-border"
+ >
+ <li
+ v-for="(tag, index) in edit.userTags"
+ :key="`${tag.username}-${index}`"
+ class="flex items-center gap-2.5 py-1.5 pr-1.5 pl-3 text-sm transition-colors"
+ :class="
+ movingIndex === index
+ ? 'bg-primary-selected'
+ : 'hover:bg-muted/60'
+ "
+ :data-testid="`media-editor-tag-${index}`"
+ >
+ <span
+ class="flex size-6 shrink-0 items-center justify-center rounded-full text-xs font-medium tabular-nums"
+ :class="
+ movingIndex === index
+ ? 'bg-primary-strong text-primary-strong-foreground'
+ : 'bg-primary-selected text-primary-text'
+ "
+ >{{ index + 1 }}</span
+ >
+ <a
+ :href="instagramProfileUrl(tag.username)"
+ target="_blank"
+ rel="noopener noreferrer"
+ class="inline-flex min-w-0 flex-1 items-center gap-1 font-medium underline-offset-2 hover:underline"
+ :data-testid="`media-editor-tag-link-${index}`"
+ >
+ <span class="truncate">@{{ tag.username }}</span>
+ <IconExternalLink
+ class="size-3.5 shrink-0 text-muted-foreground"
+ aria-hidden="true"
+ />
+ </a>
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ class="h-7 shrink-0 px-2 text-xs"
+ :data-testid="`media-editor-tag-move-${index}`"
+ :aria-pressed="movingIndex === index"
+ @click="toggleMove(index)"
+ >
+ <span data-single-line>{{
+ $t(
+ movingIndex === index
+ ? 'posts.composer.media_editor.tags_cancel'
+ : 'posts.composer.media_editor.tags_move',
+ )
+ }}</span>
+ </Button>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ class="shrink-0 text-muted-foreground hover:text-foreground"
+ :data-testid="`media-editor-tag-remove-${index}`"
+ :aria-label="
+ $t('posts.composer.media_editor.tags_remove', {
+ username: tag.username,
+ })
+ "
+ @click="removeTag(index)"
+ >
+ <IconX class="size-4" />
+ </Button>
+ </li>
+ </ol>
+
+ <p
+ v-if="movingUsername"
+ class="text-xs text-muted-foreground"
+ data-testid="media-editor-tag-move-hint"
+ >
+ {{
+ $t('posts.composer.media_editor.tags_move_hint', {
+ username: movingUsername,
+ })
+ }}
+ </p>
+ </div>
+
+
<div class="space-y-2">
- <h3 class="text-sm font-medium">
- {{ $t('posts.composer.media_editor.tags_heading') }}
- </h3>
<Button
type="button"
variant="outline"
@@ -110,79 +273,6 @@ const removeTag = (index: number): void => {
</p>
</div>
- <form
- v-if="pendingPoint"
- class="space-y-2"
- data-testid="media-editor-tag-form"
- @submit.prevent="saveTag"
- >
- <div
- class="flex items-center gap-2 rounded-lg border border-border bg-background px-3"
- :class="invalid ? 'border-destructive' : ''"
- >
- <IconAt class="size-4 shrink-0 text-muted-foreground" />
- <input
- ref="input"
- v-model="username"
- data-testid="media-editor-tag-username"
- class="h-9 w-full bg-transparent text-sm outline-none"
- autocomplete="off"
- :placeholder="
- $t('posts.composer.media_editor.tags_placeholder')
- "
- :aria-invalid="invalid"
- @input="clearInvalid"
- />
- </div>
- <p v-if="invalid" class="text-xs text-destructive">
- {{ $t('posts.composer.media_editor.tags_invalid') }}
- </p>
- <div class="flex justify-end gap-2">
- <Button
- type="button"
- variant="ghost"
- size="sm"
- @click="clearPendingPoint"
- >
- {{ $t('posts.composer.media_editor.tags_cancel') }}
- </Button>
- <Button
- type="submit"
- size="sm"
- data-testid="media-editor-tag-save"
- >
- {{ $t('posts.composer.media_editor.tags_save') }}
- </Button>
- </div>
- </form>
-
- <ol v-if="edit.userTags.length" class="space-y-2">
- <li
- v-for="(tag, index) in edit.userTags"
- :key="`${tag.username}-${index}`"
- class="flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-sm"
- :data-testid="`media-editor-tag-${index}`"
- >
- <span
- class="flex size-5 shrink-0 items-center justify-center rounded-full bg-foreground text-[11px] font-medium text-background"
- >{{ index + 1 }}</span
- >
- <span class="min-w-0 flex-1 truncate">@{{ tag.username }}</span>
- <button
- type="button"
- class="text-muted-foreground hover:text-foreground"
- :aria-label="
- $t('posts.composer.media_editor.tags_remove', {
- username: tag.username,
- })
- "
- @click="removeTag(index)"
- >
- <IconX class="size-4" />
- </button>
- </li>
- </ol>
-
<p class="text-xs text-muted-foreground">
{{ $t('posts.composer.media_editor.tags_limitations') }}
</p>
diff --git a/resources/js/components/posts/composer/PostComposerDialog.vue b/resources/js/components/posts/composer/PostComposerDialog.vue
index 5a4cfa53d..d1adc14ef 100644
--- a/resources/js/components/posts/composer/PostComposerDialog.vue
+++ b/resources/js/components/posts/composer/PostComposerDialog.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { useHttp, usePage } from '@inertiajs/vue3';
+import { Link, useHttp, usePage } from '@inertiajs/vue3';
import {
IconAlertTriangle,
IconArrowLeft,
@@ -35,7 +35,6 @@ import {
effectScope,
type EffectScope,
nextTick,
- onMounted,
ref,
shallowReactive,
watch,
@@ -56,6 +55,7 @@ import PlatformLogo from '@/components/PlatformLogo.vue';
import ComposerAccountChip from '@/components/posts/composer/ComposerAccountChip.vue';
import ComposerAccountOptions from '@/components/posts/composer/ComposerAccountOptions.vue';
import ComposerAccountStack from '@/components/posts/composer/ComposerAccountStack.vue';
+import ComposerDiscardDialog from '@/components/posts/composer/ComposerDiscardDialog.vue';
import ComposerEditorToolbar from '@/components/posts/composer/ComposerEditorToolbar.vue';
import ComposerLinkCard from '@/components/posts/composer/ComposerLinkCard.vue';
import ComposerNetworkCard from '@/components/posts/composer/ComposerNetworkCard.vue';
@@ -73,15 +73,6 @@ import ThreadRepliesField from '@/components/posts/editor/ThreadRepliesField.vue
import PlatformPreview from '@/components/posts/previews/PlatformPreview.vue';
import PreviewPanelTitle from '@/components/posts/previews/PreviewPanelTitle.vue';
import PublishEmptyIllustration from '@/components/publish/PublishEmptyIllustration.vue';
-import {
- AlertDialog,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogTitle,
-} from '@/components/ui/alert-dialog';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
import {
@@ -101,6 +92,10 @@ import {
TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip';
+import { useComposerTimezone } from '@/composables/composer/useComposerTimezone';
+import { useComposerUnsavedChanges } from '@/composables/composer/useComposerUnsavedChanges';
+import { useLastUsedAccounts } from '@/composables/composer/useLastUsedAccounts';
+import { useSaveAndLinkFacebook } from '@/composables/composer/useSaveAndLinkFacebook';
import { useAtLeastBreakpoint, useBelowBreakpoint } from '@/composables/useBreakpoint';
import { useCanHover } from '@/composables/useCanHover';
import {
@@ -110,11 +105,12 @@ import {
fromAutosaveMedia,
isExpiredUpload,
toAutosaveMedia,
+ useAutosavePreview,
useComposerAutosave,
} from '@/composables/useComposerAutosave';
import { useComposerLiveState } from '@/composables/useComposerData';
-import { useComposerTimezone } from '@/composables/useComposerTimezone';
import { useConnectChannelDialog } from '@/composables/useConnectChannelDialog';
+import { trackPostComposerOpen } from '@/composables/useGlobalPostComposer';
import { useLinkCard } from '@/composables/useLinkCard';
import {
getMediaValidationWarning,
@@ -129,7 +125,9 @@ import {
import { getMediaRulesForContentType } from '@/composables/useMediaRules';
import {
type MediaUploader,
+ mediaUploadLimits,
useMediaUpload,
+ withSharedUploads,
} from '@/composables/useMediaUpload';
import { usePageErrors } from '@/composables/usePageErrors';
import {
@@ -169,7 +167,7 @@ import {
rulesFor,
} from '@/lib/mediaEditor';
import { isGooglePickerOpen } from '@/lib/mediaSources/googleDrive';
-import { acceptAttribute } from '@/lib/mediaType';
+import { acceptAttribute, mediaKey } from '@/lib/mediaType';
import { evaluatePlatformMeta } from '@/lib/platformMeta';
import {
newThreadReply,
@@ -182,7 +180,6 @@ import { settings as channelSettings } from '@/routes/app/channels';
import { linkPreviewMedia } from '@/routes/app/posts';
import { update as updatePreferences } from '@/routes/app/settings/preferences';
import type {
- MediaUploadLimits,
PinterestBoardsPayload,
SharedData,
User,
@@ -258,9 +255,12 @@ const emit = defineEmits<{
event: 'submit',
composition: PostComposition,
createAnother: boolean,
+ onSaved?: () => void,
): void;
}>();
+trackPostComposerOpen(() => props.open);
+
const composition = usePostComposition(
() => props.socialAccounts,
props.initialPost,
@@ -394,7 +394,6 @@ useResizeObserver(accountStrip, updateAccountStripFade);
const accountPickerOpen = ref(false);
const accountSearch = ref('');
-const lastUsedAccountIds = ref<string[]>([]);
const scheduleMenuOpen = ref(false);
const schedulePanel = ref<'menu' | 'picker'>('menu');
@@ -537,13 +536,6 @@ watch(
{ immediate: true },
);
const page = usePage<SharedData>();
-const mediaUploadLimits = (): MediaUploadLimits =>
- page.props.mediaUploadLimits ?? {
- max_bytes: { image: 0, video: 0, document: 0 },
- extensions: { image: [], video: [], document: [] },
- upload_retention_hours: 0,
- heic: false,
- };
const trayKey = (groupKey: string | null): string =>
groupKey !== null && customizing.value ? groupKey : '';
const appendMedia = (
@@ -655,33 +647,6 @@ const uploadScope = effectScope();
const uploaders = shallowReactive(new Map<string, MediaUploader>());
const cardUploaders = new Map<string, MediaUploader>();
const replyUploaders = shallowReactive(new Map<string, MediaUploader>());
-const withSharedUploads = (
- own: MediaUploader,
- shared: MediaUploader,
-): MediaUploader => {
- const owner = (key: string): MediaUploader =>
- shared.entries.value.some((entry) => entry.key === key) ||
- shared.imports.value.some((pending) => pending.key === key)
- ? shared
- : own;
-
- return {
- ...own,
- entries: computed(() => [
- ...shared.entries.value,
- ...own.entries.value,
- ]),
- imports: computed(() => [
- ...shared.imports.value,
- ...own.imports.value,
- ]),
- busy: computed(() => shared.busy.value || own.busy.value),
- failed: computed(() => shared.failed.value || own.failed.value),
- retry: (key) => owner(key).retry(key),
- cancel: (key) => owner(key).cancel(key),
- remove: (key) => owner(key).remove(key),
- };
-};
const createUploader = (key: string): void => {
if (uploaders.has(key)) return;
uploadScope.run(() => {
@@ -782,7 +747,6 @@ const mediaUploading = computed(() =>
const mediaFailed = computed(() =>
activeUploaders.value.some((uploader) => uploader.failed.value),
);
-const mediaKey = (item: MediaItem): string => item.upload_token ?? item.id;
const ownsMediaOverride = (accountId: string): boolean =>
Object.hasOwn(composition.overrides.value[accountId] ?? {}, 'media');
type SubmittedMedia = {
@@ -993,38 +957,8 @@ const addLabel = (label: {
}
composition.labelIds.value = [...composition.labelIds.value, label.id];
};
-const filteredAccounts = computed(() => {
- const query = accountSearch.value.trim().toLocaleLowerCase();
-
- return query
- ? props.socialAccounts.filter((account) =>
- [
- account.display_name,
- account.username,
- getPlatformLabel(account.platform),
- ].some((value) => (value ?? '').toLocaleLowerCase().includes(query)),
- )
- : props.socialAccounts;
-});
-const recentlyUsedAccounts = computed(() =>
- props.socialAccounts.filter((account) =>
- lastUsedAccountIds.value.includes(account.id),
- ),
-);
-onMounted(() => {
- try {
- const saved = JSON.parse(
- localStorage.getItem('trypost:composer:last-used-accounts') ?? '[]',
- );
- if (Array.isArray(saved)) {
- lastUsedAccountIds.value = saved.filter(
- (id): id is string => typeof id === 'string',
- );
- }
- } catch {
- lastUsedAccountIds.value = [];
- }
-});
+const { recentlyUsed: recentlyUsedAccounts, remember: rememberAccounts } =
+ useLastUsedAccounts(() => props.socialAccounts);
const hasSharedPreview = computed(
() =>
Boolean(composition.content.value.trim()) ||
@@ -1810,12 +1744,15 @@ const onMediaEdited = async (changes: MediaEditChange[]): Promise<void> => {
cropTarget.value = null;
};
-const submit = (status: PostComposition['status']): void => {
+const submit = (
+ status: PostComposition['status'],
+ onSaved?: () => void,
+): boolean => {
if (
!canSubmit.value ||
(status !== PostStatus.Draft && hasBlockingIssues.value)
)
- return;
+ return false;
submittedMedia.value = snapshotMedia();
const queue =
status === PostStatus.Scheduled &&
@@ -1824,26 +1761,30 @@ const submit = (status: PostComposition['status']): void => {
: null;
const payload = composition.materialize(status, queue);
if (status === PostStatus.Scheduled && !queue) {
- if (!scheduledInstant) return;
+ if (!scheduledInstant) return false;
payload.scheduled_at = scheduledInstant;
if (isInitialQueueSlot()) payload.queue_slot = scheduledInstant;
}
- try {
- localStorage.setItem(
- 'trypost:composer:last-used-accounts',
- JSON.stringify(composition.selectedAccountIds.value),
- );
- } catch {
- // Browser storage is optional; publishing must still work without it.
- }
+ rememberAccounts(composition.selectedAccountIds.value);
autosave.flush();
- emit('submit', payload, createAnother.value && !props.postId);
+ emit('submit', payload, createAnother.value && !props.postId, () => {
+ unsavedChanges.markSaved();
+ onSaved?.();
+ });
+
+ return true;
};
const submitDraft = (): void => {
submit(PostStatus.Draft);
};
+const saveAndLinkFacebook = useSaveAndLinkFacebook({
+ status: () => props.initialPost?.status,
+ publishesNow: () => scheduleMode.value === 'now',
+ submit,
+});
+
const submitSelectedSchedule = (): void => {
submit(
scheduleMode.value === 'now'
@@ -1882,32 +1823,11 @@ const autosave = useComposerAutosave(
),
),
);
-const resumeAccounts = computed(() =>
- (autosave.saved.value?.accountIds ?? []).flatMap((id) => {
- const account = props.socialAccounts.find(
- (candidate) => candidate.id === id,
- );
-
- return account ? [account] : [];
- }),
-);
-const resumeMediaCount = computed(
- () =>
- (autosave.saved.value?.media ?? []).filter(
- (item) =>
- !isExpiredUpload(
- item,
- mediaUploadLimits().upload_retention_hours,
- ),
- ).length,
-);
-const resumePreview = computed(
- () =>
- (autosave.saved.value?.content ?? '')
- .split('\n')
- .map((line) => line.trim())
- .find(Boolean) ?? '',
-);
+const {
+ accounts: resumeAccounts,
+ mediaCount: resumeMediaCount,
+ preview: resumePreview,
+} = useAutosavePreview(autosave.saved, () => props.socialAccounts);
const resumeOpen = ref(
autosaveEnabled &&
Boolean(
@@ -2034,7 +1954,26 @@ const discardUnfinishedPost = (): void => {
resumeOpen.value = false;
};
-const close = (): void => emit('update:open', false);
+const closeComposer = (): void => emit('update:open', false);
+
+const unsavedChanges = useComposerUnsavedChanges({
+ editingSavedPost: Boolean(props.initialPost || props.postId),
+ isOpen: () => props.open,
+ close: closeComposer,
+ composition,
+ scheduleMode: () => scheduleMode.value,
+ uploading: () => mediaUploading.value,
+});
+
+const close = (): void => unsavedChanges.guard(closeComposer);
+
+const onDialogOpenChange = (value: boolean): void => {
+ if (value) {
+ emit('update:open', true);
+ return;
+ }
+ close();
+};
</script>
<template>
@@ -2210,7 +2149,7 @@ const close = (): void => emit('update:open', false);
class="mt-2 space-y-1 border-t border-border-strong px-3 pt-3 pb-1 text-xs text-muted-foreground"
>
<p>{{ $t('posts.composer.queue.no_slots_hint') }}</p>
- <a
+ <Link
v-if="accountsWithoutSlots.length === 1"
:href="
channelSettings.url(
@@ -2221,7 +2160,7 @@ const close = (): void => emit('update:open', false);
class="font-medium text-foreground underline underline-offset-2"
>{{
$t('posts.composer.queue.manage_slots')
- }}</a
+ }}</Link
>
<p v-else>
{{
@@ -2242,18 +2181,22 @@ const close = (): void => emit('update:open', false);
</div>
</template>
</DefineScheduleMenu>
- <Dialog :open="open" @update:open="emit('update:open', $event)">
+ <Dialog :open="open" @update:open="onDialogOpenChange">
<DialogContent
- class="motion-resize top-0 left-0 flex h-dvh max-h-dvh w-screen max-w-none translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden rounded-none p-0 sm:top-1/2 sm:left-1/2 sm:max-w-none sm:-translate-x-1/2 sm:-translate-y-1/2"
+ class="motion-resize top-0 left-0 flex h-dvh max-h-dvh w-screen max-w-none translate-x-0 translate-y-0 flex-col gap-0 overflow-hidden rounded-none p-0 sm:max-w-none"
:class="
expandedDialog
- ? 'sm:h-dvh sm:max-h-dvh sm:w-screen sm:rounded-none'
- : 'sm:h-[calc(100dvh-3rem)] sm:max-h-[888px] sm:w-[min(1280px,calc(100vw-3rem))] sm:rounded-2xl'
+ ? 'sm:top-0 sm:left-0 sm:h-dvh sm:max-h-dvh sm:w-screen sm:rounded-none'
+ : 'sm:top-[round(down,calc((100dvh_-_min(100dvh_-_3rem,888px))_/_2),1px)] sm:left-[round(down,calc((100vw_-_min(1280px,100vw_-_3rem))_/_2),1px)] sm:h-[calc(100dvh-3rem)] sm:max-h-[888px] sm:w-[min(1280px,calc(100vw-3rem))] sm:rounded-2xl'
"
:show-close-button="false"
:aria-describedby="undefined"
data-testid="post-composer-dialog"
:disable-outside-pointer-events="!isGooglePickerOpen"
+ @pointerdown.capture="unsavedChanges.markInteracted"
+ @keydown.capture="unsavedChanges.markInteracted"
+ @paste.capture="unsavedChanges.markInteracted"
+ @dragenter.capture="unsavedChanges.markInteracted"
@interact-outside="isGooglePickerOpen && $event.preventDefault()"
>
<input
@@ -2282,7 +2225,7 @@ const close = (): void => emit('update:open', false);
><IconArrowLeft class="size-4"
/></Button>
<DialogTitle class="font-sans">{{
- initialPost || initialDraft
+ initialPost
? $t('posts.edit.title')
: $t('posts.create.title')
}}</DialogTitle>
@@ -2582,7 +2525,7 @@ const close = (): void => emit('update:open', false);
<ComposerAccountOptions
v-else
v-model:search="accountSearch"
- :accounts="filteredAccounts"
+ :accounts="socialAccounts"
:selected-ids="
composition.selectedAccountIds.value
"
@@ -3182,6 +3125,11 @@ const close = (): void => emit('update:open', false);
$event,
)
"
+ @link-facebook="
+ saveAndLinkFacebook(
+ group.anchor.id,
+ )
+ "
/>
</template>
</ComposerNetworkCard>
@@ -3544,38 +3492,27 @@ const close = (): void => emit('update:open', false);
v-model:open="unsplashOpen"
@picked="onUnsplashPicked"
/>
- <AlertDialog v-model:open="confirmingBack">
- <AlertDialogContent
- class="gap-0 px-0 pt-6 pb-0 sm:max-w-[512px]"
- data-testid="composer-back-confirm"
- >
- <AlertDialogHeader class="gap-3 px-6 pb-4 text-left">
- <AlertDialogTitle class="font-sans text-base font-medium">
- {{ $t('posts.composer.back_confirm.title') }}
- </AlertDialogTitle>
- <AlertDialogDescription class="text-sm text-foreground">
- {{ $t('posts.composer.back_confirm.description') }}
- </AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter
- class="mx-2 mb-2"
- >
- <AlertDialogCancel
- data-testid="composer-back-cancel"
- >
- {{ $t('common.cancel') }}
- </AlertDialogCancel>
- <Button
- variant="destructive"
- size="lg"
- data-testid="composer-back-confirm-go"
- @click="goBackToSharedStep"
- >
- {{ $t('posts.composer.back_confirm.confirm') }}
- </Button>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
+ <ComposerDiscardDialog
+ v-model:open="unsavedChanges.confirming.value"
+ :title="$t('common.unsaved_changes.title')"
+ :description="$t('common.unsaved_changes.description')"
+ :action="$t('common.unsaved_changes.discard')"
+ test-id="unsaved-changes-dialog"
+ cancel-test-id="unsaved-changes-keep"
+ action-test-id="unsaved-changes-discard"
+ @confirm="unsavedChanges.discard"
+ @cancel="unsavedChanges.keepEditing"
+ />
+ <ComposerDiscardDialog
+ v-model:open="confirmingBack"
+ :title="$t('posts.composer.back_confirm.title')"
+ :description="$t('posts.composer.back_confirm.description')"
+ :action="$t('posts.composer.back_confirm.confirm')"
+ test-id="composer-back-confirm"
+ cancel-test-id="composer-back-cancel"
+ action-test-id="composer-back-confirm-go"
+ @confirm="goBackToSharedStep"
+ />
<ResumeUnfinishedPostDialog
:open="resumeOpen"
:accounts="resumeAccounts"
diff --git a/resources/js/components/posts/editor/DiscordSettings.vue b/resources/js/components/posts/editor/DiscordSettings.vue
index c05841e90..8ba07f84e 100644
--- a/resources/js/components/posts/editor/DiscordSettings.vue
+++ b/resources/js/components/posts/editor/DiscordSettings.vue
@@ -96,7 +96,13 @@ onMounted(loadChannels);
const channelId = computed({
get: () => (props.meta?.channel_id as string) ?? '',
- set: (value: string) => updateMeta({ channel_id: value || null }),
+ set: (value: string) =>
+ updateMeta({
+ channel_id: value || null,
+ channel_name:
+ channelOptions.value.find((channel) => channel.id === value)
+ ?.name ?? null,
+ }),
});
const channelOptions = computed<DiscordChannel[]>(() => {
@@ -105,7 +111,10 @@ const channelOptions = computed<DiscordChannel[]>(() => {
!channels.value.some((channel) => channel.id === channelId.value)
) {
return [
- { id: channelId.value, name: channelId.value },
+ {
+ id: channelId.value,
+ name: props.meta?.channel_name ?? channelId.value,
+ },
...channels.value,
];
}
@@ -120,20 +129,6 @@ const channelSelectOptions = computed(() =>
})),
);
-watch(
- [channelId, channels],
- () => {
- const name = channels.value.find(
- (channel) => channel.id === channelId.value,
- )?.name;
-
- if (name && props.meta?.channel_name !== name) {
- updateMeta({ channel_name: name });
- }
- },
- { immediate: true },
-);
-
const storedChannelError = useMetaErrors(() => props.platformIndex)('channel_id');
const channelError = computed(() =>
props.meta?.channel_id ? undefined : storedChannelError.value,
diff --git a/resources/js/components/posts/editor/InstagramSettings.vue b/resources/js/components/posts/editor/InstagramSettings.vue
index e92d5f015..0180c50c4 100644
--- a/resources/js/components/posts/editor/InstagramSettings.vue
+++ b/resources/js/components/posts/editor/InstagramSettings.vue
@@ -1,33 +1,993 @@
<script setup lang="ts">
-import { computed } from 'vue';
+import { useHttp } from '@inertiajs/vue3';
+import {
+ IconAt,
+ IconInfoCircle,
+ IconMusic,
+ IconPlayerPauseFilled,
+ IconPlayerPlayFilled,
+ IconTrash,
+ IconUserPlus,
+ IconVolume,
+ IconX,
+} from '@tabler/icons-vue';
+import { computed, onUnmounted, ref, watch } from 'vue';
+import {
+ index as audioIndex,
+ show as audioShow,
+} from '@/actions/App/Http/Controllers/App/InstagramAudioController';
+import InputError from '@/components/InputError.vue';
import SettingsRow from '@/components/posts/editor/SettingsRow.vue';
import SettingsSection from '@/components/posts/editor/SettingsSection.vue';
+import TrialReelIllustration from '@/components/posts/editor/TrialReelIllustration.vue';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import {
+ Popover,
+ PopoverAnchor,
+ PopoverContent,
+ PopoverTrigger,
+} from '@/components/ui/popover';
+import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group';
+import { Skeleton } from '@/components/ui/skeleton';
import { Switch } from '@/components/ui/switch';
+import { useReelSoundtrack } from '@/composables/composer/useReelSoundtrack';
+import { useMetaErrors } from '@/composables/useMetaErrors';
+import { instagramProfileUrl } from '@/lib/instagram';
+import { rangeFill } from '@/lib/rangeFill';
import { ContentType } from '@/types/content-type';
+import type { InstagramAudio } from '@/types/instagram';
+import { Platform } from '@/types/platform';
+
+type VolumeKey = 'video_volume' | 'audio_volume';
+
+const VOLUME_CONTROLS: { key: VolumeKey; labelKey: string }[] = [
+ { key: 'video_volume', labelKey: 'posts.form.instagram.music.video_volume' },
+ { key: 'audio_volume', labelKey: 'posts.form.instagram.music.audio_volume' },
+];
+
+const MAX_COLLABORATORS = 3;
+
+const SOUND_WAVE_BARS = [
+ { height: '40%', delay: '0ms' },
+ { height: '80%', delay: '-300ms' },
+ { height: '100%', delay: '-600ms' },
+ { height: '70%', delay: '-150ms' },
+ { height: '50%', delay: '-450ms' },
+];
+const COLLABORATORS_NOTICE_KEY = 'trypost:instagram:collaborators-notice-seen';
+const SEARCH_DEBOUNCE_MS = 300;
+const HOVER_PREVIEW_DELAY_MS = 150;
+const TOO_MANY_REQUESTS = 429;
+
+const TRIAL_OPTIONS = [
+ { value: '', labelKey: 'posts.form.instagram.trial_reel.off' },
+ { value: 'SS_PERFORMANCE', labelKey: 'posts.form.instagram.trial_reel.auto' },
+ { value: 'MANUAL', labelKey: 'posts.form.instagram.trial_reel.manual' },
+];
const props = withDefaults(
defineProps<{
+ accountId: string;
+ platform: string;
contentType: string;
+ platformIndex: number;
meta?: Record<string, any>;
disabled?: boolean;
}>(),
{ meta: () => ({}), disabled: false },
);
-const emit = defineEmits<{ 'update:meta': [value: Record<string, any>] }>();
+const emit = defineEmits<{
+ 'update:meta': [value: Record<string, any>];
+ 'link-facebook': [];
+}>();
+
+const updateMeta = (patch: Record<string, any>): void =>
+ emit('update:meta', { ...props.meta, ...patch });
+
+const readFlag = (key: string): boolean => {
+ try {
+ return localStorage.getItem(key) === '1';
+ } catch {
+ return false;
+ }
+};
+
+const writeFlag = (key: string): void => {
+ try {
+ localStorage.setItem(key, '1');
+ } catch {
+ return;
+ }
+};
+
+const metaError = useMetaErrors(() => props.platformIndex);
+const audioError = metaError('audio');
+const collaboratorsError = metaError('collaborators');
+const collaboratorErrors = Array.from(
+ { length: MAX_COLLABORATORS },
+ (_, index) => metaError(`collaborators.${index}`),
+);
+const collaboratorError = computed(
+ () =>
+ collaboratorsError.value ??
+ collaboratorErrors.find((error) => error.value)?.value,
+);
+const trialError = metaError('trial_graduation');
const isReel = computed(() => props.contentType === ContentType.InstagramReel);
+const takesCollaborators = computed(
+ () =>
+ props.contentType === ContentType.InstagramReel ||
+ props.contentType === ContentType.InstagramFeed,
+);
+const musicNeedsFacebook = computed(
+ () => props.platform !== Platform.InstagramFacebook,
+);
+
const shareToFeed = computed({
get: (): boolean => props.meta.share_to_feed ?? true,
- set: (value: boolean) =>
- emit('update:meta', { ...props.meta, share_to_feed: value }),
+ set: (value: boolean) => updateMeta({ share_to_feed: value }),
+});
+
+const selectedAudio = computed(
+ () => (props.meta.audio as InstagramAudio | null | undefined) ?? null,
+);
+
+const musicOpen = ref(false);
+const musicQuery = ref('');
+const tracks = ref<InstagramAudio[]>([]);
+const tracksLoading = ref(false);
+const tracksFailed = ref(false);
+const tracksLimited = ref(false);
+
+const isRateLimited = (error: unknown): boolean =>
+ (error as { response?: { status?: number } } | null)?.response?.status ===
+ TOO_MANY_REQUESTS;
+const audioHttp = useHttp<Record<string, never>, InstagramAudio[]>();
+
+let latestSearch = 0;
+
+const failSearch = (limited: boolean): void => {
+ tracks.value = [];
+ tracksFailed.value = true;
+ tracksLimited.value = limited;
+};
+
+const loadTracks = async (): Promise<void> => {
+ const search = ++latestSearch;
+ tracksLoading.value = true;
+ tracksFailed.value = false;
+ tracksLimited.value = false;
+
+ try {
+ const query = musicQuery.value.trim();
+ const found = await audioHttp.get(
+ audioIndex.url(props.accountId, {
+ query: query === '' ? {} : { q: query },
+ }),
+ );
+ if (search !== latestSearch) return;
+
+ if (Array.isArray(found)) {
+ tracks.value = found;
+ } else {
+ failSearch(false);
+ }
+ } catch (error) {
+ if (search !== latestSearch) return;
+ failSearch(isRateLimited(error));
+ } finally {
+ if (search === latestSearch) tracksLoading.value = false;
+ }
+};
+
+let searchTimer: ReturnType<typeof setTimeout> | undefined;
+watch(musicQuery, () => {
+ clearTimeout(searchTimer);
+ searchTimer = setTimeout(loadTracks, SEARCH_DEBOUNCE_MS);
+});
+
+const soundtrack = useReelSoundtrack();
+
+const brokenUrls = ref(new Set<string>());
+const isUsable = (url: string | null | undefined): url is string =>
+ Boolean(url) && !brokenUrls.value.has(url as string);
+const markBroken = (url: string | null | undefined): void => {
+ if (url) brokenUrls.value = new Set([...brokenUrls.value, url]);
+};
+
+const audioDetailsHttp = useHttp<Record<string, never>, InstagramAudio>();
+const refreshedAudioIds = new Set<string>();
+
+const refreshSelectedAudio = async (): Promise<boolean> => {
+ const audio = selectedAudio.value;
+ if (!audio || musicNeedsFacebook.value || refreshedAudioIds.has(audio.id)) {
+ return false;
+ }
+ refreshedAudioIds.add(audio.id);
+
+ try {
+ const fresh = await audioDetailsHttp.get(
+ audioShow.url({ account: props.accountId, audioId: audio.id }),
+ );
+ const current = selectedAudio.value;
+
+ if (!fresh || current?.id !== audio.id) {
+ return false;
+ }
+
+ updateMeta({
+ audio: {
+ ...current,
+ cover_url: fresh.cover_url,
+ preview_url: fresh.preview_url,
+ },
+ });
+
+ return true;
+ } catch {
+ return false;
+ }
+};
+
+const onSelectedLinkBroken = (url: string | null | undefined): void => {
+ void refreshSelectedAudio().then((refreshed) => {
+ if (!refreshed) markBroken(url);
+ });
+};
+const playingId = soundtrack.playingAudioId;
+
+let hoverTimer: ReturnType<typeof setTimeout> | undefined;
+
+const stopPreview = (): void => {
+ clearTimeout(hoverTimer);
+ soundtrack.stop();
+};
+
+const togglePreview = (track: InstagramAudio): void => {
+ if (playingId.value === track.id) {
+ soundtrack.stop();
+
+ return;
+ }
+
+ if (!isUsable(track.preview_url)) {
+ soundtrack.stop();
+
+ return;
+ }
+
+ soundtrack.play(
+ track.id,
+ track.preview_url,
+ track.audio_volume ?? 100,
+ () =>
+ track.id === selectedAudio.value?.id
+ ? onSelectedLinkBroken(track.preview_url)
+ : markBroken(track.preview_url),
+ );
+};
+
+const startHoverPreview = (track: InstagramAudio): void => {
+ clearTimeout(hoverTimer);
+ if (!isUsable(track.preview_url) || playingId.value === track.id) return;
+ hoverTimer = setTimeout(
+ () =>
+ soundtrack.play(track.id, track.preview_url as string, 100, () =>
+ markBroken(track.preview_url),
+ ),
+ HOVER_PREVIEW_DELAY_MS,
+ );
+};
+
+const stopHoverPreview = (track: InstagramAudio): void => {
+ clearTimeout(hoverTimer);
+ if (playingId.value === track.id) soundtrack.stop();
+};
+
+const onMusicOpenChange = (open: boolean): void => {
+ musicOpen.value = open;
+
+ if (!open) {
+ stopPreview();
+
+ return;
+ }
+
+ if (!musicNeedsFacebook.value && tracks.value.length === 0) {
+ void loadTracks();
+ }
+};
+
+const closeMusic = (): void => {
+ onMusicOpenChange(false);
+};
+
+const formatDuration = (milliseconds: number): string => {
+ const seconds = Math.round(milliseconds / 1000);
+
+ return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, '0')}`;
+};
+
+const trackDetails = (track: InstagramAudio): string =>
+ [
+ track.duration_ms ? formatDuration(track.duration_ms) : null,
+ track.artist,
+ ]
+ .filter(Boolean)
+ .join(' · ');
+
+const selectTrack = (track: InstagramAudio): void => {
+ updateMeta({
+ audio: {
+ id: track.id,
+ title: track.title,
+ artist: track.artist,
+ cover_url: track.cover_url,
+ preview_url: track.preview_url,
+ },
+ });
+ closeMusic();
+};
+
+const volumeOf = (key: VolumeKey): number => selectedAudio.value?.[key] ?? 100;
+
+const changeVolume = (key: VolumeKey, event: Event): void => {
+ const volume = Number((event.target as HTMLInputElement).value);
+ updateMeta({ audio: { ...selectedAudio.value, [key]: volume } });
+
+ if (key === 'audio_volume' && playingId.value === selectedAudio.value?.id) {
+ soundtrack.setVolume(volume);
+ }
+};
+
+const removeAudio = (): void => {
+ soundtrack.stop();
+ updateMeta({ audio: null });
+};
+
+const linkFacebook = (): void => {
+ closeMusic();
+ emit('link-facebook');
+};
+
+const collaborators = computed<string[]>(() =>
+ Array.isArray(props.meta.collaborators) ? props.meta.collaborators : [],
+);
+const collaboratorDraft = ref('');
+const collaboratorNoticeOpen = ref(false);
+
+const addCollaborator = (): void => {
+ const username = collaboratorDraft.value.trim().replace(/^@+/, '');
+ collaboratorDraft.value = '';
+
+ if (
+ username === '' ||
+ collaborators.value.length >= MAX_COLLABORATORS ||
+ collaborators.value.some(
+ (existing) => existing.toLowerCase() === username.toLowerCase(),
+ )
+ ) {
+ return;
+ }
+
+ updateMeta({
+ collaborators: [...collaborators.value, username],
+ trial_graduation: null,
+ });
+
+ if (!readFlag(COLLABORATORS_NOTICE_KEY)) {
+ collaboratorNoticeOpen.value = true;
+ }
+};
+
+const onCollaboratorKeydown = (event: KeyboardEvent): void => {
+ if (event.key === 'Enter' || event.key === ',' || event.key === ' ') {
+ event.preventDefault();
+ addCollaborator();
+ }
+};
+
+const removeCollaborator = (username: string): void => {
+ updateMeta({
+ collaborators: collaborators.value.filter(
+ (existing) => existing !== username,
+ ),
+ });
+};
+
+const dismissCollaboratorNotice = (): void => {
+ writeFlag(COLLABORATORS_NOTICE_KEY);
+ collaboratorNoticeOpen.value = false;
+};
+
+const trialGraduation = computed(
+ () => (props.meta.trial_graduation as string | null | undefined) ?? '',
+);
+const TRIAL_HINTS: Record<string, string> = {
+ SS_PERFORMANCE: 'posts.form.instagram.trial_reel.auto_hint',
+ MANUAL: 'posts.form.instagram.trial_reel.manual_hint',
+};
+const trialHint = computed(() => TRIAL_HINTS[trialGraduation.value] ?? null);
+const pendingTrial = ref<string | null>(null);
+const trialCheckOpen = computed(() => pendingTrial.value !== null);
+
+const trialOptionLabels = new Map<string, HTMLElement>();
+const rememberTrialOption = (value: string, element: unknown): void => {
+ if (element instanceof HTMLElement) {
+ trialOptionLabels.set(value, element);
+ }
+};
+const trialAnchor = computed(() =>
+ pendingTrial.value === null
+ ? undefined
+ : trialOptionLabels.get(pendingTrial.value),
+);
+
+const selectTrial = (value: string): void => {
+ if (value !== '' && trialGraduation.value === '') {
+ pendingTrial.value = value;
+
+ return;
+ }
+
+ updateMeta({ trial_graduation: value === '' ? null : value });
+};
+
+const cancelTrialCheck = (): void => {
+ pendingTrial.value = null;
+};
+
+const confirmTrialCheck = (): void => {
+ const value = pendingTrial.value;
+ pendingTrial.value = null;
+ updateMeta({ trial_graduation: value });
+};
+
+watch(
+ () => props.accountId,
+ () => {
+ tracks.value = [];
+ musicQuery.value = '';
+ refreshedAudioIds.clear();
+ },
+);
+
+const ownsPlayingAudio = (): boolean =>
+ playingId.value !== null &&
+ (playingId.value === selectedAudio.value?.id ||
+ tracks.value.some((track) => track.id === playingId.value));
+
+onUnmounted(() => {
+ clearTimeout(searchTimer);
+ clearTimeout(hoverTimer);
+
+ if (ownsPlayingAudio()) {
+ soundtrack.stop();
+ }
});
</script>
<template>
- <SettingsSection v-if="isReel">
- <SettingsRow :label="$t('posts.form.instagram.share_to_feed')">
+ <SettingsSection v-if="takesCollaborators">
+ <SettingsRow v-if="isReel" :label="$t('posts.form.instagram.music.label')">
+ <template #label>
+ <span data-single-line>{{
+ $t('posts.form.instagram.music.label')
+ }}</span>
+ </template>
+ <div class="flex min-h-8 items-center">
+ <div
+ v-if="selectedAudio"
+ class="flex w-full min-w-0 items-center gap-3 rounded-md border p-2"
+ data-testid="instagram-music-selected"
+ >
+ <button
+ type="button"
+ class="relative size-12 shrink-0 overflow-hidden rounded-md bg-muted disabled:cursor-default"
+ data-testid="instagram-music-selected-preview"
+ :disabled="!isUsable(selectedAudio.preview_url)"
+ :aria-label="
+ playingId === selectedAudio.id
+ ? $t('posts.form.instagram.music.pause')
+ : $t('posts.form.instagram.music.play')
+ "
+ @click="togglePreview(selectedAudio)"
+ >
+ <img
+ v-if="isUsable(selectedAudio.cover_url)"
+ :src="selectedAudio.cover_url"
+ alt=""
+ class="absolute inset-0 size-full object-cover"
+ data-testid="instagram-music-selected-cover"
+ @error="onSelectedLinkBroken(selectedAudio.cover_url)"
+ />
+ <IconMusic
+ v-else
+ class="absolute inset-0 m-auto size-5 text-muted-foreground"
+ />
+ <span
+ v-if="isUsable(selectedAudio.preview_url)"
+ class="absolute inset-0 m-auto flex size-7 items-center justify-center rounded-full bg-success text-white"
+ >
+ <IconPlayerPauseFilled
+ v-if="playingId === selectedAudio.id"
+ class="size-3.5"
+ />
+ <IconPlayerPlayFilled v-else class="size-3.5" />
+ </span>
+ </button>
+ <span class="min-w-0 flex-1">
+ <span class="block truncate text-sm text-foreground">{{
+ selectedAudio.title
+ }}</span>
+ <span
+ v-if="selectedAudio.artist"
+ class="block truncate text-sm text-muted-foreground"
+ >{{ selectedAudio.artist }}</span
+ >
+ </span>
+ <Popover>
+ <PopoverTrigger as-child>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon-sm"
+ data-testid="instagram-music-volume"
+ :aria-label="$t('posts.form.instagram.music.volume')"
+ :disabled="disabled"
+ >
+ <IconVolume class="size-4" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ align="end"
+ class="w-64 space-y-4"
+ data-testid="instagram-music-volume-panel"
+ >
+ <label
+ v-for="control in VOLUME_CONTROLS"
+ :key="control.key"
+ class="block space-y-1 text-sm"
+ >
+ <span class="flex justify-between">
+ <span data-single-line>{{
+ $t(control.labelKey)
+ }}</span>
+ <span class="text-muted-foreground"
+ >{{ volumeOf(control.key) }}%</span
+ >
+ </span>
+ <input
+ type="range"
+ min="0"
+ max="100"
+ step="1"
+ class="editor-range w-full"
+ :data-testid="`instagram-music-${control.key}`"
+ :style="rangeFill(volumeOf(control.key), 0, 100)"
+ :value="volumeOf(control.key)"
+ @input="changeVolume(control.key, $event)"
+ />
+ </label>
+ </PopoverContent>
+ </Popover>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon-sm"
+ data-testid="instagram-music-remove"
+ :aria-label="$t('posts.form.instagram.music.remove')"
+ :disabled="disabled"
+ @click="removeAudio"
+ >
+ <IconTrash class="size-4" />
+ </Button>
+ </div>
+ <Popover
+ v-else
+ :open="musicOpen"
+ @update:open="onMusicOpenChange"
+ >
+ <PopoverTrigger as-child>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ data-testid="instagram-music-add"
+ :disabled="disabled"
+ >
+ <span data-single-line>{{
+ $t('posts.form.instagram.music.add')
+ }}</span>
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ v-if="musicNeedsFacebook"
+ side="top"
+ class="w-80 space-y-3"
+ data-testid="instagram-music-link-facebook"
+ >
+ <p class="text-sm font-semibold">
+ {{ $t('posts.form.instagram.music.link_title') }}
+ </p>
+ <p class="text-sm text-muted-foreground">
+ {{ $t('posts.form.instagram.music.link_body') }}
+ </p>
+ <div class="flex justify-end gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ data-testid="instagram-music-maybe-later"
+ @click="closeMusic"
+ >
+ <span data-single-line>{{
+ $t('posts.form.instagram.music.maybe_later')
+ }}</span>
+ </Button>
+ <Button
+ type="button"
+ size="sm"
+ data-testid="instagram-music-save-and-link"
+ @click="linkFacebook"
+ >
+ <span data-single-line>{{
+ $t('posts.form.instagram.music.save_and_link')
+ }}</span>
+ </Button>
+ </div>
+ </PopoverContent>
+ <PopoverContent
+ v-else
+ side="top"
+ align="start"
+ class="w-96 p-0"
+ data-testid="instagram-music-picker"
+ >
+ <div class="p-2">
+ <Input
+ v-model="musicQuery"
+ type="text"
+ autocomplete="off"
+ data-testid="instagram-music-search"
+ :placeholder="
+ $t('posts.form.instagram.music.search_placeholder')
+ "
+ />
+ </div>
+ <div class="max-h-80 overflow-y-auto px-2 pb-2">
+ <template v-if="tracksLoading">
+ <div
+ v-for="index in 5"
+ :key="index"
+ class="flex items-center gap-3 p-2"
+ data-testid="instagram-music-skeleton"
+ >
+ <Skeleton class="size-12 shrink-0 rounded-md" />
+ <div class="flex-1 space-y-2">
+ <Skeleton class="h-3.5 w-3/4" />
+ <Skeleton class="h-3 w-1/2" />
+ </div>
+ </div>
+ </template>
+ <p
+ v-else-if="tracksFailed"
+ class="px-2 py-4 text-sm text-destructive"
+ data-testid="instagram-music-failed"
+ >
+ {{
+ $t(
+ tracksLimited
+ ? 'posts.form.instagram.music.too_many_searches'
+ : 'posts.form.instagram.music.search_failed',
+ )
+ }}
+ </p>
+ <p
+ v-else-if="tracks.length === 0"
+ class="px-2 py-4 text-sm text-muted-foreground"
+ >
+ {{ $t('posts.form.instagram.music.empty') }}
+ </p>
+ <button
+ v-for="track in tracks"
+ v-else
+ :key="track.id"
+ type="button"
+ class="flex w-full items-center gap-3 rounded-md p-2 text-left hover:bg-muted focus-visible:bg-muted focus-visible:outline-none"
+ :data-testid="`instagram-music-track-${track.id}`"
+ @mouseenter="startHoverPreview(track)"
+ @mouseleave="stopHoverPreview(track)"
+ @click="selectTrack(track)"
+ >
+ <span
+ class="relative size-12 shrink-0 overflow-hidden rounded-md bg-muted"
+ >
+ <img
+ v-if="isUsable(track.cover_url)"
+ :src="track.cover_url"
+ alt=""
+ class="absolute inset-0 size-full object-cover"
+ @error="markBroken(track.cover_url)"
+ />
+ <IconMusic
+ v-else
+ class="absolute inset-0 m-auto size-5 text-muted-foreground"
+ />
+ </span>
+ <span class="min-w-0 flex-1">
+ <span class="flex items-center gap-1.5">
+ <span
+ v-if="playingId === track.id"
+ class="motion-sound-wave flex h-3 shrink-0 items-center gap-0.5"
+ aria-hidden="true"
+ data-testid="instagram-music-playing"
+ >
+ <span
+ v-for="bar in SOUND_WAVE_BARS"
+ :key="bar.delay"
+ class="w-0.5 rounded-full bg-success"
+ :style="{
+ height: bar.height,
+ animationDelay: bar.delay,
+ }"
+ />
+ </span>
+ <span class="truncate text-sm text-foreground">{{
+ track.title
+ }}</span>
+ </span>
+ <span
+ class="block truncate text-sm text-muted-foreground"
+ >{{ trackDetails(track) }}</span
+ >
+ </span>
+ </button>
+ </div>
+ <p
+ class="flex items-center gap-1.5 border-t px-3 py-2 text-xs text-muted-foreground"
+ >
+ <IconInfoCircle class="size-3.5 shrink-0" />
+ {{ $t('posts.form.instagram.music.limited') }}
+ </p>
+ </PopoverContent>
+ </Popover>
+ </div>
+ <p
+ v-if="selectedAudio"
+ class="text-xs text-muted-foreground"
+ data-testid="instagram-music-part-hint"
+ >
+ {{ $t('posts.form.instagram.music.part_hint') }}
+ </p>
+ <InputError :message="audioError" />
+ </SettingsRow>
+
+ <SettingsRow
+ :label="$t('posts.form.instagram.collaborators.label')"
+ :align-top="collaborators.length > 0"
+ >
+ <template #label>
+ <span data-single-line>{{
+ $t('posts.form.instagram.collaborators.label')
+ }}</span>
+ </template>
+ <p
+ v-if="isReel && trialGraduation !== ''"
+ class="flex min-h-8 items-center text-sm text-muted-foreground"
+ data-testid="instagram-collaborators-unavailable"
+ >
+ {{ $t('posts.form.instagram.collaborators.no_trial') }}
+ </p>
+ <Popover v-else :open="collaboratorNoticeOpen">
+ <PopoverAnchor as-child>
+ <div
+ class="flex flex-col gap-2"
+ data-testid="instagram-collaborators"
+ >
+ <div
+ v-if="collaborators.length > 0"
+ class="flex flex-wrap items-center gap-2"
+ >
+ <span
+ v-for="username in collaborators"
+ :key="username"
+ class="inline-flex items-center gap-1 rounded-md bg-muted px-2 py-1 text-sm"
+ >
+ <a
+ :href="instagramProfileUrl(username)"
+ target="_blank"
+ rel="noopener noreferrer"
+ class="cursor-alias underline-offset-2 hover:underline"
+ :data-testid="`instagram-collaborator-${username}`"
+ >@{{ username }}</a
+ >
+ <button
+ type="button"
+ class="rounded text-muted-foreground hover:text-foreground"
+ :data-testid="`instagram-collaborator-remove-${username}`"
+ :aria-label="
+ $t('posts.form.instagram.collaborators.remove', {
+ username,
+ })
+ "
+ :disabled="disabled"
+ @click="removeCollaborator(username)"
+ >
+ <IconX class="size-3.5" />
+ </button>
+ </span>
+ </div>
+ <div
+ v-if="collaborators.length < MAX_COLLABORATORS"
+ class="flex items-center gap-2"
+ >
+ <div class="relative min-w-0 flex-1">
+ <IconAt
+ class="pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"
+ />
+ <Input
+ v-model="collaboratorDraft"
+ type="text"
+ class="pl-8"
+ autocomplete="off"
+ data-testid="instagram-collaborator-input"
+ :placeholder="
+ $t(
+ 'posts.form.instagram.collaborators.placeholder',
+ )
+ "
+ :aria-label="
+ $t('posts.form.instagram.collaborators.add')
+ "
+ :disabled="disabled"
+ @keydown="onCollaboratorKeydown"
+ @blur="addCollaborator"
+ />
+ </div>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ data-testid="instagram-collaborator-add"
+ :aria-label="
+ $t('posts.form.instagram.collaborators.add')
+ "
+ :disabled="disabled"
+ @click="addCollaborator"
+ >
+ <IconUserPlus class="size-4" />
+ </Button>
+ </div>
+ </div>
+ </PopoverAnchor>
+ <PopoverContent
+ side="bottom"
+ align="start"
+ class="w-80 space-y-3"
+ data-testid="instagram-collaborators-notice"
+ @open-auto-focus.prevent
+ @escape-key-down="dismissCollaboratorNotice"
+ @pointer-down-outside="dismissCollaboratorNotice"
+ >
+ <p class="text-sm">
+ {{ $t('posts.form.instagram.collaborators.notice') }}
+ </p>
+ <div class="flex justify-end">
+ <Button
+ type="button"
+ size="sm"
+ data-testid="instagram-collaborators-notice-dismiss"
+ @click="dismissCollaboratorNotice"
+ >
+ <span data-single-line>{{
+ $t('posts.form.instagram.collaborators.got_it')
+ }}</span>
+ </Button>
+ </div>
+ </PopoverContent>
+ </Popover>
+ <InputError :message="collaboratorError" />
+ </SettingsRow>
+
+ <SettingsRow
+ v-if="isReel"
+ :label="$t('posts.form.instagram.trial_reel.label')"
+ :align-top="Boolean(trialHint) && collaborators.length === 0"
+ >
+ <template #label>
+ <span data-single-line>{{
+ $t('posts.form.instagram.trial_reel.label')
+ }}</span>
+ </template>
+ <p
+ v-if="collaborators.length > 0"
+ class="flex min-h-8 items-center text-sm text-muted-foreground"
+ data-testid="instagram-trial-reel-unavailable"
+ >
+ {{ $t('posts.form.instagram.trial_reel.no_collaborators') }}
+ </p>
+ <Popover v-else :open="trialCheckOpen">
+ <PopoverAnchor :reference="trialAnchor" as-child>
+ <div>
+ <RadioGroup
+ :model-value="trialGraduation"
+ :disabled="disabled"
+ orientation="horizontal"
+ :aria-label="$t('posts.form.instagram.trial_reel.label')"
+ class="flex min-h-8 flex-wrap items-center gap-x-5 gap-y-2"
+ data-testid="instagram-trial-reel"
+ @update:model-value="selectTrial(String($event))"
+ >
+ <label
+ v-for="option in TRIAL_OPTIONS"
+ :key="option.value"
+ :ref="(element) => rememberTrialOption(option.value, element)"
+ class="flex cursor-pointer items-center gap-2 text-sm text-foreground has-disabled:cursor-not-allowed has-disabled:opacity-50"
+ >
+ <RadioGroupItem
+ :value="option.value"
+ :data-testid="`instagram-trial-reel-${option.value || 'off'}`"
+ />
+ <span data-single-line>{{ $t(option.labelKey) }}</span>
+ </label>
+ </RadioGroup>
+ </div>
+ </PopoverAnchor>
+ <PopoverContent
+ side="top"
+ class="w-80 space-y-3"
+ data-testid="instagram-trial-reel-check"
+ @escape-key-down="cancelTrialCheck"
+ @pointer-down-outside="cancelTrialCheck"
+ >
+ <TrialReelIllustration />
+ <p class="text-sm font-semibold">
+ {{ $t('posts.form.instagram.trial_reel.check_title') }}
+ </p>
+ <p class="text-sm text-muted-foreground">
+ {{ $t('posts.form.instagram.trial_reel.check_body') }}
+ </p>
+ <div class="flex justify-end gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ data-testid="instagram-trial-reel-check-no"
+ @click="cancelTrialCheck"
+ >
+ <span data-single-line>{{
+ $t('posts.form.instagram.trial_reel.not_checked')
+ }}</span>
+ </Button>
+ <Button
+ type="button"
+ size="sm"
+ data-testid="instagram-trial-reel-check-yes"
+ @click="confirmTrialCheck"
+ >
+ <span data-single-line>{{
+ $t('posts.form.instagram.trial_reel.checked')
+ }}</span>
+ </Button>
+ </div>
+ </PopoverContent>
+ </Popover>
+ <p
+ v-if="trialHint && collaborators.length === 0"
+ class="text-[13px] text-muted-foreground"
+ data-testid="instagram-trial-reel-hint"
+ >
+ {{ $t(trialHint) }}
+ </p>
+ <InputError :message="trialError" />
+ </SettingsRow>
+
+ <SettingsRow v-if="isReel" :label="$t('posts.form.instagram.share_to_feed')">
<template #label>
<span data-single-line>{{
$t('posts.form.instagram.share_to_feed')
diff --git a/resources/js/components/posts/editor/PinterestBoardPicker.vue b/resources/js/components/posts/editor/PinterestBoardPicker.vue
index 21925ae18..864d9e62f 100644
--- a/resources/js/components/posts/editor/PinterestBoardPicker.vue
+++ b/resources/js/components/posts/editor/PinterestBoardPicker.vue
@@ -21,6 +21,7 @@ import {
PopoverTrigger,
} from '@/components/ui/popover';
import { usePinterestBoards } from '@/composables/usePinterestBoards';
+import { filterBySearch } from '@/lib/search';
import type { PinterestBoard, PinterestBoardsPayload } from '@/types';
const props = withDefaults(
@@ -56,15 +57,9 @@ const selectedBoard = computed<PinterestBoard | undefined>(() =>
boards.value.find((board) => board.id === boardId.value),
);
-const filteredBoards = computed(() => {
- const query = search.value.trim().toLocaleLowerCase();
-
- return query
- ? boards.value.filter((board) =>
- board.name.toLocaleLowerCase().includes(query),
- )
- : boards.value;
-});
+const filteredBoards = computed(() =>
+ filterBySearch(boards.value, search.value, (board) => [board.name]),
+);
const refreshHttp = useHttp<Record<string, never>, PinterestBoardsPayload>(
{},
diff --git a/resources/js/components/posts/editor/PostNoteItem.vue b/resources/js/components/posts/editor/PostNoteItem.vue
index a767b3564..ed8612aef 100644
--- a/resources/js/components/posts/editor/PostNoteItem.vue
+++ b/resources/js/components/posts/editor/PostNoteItem.vue
@@ -85,23 +85,19 @@ const handleEditKeydown = (event: KeyboardEvent) => {
<template>
<div
:data-note-id="note.id"
- class="group/note relative flex gap-2.5 rounded-lg px-2 py-2 transition-colors"
- :class="
- highlighted
- ? 'bg-primary-subtle ring-2 ring-primary-strong'
- : 'hover:bg-accent has-[[data-state=open]]:bg-accent'
- "
+ class="group/note relative -mx-2 flex gap-3 rounded-lg px-2 py-1 transition-colors"
+ :class="{ 'bg-primary-subtle': highlighted }"
data-testid="note-item"
>
<Avatar
:src="note.user.photo_url"
:name="note.user.name"
- class="size-7 text-[11px]"
+ class="size-7 shrink-0 text-xs"
fallback-class="bg-sidebar-accent text-sidebar-accent-foreground"
/>
<div class="min-w-0 flex-1">
- <div class="flex min-h-7 items-center gap-1.5">
+ <div class="flex min-h-5 items-center gap-1.5">
<span
class="truncate text-sm font-medium text-foreground"
data-testid="note-author"
@@ -117,7 +113,7 @@ const handleEditKeydown = (event: KeyboardEvent) => {
<span
v-if="wasEdited"
class="shrink-0 text-xs text-muted-foreground"
- >· {{ $t('notes.edited') }}</span
+ >({{ $t('notes.edited') }})</span
>
<div
@@ -192,7 +188,7 @@ const handleEditKeydown = (event: KeyboardEvent) => {
<NoteBody
v-else
:body="note.body"
- class="leading-relaxed text-foreground"
+ class="mt-0.5 leading-relaxed text-foreground"
/>
</div>
</div>
diff --git a/resources/js/components/posts/editor/PostNotesPanel.vue b/resources/js/components/posts/editor/PostNotesPanel.vue
index ca7ae2a23..830b7c882 100644
--- a/resources/js/components/posts/editor/PostNotesPanel.vue
+++ b/resources/js/components/posts/editor/PostNotesPanel.vue
@@ -1,9 +1,17 @@
<script setup lang="ts">
-import { IconArrowUp, IconLoader2, IconMessage } from '@tabler/icons-vue';
+import { usePage } from '@inertiajs/vue3';
+import { IconArrowUp, IconLoader2 } from '@tabler/icons-vue';
import { computed, nextTick, onMounted, ref, watch } from 'vue';
import PostNoteItem from '@/components/posts/editor/PostNoteItem.vue';
+import { Avatar } from '@/components/ui/avatar';
import { Button } from '@/components/ui/button';
+import {
+ InputGroup,
+ InputGroupAddon,
+ InputGroupButton,
+ InputGroupTextarea,
+} from '@/components/ui/input-group';
import { usePostEcho } from '@/composables/echo/usePostEcho';
import {
destroy as destroyNote,
@@ -18,6 +26,7 @@ interface PaginatedResponse {
meta: {
current_page: number;
last_page: number;
+ total: number;
};
}
@@ -28,14 +37,18 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
- countChange: [delta: number];
+ count: [total: number];
}>();
+const page = usePage();
+const currentUser = computed(() => page.props.auth.user);
+
const csrfToken =
document.querySelector<HTMLMetaElement>('meta[name="csrf-token"]')
?.content ?? '';
const notes = ref<PostNote[]>([]);
+const total = ref(0);
const currentPage = ref(1);
const lastPage = ref(1);
const loading = ref(false);
@@ -45,7 +58,9 @@ const newBody = ref('');
const highlightedId = ref<string | null>(null);
const scrollContainer = ref<HTMLDivElement | null>(null);
-const composerInput = ref<HTMLTextAreaElement | null>(null);
+const composerInput = ref<{ $el: HTMLTextAreaElement } | null>(null);
+
+watch(total, (count) => emit('count', count));
const hasOlderNotes = computed(() => currentPage.value < lastPage.value);
const canSend = computed(() => newBody.value.trim() !== '' && !sending.value);
@@ -84,6 +99,7 @@ const loadNotes = async (page = 1) => {
const chronological = [...data.data].reverse();
currentPage.value = data.meta.current_page;
lastPage.value = data.meta.last_page;
+ total.value = data.meta.total;
if (page === 1) {
notes.value = chronological;
@@ -108,7 +124,7 @@ const loadOlderNotes = () => {
};
const focusComposer = () => {
- composerInput.value?.focus();
+ composerInput.value?.$el.focus();
};
const sendNote = async () => {
@@ -132,7 +148,7 @@ const sendNote = async () => {
const created: PostNote = await response.json();
notes.value.push(created);
- emit('countChange', 1);
+ total.value++;
newBody.value = '';
await nextTick();
scrollToBottom();
@@ -169,7 +185,7 @@ const deleteNote = async (note: PostNote) => {
}
notes.value = notes.value.filter((item) => item.id !== note.id);
- emit('countChange', -1);
+ total.value = Math.max(0, total.value - 1);
};
const handleComposerKeydown = (event: KeyboardEvent) => {
@@ -237,18 +253,18 @@ watch(
</script>
<template>
- <div class="flex min-h-0 flex-col">
+ <section class="flex min-h-0 flex-col gap-3">
<div
ref="scrollContainer"
- class="max-h-80 min-h-0 overflow-y-auto overscroll-contain"
+ class="-mx-2 max-h-80 min-h-0 overflow-x-hidden overflow-y-auto overscroll-contain px-2"
data-testid="notes-list"
>
- <div v-if="hasOlderNotes" class="flex justify-center pt-2">
+ <div v-if="hasOlderNotes" class="flex justify-start pb-2">
<Button
type="button"
variant="ghost"
size="sm"
- class="text-muted-foreground"
+ class="-ms-2 text-muted-foreground"
:disabled="loading"
@click="loadOlderNotes"
>
@@ -262,33 +278,27 @@ watch(
<div
v-if="loading && notes.length === 0"
- class="flex items-center justify-center py-10"
+ class="flex items-center gap-3 py-1"
>
<IconLoader2
- class="size-5 animate-spin text-muted-foreground"
+ class="size-4 animate-spin text-muted-foreground"
/>
</div>
- <div
+ <p
v-else-if="notes.length === 0"
- class="flex flex-col items-center px-6 py-8 text-center"
+ class="py-1 text-sm text-muted-foreground"
data-testid="notes-empty"
>
- <div
- class="mb-3 flex size-9 items-center justify-center rounded-full bg-accent text-muted-foreground"
+ {{ $t('notes.empty') }}
+ </p>
+
+ <ol v-else class="flex flex-col">
+ <li
+ v-for="note in notes"
+ :key="note.id"
+ class="relative pb-3 last:pb-0 [&:not(:last-child)]:before:absolute [&:not(:last-child)]:before:start-[13.5px] [&:not(:last-child)]:before:top-9 [&:not(:last-child)]:before:bottom-1 [&:not(:last-child)]:before:w-px [&:not(:last-child)]:before:bg-border-strong"
>
- <IconMessage class="size-4.5" stroke-width="1.75" />
- </div>
- <p class="text-sm font-emphasis text-foreground">
- {{ $t('notes.empty_title') }}
- </p>
- <p class="mt-0.5 text-xs text-muted-foreground">
- {{ $t('notes.empty_description') }}
- </p>
- </div>
-
- <ul v-else class="flex flex-col gap-0.5 p-2">
- <li v-for="note in notes" :key="note.id">
<PostNoteItem
:note="note"
:current-user-id="currentUserId"
@@ -297,34 +307,49 @@ watch(
@delete="deleteNote(note)"
/>
</li>
- </ul>
+ </ol>
</div>
- <div class="shrink-0 border-t border-border p-3">
- <div class="flex items-end gap-2">
- <textarea
+ <div class="flex shrink-0 items-end gap-3">
+ <Avatar
+ v-if="currentUser"
+ :src="currentUser.photo_url"
+ :name="currentUser.name"
+ class="mb-[5px] size-7 shrink-0 text-xs"
+ fallback-class="bg-sidebar-accent text-sidebar-accent-foreground"
+ />
+ <InputGroup
+ class="min-w-0 flex-1 items-end rounded-[18px] border-transparent bg-muted shadow-none transition-colors hover:border-border-strong has-[[data-slot=input-group-control]:focus-visible]:bg-card"
+ data-testid="note-composer"
+ >
+ <InputGroupTextarea
ref="composerInput"
v-model="newBody"
rows="1"
- class="flex field-sizing-content max-h-28 min-h-8 w-full min-w-0 resize-none rounded-md border border-input bg-card px-2 py-[5px] text-sm leading-5 text-foreground transition-[color,box-shadow] outline-none placeholder:text-subtle-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring dark:bg-input/30"
:placeholder="$t('notes.placeholder')"
:aria-label="$t('notes.placeholder')"
+ class="max-h-28 min-h-0 py-[7px] ps-4 leading-5"
data-testid="note-input"
@keydown="handleComposerKeydown"
/>
- <Button
- type="button"
- size="icon"
- class="shrink-0"
- :disabled="!canSend"
- :aria-label="$t('notes.send')"
- data-testid="note-send"
- @click="sendNote"
- >
- <IconLoader2 v-if="sending" class="size-4 animate-spin" />
- <IconArrowUp v-else class="size-4" />
- </Button>
- </div>
+ <InputGroupAddon align="inline-end" class="pb-1.5">
+ <InputGroupButton
+ variant="default"
+ size="icon-xs"
+ class="me-0.5 rounded-full disabled:bg-transparent disabled:text-muted-foreground disabled:opacity-100"
+ :disabled="!canSend"
+ :aria-label="$t('notes.send')"
+ data-testid="note-send"
+ @click="sendNote"
+ >
+ <IconLoader2
+ v-if="sending"
+ class="size-3.5 animate-spin"
+ />
+ <IconArrowUp v-else class="size-3.5" />
+ </InputGroupButton>
+ </InputGroupAddon>
+ </InputGroup>
</div>
- </div>
+ </section>
</template>
diff --git a/resources/js/components/posts/editor/TrialReelIllustration.vue b/resources/js/components/posts/editor/TrialReelIllustration.vue
new file mode 100644
index 000000000..b150bb791
--- /dev/null
+++ b/resources/js/components/posts/editor/TrialReelIllustration.vue
@@ -0,0 +1,59 @@
+<script setup lang="ts">
+import { IconFlask } from '@tabler/icons-vue';
+</script>
+
+<template>
+ <div
+ class="flex justify-center overflow-hidden rounded-lg bg-amber-100 px-6 pt-4 dark:bg-amber-300/10"
+ aria-hidden="true"
+ data-testid="instagram-trial-reel-illustration"
+ >
+ <div
+ class="w-full space-y-2 rounded-t-lg bg-background p-3 pb-2.5 shadow-xs ring-1 ring-amber-900/5 dark:bg-card dark:ring-white/10"
+ >
+ <div
+ class="space-y-1.5 rounded-md border border-amber-400 bg-amber-50 p-2 dark:border-amber-400/60 dark:bg-amber-400/10"
+ >
+ <div class="flex items-center gap-1.5">
+ <IconFlask
+ class="size-3.5 text-amber-600 dark:text-amber-300"
+ :stroke-width="1.5"
+ />
+ <span
+ class="flex-1 text-[10px] font-medium text-foreground"
+ >{{
+ $t('posts.form.instagram.trial_reel.badge')
+ }}</span
+ >
+ <span
+ class="flex h-3 w-5 items-center justify-end rounded-full bg-amber-400 p-0.5 dark:bg-amber-400/80"
+ >
+ <span
+ class="size-2 rounded-full bg-white dark:bg-amber-950"
+ />
+ </span>
+ </div>
+ <span
+ class="block h-1 w-full rounded-full bg-amber-300/60 dark:bg-amber-300/25"
+ />
+ <span
+ class="block h-1 w-4/5 rounded-full bg-amber-300/60 dark:bg-amber-300/25"
+ />
+ </div>
+ <span
+ class="block h-1 w-2/3 rounded-full bg-muted-foreground/20"
+ />
+ <span
+ class="block h-1 w-1/2 rounded-full bg-muted-foreground/20"
+ />
+ <div class="flex gap-2 pt-1">
+ <span
+ class="h-4 flex-1 rounded-md border border-border bg-muted"
+ />
+ <span
+ class="h-4 flex-1 rounded-md bg-primary-strong dark:bg-primary"
+ />
+ </div>
+ </div>
+ </div>
+</template>
diff --git a/resources/js/components/posts/previews/InstagramPreview.vue b/resources/js/components/posts/previews/InstagramPreview.vue
index 6870449f8..c115648ab 100644
--- a/resources/js/components/posts/previews/InstagramPreview.vue
+++ b/resources/js/components/posts/previews/InstagramPreview.vue
@@ -4,8 +4,10 @@ import {
IconBrandInstagram,
IconDots,
IconDotsVertical,
+ IconFlask,
IconHeart,
IconMessageCircle,
+ IconMusic,
IconRepeat,
IconSend,
} from '@tabler/icons-vue';
@@ -16,7 +18,12 @@ import PreviewAvatar from '@/components/posts/previews/PreviewAvatar.vue';
import PreviewStoryHeader from '@/components/posts/previews/PreviewStoryHeader.vue';
import PreviewText from '@/components/posts/previews/PreviewText.vue';
import PreviewVerticalCard from '@/components/posts/previews/PreviewVerticalCard.vue';
+import {
+ providePreviewSoundtrack,
+ soundtrackLabel,
+} from '@/composables/composer/useReelSoundtrack';
import { ContentType } from '@/types/content-type';
+import type { InstagramAudio } from '@/types/instagram';
import type { PreviewProps } from './types';
@@ -28,6 +35,16 @@ const feedAspectPadding = computed((): number => {
return width > 0 && height > 0 ? (height / width) * 100 : 100;
});
+const selectedAudio = computed(
+ () => (props.meta?.audio as InstagramAudio | null | undefined) ?? null,
+);
+
+const audioLabel = computed(() => soundtrackLabel(selectedAudio.value));
+
+const isTrialReel = computed(() => Boolean(props.meta?.trial_graduation));
+
+providePreviewSoundtrack(() => selectedAudio.value);
+
const CAPTION_LIMIT = 100;
const caption = computed((): string =>
@@ -50,6 +67,16 @@ const caption = computed((): string =>
{ icon: IconDots },
]"
>
+ <template #top>
+ <span
+ v-if="isTrialReel"
+ class="absolute top-3 left-3 inline-flex items-center gap-1 rounded-md bg-black/50 px-2 py-1 text-xs font-medium"
+ data-testid="instagram-preview-trial"
+ >
+ <IconFlask class="size-3.5" />
+ {{ $t('posts.form.instagram.trial_reel.badge') }}
+ </span>
+ </template>
<template #footer>
<div
class="flex items-center gap-2 font-semibold"
@@ -59,6 +86,14 @@ const caption = computed((): string =>
<span class="truncate">{{ socialAccount.handle_label }}</span>
</div>
<p v-if="content" class="truncate">{{ content }}</p>
+ <p
+ v-if="audioLabel"
+ class="flex items-center gap-1 truncate text-xs"
+ data-testid="instagram-preview-audio"
+ >
+ <IconMusic class="size-3.5 shrink-0" />
+ <span class="truncate">{{ audioLabel }}</span>
+ </p>
</template>
<template #corner>
<PreviewAvatar
@@ -105,7 +140,7 @@ const caption = computed((): string =>
<IconDotsVertical class="size-[18px]" />
</div>
<div
- class="relative w-full bg-black"
+ class="relative w-full bg-muted"
:style="{ paddingBottom: `${feedAspectPadding}%` }"
data-testid="instagram-feed-media"
>
diff --git a/resources/js/components/posts/previews/PreviewMedia.vue b/resources/js/components/posts/previews/PreviewMedia.vue
index bf6f7409d..965e1c0c8 100644
--- a/resources/js/components/posts/previews/PreviewMedia.vue
+++ b/resources/js/components/posts/previews/PreviewMedia.vue
@@ -88,7 +88,7 @@ const frameClass = computed((): string =>
v-if="isDocument(first)"
:src="`${first.url}#toolbar=0&navpanes=0&view=FitH`"
:title="first.original_filename || 'PDF'"
- class="size-full border-0"
+ class="absolute -top-2 -left-2 h-[calc(100%+1rem)] w-[calc(100%+1rem)] max-w-none border-0"
loading="lazy"
/>
<PostMediaPreview
@@ -99,29 +99,6 @@ const frameClass = computed((): string =>
/>
</div>
</div>
- <div v-else-if="mode === 'stack'" class="space-y-0.5">
- <div
- v-for="item in media"
- :key="item.id"
- class="relative overflow-hidden bg-muted"
- :class="frameClass"
- :style="{ paddingBottom: `${ratioOf(item) * 100}%` }"
- >
- <div class="absolute inset-0">
- <VideoPreview
- v-if="isVideo(item)"
- :src="item.url"
- video-class="size-full object-cover bg-black"
- />
- <img
- v-else
- :src="item.url"
- :alt="item.original_filename"
- class="size-full object-cover"
- />
- </div>
- </div>
- </div>
<div
v-else-if="mode === 'collage'"
class="grid grid-cols-6 gap-0.5 overflow-hidden"
@@ -182,10 +159,12 @@ const frameClass = computed((): string =>
<div
v-for="(item, index) in media.slice(0, 4)"
:key="item.id"
- class="relative aspect-square overflow-hidden"
- :class="{
- 'row-span-2 aspect-auto': media.length === 3 && index === 0,
- }"
+ class="relative overflow-hidden"
+ :class="
+ media.length === 3 && index === 0
+ ? 'row-span-2'
+ : 'aspect-square'
+ "
>
<VideoPreview
v-if="isVideo(item)"
diff --git a/resources/js/components/posts/previews/VideoPreview.vue b/resources/js/components/posts/previews/VideoPreview.vue
index e687848c0..f689c82c6 100644
--- a/resources/js/components/posts/previews/VideoPreview.vue
+++ b/resources/js/components/posts/previews/VideoPreview.vue
@@ -2,6 +2,8 @@
import { IconPlayerPlayFilled } from '@tabler/icons-vue';
import { ref } from 'vue';
+import { useSoundtrackVideo } from '@/composables/composer/useReelSoundtrack';
+
const props = withDefaults(
defineProps<{
src: string;
@@ -15,12 +17,16 @@ const props = withDefaults(
const videoRef = ref<HTMLVideoElement | null>(null);
const isPlaying = ref(false);
+const soundtrack = useSoundtrackVideo(videoRef);
+
const markPlaying = (): void => {
isPlaying.value = true;
+ soundtrack.onVideoPlay();
};
const markPaused = (): void => {
isPlaying.value = false;
+ soundtrack.onVideoPause();
};
const toggle = () => {
diff --git a/resources/js/components/posts/previews/XPreview.vue b/resources/js/components/posts/previews/XPreview.vue
index 35fccfee5..93bea3c49 100644
--- a/resources/js/components/posts/previews/XPreview.vue
+++ b/resources/js/components/posts/previews/XPreview.vue
@@ -23,7 +23,7 @@ defineProps<PreviewProps>();
:media="media"
:handle="`@${socialAccount.username || socialAccount.handle_label}`"
content-testid="x-preview-content"
- media-layout="stack"
+ media-layout="grid"
link-card
:actions="[
{ icon: IconMessageCircle },
diff --git a/resources/js/components/posts/previews/types.ts b/resources/js/components/posts/previews/types.ts
index b0ff4846b..5b87c0e54 100644
--- a/resources/js/components/posts/previews/types.ts
+++ b/resources/js/components/posts/previews/types.ts
@@ -30,7 +30,6 @@ export interface PreviewAction {
export type PreviewMediaLayout =
| 'grid'
- | 'stack'
| 'peek'
| 'carousel'
| 'collage';
diff --git a/resources/js/components/publish/AddToQueueButton.vue b/resources/js/components/publish/AddToQueueButton.vue
new file mode 100644
index 000000000..a372d9f51
--- /dev/null
+++ b/resources/js/components/publish/AddToQueueButton.vue
@@ -0,0 +1,118 @@
+<script setup lang="ts">
+import { router } from '@inertiajs/vue3';
+import { IconListNumbers } from '@tabler/icons-vue';
+import { ref } from 'vue';
+
+import QueueSetupIllustration from '@/components/publish/QueueSetupIllustration.vue';
+import { Button } from '@/components/ui/button';
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from '@/components/ui/popover';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/components/ui/tooltip';
+import { schedulePostCard } from '@/composables/usePostCardActions';
+import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
+import { settings as channelSettings } from '@/routes/app/channels';
+import type { PostCard, PublishSocialAccount } from '@/types/publish';
+
+const props = defineProps<{
+ post: PostCard;
+ account: PublishSocialAccount;
+}>();
+
+const { canManageAccounts, requiresApproval } = useWorkspaceAbilities();
+
+const queueSetupOpen = ref(false);
+
+const addToQueue = (): void => {
+ schedulePostCard(props.post.id, 'queue_next', {
+ requestsApproval: requiresApproval.value,
+ });
+};
+
+const closeQueueSetup = (): void => {
+ queueSetupOpen.value = false;
+};
+
+const openPostingTimes = (): void => {
+ router.visit(channelSettings.url(props.account.id));
+};
+</script>
+
+<template>
+ <Tooltip v-if="account.has_posting_schedule">
+ <TooltipTrigger as-child>
+ <Button
+ variant="outline"
+ :data-testid="`post-add-to-queue-${post.id}`"
+ @click="addToQueue"
+ >
+ <IconListNumbers class="size-4" />
+ {{ $t('posts.publish.actions.add_to_queue') }}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent :data-testid="`post-add-to-queue-tooltip-${post.id}`">
+ {{ $t('posts.publish.actions.add_to_queue_hint') }}
+ </TooltipContent>
+ </Tooltip>
+ <Popover v-else v-model:open="queueSetupOpen">
+ <PopoverTrigger as-child>
+ <Button
+ variant="outline"
+ :data-testid="`post-add-to-queue-${post.id}`"
+ >
+ <IconListNumbers class="size-4" />
+ {{ $t('posts.publish.actions.add_to_queue') }}
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent
+ side="top"
+ align="end"
+ class="w-80 space-y-3"
+ :data-testid="`post-queue-setup-${post.id}`"
+ >
+ <QueueSetupIllustration
+ :data-testid="`post-queue-setup-illustration-${post.id}`"
+ />
+ <p class="text-sm font-semibold">
+ {{ $t('posts.publish.actions.queue_setup.title') }}
+ </p>
+ <p class="text-sm text-muted-foreground">
+ {{
+ canManageAccounts
+ ? $t('posts.publish.actions.queue_setup.body')
+ : $t('posts.publish.actions.queue_setup.body_member')
+ }}
+ </p>
+ <div class="flex justify-end gap-2">
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ :data-testid="`post-queue-setup-not-now-${post.id}`"
+ @click="closeQueueSetup"
+ >
+ <span data-single-line>{{
+ $t('posts.publish.actions.queue_setup.not_now')
+ }}</span>
+ </Button>
+ <Button
+ v-if="canManageAccounts"
+ type="button"
+ size="sm"
+ :data-testid="`post-queue-setup-action-${post.id}`"
+ @click="openPostingTimes"
+ >
+ <span data-single-line>{{
+ $t('posts.publish.actions.queue_setup.action')
+ }}</span>
+ </Button>
+ </div>
+ </PopoverContent>
+ </Popover>
+</template>
diff --git a/resources/js/components/publish/PostCardMenu.vue b/resources/js/components/publish/PostCardMenu.vue
index bdb3695b8..b569159e4 100644
--- a/resources/js/components/publish/PostCardMenu.vue
+++ b/resources/js/components/publish/PostCardMenu.vue
@@ -7,8 +7,10 @@ import {
IconCopyPlus,
IconDotsVertical,
IconFileArrowLeft,
+ IconLink,
IconRepeat,
IconSend,
+ IconShare3,
IconTrash,
} from '@tabler/icons-vue';
import { computed } from 'vue';
@@ -122,6 +124,23 @@ const isQueued = computed(
<IconArrowsMaximize class="size-4" />
{{ $t('posts.show.title') }}
</DropdownMenuItem>
+ <template v-if="post.platform_url">
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ :data-testid="`post-share-link-${testKey}`"
+ @click="emit('select', 'share_link')"
+ >
+ <IconShare3 class="size-4" />
+ {{ $t('posts.publish.actions.share_link') }}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ :data-testid="`post-copy-link-${testKey}`"
+ @click="emit('select', 'copy_link')"
+ >
+ <IconLink class="size-4" />
+ {{ $t('posts.publish.actions.copy_link') }}
+ </DropdownMenuItem>
+ </template>
<template v-if="isQueued">
<DropdownMenuSeparator />
<DropdownMenuItem
diff --git a/resources/js/components/publish/PostTimelineCard.vue b/resources/js/components/publish/PostTimelineCard.vue
index 57362bf16..5327dc4c1 100644
--- a/resources/js/components/publish/PostTimelineCard.vue
+++ b/resources/js/components/publish/PostTimelineCard.vue
@@ -3,10 +3,12 @@ import { router, usePage } from '@inertiajs/vue3';
import {
IconArrowsMaximize,
IconCircleDashedPlus,
+ IconCirclePlay,
IconEdit,
IconExternalLink,
+ IconMessageCircle,
+ IconMessageCircleFilled,
IconGripVertical,
- IconListNumbers,
IconClockPause,
IconHourglass,
IconLoader2,
@@ -14,7 +16,6 @@ import {
IconPlayerPlayFilled,
IconRepeat,
IconSend,
- IconVideo,
IconX,
} from '@tabler/icons-vue';
import { type Component, computed, inject, ref, watch } from 'vue';
@@ -24,8 +25,9 @@ import { edit as editPostRoute } from '@/actions/App/Http/Controllers/App/PostCo
import ChannelAvatar from '@/components/ChannelAvatar.vue';
import MediaLightbox from '@/components/media/MediaLightbox.vue';
import PlatformBrandIcon from '@/components/PlatformBrandIcon.vue';
-import PostNotesPopover from '@/components/posts/PostNotesPopover.vue';
+import PostNotesPanel from '@/components/posts/editor/PostNotesPanel.vue';
import PostScheduleModeBadge from '@/components/posts/PostScheduleModeBadge.vue';
+import AddToQueueButton from '@/components/publish/AddToQueueButton.vue';
import ApprovePostButton from '@/components/publish/ApprovePostButton.vue';
import PostCardLabels from '@/components/publish/PostCardLabels.vue';
import PostCardMenu from '@/components/publish/PostCardMenu.vue';
@@ -36,13 +38,17 @@ import PostRecurrenceDialog from '@/components/publish/PostRecurrenceDialog.vue'
import PostRecurrenceSummary from '@/components/publish/PostRecurrenceSummary.vue';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from '@/components/ui/collapsible';
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip';
-import { useAtLeastBreakpoint } from '@/composables/useBreakpoint';
import { useDisplayTimezone } from '@/composables/useDisplayTimezone';
import {
getContentTypeBadgeKey,
@@ -50,9 +56,11 @@ import {
} from '@/composables/usePlatformLogo';
import {
deletePostCardKey,
+ copyPostCardLink,
duplicatePostCard,
editPostCardUrlKey,
schedulePostCard,
+ sharePostCardLink,
toastFirstError,
} from '@/composables/usePostCardActions';
import { getPostStatusConfig } from '@/composables/usePostStatus';
@@ -107,7 +115,7 @@ const emit = defineEmits<{
const MAX_THUMBNAILS = 4;
const page = usePage();
-const { canApprove, canCreatePost, canPublishDirectly, requiresApproval } =
+const { canApprove, canCreatePost, canPublishDirectly } =
useWorkspaceAbilities();
const deletePost = inject(deletePostCardKey, () => {});
const editUrl = inject(editPostCardUrlKey, (post: PostCard) =>
@@ -126,8 +134,10 @@ const authUserId = computed(() => String(page.props.authUserId ?? ''));
const openPostNotesId = computed(
() => (page.props.openPostNotesId as string | null | undefined) ?? null,
);
-const highlightNoteId = computed(
- () => (page.props.highlightNoteId as string | null | undefined) ?? null,
+const highlightNoteId = computed(() =>
+ openPostNotesId.value === props.post.id
+ ? ((page.props.highlightNoteId as string | null | undefined) ?? null)
+ : null,
);
const platform = computed(() => props.post.platform ?? null);
@@ -159,7 +169,23 @@ const scheduleMode = computed(() => {
});
const showNotes = computed(() => !props.popover && !isPublishing.value);
-const notesBesideCard = useAtLeastBreakpoint('lg');
+const notesOpen = ref(openPostNotesId.value === props.post.id);
+const noteCount = ref(props.post.notes_count);
+
+watch(
+ () => props.post.notes_count,
+ (count) => {
+ noteCount.value = count;
+ },
+);
+
+watch(openPostNotesId, (id) => {
+ if (id === props.post.id) notesOpen.value = true;
+});
+
+const setNoteCount = (count: number): void => {
+ noteCount.value = count;
+};
const time = computed(() => {
if (props.tab === 'sent') {
@@ -227,8 +253,8 @@ const openLightbox = (index: number): void => {
const CONTENT_TYPE_ICONS: Record<string, Component> = {
instagram_story: IconCircleDashedPlus,
facebook_story: IconCircleDashedPlus,
- instagram_reel: IconVideo,
- facebook_reel: IconVideo,
+ instagram_reel: IconCirclePlay,
+ facebook_reel: IconCirclePlay,
};
const contentTypeIcon = computed(() =>
@@ -241,10 +267,6 @@ const contentTypeKey = computed(() =>
: null,
);
-const canQueue = computed(
- () => account.value?.has_posting_schedule === true,
-);
-
const permalink = computed(() => props.post.platform_url ?? null);
const metricsDetail = computed(() => {
@@ -286,12 +308,6 @@ const revertRequest = (): void => {
schedulePostCard(props.post.id, 'draft', APPROVAL_RELOAD);
};
-const addToQueue = (): void => {
- schedulePostCard(props.post.id, 'queue_next', {
- requestsApproval: requiresApproval.value,
- });
-};
-
const recurrence = computed(() =>
props.post.status === PostStatus.Scheduled && props.post.scheduled_at
? recurrenceRuleOf(props.post)
@@ -341,6 +357,12 @@ const runPostAction = (action: PostCardMenuAction, post: PostCard): void => {
case 'details':
detailsOpen.value = true;
break;
+ case 'share_link':
+ sharePostCardLink(post);
+ break;
+ case 'copy_link':
+ copyPostCardLink(post);
+ break;
case 'delete':
deletePost(post);
break;
@@ -476,450 +498,449 @@ defineExpose({ openDetails });
</Button>
</div>
- <article
- class="min-w-0 overflow-hidden"
- :class="{
- 'rounded-xl border bg-card': !popover,
- 'border-border-strong': !popover,
- }"
- >
- <p
- v-if="recurrence && post.scheduled_at"
- class="flex items-start gap-2 border-b border-border-strong bg-secondary px-4 py-2.5 text-sm text-foreground"
- :data-testid="`post-recurrence-banner-${post.id}`"
+ <Collapsible v-model:open="notesOpen" as-child>
+ <article
+ class="min-w-0 overflow-hidden"
+ :class="{
+ 'rounded-xl border bg-card': !popover,
+ 'border-border-strong': !popover,
+ }"
>
- <IconRepeat class="mt-0.5 size-4 shrink-0" />
- <PostRecurrenceSummary
- :scheduled-at="post.scheduled_at"
- :timezone="recurrenceTimezone"
- :rule="recurrence"
- :remaining="recurrence.times"
- :origin-at="post.recurrence_origin_at"
- />
- </p>
- <div
- v-if="isPublishing && !popover"
- class="relative flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border-strong bg-secondary px-4 py-2.5 text-sm text-foreground"
- role="status"
- :data-testid="`post-publishing-${post.id}`"
- >
- <span
- v-if="!isInGoogleReview"
- class="absolute inset-x-0 -bottom-px h-0.5 overflow-hidden"
- aria-hidden="true"
- :data-testid="`post-publishing-progress-${post.id}`"
- >
- <span
- class="motion-progress-sweep block h-full w-2/5 rounded-full bg-primary-strong"
- />
- </span>
- <span
- v-if="limitRetryAt"
- class="inline-flex items-center gap-2"
- :data-testid="`post-limit-retry-${post.id}`"
+ <p
+ v-if="recurrence && post.scheduled_at"
+ class="flex items-start gap-2 border-b border-border-strong bg-secondary px-4 py-2.5 text-sm text-foreground"
+ :data-testid="`post-recurrence-banner-${post.id}`"
>
- <IconClockPause
- class="size-4 text-primary-strong"
- aria-hidden="true"
+ <IconRepeat class="mt-0.5 size-4 shrink-0" />
+ <PostRecurrenceSummary
+ :scheduled-at="post.scheduled_at"
+ :timezone="recurrenceTimezone"
+ :rule="recurrence"
+ :remaining="recurrence.times"
+ :origin-at="post.recurrence_origin_at"
/>
- {{
- $t('posts.publish.retrying_at', {
- time: formatTime(limitRetryAt),
- })
- }}
- </span>
- <span
- v-else-if="isInGoogleReview"
- class="inline-flex items-center gap-2"
- :data-testid="`post-google-review-${post.id}`"
+ </p>
+ <div
+ v-if="isPublishing && !popover"
+ class="relative flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border-strong bg-secondary px-4 py-2.5 text-sm text-foreground"
+ role="status"
+ :data-testid="`post-publishing-${post.id}`"
>
- <IconHourglass
- class="size-4 text-primary-strong"
- aria-hidden="true"
- />
- {{ $t('posts.publish.in_google_review') }}
- </span>
- <span v-else class="inline-flex items-center gap-2">
- <IconLoader2
- class="size-4 animate-spin text-primary-strong"
+ <span
+ v-if="!isInGoogleReview"
+ class="absolute inset-x-0 -bottom-px h-0.5 overflow-hidden"
aria-hidden="true"
- />
- {{
- platform
- ? $t('posts.publish.publishing_on', {
- network: getPlatformLabel(platform),
- })
- : $t('posts.publish.publishing_badge')
- }}
- </span>
- </div>
- <div
- class="relative flex gap-4 p-4 md:gap-6"
- :class="{ 'opacity-70': isPublishing && !popover }"
- >
+ :data-testid="`post-publishing-progress-${post.id}`"
+ >
+ <span
+ class="motion-progress-sweep block h-full w-2/5 rounded-full bg-primary-strong"
+ />
+ </span>
+ <span
+ v-if="limitRetryAt"
+ class="inline-flex items-center gap-2"
+ :data-testid="`post-limit-retry-${post.id}`"
+ >
+ <IconClockPause
+ class="size-4 text-primary-strong"
+ aria-hidden="true"
+ />
+ {{
+ $t('posts.publish.retrying_at', {
+ time: formatTime(limitRetryAt),
+ })
+ }}
+ </span>
+ <span
+ v-else-if="isInGoogleReview"
+ class="inline-flex items-center gap-2"
+ :data-testid="`post-google-review-${post.id}`"
+ >
+ <IconHourglass
+ class="size-4 text-primary-strong"
+ aria-hidden="true"
+ />
+ {{ $t('posts.publish.in_google_review') }}
+ </span>
+ <span v-else class="inline-flex items-center gap-2">
+ <IconLoader2
+ class="size-4 animate-spin text-primary-strong"
+ aria-hidden="true"
+ />
+ {{
+ platform
+ ? $t('posts.publish.publishing_on', {
+ network: getPlatformLabel(platform),
+ })
+ : $t('posts.publish.publishing_badge')
+ }}
+ </span>
+ </div>
<div
- :draggable="draggable ? 'false' : undefined"
- class="flex min-w-0 flex-1 cursor-pointer flex-col gap-4 outline-none after:absolute after:inset-0 focus-visible:after:outline-2 focus-visible:after:outline-offset-[-2px] focus-visible:after:outline-ring"
- :data-testid="`post-open-${post.id}`"
- @click="open"
+ class="relative flex gap-4 p-4 md:gap-6"
+ :class="{ 'opacity-70': isPublishing && !popover }"
>
- <div class="flex items-center gap-3">
- <ChannelAvatar
- :status="account?.status"
- :account-id="account?.id"
- v-if="platform"
- :platform="platform"
- :src="account?.avatar_url"
- :verified="account?.verified_badge"
- :name="
- account?.display_label ??
- getPlatformLabel(platform)
- "
- ring="card"
- @dragstart="draggable ? $event.preventDefault() : undefined"
- />
- <div class="min-w-0">
- <p
- class="truncate text-sm leading-tight font-emphasis text-foreground"
- >
- {{
+ <div
+ :draggable="draggable ? 'false' : undefined"
+ class="flex min-w-0 flex-1 cursor-pointer flex-col gap-4 outline-none after:absolute after:inset-0 focus-visible:after:outline-2 focus-visible:after:outline-offset-[-2px] focus-visible:after:outline-ring"
+ :data-testid="`post-open-${post.id}`"
+ @click="open"
+ >
+ <div class="flex items-center gap-3">
+ <ChannelAvatar
+ :status="account?.status"
+ :account-id="account?.id"
+ v-if="platform"
+ :platform="platform"
+ :src="account?.avatar_url"
+ :verified="account?.verified_badge"
+ :name="
account?.display_label ??
- getPlatformLabel(platform ?? '')
- }}
- </p>
- <p
- v-if="popover && account?.handle_label"
- class="truncate text-xs text-muted-foreground"
+ getPlatformLabel(platform)
+ "
+ ring="card"
+ @dragstart="draggable ? $event.preventDefault() : undefined"
+ />
+ <div class="min-w-0">
+ <p
+ class="truncate text-sm leading-tight font-emphasis text-foreground"
+ >
+ {{
+ account?.display_label ??
+ getPlatformLabel(platform ?? '')
+ }}
+ </p>
+ <p
+ v-if="popover && account?.handle_label"
+ class="truncate text-xs text-muted-foreground"
+ >
+ {{ account.handle_label }}
+ </p>
+ </div>
+ <Badge
+ v-if="contentTypeKey"
+ variant="secondary"
+ class="ms-auto h-6 gap-1.5 px-2 [&>svg]:size-4"
+ :data-testid="`post-content-type-${post.id}`"
>
- {{ account.handle_label }}
- </p>
+ <component
+ :is="contentTypeIcon"
+ v-if="contentTypeIcon"
+ class="shrink-0"
+ aria-hidden="true"
+ :data-testid="`post-content-type-icon-${post.id}`"
+ />
+ {{ $t(contentTypeKey) }}
+ </Badge>
</div>
- <Badge
- v-if="contentTypeKey"
- variant="secondary"
- class="ms-auto h-6 gap-1 px-2"
- :data-testid="`post-content-type-${post.id}`"
+ <p
+ class="line-clamp-4 text-sm whitespace-pre-line text-foreground"
+ :class="{
+ 'text-muted-foreground': !preview,
+ 'leading-relaxed': popover,
+ }"
>
- <component
- :is="contentTypeIcon"
- v-if="contentTypeIcon"
- class="size-3.5"
- aria-hidden="true"
- />
- {{ $t(contentTypeKey) }}
- </Badge>
+ {{ preview || $t('calendar.no_content') }}
+ </p>
</div>
- <p
- class="line-clamp-4 text-sm whitespace-pre-line text-foreground"
- :class="{
- 'text-muted-foreground': !preview,
- 'leading-relaxed': popover,
- }"
+ <div
+ v-if="thumbnails.length"
+ class="relative z-10 grid w-24 shrink-0 content-start gap-2"
+ :class="[
+ thumbnails.length > 1 ? 'grid-cols-2' : '',
+ popover ? 'w-36' : 'md:w-[180px]',
+ ]"
>
- {{ preview || $t('calendar.no_content') }}
- </p>
- </div>
- <div
- v-if="thumbnails.length"
- class="relative z-10 grid w-24 shrink-0 content-start gap-2"
- :class="[
- thumbnails.length > 1 ? 'grid-cols-2' : '',
- popover ? 'w-36' : 'md:w-[180px]',
- ]"
- >
- <button
- v-for="(thumbnail, index) in thumbnails"
- :key="thumbnail.url"
- type="button"
- :aria-label="$t('common.media_lightbox.open')"
- :draggable="draggable ? 'false' : undefined"
- class="group/thumbnail relative block aspect-square cursor-zoom-in overflow-hidden rounded-md border border-border-strong bg-secondary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring"
- :data-testid="`post-thumbnail-${post.id}-${index}`"
- @click="openLightbox(index)"
- >
- <img
- v-if="isImage(thumbnail)"
+ <button
+ v-for="(thumbnail, index) in thumbnails"
+ :key="thumbnail.url"
+ type="button"
+ :aria-label="$t('common.media_lightbox.open')"
:draggable="draggable ? 'false' : undefined"
- :src="thumbnail.url"
- alt=""
- class="size-full object-cover"
- loading="lazy"
- />
- <template v-else>
- <video
- :src="videoFrameUrl(thumbnail)"
+ class="group/thumbnail relative block aspect-square cursor-zoom-in overflow-hidden rounded-md border border-border-strong bg-secondary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring"
+ :data-testid="`post-thumbnail-${post.id}-${index}`"
+ @click="openLightbox(index)"
+ >
+ <img
+ v-if="isImage(thumbnail)"
+ :draggable="draggable ? 'false' : undefined"
+ :src="thumbnail.url"
+ alt=""
class="size-full object-cover"
- muted
- playsinline
- preload="metadata"
- :data-testid="`post-thumbnail-video-${post.id}-${index}`"
+ loading="lazy"
/>
- <IconPlayerPlayFilled
+ <template v-else>
+ <video
+ :src="videoFrameUrl(thumbnail)"
+ class="size-full object-cover"
+ muted
+ playsinline
+ preload="metadata"
+ :data-testid="`post-thumbnail-video-${post.id}-${index}`"
+ />
+ <IconPlayerPlayFilled
+ aria-hidden="true"
+ class="absolute top-1/2 left-1/2 size-8 -translate-x-1/2 -translate-y-1/2 rounded-full bg-black/60 p-2 text-white transition-opacity group-hover/thumbnail:opacity-0"
+ />
+ </template>
+ <span
aria-hidden="true"
- class="absolute top-1/2 left-1/2 size-8 -translate-x-1/2 -translate-y-1/2 rounded-full bg-black/60 p-2 text-white transition-opacity group-hover/thumbnail:opacity-0"
- />
- </template>
- <span
- aria-hidden="true"
- class="pointer-events-none absolute inset-0 flex items-center justify-center bg-black/0 transition-colors group-hover/thumbnail:bg-black/30"
+ class="pointer-events-none absolute inset-0 flex items-center justify-center bg-black/0 transition-colors group-hover/thumbnail:bg-black/30"
+ >
+ <IconArrowsMaximize
+ class="size-6 text-white opacity-0 drop-shadow transition-opacity group-hover/thumbnail:opacity-100"
+ :data-testid="`post-thumbnail-expand-${post.id}-${index}`"
+ />
+ </span>
+ </button>
+ <button
+ v-if="hiddenVisuals > 0"
+ type="button"
+ :aria-label="$t('common.media_lightbox.open')"
+ class="absolute right-1.5 bottom-1.5 inline-flex size-6 cursor-zoom-in items-center justify-center rounded-full bg-foreground/60 text-xs font-medium text-background transition-colors hover:bg-foreground/80 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring"
+ :data-testid="`post-thumbnail-more-${post.id}`"
+ @click="openLightbox(MAX_THUMBNAILS)"
>
- <IconArrowsMaximize
- class="size-6 text-white opacity-0 drop-shadow transition-opacity group-hover/thumbnail:opacity-100"
- :data-testid="`post-thumbnail-expand-${post.id}-${index}`"
- />
- </span>
- </button>
- <button
- v-if="hiddenVisuals > 0"
- type="button"
- :aria-label="$t('common.media_lightbox.open')"
- class="absolute right-1.5 bottom-1.5 inline-flex size-6 cursor-zoom-in items-center justify-center rounded-full bg-foreground/60 text-xs font-medium text-background transition-colors hover:bg-foreground/80 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring"
- :data-testid="`post-thumbnail-more-${post.id}`"
- @click="openLightbox(MAX_THUMBNAILS)"
- >
- +{{ hiddenVisuals }}
- </button>
- </div>
- <div
- v-if="showNotes && !notesBesideCard"
- class="relative z-10 shrink-0"
- >
- <PostNotesPopover
- :post-id="post.id"
- :count="post.notes_count"
- :current-user-id="authUserId"
- :initial-open="openPostNotesId === post.id"
- :highlight-note-id="highlightNoteId"
+ +{{ hiddenVisuals }}
+ </button>
+ </div>
+
+ <MediaLightbox
+ v-model:open="lightboxOpen"
+ :items="visuals"
+ :start-index="lightboxIndex"
/>
</div>
- <MediaLightbox
- v-model:open="lightboxOpen"
- :items="visuals"
- :start-index="lightboxIndex"
- />
- </div>
- <PostCardLabels
- v-if="!isPublishing"
- class="-mt-1 px-4 pb-4"
- :post-id="post.id"
- :labels="post.labels ?? []"
- :test-key="post.id"
- />
+ <PostCardLabels
+ v-if="!isPublishing"
+ class="-mt-1 px-4 pb-4"
+ :post-id="post.id"
+ :labels="post.labels ?? []"
+ :test-key="post.id"
+ />
- <PostMetricsBand
- v-if="tab === 'sent' && metricsDetail && hasMetrics"
- :detail="metricsDetail"
- :channel-id="account?.id ?? null"
- :metrics-test-id="`post-metrics-${post.id}`"
- :insights-test-id="`post-insights-${post.id}`"
- />
+ <PostMetricsBand
+ v-if="tab === 'sent' && metricsDetail && hasMetrics"
+ :detail="metricsDetail"
+ :channel-id="account?.id ?? null"
+ :metrics-test-id="`post-metrics-${post.id}`"
+ :insights-test-id="`post-insights-${post.id}`"
+ />
- <div
- class="m-2 flex min-h-14 flex-wrap items-center gap-x-4 gap-y-2 rounded-xl bg-muted p-3 [&_[data-variant=ghost]:hover]:bg-secondary"
- :class="popover ? 'justify-end' : 'justify-between'"
- :data-testid="`post-footer-${post.id}`"
- >
- <p
- v-if="!popover"
- class="min-w-0 truncate text-sm text-foreground"
- :class="{ 'max-sm:hidden': post.origin === PostOrigin.Network }"
- >
- <TooltipProvider
- v-if="post.origin === PostOrigin.Network && platform"
- :delay-duration="200"
- >
- <Tooltip>
- <TooltipTrigger as-child>
- <span
- class="inline-flex cursor-default items-center gap-1"
- :data-testid="`post-published-via-${post.id}`"
- >
- {{ $t('posts.publish.published_via') }}
- <PlatformBrandIcon
- :platform="platform"
- :data-testid="`post-published-via-icon-${post.id}`"
- />
- <template v-if="platform !== Platform.X">
- {{ getPlatformLabel(platform) }}
- </template>
- </span>
- </TooltipTrigger>
- <TooltipContent :data-testid="`post-published-via-tooltip-${post.id}`">
- {{
- $t('posts.publish.published_directly_from', {
- network: getPlatformLabel(platform),
- })
- }}
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- <span
- v-else-if="post.user?.name"
- :data-testid="`post-created-by-${post.id}`"
- >{{
- $t('posts.publish.created_by', {
- name: post.user.name,
- when: date.diffForHumans(post.created_at),
- })
- }}</span>
- </p>
<div
- class="flex max-w-full shrink-0 flex-wrap items-center gap-1 max-sm:ms-auto"
- :data-testid="`post-actions-${post.id}`"
+ class="m-2 flex min-h-14 flex-wrap items-center gap-x-4 gap-y-2 rounded-xl bg-muted p-3 [&_[data-variant=ghost]:hover]:bg-secondary"
+ :class="popover ? 'justify-end' : 'justify-between'"
+ :data-testid="`post-footer-${post.id}`"
>
- <template v-if="isPending && canApprove">
- <ApprovePostButton :post="post" :test-key="post.id" />
- <Button
- variant="outline"
- class="text-destructive-text"
- :data-testid="`post-reject-${post.id}`"
- @click="rejectPost"
- >
- <IconX class="size-4" />
- {{ $t('posts.approvals.reject') }}
- </Button>
- </template>
- <Button
- v-else-if="isPending"
- variant="outline"
- :data-testid="`post-revert-${post.id}`"
- @click="revertRequest"
+ <p
+ v-if="!popover"
+ class="min-w-0 truncate text-sm text-foreground"
+ :class="{ 'max-sm:hidden': post.origin === PostOrigin.Network }"
>
- <IconX class="size-4" />
- {{ $t('posts.approvals.revert') }}
- </Button>
- <template v-if="canCreatePost && tab === 'drafts'">
- <Button
- v-if="canQueue"
- variant="outline"
- :data-testid="`post-add-to-queue-${post.id}`"
- @click="addToQueue"
+ <TooltipProvider
+ v-if="post.origin === PostOrigin.Network && platform"
+ :delay-duration="200"
>
- <IconListNumbers class="size-4" />
- {{ $t('posts.publish.actions.add_to_queue') }}
- </Button>
- <TooltipProvider v-else :delay-duration="200">
<Tooltip>
<TooltipTrigger as-child>
- <span tabindex="0">
- <Button
- variant="outline"
- disabled
- :data-testid="`post-add-to-queue-${post.id}`"
- >
- <IconListNumbers class="size-4" />
- {{
- $t(
- 'posts.publish.actions.add_to_queue',
- )
- }}
- </Button>
+ <span
+ class="inline-flex cursor-default items-center gap-1"
+ :data-testid="`post-published-via-${post.id}`"
+ >
+ {{ $t('posts.publish.published_via') }}
+ <PlatformBrandIcon
+ :platform="platform"
+ :data-testid="`post-published-via-icon-${post.id}`"
+ />
+ <template v-if="platform !== Platform.X">
+ {{ getPlatformLabel(platform) }}
+ </template>
</span>
</TooltipTrigger>
- <TooltipContent>
+ <TooltipContent :data-testid="`post-published-via-tooltip-${post.id}`">
{{
- $t(
- 'posts.publish.actions.add_to_queue_disabled',
- )
+ $t('posts.publish.published_directly_from', {
+ network: getPlatformLabel(platform),
+ })
}}
</TooltipContent>
</Tooltip>
</TooltipProvider>
- </template>
- <Tooltip v-if="permalink && platform">
- <TooltipTrigger as-child>
+ <span
+ v-else-if="post.user?.name"
+ :data-testid="`post-created-by-${post.id}`"
+ >{{
+ $t('posts.publish.created_by', {
+ name: post.user.name,
+ when: date.diffForHumans(post.created_at),
+ })
+ }}</span>
+ </p>
+ <div
+ class="flex max-w-full shrink-0 flex-wrap items-center gap-1 max-sm:ms-auto"
+ :data-testid="`post-actions-${post.id}`"
+ >
+ <Tooltip v-if="showNotes">
+ <TooltipTrigger as-child>
+ <CollapsibleTrigger as-child>
+ <Button
+ variant="outline"
+ class="data-[state=open]:bg-accent"
+ :data-testid="`post-notes-trigger-${post.id}`"
+ >
+ <IconMessageCircleFilled
+ v-if="noteCount > 0"
+ class="size-4"
+ :data-testid="`post-notes-filled-icon-${post.id}`"
+ />
+ <IconMessageCircle
+ v-else
+ class="size-4 text-muted-foreground"
+ :data-testid="`post-notes-outline-icon-${post.id}`"
+ />
+ {{ $t('notes.title') }}
+ <span
+ v-if="noteCount > 0"
+ class="flex h-4 min-w-4 items-center justify-center rounded-full bg-primary-selected px-1 text-[10px] leading-none font-medium text-primary-text tabular-nums"
+ :data-testid="`post-notes-count-${post.id}`"
+ >{{ noteCount > 99 ? '99+' : noteCount }}</span
+ >
+ </Button>
+ </CollapsibleTrigger>
+ </TooltipTrigger>
+ <TooltipContent
+ :data-testid="`post-notes-tooltip-${post.id}`"
+ >
+ {{
+ notesOpen
+ ? $t('notes.hide')
+ : $t('notes.show')
+ }}
+ </TooltipContent>
+ </Tooltip>
+ <template v-if="isPending && canApprove">
+ <ApprovePostButton :post="post" :test-key="post.id" />
<Button
- as="a"
- :href="permalink"
- target="_blank"
- rel="noopener noreferrer"
variant="outline"
- :data-testid="`post-view-${post.id}`"
+ class="text-destructive-text"
+ :data-testid="`post-reject-${post.id}`"
+ @click="rejectPost"
>
- <IconExternalLink class="size-4" />
- {{ $t('posts.publish.actions.view_post') }}
+ <IconX class="size-4" />
+ {{ $t('posts.approvals.reject') }}
</Button>
- </TooltipTrigger>
- <TooltipContent
- :data-testid="`post-view-tooltip-${post.id}`"
+ </template>
+ <Button
+ v-else-if="isPending"
+ variant="outline"
+ :data-testid="`post-revert-${post.id}`"
+ @click="revertRequest"
>
- {{
- $t('posts.publish.actions.open_on_network', {
- network: getPlatformLabel(
- platform,
- ),
- })
- }}
- </TooltipContent>
- </Tooltip>
- <Button
- v-if="canPublishDirectly && post.status === PostStatus.Scheduled"
- variant="outline"
- :data-testid="`post-publish-now-${post.id}`"
- @click="schedulePostCard(post.id, 'publish_now')"
- >
- <IconSend class="size-4" />
- {{ $t('posts.publish.actions.publish_now') }}
- </Button>
- <Tooltip v-if="canCreatePost && isEditable">
- <TooltipTrigger as-child>
- <Button
- variant="outline"
- size="icon"
- :aria-label="$t('posts.publish.actions.edit')"
- :data-testid="`post-edit-${post.id}`"
- @click="edit()"
+ <IconX class="size-4" />
+ {{ $t('posts.approvals.revert') }}
+ </Button>
+ <AddToQueueButton
+ v-if="canCreatePost && tab === 'drafts' && account"
+ :post="post"
+ :account="account"
+ />
+ <Tooltip v-if="permalink && platform">
+ <TooltipTrigger as-child>
+ <Button
+ as="a"
+ :href="permalink"
+ target="_blank"
+ rel="noopener noreferrer"
+ variant="outline"
+ :data-testid="`post-view-${post.id}`"
+ >
+ <IconExternalLink class="size-4" />
+ {{ $t('posts.publish.actions.view_post') }}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent
+ :data-testid="`post-view-tooltip-${post.id}`"
>
- <IconPencil class="size-4" />
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- {{ $t('posts.publish.actions.edit') }}
- </TooltipContent>
- </Tooltip>
- <PostCardMenu
- v-if="canCreatePost && !isPublishing"
- :post="post"
- :test-key="post.id"
- :can-move-up="canMoveUp"
- :can-move-down="canMoveDown"
- :movable="movable"
- @select="onMenuSelect"
- />
- <PostDetailsDialog
- v-if="canCreatePost"
- v-model:open="detailsOpen"
- :post="post"
- :test-key="post.id"
- :timezone="timezone"
- @select="runPostAction"
- @edit="edit"
- />
- <PostRecurrenceDialog
- v-if="canCreatePost"
- v-model:open="recurrenceOpen"
- :post="
- recurrencePost.id === post.id ? post : recurrencePost
- "
- :test-key="post.id"
- :timezone="recurrenceTimezone"
- />
+ {{
+ $t('posts.publish.actions.open_on_network', {
+ network: getPlatformLabel(
+ platform,
+ ),
+ })
+ }}
+ </TooltipContent>
+ </Tooltip>
+ <Button
+ v-if="canPublishDirectly && post.status === PostStatus.Scheduled"
+ variant="outline"
+ :data-testid="`post-publish-now-${post.id}`"
+ @click="schedulePostCard(post.id, 'publish_now')"
+ >
+ <IconSend class="size-4" />
+ {{ $t('posts.publish.actions.publish_now') }}
+ </Button>
+ <Tooltip v-if="canCreatePost && isEditable">
+ <TooltipTrigger as-child>
+ <Button
+ variant="outline"
+ size="icon"
+ :aria-label="$t('posts.publish.actions.edit')"
+ :data-testid="`post-edit-${post.id}`"
+ @click="edit()"
+ >
+ <IconPencil class="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ {{ $t('posts.publish.actions.edit') }}
+ </TooltipContent>
+ </Tooltip>
+ <PostCardMenu
+ v-if="canCreatePost && !isPublishing"
+ :post="post"
+ :test-key="post.id"
+ :can-move-up="canMoveUp"
+ :can-move-down="canMoveDown"
+ :movable="movable"
+ @select="onMenuSelect"
+ />
+ <PostDetailsDialog
+ v-if="canCreatePost"
+ v-model:open="detailsOpen"
+ :post="post"
+ :test-key="post.id"
+ :timezone="timezone"
+ @select="runPostAction"
+ @edit="edit"
+ />
+ <PostRecurrenceDialog
+ v-if="canCreatePost"
+ v-model:open="recurrenceOpen"
+ :post="
+ recurrencePost.id === post.id ? post : recurrencePost
+ "
+ :test-key="post.id"
+ :timezone="recurrenceTimezone"
+ />
+ </div>
</div>
- </div>
- </article>
+ <CollapsibleContent
+ v-if="showNotes"
+ class="overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down motion-reduce:animate-none"
+ :data-testid="`post-notes-section-${post.id}`"
+ >
+ <PostNotesPanel
+ class="px-4 pt-2 pb-4"
+ :post-id="post.id"
+ :current-user-id="authUserId"
+ :highlight-note-id="highlightNoteId"
+ :aria-label="$t('notes.title')"
+ @count="setNoteCount"
+ />
+ </CollapsibleContent>
+ </article>
+ </Collapsible>
- <div
- v-if="showNotes && notesBesideCard"
- class="absolute top-0 left-full ms-1"
- >
- <PostNotesPopover
- :post-id="post.id"
- :count="post.notes_count"
- :current-user-id="authUserId"
- :initial-open="openPostNotesId === post.id"
- :highlight-note-id="highlightNoteId"
- />
- </div>
</div>
</template>
diff --git a/resources/js/components/publish/QueueSetupIllustration.vue b/resources/js/components/publish/QueueSetupIllustration.vue
new file mode 100644
index 000000000..59f4faca9
--- /dev/null
+++ b/resources/js/components/publish/QueueSetupIllustration.vue
@@ -0,0 +1,65 @@
+<script setup lang="ts">
+import { IconClock, IconPlus } from '@tabler/icons-vue';
+</script>
+
+<template>
+ <div
+ class="flex justify-center overflow-hidden rounded-lg bg-sky-100 px-6 pt-4 dark:bg-sky-950/70"
+ aria-hidden="true"
+ >
+ <div
+ class="w-full space-y-1.5 rounded-t-lg bg-background p-3 pb-2.5 shadow-xs ring-1 ring-sky-900/5 dark:bg-card dark:ring-white/10"
+ >
+ <div
+ class="flex items-center gap-1.5 pb-0.5"
+ >
+ <IconClock
+ class="size-3.5 text-muted-foreground"
+ :stroke-width="1.5"
+ />
+ <span
+ class="block h-1 w-14 rounded-full bg-muted-foreground/30"
+ />
+ </div>
+ <div class="flex items-center gap-2">
+ <span
+ class="block h-1 w-4 shrink-0 rounded-full bg-muted-foreground/20"
+ />
+ <div
+ class="flex h-5 flex-1 items-center gap-1.5 rounded-md border border-border bg-muted px-1.5"
+ >
+ <span
+ class="size-2 shrink-0 rounded-full bg-muted-foreground/30"
+ />
+ <span
+ class="block h-1 w-3/5 rounded-full bg-muted-foreground/20"
+ />
+ </div>
+ </div>
+ <div class="flex items-center gap-2">
+ <span
+ class="block h-1 w-4 shrink-0 rounded-full bg-sky-400 dark:bg-sky-400/80"
+ />
+ <div
+ class="flex h-5 flex-1 items-center gap-1 rounded-md border border-sky-400 bg-sky-50 px-1.5 dark:border-sky-400/60 dark:bg-sky-400/10"
+ >
+ <IconPlus
+ class="size-3 text-sky-500 dark:text-sky-300"
+ :stroke-width="1.75"
+ />
+ <span
+ class="block h-1 w-2/5 rounded-full bg-sky-300/80 dark:bg-sky-300/40"
+ />
+ </div>
+ </div>
+ <div class="flex items-center gap-2">
+ <span
+ class="block h-1 w-4 shrink-0 rounded-full bg-muted-foreground/20"
+ />
+ <span
+ class="block h-5 flex-1 rounded-md border border-dashed border-border-strong"
+ />
+ </div>
+ </div>
+ </div>
+</template>
diff --git a/resources/js/components/settings/DeleteWorkspace.vue b/resources/js/components/settings/DeleteWorkspace.vue
index 63157a69c..9ad8ed62e 100644
--- a/resources/js/components/settings/DeleteWorkspace.vue
+++ b/resources/js/components/settings/DeleteWorkspace.vue
@@ -6,8 +6,8 @@ import { computed, ref } from 'vue';
import ConfirmDeleteModal from '@/components/ConfirmDeleteModal.vue';
import SettingsSection from '@/components/settings/SettingsSection.vue';
import { Button } from '@/components/ui/button';
-import { edit as editAuthentication } from '@/routes/app/authentication';
import { index as billingIndex } from '@/routes/app/billing';
+import { edit as editProfile } from '@/routes/app/profile';
import { destroy as destroyWorkspace } from '@/routes/app/workspaces';
const props = defineProps<{
@@ -95,7 +95,7 @@ const openDeleteModal = () => {
</Link>
</Button>
<Button variant="destructive" as-child>
- <Link :href="editAuthentication()">
+ <Link :href="editProfile()">
{{ $t('settings.workspace.delete_go_to_delete_account') }}
</Link>
</Button>
diff --git a/resources/js/components/settings/profile/ProfileLoginSettings.vue b/resources/js/components/settings/profile/ProfileLoginSettings.vue
new file mode 100644
index 000000000..6de17fe65
--- /dev/null
+++ b/resources/js/components/settings/profile/ProfileLoginSettings.vue
@@ -0,0 +1,221 @@
+<script setup lang="ts">
+import { Form, usePage } from '@inertiajs/vue3';
+import { ref } from 'vue';
+
+import ConnectedAccountController from '@/actions/App/Http/Controllers/App/Settings/ConnectedAccountController';
+import PasswordController from '@/actions/App/Http/Controllers/App/Settings/PasswordController';
+import PasswordRequirements from '@/components/auth/PasswordRequirements.vue';
+import type { PasswordRequirement } from '@/components/auth/PasswordRequirements.vue';
+import SettingsField from '@/components/settings/SettingsField.vue';
+import SettingsListRow from '@/components/settings/SettingsListRow.vue';
+import SettingsSection from '@/components/settings/SettingsSection.vue';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Separator } from '@/components/ui/separator';
+import { connect } from '@/routes/app/profile/connected-accounts';
+
+export type SocialProvider = 'google' | 'github';
+
+export type ConnectedAccount = {
+ provider: SocialProvider;
+ label: string;
+ connected: boolean;
+ can_disconnect: boolean;
+};
+
+defineProps<{
+ hasPassword: boolean;
+ passwordRequirements: PasswordRequirement[];
+ connectedAccounts: ConnectedAccount[];
+}>();
+
+const newPassword = ref('');
+
+const clearNewPassword = (): void => {
+ newPassword.value = '';
+};
+
+const page = usePage();
+const providerEnabled = (provider: SocialProvider): boolean =>
+ Boolean(
+ page.props[
+ provider === 'google' ? 'googleAuthEnabled' : 'githubAuthEnabled'
+ ],
+ );
+</script>
+
+<template>
+ <div class="flex flex-col gap-10">
+ <SettingsSection
+ :title="
+ hasPassword
+ ? $t('settings.profile.password.update_title')
+ : $t('settings.profile.password.set_title')
+ "
+ :description="
+ hasPassword
+ ? $t('settings.profile.password.update_description')
+ : $t('settings.profile.password.set_description')
+ "
+ >
+ <Form
+ v-bind="PasswordController.update.form()"
+ :options="{ preserveScroll: true }"
+ reset-on-success
+ :reset-on-error="[
+ 'password',
+ 'password_confirmation',
+ 'current_password',
+ ]"
+ class="flex flex-col gap-6"
+ v-slot="{ errors, processing }"
+ @success="clearNewPassword"
+ @error="clearNewPassword"
+ >
+ <SettingsField
+ v-if="hasPassword"
+ :label="
+ $t('settings.profile.password.current_password')
+ "
+ for="current_password"
+ :error="errors.current_password"
+ >
+ <Input
+ id="current_password"
+ name="current_password"
+ type="password"
+ autocomplete="current-password"
+ />
+ </SettingsField>
+
+ <SettingsField
+ :label="$t('settings.profile.password.new_password')"
+ for="password"
+ :error="errors.password"
+ >
+ <Input
+ id="password"
+ v-model="newPassword"
+ name="password"
+ type="password"
+ autocomplete="new-password"
+ data-testid="profile-new-password"
+ />
+ <PasswordRequirements
+ :password="newPassword"
+ :requirements="passwordRequirements"
+ />
+ </SettingsField>
+
+ <SettingsField
+ :label="
+ $t('settings.profile.password.confirm_password')
+ "
+ for="password_confirmation"
+ :error="errors.password_confirmation"
+ >
+ <Input
+ id="password_confirmation"
+ name="password_confirmation"
+ type="password"
+ autocomplete="new-password"
+ />
+ </SettingsField>
+
+ <Button
+ :disabled="processing"
+ class="self-start"
+ data-test="update-password-button"
+ >
+ {{
+ hasPassword
+ ? $t('settings.profile.password.save')
+ : $t('settings.profile.password.set')
+ }}
+ </Button>
+ </Form>
+ </SettingsSection>
+
+ <Separator />
+
+ <SettingsSection
+ :title="$t('settings.profile.providers.title')"
+ :description="$t('settings.profile.providers.description')"
+ >
+ <ul class="flex flex-col gap-2">
+ <SettingsListRow
+ v-for="account in connectedAccounts"
+ :key="account.provider"
+ :data-test="`connected-account-${account.provider}`"
+ >
+ <template #media>
+ <img
+ :src="`/images/social/${account.provider}.svg`"
+ :alt="account.label"
+ class="size-7 shrink-0 object-contain"
+ :class="{
+ 'dark:invert': account.provider === 'github',
+ }"
+ :data-testid="`connected-account-icon-${account.provider}`"
+ />
+ </template>
+ <p
+ class="truncate text-sm leading-tight font-emphasis text-foreground"
+ >
+ {{ account.label }}
+ </p>
+ <p class="text-sm text-muted-foreground">
+ {{
+ account.connected
+ ? $t(
+ 'settings.profile.providers.connected',
+ )
+ : $t(
+ 'settings.profile.providers.not_connected',
+ )
+ }}
+ </p>
+ <template #actions>
+ <Form
+ v-if="account.connected && account.can_disconnect"
+ v-bind="
+ ConnectedAccountController.destroy.form(
+ account.provider,
+ )
+ "
+ :options="{ preserveScroll: true }"
+ #default="{ processing }"
+ >
+ <Button
+ type="submit"
+ variant="outline"
+ :disabled="processing"
+ :data-test="`disconnect-${account.provider}`"
+ >
+ {{
+ $t(
+ 'settings.profile.providers.disconnect',
+ )
+ }}
+ </Button>
+ </Form>
+ <Button
+ v-else-if="
+ !account.connected &&
+ providerEnabled(account.provider)
+ "
+ variant="outline"
+ as="a"
+ :href="connect(account.provider).url"
+ :data-test="`connect-${account.provider}`"
+ >
+ {{
+ $t('settings.profile.providers.connect')
+ }}
+ </Button>
+ </template>
+ </SettingsListRow>
+ </ul>
+ </SettingsSection>
+ </div>
+</template>
diff --git a/resources/js/components/settings/profile/ProfileSessions.vue b/resources/js/components/settings/profile/ProfileSessions.vue
new file mode 100644
index 000000000..6b8b94c51
--- /dev/null
+++ b/resources/js/components/settings/profile/ProfileSessions.vue
@@ -0,0 +1,130 @@
+<script setup lang="ts">
+import { computed, useTemplateRef } from 'vue';
+
+import SessionController from '@/actions/App/Http/Controllers/App/Settings/SessionController';
+import ConfirmDeleteModal from '@/components/ConfirmDeleteModal.vue';
+import SettingsListRow from '@/components/settings/SettingsListRow.vue';
+import SettingsSection from '@/components/settings/SettingsSection.vue';
+import { Badge } from '@/components/ui/badge';
+import { Button } from '@/components/ui/button';
+import {
+ browserIconUrl,
+ isMonochromeOsIcon,
+ osIconUrl,
+ parseBrowserName,
+ parseOsName,
+} from '@/lib/userAgent';
+
+export type Session = {
+ id: string;
+ user_agent: string | null;
+ last_active: string;
+ is_current: boolean;
+};
+
+const props = defineProps<{
+ sessions: Session[];
+}>();
+
+const orderedSessions = computed<Session[]>(() => [
+ ...props.sessions.filter((session) => session.is_current),
+ ...props.sessions.filter((session) => !session.is_current),
+]);
+
+const logoutDialog = useTemplateRef('logoutDialog');
+
+const openLogoutDialog = (): void => {
+ logoutDialog.value?.open({ url: SessionController.destroyOthers.url() });
+};
+</script>
+
+<template>
+ <SettingsSection
+ data-testid="profile-sessions"
+ :title="$t('settings.profile.sessions.title')"
+ :description="$t('settings.profile.sessions.description')"
+ >
+ <template #actions>
+ <Button
+ variant="outline"
+ data-test="log-out-other-sessions-button"
+ :disabled="sessions.length <= 1"
+ @click="openLogoutDialog"
+ >
+ {{ $t('settings.profile.sessions.log_out_others') }}
+ </Button>
+ </template>
+
+ <ul class="flex flex-col gap-2">
+ <SettingsListRow
+ v-for="session in orderedSessions"
+ :key="session.id"
+ data-test="session-row"
+ >
+ <template #media>
+ <img
+ :src="browserIconUrl(session.user_agent)"
+ :alt="parseBrowserName(session.user_agent)"
+ class="size-9 shrink-0 object-contain"
+ :data-testid="`session-browser-icon-${session.id}`"
+ />
+ </template>
+ <p
+ class="flex min-w-0 items-center gap-1.5 text-sm leading-tight text-foreground"
+ >
+ <span class="truncate font-emphasis">
+ {{ parseBrowserName(session.user_agent) }}
+ </span>
+ <template v-if="parseOsName(session.user_agent)">
+ <span class="text-muted-foreground">
+ {{ $t('settings.profile.sessions.on') }}
+ </span>
+ <img
+ :src="osIconUrl(session.user_agent)"
+ alt=""
+ class="size-4 shrink-0 object-contain"
+ :class="{
+ 'dark:invert': isMonochromeOsIcon(
+ session.user_agent,
+ ),
+ }"
+ :data-testid="`session-os-icon-${session.id}`"
+ />
+ <span class="truncate text-muted-foreground">
+ {{ parseOsName(session.user_agent) }}
+ </span>
+ </template>
+ </p>
+ <p
+ v-if="!session.is_current"
+ class="-mt-0.5 text-xs leading-4 text-muted-foreground"
+ :data-testid="`session-last-activity-${session.id}`"
+ >
+ {{
+ $t('settings.profile.sessions.last_activity', {
+ time: session.last_active,
+ })
+ }}
+ </p>
+ <template #actions>
+ <Badge
+ v-if="session.is_current"
+ variant="success"
+ class="shrink-0"
+ >
+ {{ $t('settings.profile.sessions.active_now') }}
+ </Badge>
+ </template>
+ </SettingsListRow>
+ </ul>
+
+ <ConfirmDeleteModal
+ ref="logoutDialog"
+ :title="$t('settings.profile.sessions.modal_title')"
+ :description="$t('settings.profile.sessions.modal_description')"
+ :action="$t('settings.profile.sessions.submit')"
+ :cancel="$t('settings.profile.sessions.cancel')"
+ action-test-id="confirm-log-out-other-sessions"
+ />
+ </SettingsSection>
+</template>
diff --git a/resources/js/components/ui/radio-group/RadioGroupItem.vue b/resources/js/components/ui/radio-group/RadioGroupItem.vue
index 456060255..962503022 100644
--- a/resources/js/components/ui/radio-group/RadioGroupItem.vue
+++ b/resources/js/components/ui/radio-group/RadioGroupItem.vue
@@ -2,9 +2,7 @@
import type { RadioGroupItemProps } from "reka-ui"
import type { HTMLAttributes } from "vue"
import { reactiveOmit } from "@vueuse/core"
-import { IconCircleFilled } from "@tabler/icons-vue"
import {
- RadioGroupIndicator,
RadioGroupItem,
useForwardProps,
} from "reka-ui"
@@ -23,18 +21,9 @@ const forwardedProps = useForwardProps(delegatedProps)
v-bind="forwardedProps"
:class="
cn(
- 'border-input text-primary-strong focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
+ 'border-input text-primary-strong data-[state=checked]:bg-[radial-gradient(circle,currentColor_3.5px,transparent_4px)] focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50',
props.class,
)
"
- >
- <RadioGroupIndicator
- data-slot="radio-group-indicator"
- class="relative flex items-center justify-center"
- >
- <slot>
- <IconCircleFilled class="text-primary-strong absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
- </slot>
- </RadioGroupIndicator>
- </RadioGroupItem>
+ />
</template>
diff --git a/resources/js/composables/useComposerTimezone.ts b/resources/js/composables/composer/useComposerTimezone.ts
similarity index 100%
rename from resources/js/composables/useComposerTimezone.ts
rename to resources/js/composables/composer/useComposerTimezone.ts
diff --git a/resources/js/composables/composer/useComposerUnsavedChanges.ts b/resources/js/composables/composer/useComposerUnsavedChanges.ts
new file mode 100644
index 000000000..3756a84d4
--- /dev/null
+++ b/resources/js/composables/composer/useComposerUnsavedChanges.ts
@@ -0,0 +1,89 @@
+import { nextTick, ref, watch } from 'vue';
+
+import { useUnsavedChanges } from '@/composables/composer/useUnsavedChanges';
+import type { usePostComposition } from '@/composables/usePostComposition';
+import { PostStatus } from '@/types/post';
+
+interface ComposerUnsavedChangesOptions {
+ /** Only an edit of a saved post can lose work: a new post is autosaved. */
+ editingSavedPost: boolean;
+ isOpen: () => boolean;
+ /** Closes the composer: what discarding after the browser's back button does. */
+ close: () => void;
+ composition: ReturnType<typeof usePostComposition>;
+ /** The schedule picked in the composer: now, custom, next or top. */
+ scheduleMode: () => string;
+ /** A file still uploading: closing would lose it before it joins the post. */
+ uploading: () => boolean;
+}
+
+/**
+ * The composer's unsaved-changes guard: compares what saving would send with
+ * what it would have sent when the post opened. A file still uploading counts
+ * too: it joins the post only once the upload finishes.
+ *
+ * Settings fill some values in on their own once their data loads (a renewed
+ * music cover, the TikTok creator's limits), so the opened state is taken
+ * again at the person's first interaction and nothing counts before it.
+ */
+export const useComposerUnsavedChanges = (
+ options: ComposerUnsavedChangesOptions,
+) => {
+ const { composition, scheduleMode } = options;
+
+ /** What saving would send, so any change the person makes counts. */
+ const snapshot = (): string => {
+ const mode = scheduleMode();
+
+ return JSON.stringify({
+ submission: composition.materialize(
+ PostStatus.Scheduled,
+ mode === 'next' || mode === 'top' ? mode : null,
+ ),
+ scheduleMode: mode,
+ });
+ };
+
+ const opened = ref<string | null>(null);
+ const interacted = ref(false);
+ const saved = ref(false);
+
+ watch(
+ () =>
+ composition.selectedAccounts.value.length ===
+ composition.selectedAccountIds.value.length,
+ async (ready) => {
+ if (!ready || opened.value !== null) return;
+ await nextTick();
+ opened.value = snapshot();
+ },
+ { immediate: true },
+ );
+
+ const markInteracted = (): void => {
+ if (interacted.value) return;
+ interacted.value = true;
+ if (opened.value !== null) {
+ opened.value = snapshot();
+ }
+ };
+
+ const markSaved = (): void => {
+ saved.value = true;
+ };
+
+ const hasUnsavedChanges = (): boolean =>
+ options.editingSavedPost &&
+ options.isOpen() &&
+ !saved.value &&
+ (options.uploading() ||
+ (interacted.value &&
+ opened.value !== null &&
+ snapshot() !== opened.value));
+
+ return {
+ ...useUnsavedChanges(hasUnsavedChanges, options.close),
+ markInteracted,
+ markSaved,
+ };
+};
diff --git a/resources/js/composables/composer/useLastUsedAccounts.ts b/resources/js/composables/composer/useLastUsedAccounts.ts
new file mode 100644
index 000000000..04d6751c7
--- /dev/null
+++ b/resources/js/composables/composer/useLastUsedAccounts.ts
@@ -0,0 +1,41 @@
+import { computed, onMounted, ref } from 'vue';
+
+import type { ComposerAccount } from '@/composables/usePostComposition';
+
+const STORAGE_KEY = 'trypost:composer:last-used-accounts';
+
+/**
+ * The channels the last post was sent to, offered as a shortcut in the
+ * composer. Kept in this browser only; without storage there is no shortcut.
+ */
+export const useLastUsedAccounts = (accounts: () => ComposerAccount[]) => {
+ const ids = ref<string[]>([]);
+
+ onMounted(() => {
+ try {
+ const saved = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]');
+
+ if (Array.isArray(saved)) {
+ ids.value = saved.filter(
+ (id): id is string => typeof id === 'string',
+ );
+ }
+ } catch {
+ ids.value = [];
+ }
+ });
+
+ const recentlyUsed = computed(() =>
+ accounts().filter((account) => ids.value.includes(account.id)),
+ );
+
+ const remember = (accountIds: string[]): void => {
+ try {
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(accountIds));
+ } catch {
+ return;
+ }
+ };
+
+ return { recentlyUsed, remember };
+};
diff --git a/resources/js/composables/composer/useReelSoundtrack.ts b/resources/js/composables/composer/useReelSoundtrack.ts
new file mode 100644
index 000000000..2986545a9
--- /dev/null
+++ b/resources/js/composables/composer/useReelSoundtrack.ts
@@ -0,0 +1,139 @@
+import {
+ computed,
+ inject,
+ provide,
+ readonly,
+ ref,
+ watch,
+ type ComputedRef,
+ type InjectionKey,
+ type Ref,
+} from 'vue';
+
+import type { InstagramAudio } from '@/types/instagram';
+
+/** What a reel preview tells its video about the soundtrack picked in the composer. */
+interface PreviewSoundtrack {
+ playing: ComputedRef<boolean>;
+ videoVolume: ComputedRef<number>;
+ start: () => void;
+ stop: () => void;
+}
+
+const PREVIEW_SOUNDTRACK: InjectionKey<PreviewSoundtrack> =
+ Symbol('previewSoundtrack');
+
+const playingAudioId = ref<string | null>(null);
+let player: HTMLAudioElement | null = null;
+
+const stop = (): void => {
+ player?.pause();
+ player = null;
+ playingAudioId.value = null;
+};
+
+const play = (
+ audioId: string,
+ url: string,
+ volume: number,
+ onUnavailable?: () => void,
+): void => {
+ stop();
+ const audio = new Audio(url);
+ audio.volume = volume / 100;
+ audio.addEventListener('ended', stop);
+ player = audio;
+ playingAudioId.value = audioId;
+ void audio.play().catch((error: unknown) => {
+ if (player === audio) stop();
+ if ((error as DOMException)?.name !== 'AbortError') onUnavailable?.();
+ });
+};
+
+const setVolume = (volume: number): void => {
+ if (player) player.volume = volume / 100;
+};
+
+/**
+ * The one Instagram audio preview playing in the composer. Playing the reel
+ * preview's video plays the post's own track along with it.
+ */
+export const useReelSoundtrack = () => ({
+ playingAudioId: readonly(playingAudioId),
+ play,
+ stop,
+ setVolume,
+});
+
+/** The picked track as the reel preview names it: title and artist. */
+export const soundtrackLabel = (
+ audio: InstagramAudio | null | undefined,
+): string | null =>
+ audio?.id
+ ? [audio.title, audio.artist].filter(Boolean).join(' · ') || null
+ : null;
+
+/**
+ * Ties the reel preview's video to the post's picked track: playing the video
+ * plays the track with it (see `useSoundtrackVideo`).
+ */
+export const providePreviewSoundtrack = (
+ audio: () => InstagramAudio | null,
+): void => {
+ provide(PREVIEW_SOUNDTRACK, {
+ playing: computed(
+ () =>
+ Boolean(audio()?.id) && playingAudioId.value === audio()?.id,
+ ),
+ videoVolume: computed(() => (audio()?.video_volume ?? 100) / 100),
+ start: () => {
+ const track = audio();
+ if (track?.id && track.preview_url) {
+ play(track.id, track.preview_url, track.audio_volume ?? 100);
+ }
+ },
+ stop,
+ });
+};
+
+/**
+ * Plays the soundtrack its reel provides when a preview video plays: the
+ * video at the chosen video volume, the track at the chosen music volume.
+ * Pausing or ending the video stops the track, and stopping the track pauses
+ * the video. Playing the track alone (the settings card) leaves the video
+ * still. Outside a reel preview it does nothing.
+ *
+ * @returns what to call when the video plays and when it pauses
+ */
+export const useSoundtrackVideo = (
+ video: Ref<HTMLVideoElement | null>,
+): { onVideoPlay: () => void; onVideoPause: () => void } => {
+ const soundtrack = inject(PREVIEW_SOUNDTRACK, null);
+
+ watch(
+ () => soundtrack?.playing.value ?? false,
+ (playing) => {
+ if (!playing) video.value?.pause();
+ },
+ );
+
+ watch(
+ () => soundtrack?.videoVolume.value,
+ (volume) => {
+ if (video.value && volume !== undefined) {
+ video.value.volume = volume;
+ }
+ },
+ );
+
+ return {
+ onVideoPlay: (): void => {
+ if (!soundtrack) return;
+ if (video.value) video.value.volume = soundtrack.videoVolume.value;
+ if (!soundtrack.playing.value) soundtrack.start();
+ },
+ onVideoPause: (): void => {
+ if (soundtrack?.playing.value) soundtrack.stop();
+ },
+ };
+};
diff --git a/resources/js/composables/composer/useSaveAndLinkFacebook.ts b/resources/js/composables/composer/useSaveAndLinkFacebook.ts
new file mode 100644
index 000000000..73e9adfd7
--- /dev/null
+++ b/resources/js/composables/composer/useSaveAndLinkFacebook.ts
@@ -0,0 +1,56 @@
+import { trans } from 'laravel-vue-i18n';
+import { toast } from 'vue-sonner';
+
+import { useConnectChannelDialog } from '@/composables/useConnectChannelDialog';
+import type { PostComposition } from '@/composables/usePostComposition';
+import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
+import { PostStatus } from '@/types/post';
+
+interface SaveAndLinkFacebookOptions {
+ /** The status the edited post had when it opened, if it was saved. */
+ status: () => string | undefined;
+ /** Whether the composer is set to publish now rather than at a time or in the queue. */
+ publishesNow: () => boolean;
+ /** Saves the post; false when it cannot be saved yet. */
+ submit: (status: PostComposition['status'], onSaved: () => void) => boolean;
+}
+
+/**
+ * Saves the post, then opens the step that reconnects an Instagram account
+ * through Facebook (music needs it). A scheduled post stays scheduled and a
+ * pending request stays pending; anything else is saved as a draft. An
+ * approver is asked to decide on a pending post first, so saving never
+ * approves it by accident.
+ */
+export const useSaveAndLinkFacebook = (options: SaveAndLinkFacebookOptions) => {
+ const { requiresApproval } = useWorkspaceAbilities();
+ const { openAt } = useConnectChannelDialog();
+
+ return (accountId: string): void => {
+ const status = options.status();
+
+ if (status === PostStatus.PendingApproval && !requiresApproval.value) {
+ toast.error(trans('posts.form.instagram.music.save_and_link_pending'), {
+ testId: 'instagram-music-save-and-link-pending',
+ });
+
+ return;
+ }
+
+ const keepsSchedule =
+ (status === PostStatus.Scheduled ||
+ status === PostStatus.PendingApproval) &&
+ !options.publishesNow();
+
+ const submitted = options.submit(
+ keepsSchedule ? PostStatus.Scheduled : PostStatus.Draft,
+ () => openAt('instagram-facebook', accountId),
+ );
+
+ if (!submitted) {
+ toast.error(trans('posts.form.instagram.music.save_and_link_blocked'), {
+ testId: 'instagram-music-save-and-link-blocked',
+ });
+ }
+ };
+};
diff --git a/resources/js/composables/composer/useUnsavedChanges.ts b/resources/js/composables/composer/useUnsavedChanges.ts
new file mode 100644
index 000000000..115aa1d02
--- /dev/null
+++ b/resources/js/composables/composer/useUnsavedChanges.ts
@@ -0,0 +1,166 @@
+import { router } from '@inertiajs/vue3';
+import { onScopeDispose, ref, watch } from 'vue';
+
+import { stepBackInHistory } from '@/lib/inAppHistory';
+
+/**
+ * Asks before unsaved work is lost: closing what holds it (through `guard`),
+ * an Inertia visit to another page, the browser's back button, or reloading
+ * and closing the tab (the browser's own prompt, which no page can word).
+ * Writes (POST, PUT, ...) and partial reloads of the current page are never
+ * held.
+ *
+ * The back button cannot be cancelled, so while there is unsaved work the
+ * current history entry is doubled: back lands on the copy (an entry without
+ * Inertia state, which Inertia leaves on the same page), the entry is doubled
+ * again at once so a second back or a forward is caught too, and it asks from
+ * there. Discarding after back runs `close` rather than going back in
+ * history, since a page opened from a link may have nothing to go back to.
+ * A jump past the copy (the back button's history menu) lands on an entry
+ * with state: it cannot be held, so the doubling ends and Inertia navigates.
+ * Unmounting while held (a save whose page no longer shows the composer)
+ * steps back onto the copy, so it never leaves a Back that goes nowhere; the
+ * page waits for that step (`afterHistorySettles`) before leaving through
+ * history itself.
+ *
+ * Releasing the hold steps back onto the copy and gives it the page's state
+ * again. Inertia only fills an entry without state when its page differs from
+ * the last one it wrote, which is no longer true once a back was caught, and
+ * a copy left without state is a Back that does nothing.
+ */
+export const useUnsavedChanges = (
+ isDirty: () => boolean,
+ close: () => void,
+) => {
+ const confirming = ref(false);
+ let pending: (() => void) | null = null;
+ let discarded = false;
+
+ const holds = (): boolean => !discarded && isDirty();
+
+ const guard = (action: () => void): void => {
+ if (!holds()) {
+ action();
+ return;
+ }
+ pending = action;
+ confirming.value = true;
+ };
+
+ let holdingBack = false;
+ let releasing = false;
+ let afterRelease: (() => void) | null = null;
+ let pageState: unknown = null;
+ let pageUrl = window.location.href;
+
+ const holdBack = (): void => {
+ if (holdingBack || releasing) return;
+ holdingBack = true;
+ pageState = window.history.state ?? pageState;
+ window.history.replaceState(null, '', window.location.href);
+ window.history.pushState(pageState, '', window.location.href);
+ };
+
+ /**
+ * Drops the doubled history entry, then runs `then` once the browser is
+ * back on the copy, so leaving never strands it.
+ */
+ const releaseBack = (then?: () => void): void => {
+ if (!holdingBack) {
+ then?.();
+ return;
+ }
+ holdingBack = false;
+ releasing = true;
+ afterRelease = then ?? null;
+ pageState = window.history.state ?? pageState;
+ pageUrl = window.location.href;
+ window.history.back();
+ };
+
+ const discard = (): void => {
+ const action = pending;
+ pending = null;
+ confirming.value = false;
+ if (!action) return;
+ discarded = true;
+ releaseBack(action);
+ };
+
+ const keepEditing = (): void => {
+ pending = null;
+ confirming.value = false;
+ };
+
+ const onPopState = (event: PopStateEvent): void => {
+ if (releasing) {
+ releasing = false;
+ if (window.history.state === null && pageState !== null) {
+ window.history.replaceState(pageState, '', pageUrl);
+ }
+ const then = afterRelease;
+ afterRelease = null;
+
+ if (then) {
+ then();
+ } else if (isDirty()) {
+ holdBack();
+ }
+
+ return;
+ }
+
+ if (!holdingBack || !holds()) return;
+ holdingBack = false;
+ if (event.state !== null) return;
+ holdBack();
+ guard(close);
+ };
+
+ watch(isDirty, (dirty) => (dirty ? holdBack() : releaseBack()));
+
+ const stopVisits = router.on('before', (event) => {
+ const visit = event.detail.visit;
+
+ if (
+ visit.method !== 'get' ||
+ visit.only.length > 0 ||
+ visit.except.length > 0 ||
+ visit.prefetch ||
+ visit.url.href === window.location.href ||
+ !holds()
+ ) {
+ return;
+ }
+
+ event.preventDefault();
+ guard(() =>
+ router.visit(visit.url.href, {
+ preserveScroll: visit.preserveScroll,
+ preserveState: visit.preserveState,
+ replace: visit.replace,
+ }),
+ );
+ });
+
+ const onBeforeUnload = (event: BeforeUnloadEvent): void => {
+ if (!holds()) return;
+ event.preventDefault();
+ event.returnValue = '';
+ };
+
+ window.addEventListener('beforeunload', onBeforeUnload);
+ window.addEventListener('popstate', onPopState);
+
+ onScopeDispose(() => {
+ stopVisits();
+ window.removeEventListener('beforeunload', onBeforeUnload);
+ window.removeEventListener('popstate', onPopState);
+ if (holdingBack) {
+ holdingBack = false;
+ stepBackInHistory();
+ }
+ });
+
+ return { confirming, guard, discard, keepEditing };
+};
diff --git a/resources/js/composables/useChannelOrder.ts b/resources/js/composables/useChannelOrder.ts
index c622fd524..b27c28447 100644
--- a/resources/js/composables/useChannelOrder.ts
+++ b/resources/js/composables/useChannelOrder.ts
@@ -1,4 +1,3 @@
-import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
import {
draggable,
dropTargetForElements,
@@ -6,9 +5,6 @@ import {
} from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
import { reorder } from '@atlaskit/pragmatic-drag-and-drop/reorder';
-import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge/attach-closest-edge';
-import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge/extract-closest-edge';
-import { getReorderDestinationIndex } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/get-reorder-destination-index';
import { router } from '@inertiajs/vue3';
import { trans } from 'laravel-vue-i18n';
import { nextTick, onBeforeUnmount, ref, type Directive, type Ref } from 'vue';
@@ -21,11 +17,6 @@ import {
} from '@/lib/dragPlaceholder';
import { reorder as reorderChannels } from '@/routes/app/channels';
-export interface ChannelDropIndicator {
- channelId: string;
- edge: 'top' | 'bottom';
-}
-
export interface ChannelDragPreview {
channelId: string;
index: number;
@@ -137,26 +128,22 @@ const focusHandle = (list: string, channelId: string): void => {
/**
* Drag-and-drop (by handle) and keyboard reordering for one rendered list of
* channels. `list` keeps two lists on the same page from accepting each
- * other's drops; `order` returns the ids as currently rendered. With
- * `placeholder`, the list element bound with `vSortableChannelList` is the
- * only drop target: the dragged row collapses, `dragPreview` holds the slot
- * it would land in, and dropping anywhere over the list lands it there.
+ * other's drops; `order` returns the ids as currently rendered. The list
+ * element bound with `vSortableChannelList` is the only drop target: the
+ * dragged row collapses, `dragPreview` holds the slot it would land in, and
+ * dropping anywhere over the list lands it there.
*/
export const useChannelOrder = (options: {
list: string;
order: () => string[];
- placeholder?: boolean;
}): {
vSortableChannel: Directive<HTMLElement, string | null>;
vSortableChannelList: Directive<HTMLElement, boolean>;
- move: (channelId: string, offset: -1 | 1) => void;
onHandleKeydown: (event: KeyboardEvent, channelId: string) => void;
- dropIndicator: Ref<ChannelDropIndicator | null>;
dragPreview: Ref<ChannelDragPreview | null>;
saving: Ref<boolean>;
} => {
const { list } = options;
- const dropIndicator = ref<ChannelDropIndicator | null>(null);
const dragPreview = ref<ChannelDragPreview | null>(null);
let listElement: HTMLElement | null = null;
let startIndex = -1;
@@ -235,65 +222,29 @@ export const useChannelOrder = (options: {
saveChannelOrder(next);
};
- const dropOnRow = (
- channelId: string,
- target: { data: Record<string | symbol, unknown> } | undefined,
- ): void => {
- if (!target || !isChannelItem(target.data, list)) {
- return;
- }
-
- const order = options.order();
- const start = order.indexOf(channelId);
- const targetIndex = order.indexOf(target.data.channelId);
-
- if (start === -1 || targetIndex === -1) {
- return;
- }
-
- const finishIndex = getReorderDestinationIndex({
- startIndex: start,
- indexOfTarget: targetIndex,
- closestEdgeOfTarget: extractClosestEdge(target.data),
- axis: 'vertical',
- });
-
- if (finishIndex !== start) {
- saveChannelOrder(reorder({ list: order, startIndex: start, finishIndex }));
- }
- };
-
const stopMonitor = monitorForElements({
canMonitor: ({ source }) => isChannelItem(source.data, list),
onDragStart: ({ source }) => {
- if (options.placeholder && isChannelItem(source.data, list)) {
+ if (isChannelItem(source.data, list)) {
startPreview(source.data.channelId);
}
},
onDrop: ({ source, location }) => {
- dropIndicator.value = null;
-
if (!isChannelItem(source.data, list)) {
endPreview();
return;
}
- if (options.placeholder) {
- const overList = location.current.dropTargets.some((target) =>
- isListTarget(target.data, list),
- );
+ const overList = location.current.dropTargets.some((target) =>
+ isListTarget(target.data, list),
+ );
- if (overList) {
- placeAt(location.current.input);
- }
-
- dropPreview(source.data.channelId, overList);
-
- return;
+ if (overList) {
+ placeAt(location.current.input);
}
- dropOnRow(source.data.channelId, location.current.dropTargets[0]);
+ dropPreview(source.data.channelId, overList);
},
});
@@ -306,63 +257,17 @@ export const useChannelOrder = (options: {
row: HTMLElement,
handle: HTMLElement,
channelId: string,
- ): (() => void) => {
- const drag = draggable({
+ ): (() => void) =>
+ draggable({
element: row,
dragHandle: handle,
getInitialData: () => ({ [ITEM_KEY]: list, channelId }),
- onGenerateDragPreview: ({ nativeSetDragImage }) => {
- if (options.placeholder) {
- disableNativeDragPreview({ nativeSetDragImage });
- }
- },
+ onGenerateDragPreview: ({ nativeSetDragImage }) =>
+ disableNativeDragPreview({ nativeSetDragImage }),
onDragStart: () => row.setAttribute('data-dragging', ''),
onDrop: () => row.removeAttribute('data-dragging'),
});
- if (options.placeholder) {
- return drag;
- }
-
- return combine(
- drag,
- dropTargetForElements({
- element: row,
- canDrop: ({ source }) => isChannelItem(source.data, list),
- getData: ({ input }) =>
- attachClosestEdge(
- { [ITEM_KEY]: list, channelId },
- {
- element: row,
- input,
- allowedEdges: ['top', 'bottom'],
- },
- ),
- onDrag: ({ self, source }) => {
- const edge = extractClosestEdge(self.data);
-
- dropIndicator.value =
- edge &&
- isChannelItem(source.data, list) &&
- source.data.channelId !== channelId
- ? {
- channelId,
- edge: edge === 'bottom' ? 'bottom' : 'top',
- }
- : null;
- },
- onDragLeave: () => {
- if (dropIndicator.value?.channelId === channelId) {
- dropIndicator.value = null;
- }
- },
- onDrop: () => {
- dropIndicator.value = null;
- },
- }),
- );
- };
-
const cleanups = new WeakMap<HTMLElement, () => void>();
const unbind = (row: HTMLElement): void => {
@@ -483,9 +388,7 @@ export const useChannelOrder = (options: {
return {
vSortableChannel,
vSortableChannelList,
- move,
onHandleKeydown,
- dropIndicator,
dragPreview,
saving,
};
diff --git a/resources/js/composables/useComposerAutosave.ts b/resources/js/composables/useComposerAutosave.ts
index 4bb55dc6c..3ed8b8432 100644
--- a/resources/js/composables/useComposerAutosave.ts
+++ b/resources/js/composables/useComposerAutosave.ts
@@ -1,7 +1,11 @@
-import { getCurrentScope, onScopeDispose, ref } from 'vue';
+import { computed, getCurrentScope, onScopeDispose, ref } from 'vue';
import type { ComputedRef, Ref } from 'vue';
-import type { DestinationOverride } from '@/composables/usePostComposition';
+import { mediaUploadLimits } from '@/composables/useMediaUpload';
+import type {
+ ComposerAccount,
+ DestinationOverride,
+} from '@/composables/usePostComposition';
import dayjs from '@/dayjs';
import { classify, MediaType } from '@/lib/mediaType';
import type { MediaItem, MediaSource, SourceMetaValue } from '@/types/media';
@@ -181,3 +185,38 @@ export const useComposerAutosave = (
return { saved, save, flush, clear };
};
+
+/**
+ * What the "resume your unfinished post" dialog shows of an autosaved post:
+ * its channels that still exist, its media still within the upload
+ * retention, and its first line of text.
+ */
+export const useAutosavePreview = (
+ saved: Ref<AutosaveSnapshot | null>,
+ accounts: () => ComposerAccount[],
+) => ({
+ accounts: computed(() =>
+ (saved.value?.accountIds ?? []).flatMap((id) => {
+ const account = accounts().find((candidate) => candidate.id === id);
+
+ return account ? [account] : [];
+ }),
+ ),
+ mediaCount: computed(
+ () =>
+ (saved.value?.media ?? []).filter(
+ (item) =>
+ !isExpiredUpload(
+ item,
+ mediaUploadLimits().upload_retention_hours,
+ ),
+ ).length,
+ ),
+ preview: computed(
+ () =>
+ (saved.value?.content ?? '')
+ .split('\n')
+ .map((line) => line.trim())
+ .find(Boolean) ?? '',
+ ),
+});
diff --git a/resources/js/composables/useConnectChannelDialog.ts b/resources/js/composables/useConnectChannelDialog.ts
index 567b84921..59c6a858d 100644
--- a/resources/js/composables/useConnectChannelDialog.ts
+++ b/resources/js/composables/useConnectChannelDialog.ts
@@ -15,7 +15,6 @@ export interface ConnectChannelState {
goalAccountId?: string;
detailsPlatform?: string;
canGoBack: boolean;
- parentCanGoBack?: boolean;
}
let nextId = 0;
@@ -49,7 +48,6 @@ const goTo = (step: Exclude<ConnectChannelStep, 'grid' | 'details'>): void => {
...state.value,
step,
canGoBack: true,
- parentCanGoBack: state.value.canGoBack,
};
};
@@ -66,15 +64,6 @@ const showDetails = (platform: string): void => {
const back = (): void => {
if (!state.value) return;
- if (state.value.step === 'instagram-facebook') {
- state.value = {
- ...state.value,
- step: 'instagram',
- canGoBack: state.value.parentCanGoBack ?? false,
- };
- return;
- }
-
state.value = {
...state.value,
step: 'grid',
diff --git a/resources/js/composables/useGlobalPostComposer.ts b/resources/js/composables/useGlobalPostComposer.ts
index c53347c1e..ebe8a3f1a 100644
--- a/resources/js/composables/useGlobalPostComposer.ts
+++ b/resources/js/composables/useGlobalPostComposer.ts
@@ -1,4 +1,4 @@
-import { shallowRef } from 'vue';
+import { computed, onBeforeUnmount, ref, shallowRef, watch } from 'vue';
import type { ComposerInitialDraft } from '@/composables/usePostComposition';
@@ -15,6 +15,31 @@ let nextRequestId = 0;
export const postComposerRequest = shallowRef<PostComposerRequest | null>(null);
+const openComposerDialogs = ref(0);
+
+/**
+ * Whether a post composer is on screen, however it opened: a request still
+ * loading its data, or any composer dialog (the global one, or the edit and
+ * create dialogs of the publish page).
+ */
+export const isPostComposerOpen = computed(
+ () => postComposerRequest.value !== null || openComposerDialogs.value > 0,
+);
+
+export const trackPostComposerOpen = (isOpen: () => boolean): void => {
+ let counted = false;
+
+ const sync = (open: boolean): void => {
+ if (open === counted) return;
+
+ counted = open;
+ openComposerDialogs.value += open ? 1 : -1;
+ };
+
+ watch(isOpen, sync, { immediate: true });
+ onBeforeUnmount(() => sync(false));
+};
+
export const openPostComposer = (
options: {
date?: string | null;
diff --git a/resources/js/composables/useMediaUpload.ts b/resources/js/composables/useMediaUpload.ts
index b9b85c503..9a6f0aa75 100644
--- a/resources/js/composables/useMediaUpload.ts
+++ b/resources/js/composables/useMediaUpload.ts
@@ -1,3 +1,4 @@
+import { usePage } from '@inertiajs/vue3';
import {
computed,
getCurrentScope,
@@ -9,7 +10,7 @@ import type { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
import { isHeic, uploadTypeOf } from '@/lib/mediaType';
import { storeChunked } from '@/routes/app/media';
-import type { MediaUploadLimits } from '@/types';
+import type { MediaUploadLimits, SharedData } from '@/types';
import type { MediaItem } from '@/types/media';
import { ChunkedUploadError, uploadChunked } from '@/utils/chunkedUpload';
@@ -64,6 +65,48 @@ export interface MediaUploader {
) => void;
}
+/** The upload limits the server shares, or none at all before they arrive. */
+export const mediaUploadLimits = (): MediaUploadLimits =>
+ usePage<SharedData>().props.mediaUploadLimits ?? {
+ max_bytes: { image: 0, video: 0, document: 0 },
+ extensions: { image: [], video: [], document: [] },
+ upload_retention_hours: 0,
+ heic: false,
+ };
+
+/**
+ * One uploader that shows both lists: the shared one (uploads started in the
+ * shared editor) and its own. Each upload is retried, cancelled or removed
+ * by the uploader that started it.
+ */
+export const withSharedUploads = (
+ own: MediaUploader,
+ shared: MediaUploader,
+): MediaUploader => {
+ const owner = (key: string): MediaUploader =>
+ shared.entries.value.some((entry) => entry.key === key) ||
+ shared.imports.value.some((pending) => pending.key === key)
+ ? shared
+ : own;
+
+ return {
+ ...own,
+ entries: computed(() => [
+ ...shared.entries.value,
+ ...own.entries.value,
+ ]),
+ imports: computed(() => [
+ ...shared.imports.value,
+ ...own.imports.value,
+ ]),
+ busy: computed(() => shared.busy.value || own.busy.value),
+ failed: computed(() => shared.failed.value || own.failed.value),
+ retry: (key) => owner(key).retry(key),
+ cancel: (key) => owner(key).cancel(key),
+ remove: (key) => owner(key).remove(key),
+ };
+};
+
export const MAX_CONCURRENT_UPLOADS = 3;
const RETRYABLE: readonly UploadErrorReason[] = ['network', 'server'];
diff --git a/resources/js/composables/usePostCardActions.ts b/resources/js/composables/usePostCardActions.ts
index 0d674e8de..be874deb6 100644
--- a/resources/js/composables/usePostCardActions.ts
+++ b/resources/js/composables/usePostCardActions.ts
@@ -1,4 +1,4 @@
-import { router } from '@inertiajs/vue3';
+import { router, usePage } from '@inertiajs/vue3';
import { trans, transChoice } from 'laravel-vue-i18n';
import type { InjectionKey, Ref } from 'vue';
import { toast } from 'vue-sonner';
@@ -6,6 +6,9 @@ import { toast } from 'vue-sonner';
import { duplicate as duplicatePost } from '@/actions/App/Http/Controllers/App/PostController';
import { update as updatePostLabels } from '@/actions/App/Http/Controllers/App/PostLabelController';
import { update as updatePostSchedule } from '@/actions/App/Http/Controllers/App/PostScheduleController';
+import { openPostComposer } from '@/composables/useGlobalPostComposer';
+import { copyToClipboard } from '@/lib/utils';
+import type { SidebarChannel } from '@/types/channel';
import type {
PostCard,
PostCardLabel,
@@ -75,6 +78,31 @@ export const duplicatePostCard = (post: PostCard): void => {
router.post(duplicatePost.url(post.id));
};
+/** Opens the composer with the sent post's link and every channel of the workspace. */
+export const sharePostCardLink = (post: PostCard): void => {
+ if (!post.platform_url) return;
+
+ const channels = (usePage().props.channels as SidebarChannel[] | undefined) ?? [];
+
+ openPostComposer({
+ socialAccountIds: channels.map((channel) => channel.id),
+ draft: {
+ content: post.platform_url,
+ media: [],
+ scheduled_at: null,
+ label_ids: [],
+ },
+ });
+};
+
+export const copyPostCardLink = (post: PostCard): void => {
+ if (post.platform_url) {
+ void copyToClipboard(post.platform_url, undefined, {
+ showSuccessToast: false,
+ });
+ }
+};
+
export const syncPostCardLabels = (
postId: string,
labelIds: string[],
diff --git a/resources/js/composables/usePostDetails.ts b/resources/js/composables/usePostDetails.ts
index 59645370a..467d7ea84 100644
--- a/resources/js/composables/usePostDetails.ts
+++ b/resources/js/composables/usePostDetails.ts
@@ -4,7 +4,11 @@ import { ref } from 'vue';
import { publication as showPublication } from '@/actions/App/Http/Controllers/App/InsightsController';
import { edit as editPostRoute } from '@/actions/App/Http/Controllers/App/PostController';
import { show as showPostGroup } from '@/actions/App/Http/Controllers/App/PostGroupController';
-import { duplicatePostCard } from '@/composables/usePostCardActions';
+import {
+ copyPostCardLink,
+ duplicatePostCard,
+ sharePostCardLink,
+} from '@/composables/usePostCardActions';
import type { PublicationAnalyticsDetail } from '@/types/analytics';
import type { PostCard, PostCardMenuAction } from '@/types/publish';
@@ -45,8 +49,16 @@ export const usePostDetails = () => {
};
const runPostAction = (action: PostCardMenuAction, post: PostCard): void => {
- if (action === 'duplicate') {
- duplicatePostCard(post);
+ switch (action) {
+ case 'duplicate':
+ duplicatePostCard(post);
+ break;
+ case 'share_link':
+ sharePostCardLink(post);
+ break;
+ case 'copy_link':
+ copyPostCardLink(post);
+ break;
}
};
diff --git a/resources/js/composables/useSettingsNavigation.ts b/resources/js/composables/useSettingsNavigation.ts
index ddb992866..2f0b3922b 100644
--- a/resources/js/composables/useSettingsNavigation.ts
+++ b/resources/js/composables/useSettingsNavigation.ts
@@ -5,7 +5,6 @@ import {
IconCoin,
IconCode,
IconSignature,
- IconFingerprint,
IconPlug,
IconBuilding,
IconAdjustmentsHorizontal,
@@ -20,7 +19,6 @@ import { computed } from 'vue';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import { members } from '@/routes/app';
import { index as apiKeys } from '@/routes/app/api-keys';
-import { edit as authenticationEdit } from '@/routes/app/authentication';
import { index as billing } from '@/routes/app/billing';
import { index as labels } from '@/routes/app/labels';
import { index as mcp } from '@/routes/app/mcp';
@@ -89,12 +87,6 @@ export const useSettingsNavigation = () => {
IconAdjustmentsHorizontal,
true,
),
- ...item(
- 'authentication',
- authenticationEdit.url(),
- IconFingerprint,
- true,
- ),
...item(
'notifications',
notificationPreferences.url(),
diff --git a/resources/js/lib/inAppHistory.ts b/resources/js/lib/inAppHistory.ts
new file mode 100644
index 000000000..89158b0b6
--- /dev/null
+++ b/resources/js/lib/inAppHistory.ts
@@ -0,0 +1,82 @@
+import { router } from '@inertiajs/vue3';
+
+let pushedUrl: string | null = null;
+
+/**
+ * Remembers the URL of the last page the app pushed onto the browser history
+ * with a full visit (a link or `router.visit`: no replace, no partial reload,
+ * no prefetch). Back and forward make no visit, and a reload starts empty.
+ */
+export const trackInAppPushes = (): void => {
+ router.on('finish', (event) => {
+ const visit = event.detail.visit;
+
+ if (
+ visit.method === 'get' &&
+ visit.completed &&
+ !visit.replace &&
+ !visit.prefetch &&
+ visit.only.length === 0 &&
+ visit.except.length === 0
+ ) {
+ pushedUrl = window.location.href;
+ }
+ });
+};
+
+/**
+ * Whether the app pushed the current history entry, so the entry behind it is
+ * another page of the app the user can be sent back to. A partial reload may
+ * add query parameters to the entry afterwards (`queue_days`), so the entry
+ * still counts while its path and every parameter it was pushed with match.
+ */
+export const cameFromAppPage = (): boolean => {
+ if (pushedUrl === null) {
+ return false;
+ }
+
+ const pushed = new URL(pushedUrl);
+ const current = new URL(window.location.href);
+
+ return (
+ pushed.origin === current.origin &&
+ pushed.pathname === current.pathname &&
+ [...pushed.searchParams].every(
+ ([key, value]) => current.searchParams.get(key) === value,
+ )
+ );
+};
+
+let settling: Promise<void> | null = null;
+
+/**
+ * Goes back one history entry and remembers it until the browser lands, so
+ * `afterHistorySettles` can wait for it.
+ */
+export const stepBackInHistory = (): void => {
+ settling = new Promise((resolve) => {
+ window.addEventListener(
+ 'popstate',
+ () => {
+ settling = null;
+ resolve();
+ },
+ { once: true },
+ );
+ });
+ window.history.back();
+};
+
+/**
+ * Runs `then` once a step taken through `stepBackInHistory` has landed, or
+ * right away when none is under way.
+ */
+export const afterHistorySettles = (then: () => void): void => {
+ if (settling) {
+ void settling.then(then);
+
+ return;
+ }
+
+ then();
+};
diff --git a/resources/js/lib/instagram.ts b/resources/js/lib/instagram.ts
new file mode 100644
index 000000000..2c1b0bd92
--- /dev/null
+++ b/resources/js/lib/instagram.ts
@@ -0,0 +1,3 @@
+/** The public profile page of an Instagram username. */
+export const instagramProfileUrl = (username: string): string =>
+ `https://www.instagram.com/${encodeURIComponent(username)}/`;
diff --git a/resources/js/lib/mediaType.ts b/resources/js/lib/mediaType.ts
index ae9b098e0..2c707708f 100644
--- a/resources/js/lib/mediaType.ts
+++ b/resources/js/lib/mediaType.ts
@@ -144,3 +144,6 @@ export const uploadTypeOf = (
return MEDIA_TYPES.find((type) => hasExtension(path, extensions[type])) ?? null;
};
+
+/** What identifies a media item in a list: its upload token until it is hosted, then its id. */
+export const mediaKey = (item: { upload_token?: string | null; id: string }): string => item.upload_token ?? item.id;
diff --git a/resources/js/lib/search.ts b/resources/js/lib/search.ts
new file mode 100644
index 000000000..4843a73e7
--- /dev/null
+++ b/resources/js/lib/search.ts
@@ -0,0 +1,36 @@
+type SearchField = string | null | undefined;
+
+/**
+ * Text as a search compares it: without accents and in lowercase. Only the
+ * combining marks NFD splits off are removed, so "São" becomes "sao" while a
+ * typed "^" or "`" stays as it is.
+ */
+const normalize = (text: string): string =>
+ text.normalize('NFD').replace(/\p{M}/gu, '').toLocaleLowerCase();
+
+/**
+ * Whether every word typed appears in one of the fields, ignoring case and
+ * accents: "sao paulo" finds "São Paulo", and "paulo instagram" finds Paulo's
+ * Instagram account. An empty search matches everything.
+ */
+export const matchesSearch = (
+ query: string | null | undefined,
+ fields: readonly SearchField[],
+): boolean => {
+ const words = normalize(query ?? '').split(/\s+/).filter(Boolean);
+
+ if (words.length === 0) return true;
+
+ const values = fields
+ .filter((field): field is string => Boolean(field))
+ .map(normalize);
+
+ return words.every((word) => values.some((value) => value.includes(word)));
+};
+
+/** The items whose fields match the search (see `matchesSearch`). */
+export const filterBySearch = <T>(
+ items: readonly T[],
+ query: string | null | undefined,
+ fieldsOf: (item: T) => readonly SearchField[],
+): T[] => items.filter((item) => matchesSearch(query, fieldsOf(item)));
diff --git a/resources/js/lib/userAgent.ts b/resources/js/lib/userAgent.ts
index 3243f248c..b2b28a166 100644
--- a/resources/js/lib/userAgent.ts
+++ b/resources/js/lib/userAgent.ts
@@ -42,10 +42,34 @@ export const parseBrowserName = (userAgent: string | null): string => {
return 'DuckDuckGo';
}
+ if (userAgent.includes('HuaweiBrowser/')) {
+ return 'Huawei Browser';
+ }
+
+ if (userAgent.includes('VivoBrowser/')) {
+ return 'Vivo Browser';
+ }
+
+ if (userAgent.includes('QQBrowser/')) {
+ return 'QQ Browser';
+ }
+
+ if (userAgent.includes('Ecosia')) {
+ return 'Ecosia';
+ }
+
+ if (userAgent.startsWith('curl/')) {
+ return 'curl';
+ }
+
if (userAgent.includes('FxiOS/') || userAgent.includes('Firefox/')) {
return 'Firefox';
}
+ if (userAgent.includes('Chromium/')) {
+ return 'Chromium';
+ }
+
if (userAgent.includes('CriOS/') || userAgent.includes('Chrome/')) {
return 'Chrome';
}
@@ -66,7 +90,31 @@ export const parseOsName = (userAgent: string | null): string | null => {
return null;
}
- if (/iPhone|iPad|iPod/.test(userAgent)) {
+ if (/PlayStation/.test(userAgent)) {
+ return 'PlayStation';
+ }
+
+ if (/KAIOS/i.test(userAgent)) {
+ return 'KaiOS';
+ }
+
+ if (/Tizen/.test(userAgent)) {
+ return 'Tizen';
+ }
+
+ if (/HarmonyOS|OpenHarmony/.test(userAgent)) {
+ return 'HarmonyOS';
+ }
+
+ if (/Silk\/|Kindle|KF[A-Z]{2,4}\b/.test(userAgent)) {
+ return 'Fire OS';
+ }
+
+ if (/iPad/.test(userAgent)) {
+ return 'iPadOS';
+ }
+
+ if (/iPhone|iPod/.test(userAgent)) {
return 'iOS';
}
@@ -94,6 +142,14 @@ export const parseOsName = (userAgent: string | null): string | null => {
return 'BSD';
}
+ if (/Ubuntu/.test(userAgent)) {
+ return 'Ubuntu';
+ }
+
+ if (/Fedora/.test(userAgent)) {
+ return 'Fedora';
+ }
+
if (/Linux/.test(userAgent)) {
return 'Linux';
}
@@ -101,12 +157,57 @@ export const parseOsName = (userAgent: string | null): string | null => {
return null;
};
-export const isMobileDevice = (userAgent: string | null): boolean => {
- if (!userAgent) {
- return false;
- }
+const BROWSER_ICONS: Record<string, string> = {
+ Chrome: 'chrome.svg',
+ Chromium: 'chromium.svg',
+ curl: 'curl.svg',
+ DuckDuckGo: 'duckduckgo.svg',
+ Ecosia: 'ecosia.png',
+ Edge: 'edge.svg',
+ Firefox: 'firefox.svg',
+ 'Huawei Browser': 'huawei.png',
+ Opera: 'opera.svg',
+ 'QQ Browser': 'qq.png',
+ Safari: 'safari.png',
+ 'Samsung Internet': 'samsung-internet.svg',
+ 'UC Browser': 'uc.svg',
+ Vivaldi: 'vivaldi.svg',
+ 'Vivo Browser': 'vivo.png',
+ Yandex: 'yandex.png',
+};
- return /Mobile|Android|iPhone|iPad|iPod|Windows Phone|BlackBerry|BB10|webOS|Opera Mini|IEMobile/i.test(
- userAgent,
- );
+const OS_ICONS: Record<string, string> = {
+ Android: 'android.png',
+ BSD: 'freebsd.png',
+ ChromeOS: 'chrome_os.png',
+ Fedora: 'fedora.png',
+ 'Fire OS': 'fire_os.png',
+ HarmonyOS: 'harmony_os.png',
+ iOS: 'ios.png',
+ iPadOS: 'ipad_os.png',
+ KaiOS: 'kai_os.png',
+ Linux: 'gnu_linux.png',
+ macOS: 'mac.png',
+ PlayStation: 'playstation.png',
+ Tizen: 'tizen.png',
+ Ubuntu: 'ubuntu.png',
+ Windows: 'windows.png',
+ 'Windows Phone': 'windows.png',
};
+
+export const browserIconUrl = (userAgent: string | null): string =>
+ `/images/browsers/${BROWSER_ICONS[parseBrowserName(userAgent)] ?? 'fallback.svg'}`;
+
+const MONOCHROME_OS = new Set(['macOS', 'iPadOS', 'PlayStation']);
+
+export const osIconUrl = (userAgent: string | null): string => {
+ const os = parseOsName(userAgent);
+
+ return `/images/os/${(os && OS_ICONS[os]) || 'fallback.svg'}`;
+};
+
+/**
+ * Black, single-colour logos that would vanish on the dark theme.
+ */
+export const isMonochromeOsIcon = (userAgent: string | null): boolean =>
+ MONOCHROME_OS.has(parseOsName(userAgent) ?? '');
diff --git a/resources/js/pages/accounts/ConnectFinish.vue b/resources/js/pages/accounts/ConnectFinish.vue
index 3badf793f..034fd5e20 100644
--- a/resources/js/pages/accounts/ConnectFinish.vue
+++ b/resources/js/pages/accounts/ConnectFinish.vue
@@ -470,6 +470,7 @@ const identityCardClass = (identity: ConnectIdentity): string =>
v-else-if="isSelecting"
size="lg"
:disabled="selectedCount === 0 || form.processing"
+ :loading="form.processing"
data-testid="connect-finish"
@click="finishConnection"
>
diff --git a/resources/js/pages/publish/Index.vue b/resources/js/pages/publish/Index.vue
index 8784cbbcb..cdf0d0930 100644
--- a/resources/js/pages/publish/Index.vue
+++ b/resources/js/pages/publish/Index.vue
@@ -13,7 +13,7 @@ import {
IconUsers,
} from '@tabler/icons-vue';
import { trans, transChoice } from 'laravel-vue-i18n';
-import { computed, provide, ref, shallowRef, watch } from 'vue';
+import { computed, nextTick, provide, ref, shallowRef, watch } from 'vue';
import { toast } from 'vue-sonner';
import {
@@ -67,6 +67,7 @@ import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import date from '@/date';
import dayjs from '@/dayjs';
import AppLayout from '@/layouts/AppLayout.vue';
+import { afterHistorySettles, cameFromAppPage } from '@/lib/inAppHistory';
import { calendar } from '@/routes/app';
import {
calendar as channelCalendar,
@@ -748,20 +749,56 @@ const onComposerOpenChange = (open: boolean): void => {
if (open) return;
composerOpen.value = false;
+
+ if (cameFromAppPage()) {
+ window.history.back();
+
+ return;
+ }
+
router.visit(listUrl(), { replace: true, preserveScroll: true });
};
-const submitComposition = (composition: PostComposition): void => {
+/**
+ * After a save, steps back to the page the composer was opened from, so the
+ * edit leaves no history entry behind, and refreshes that page's posts.
+ */
+const returnToOpeningPage = (): void => {
+ void nextTick(() =>
+ afterHistorySettles(() => {
+ const stop = router.on('navigate', () => {
+ stop();
+ router.reload();
+ });
+ window.history.back();
+ }),
+ );
+};
+
+const submitComposition = (
+ composition: PostComposition,
+ _createAnother?: boolean,
+ onSaved?: () => void,
+): void => {
const editPost = props.editPost;
if (!editPost) return;
+ const returnsBack = cameFromAppPage();
+ let saved = false;
composerSubmitting.value = true;
const options = {
preserveScroll: true,
+ replace: true,
onSuccess: () => {
+ saved = true;
composerOpen.value = false;
+ onSaved?.();
},
onFinish: () => {
composerSubmitting.value = false;
+
+ if (saved && returnsBack) {
+ returnToOpeningPage();
+ }
},
};
if (!initialPost.value) {
@@ -803,7 +840,10 @@ const submitComposition = (composition: PostComposition): void => {
onSuccess: () => {
options.onSuccess();
- if (new URLSearchParams(window.location.search).has('edit')) {
+ if (
+ !returnsBack &&
+ new URLSearchParams(window.location.search).has('edit')
+ ) {
router.visit(listUrl(), {
replace: true,
preserveScroll: true,
@@ -861,7 +901,7 @@ const submitComposition = (composition: PostComposition): void => {
/>
</template>
</PublishFilterMenu>
- <AppHeaderActions>
+ <AppHeaderActions :on-phones="!channel">
<div class="flex items-center gap-2">
<ScheduleViewSwitch
active-view="list"
diff --git a/resources/js/pages/settings/profile/Authentication.vue b/resources/js/pages/settings/profile/Authentication.vue
deleted file mode 100644
index d32450ee1..000000000
--- a/resources/js/pages/settings/profile/Authentication.vue
+++ /dev/null
@@ -1,408 +0,0 @@
-<script setup lang="ts">
-import { Form, Head, usePage } from '@inertiajs/vue3';
-import { IconDeviceDesktop, IconDeviceMobile } from '@tabler/icons-vue';
-import { ref } from 'vue';
-
-import AuthenticationController from '@/actions/App/Http/Controllers/App/Settings/AuthenticationController';
-import DeleteUser from '@/components/DeleteUser.vue';
-import InputError from '@/components/InputError.vue';
-import SettingsField from '@/components/settings/SettingsField.vue';
-import SettingsListRow from '@/components/settings/SettingsListRow.vue';
-import SettingsSection from '@/components/settings/SettingsSection.vue';
-import { Badge } from '@/components/ui/badge';
-import { Button } from '@/components/ui/button';
-import {
- Dialog,
- DialogClose,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
- DialogTrigger,
-} from '@/components/ui/dialog';
-import { Input } from '@/components/ui/input';
-import { Label } from '@/components/ui/label';
-import { Separator } from '@/components/ui/separator';
-import SettingsLayout from '@/layouts/SettingsLayout.vue';
-import { isMobileDevice, parseBrowserName, parseOsName } from '@/lib/userAgent';
-import { connectProvider } from '@/routes/app/authentication';
-
-type Session = {
- id: string;
- ip_address: string | null;
- user_agent: string | null;
- last_active: string;
- is_current: boolean;
-};
-
-type SocialProvider = 'google' | 'github';
-
-type ConnectedAccount = {
- provider: SocialProvider;
- label: string;
- connected: boolean;
- can_disconnect: boolean;
-};
-
-defineProps<{
- sessions: Session[];
- hasPassword: boolean;
- connectedAccounts: ConnectedAccount[];
-}>();
-
-const logoutDialogOpen = ref(false);
-
-const closeLogoutDialog = (): void => {
- logoutDialogOpen.value = false;
-};
-
-const page = usePage();
-const providerEnabled = (provider: SocialProvider): boolean =>
- Boolean(
- page.props[
- provider === 'google' ? 'googleAuthEnabled' : 'githubAuthEnabled'
- ],
- );
-</script>
-
-<template>
- <Head :title="$t('settings.authentication.page_title')" />
-
- <SettingsLayout :title="$t('settings.authentication.page_title')">
- <div class="flex flex-col gap-10">
- <SettingsSection
- :title="$t('settings.authentication.sessions.title')"
- :description="$t('settings.authentication.sessions.description')"
- >
- <ul class="flex flex-col gap-2">
- <SettingsListRow
- v-for="session in sessions"
- :key="session.id"
- :icon="
- isMobileDevice(session.user_agent)
- ? IconDeviceMobile
- : IconDeviceDesktop
- "
- data-test="session-row"
- >
- <p
- class="truncate text-sm leading-tight font-emphasis text-foreground"
- >
- {{ parseBrowserName(session.user_agent) }}
- <span
- v-if="parseOsName(session.user_agent)"
- class="font-normal text-muted-foreground"
- >
- {{ $t('settings.authentication.sessions.on') }}
- {{ parseOsName(session.user_agent) }}
- </span>
- </p>
- <p
- class="flex flex-wrap items-center gap-x-1.5 text-sm text-muted-foreground"
- >
- <span>{{
- session.ip_address ??
- $t('settings.authentication.sessions.unknown_ip')
- }}</span>
- <template v-if="!session.is_current">
- <span aria-hidden="true">·</span>
- <span>{{ session.last_active }}</span>
- </template>
- </p>
- <template #actions>
- <Badge
- v-if="session.is_current"
- variant="success"
- class="shrink-0"
- >
- {{ $t('settings.authentication.sessions.active_now') }}
- </Badge>
- </template>
- </SettingsListRow>
- </ul>
-
- <Dialog v-model:open="logoutDialogOpen">
- <DialogTrigger as-child>
- <Button
- variant="outline"
- class="self-start"
- data-test="log-out-other-sessions-button"
- :disabled="sessions.length <= 1"
- >
- {{
- $t(
- 'settings.authentication.sessions.log_out_others',
- )
- }}
- </Button>
- </DialogTrigger>
- <DialogContent>
- <Form
- v-bind="
- AuthenticationController.destroyOtherSessions.form()
- "
- :options="{ preserveScroll: true }"
- reset-on-success
- @success="closeLogoutDialog"
- class="flex flex-col gap-6"
- v-slot="{ errors, processing }"
- >
- <DialogHeader>
- <DialogTitle>{{
- $t(
- 'settings.authentication.sessions.modal_title',
- )
- }}</DialogTitle>
- <DialogDescription>
- {{
- hasPassword
- ? $t(
- 'settings.authentication.sessions.modal_description_password',
- )
- : $t(
- 'settings.authentication.sessions.modal_description_email',
- )
- }}
- </DialogDescription>
- </DialogHeader>
-
- <div v-if="hasPassword" class="flex flex-col gap-2">
- <Label for="session_password" class="sr-only">
- {{
- $t(
- 'settings.authentication.password.current_password',
- )
- }}
- </Label>
- <Input
- id="session_password"
- type="password"
- name="password"
- :placeholder="
- $t(
- 'settings.authentication.sessions.password_placeholder',
- )
- "
- />
- <InputError :message="errors.password" />
- </div>
-
- <div v-else class="flex flex-col gap-2">
- <Label
- for="session_email_confirmation"
- class="sr-only"
- >
- {{ $t('settings.profile.email') }}
- </Label>
- <Input
- id="session_email_confirmation"
- type="email"
- name="email_confirmation"
- :placeholder="
- $t(
- 'settings.authentication.sessions.email_placeholder',
- )
- "
- autocomplete="off"
- />
- <InputError
- :message="errors.email_confirmation"
- />
- </div>
-
- <DialogFooter>
- <DialogClose as-child>
- <Button variant="ghost">
- {{
- $t(
- 'settings.authentication.sessions.cancel',
- )
- }}
- </Button>
- </DialogClose>
- <Button type="submit" :disabled="processing">
- {{
- $t(
- 'settings.authentication.sessions.submit',
- )
- }}
- </Button>
- </DialogFooter>
- </Form>
- </DialogContent>
- </Dialog>
- </SettingsSection>
-
- <Separator />
-
- <SettingsSection
- :title="
- hasPassword
- ? $t('settings.authentication.password.update_title')
- : $t('settings.authentication.password.set_title')
- "
- :description="
- hasPassword
- ? $t('settings.authentication.password.update_description')
- : $t('settings.authentication.password.set_description')
- "
- >
- <Form
- v-bind="AuthenticationController.updatePassword.form()"
- :options="{ preserveScroll: true }"
- reset-on-success
- :reset-on-error="[
- 'password',
- 'password_confirmation',
- 'current_password',
- ]"
- class="flex flex-col gap-6"
- v-slot="{ errors, processing }"
- >
- <SettingsField
- v-if="hasPassword"
- :label="
- $t('settings.authentication.password.current_password')
- "
- for="current_password"
- :error="errors.current_password"
- >
- <Input
- id="current_password"
- name="current_password"
- type="password"
- autocomplete="current-password"
- />
- </SettingsField>
-
- <SettingsField
- :label="$t('settings.authentication.password.new_password')"
- for="password"
- :error="errors.password"
- >
- <Input
- id="password"
- name="password"
- type="password"
- autocomplete="new-password"
- />
- </SettingsField>
-
- <SettingsField
- :label="
- $t('settings.authentication.password.confirm_password')
- "
- for="password_confirmation"
- :error="errors.password_confirmation"
- >
- <Input
- id="password_confirmation"
- name="password_confirmation"
- type="password"
- autocomplete="new-password"
- />
- </SettingsField>
-
- <Button
- :disabled="processing"
- class="self-start"
- data-test="update-password-button"
- >
- {{
- hasPassword
- ? $t('settings.authentication.password.save')
- : $t('settings.authentication.password.set')
- }}
- </Button>
- </Form>
- </SettingsSection>
-
- <Separator />
-
- <SettingsSection
- :title="$t('settings.authentication.providers.title')"
- :description="$t('settings.authentication.providers.description')"
- >
- <ul class="flex flex-col gap-2">
- <SettingsListRow
- v-for="account in connectedAccounts"
- :key="account.provider"
- :data-test="`connected-account-${account.provider}`"
- >
- <template #media>
- <span
- class="inline-flex size-10 shrink-0 items-center justify-center rounded-lg border border-border bg-card"
- >
- <img
- :src="`/images/social/${account.provider}.svg`"
- :alt="account.label"
- class="size-5"
- />
- </span>
- </template>
- <p
- class="truncate text-sm leading-tight font-emphasis text-foreground"
- >
- {{ account.label }}
- </p>
- <p class="text-sm text-muted-foreground">
- {{
- account.connected
- ? $t(
- 'settings.authentication.providers.connected',
- )
- : $t(
- 'settings.authentication.providers.not_connected',
- )
- }}
- </p>
- <template #actions>
- <Form
- v-if="account.connected && account.can_disconnect"
- v-bind="
- AuthenticationController.disconnectProvider.form(
- account.provider,
- )
- "
- :options="{ preserveScroll: true }"
- #default="{ processing }"
- >
- <Button
- type="submit"
- variant="outline"
- :disabled="processing"
- :data-test="`disconnect-${account.provider}`"
- >
- {{
- $t(
- 'settings.authentication.providers.disconnect',
- )
- }}
- </Button>
- </Form>
- <Button
- v-else-if="
- !account.connected &&
- providerEnabled(account.provider)
- "
- variant="outline"
- as="a"
- :href="connectProvider(account.provider).url"
- :data-test="`connect-${account.provider}`"
- >
- {{
- $t('settings.authentication.providers.connect')
- }}
- </Button>
- </template>
- </SettingsListRow>
- </ul>
- </SettingsSection>
-
- <Separator />
-
- <DeleteUser :has-password="hasPassword" />
- </div>
- </SettingsLayout>
-</template>
diff --git a/resources/js/pages/settings/profile/Profile.vue b/resources/js/pages/settings/profile/Profile.vue
index ae3feea5b..af3e38ec9 100644
--- a/resources/js/pages/settings/profile/Profile.vue
+++ b/resources/js/pages/settings/profile/Profile.vue
@@ -1,120 +1,181 @@
<script setup lang="ts">
-import { Form, Head, Link, usePage } from '@inertiajs/vue3';
-import { computed } from 'vue';
+import { Form, Head, Link, router, usePage } from '@inertiajs/vue3';
+import { computed, ref } from 'vue';
import ProfileController from '@/actions/App/Http/Controllers/App/Settings/ProfileController';
+import type { PasswordRequirement } from '@/components/auth/PasswordRequirements.vue';
+import DeleteUser from '@/components/DeleteUser.vue';
import PhotoUpload from '@/components/PhotoUpload.vue';
+import ProfileLoginSettings from '@/components/settings/profile/ProfileLoginSettings.vue';
+import type { ConnectedAccount } from '@/components/settings/profile/ProfileLoginSettings.vue';
+import ProfileSessions from '@/components/settings/profile/ProfileSessions.vue';
+import type { Session } from '@/components/settings/profile/ProfileSessions.vue';
import SettingsField from '@/components/settings/SettingsField.vue';
import SettingsSection from '@/components/settings/SettingsSection.vue';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Separator } from '@/components/ui/separator';
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import SettingsLayout from '@/layouts/SettingsLayout.vue';
-import { deletePhoto, uploadPhoto } from '@/routes/app/profile';
+import { deletePhoto, edit, uploadPhoto } from '@/routes/app/profile';
import { send } from '@/routes/verification';
+type ProfileTab = 'profile' | 'login' | 'sessions';
+
+const PROFILE_TABS: ProfileTab[] = ['profile', 'login', 'sessions'];
+
interface Props {
mustVerifyEmail: boolean;
- status?: string;
+ hasPassword: boolean;
+ passwordRequirements: PasswordRequirement[];
+ connectedAccounts: ConnectedAccount[];
+ sessions: Session[];
}
defineProps<Props>();
const page = usePage();
const user = computed(() => page.props.auth.user);
+
+const profileTab = (value: unknown): ProfileTab =>
+ PROFILE_TABS.find((tab) => tab === value) ?? 'profile';
+
+const tab = ref<ProfileTab>(
+ profileTab(
+ new URL(page.url, window.location.origin).searchParams.get('tab'),
+ ),
+);
+
+const selectTab = (value: string | number): void => {
+ tab.value = profileTab(value);
+
+ router.replace({
+ url: edit({
+ query: tab.value === 'profile' ? {} : { tab: tab.value },
+ }).url,
+ preserveScroll: true,
+ preserveState: true,
+ });
+};
</script>
<template>
<Head :title="$t('settings.profile.title')" />
<SettingsLayout :title="$t('settings.profile.title')">
- <div class="flex flex-col gap-10">
- <SettingsSection
- :title="$t('settings.profile.photo_heading')"
- :description="$t('settings.profile.photo_description')"
- >
- <PhotoUpload
- :photo-url="user.photo_url"
- :has-photo="user.has_photo"
- :name="user.name"
- :upload-url="uploadPhoto().url"
- :delete-url="deletePhoto().url"
- size="sm"
- />
- </SettingsSection>
-
- <Separator />
-
- <SettingsSection
- :title="$t('settings.profile.heading')"
- :description="$t('settings.profile.description')"
- >
- <Form
- v-bind="ProfileController.update.form()"
- class="flex flex-col gap-6"
- v-slot="{ errors, processing }"
+ <Tabs
+ :model-value="tab"
+ class="flex flex-col gap-8"
+ @update:model-value="selectTab"
+ >
+ <TabsList variant="line">
+ <TabsTrigger
+ v-for="value in PROFILE_TABS"
+ :key="value"
+ :value="value"
+ :data-testid="`profile-tab-${value}`"
>
- <SettingsField
- :label="$t('settings.profile.name')"
- for="name"
- :error="errors.name"
- >
- <Input
- id="name"
- name="name"
- :default-value="user.name"
- autocomplete="name"
- :placeholder="$t('settings.profile.name_placeholder')"
- />
- </SettingsField>
-
- <SettingsField
- :label="$t('settings.profile.email')"
- for="email"
- :error="errors.email"
- >
- <Input
- id="email"
- type="email"
- name="email"
- :default-value="user.email"
- autocomplete="username"
- :placeholder="$t('settings.profile.email_placeholder')"
- />
- </SettingsField>
-
- <div
- v-if="mustVerifyEmail && !user.email_verified_at"
- class="-mt-4 flex flex-col gap-2"
+ {{ $t(`settings.profile.tabs.${value}`) }}
+ </TabsTrigger>
+ </TabsList>
+
+ <TabsContent value="profile" class="flex flex-col gap-10">
+ <SettingsSection
+ :title="$t('settings.profile.photo_heading')"
+ :description="$t('settings.profile.photo_description')"
+ >
+ <PhotoUpload
+ :photo-url="user.photo_url"
+ :has-photo="user.has_photo"
+ :name="user.name"
+ :upload-url="uploadPhoto().url"
+ :delete-url="deletePhoto().url"
+ size="sm"
+ />
+ </SettingsSection>
+
+ <Separator />
+
+ <SettingsSection
+ :title="$t('settings.profile.heading')"
+ :description="$t('settings.profile.description')"
+ >
+ <Form
+ v-bind="ProfileController.update.form()"
+ class="flex flex-col gap-6"
+ v-slot="{ errors, processing }"
>
- <p class="text-sm text-muted-foreground">
- {{ $t('settings.profile.email_unverified') }}
- <Link
- :href="send()"
- as="button"
- class="cursor-pointer text-primary-text underline underline-offset-4 transition-control hover:text-primary-text-hover"
- >
- {{ $t('settings.profile.resend_verification') }}
- </Link>
- </p>
-
- <p
- v-if="status === 'verification-link-sent'"
- class="text-sm font-medium text-success-text"
+ <SettingsField
+ :label="$t('settings.profile.name')"
+ for="name"
+ :error="errors.name"
>
- {{ $t('settings.profile.verification_sent') }}
- </p>
- </div>
-
- <Button
- :disabled="processing"
- class="self-start"
- data-test="update-profile-button"
- >
- {{ $t('settings.profile.save') }}
- </Button>
- </Form>
- </SettingsSection>
- </div>
+ <Input
+ id="name"
+ name="name"
+ :default-value="user.name"
+ autocomplete="name"
+ :placeholder="$t('settings.profile.name_placeholder')"
+ />
+ </SettingsField>
+
+ <SettingsField
+ :label="$t('settings.profile.email')"
+ for="email"
+ :error="errors.email"
+ >
+ <Input
+ id="email"
+ type="email"
+ name="email"
+ :default-value="user.email"
+ autocomplete="username"
+ :placeholder="$t('settings.profile.email_placeholder')"
+ />
+ </SettingsField>
+
+ <div
+ v-if="mustVerifyEmail && !user.email_verified_at"
+ class="-mt-4 flex flex-col gap-2"
+ >
+ <p class="text-sm text-muted-foreground">
+ {{ $t('settings.profile.email_unverified') }}
+ <Link
+ :href="send()"
+ as="button"
+ class="cursor-pointer text-primary-text underline underline-offset-4 transition-control hover:text-primary-text-hover"
+ >
+ {{ $t('settings.profile.resend_verification') }}
+ </Link>
+ </p>
+ </div>
+
+ <Button
+ :disabled="processing"
+ class="self-start"
+ data-test="update-profile-button"
+ >
+ {{ $t('settings.profile.save') }}
+ </Button>
+ </Form>
+ </SettingsSection>
+
+ <Separator />
+
+ <DeleteUser :has-password="hasPassword" />
+ </TabsContent>
+
+ <TabsContent value="login">
+ <ProfileLoginSettings
+ :has-password="hasPassword"
+ :password-requirements="passwordRequirements"
+ :connected-accounts="connectedAccounts"
+ />
+ </TabsContent>
+
+ <TabsContent value="sessions">
+ <ProfileSessions :sessions="sessions" />
+ </TabsContent>
+ </Tabs>
</SettingsLayout>
</template>
diff --git a/resources/js/pages/settings/workspace/Channels.vue b/resources/js/pages/settings/workspace/Channels.vue
index 2eee174bf..1fa5a3789 100644
--- a/resources/js/pages/settings/workspace/Channels.vue
+++ b/resources/js/pages/settings/workspace/Channels.vue
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { Head, usePage } from '@inertiajs/vue3';
-import { IconGripVertical, IconPlus } from '@tabler/icons-vue';
+import { IconPlus } from '@tabler/icons-vue';
import { computed, ref } from 'vue';
import ChannelListItem from '@/components/channels/ChannelListItem.vue';
@@ -8,10 +8,11 @@ import ChannelsEmptyIllustration from '@/components/channels/ChannelsEmptyIllust
import DisconnectChannelDialog from '@/components/channels/DisconnectChannelDialog.vue';
import EmptyState from '@/components/EmptyState.vue';
import { Button } from '@/components/ui/button';
-import { orderChannels, useChannelOrder } from '@/composables/useChannelOrder';
+import { orderChannels } from '@/composables/useChannelOrder';
import { useConnectChannelDialog } from '@/composables/useConnectChannelDialog';
import { useNetworkConnect } from '@/composables/useNetworkConnect';
import SettingsLayout from '@/layouts/SettingsLayout.vue';
+import { Platform } from '@/types/platform';
import type {
AvailablePlatform,
ConnectedAccount,
@@ -24,19 +25,20 @@ const props = defineProps<{
const channels = computed<ConnectedAccount[]>(() =>
orderChannels(props.connectedChannels),
);
-const reorderable = computed(() => channels.value.length > 1);
-const { vSortableChannel, move, onHandleKeydown, dropIndicator } =
- useChannelOrder({
- list: 'settings',
- order: () => channels.value.map((channel) => channel.id),
- });
const page = usePage();
const platforms = computed<AvailablePlatform[]>(
() => (page.props.connectablePlatforms as AvailablePlatform[]) ?? [],
);
-const { open: openConnectDialog } = useConnectChannelDialog();
-const { startConnect } = useNetworkConnect(platforms);
+const { open: openConnectDialog, openAt } = useConnectChannelDialog();
+const { startConnect, instagramMethods } = useNetworkConnect(platforms);
+
+const canLinkFacebook = (channel: ConnectedAccount): boolean =>
+ channel.platform === Platform.Instagram &&
+ instagramMethods.value.includes(Platform.InstagramFacebook);
+
+const linkFacebook = (channel: ConnectedAccount): void =>
+ openAt(Platform.InstagramFacebook, channel.id);
const disconnectDialog = ref<InstanceType<
typeof DisconnectChannelDialog
@@ -66,40 +68,17 @@ const disconnectChannel = (channel: ConnectedAccount): void =>
<ul v-if="channels.length > 0" class="flex flex-col gap-3">
<li
- v-for="(channel, index) in channels"
+ v-for="channel in channels"
:key="channel.id"
- v-sortable-channel="reorderable ? channel.id : null"
- class="relative transition-opacity duration-150 data-dragging:opacity-40"
:data-testid="`channel-list-row-${channel.id}`"
>
- <div
- v-if="dropIndicator?.channelId === channel.id"
- class="pointer-events-none absolute inset-x-0 h-0.5 rounded-full bg-primary-strong"
- :class="dropIndicator.edge === 'top' ? '-top-[7px]' : '-bottom-[7px]'"
- :data-testid="`channel-drop-indicator-${channel.id}`"
- />
<ChannelListItem
:channel="channel"
- :can-move-up="reorderable && index > 0"
- :can-move-down="reorderable && index < channels.length - 1"
+ :can-link-facebook="canLinkFacebook(channel)"
@reconnect="reconnectChannel"
+ @link-facebook="linkFacebook"
@disconnect="disconnectChannel"
- @move="(moved, offset) => move(moved.id, offset)"
- >
- <template v-if="reorderable" #handle>
- <button
- type="button"
- class="-ms-2 flex h-8 w-5 shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground outline-hidden hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring active:cursor-grabbing"
- :aria-label="$t('channels.reorder.handle', { name: channel.display_name || channel.username })"
- :title="$t('channels.reorder.handle', { name: channel.display_name || channel.username })"
- :data-channel-handle="`settings:${channel.id}`"
- :data-testid="`channel-handle-${channel.id}`"
- @keydown="onHandleKeydown($event, channel.id)"
- >
- <IconGripVertical class="size-4" />
- </button>
- </template>
- </ChannelListItem>
+ />
</li>
</ul>
diff --git a/resources/js/pages/welcome/Mcp.vue b/resources/js/pages/welcome/Mcp.vue
index 6a18b92cc..840b0dfc2 100644
--- a/resources/js/pages/welcome/Mcp.vue
+++ b/resources/js/pages/welcome/Mcp.vue
@@ -2,14 +2,11 @@
import { Head, Link, router, useHttp, usePoll } from '@inertiajs/vue3';
import {
IconArrowRight,
- IconArrowUp,
IconBulb,
IconCalendarPlus,
IconChevronRight,
IconCircleCheckFilled,
IconListDetails,
- IconMicrophone,
- IconPlus,
IconSparkles,
IconTrendingUp,
} from '@tabler/icons-vue';
@@ -72,7 +69,7 @@ const {
pause: pauseBenefits,
resume: resumeBenefits,
stop: stopBenefits,
-} = useAutoRotate(benefits.length, 8000);
+} = useAutoRotate(benefits.length, 3000);
/** Picking a tab means the user wants to read it: the rotation stops for good. */
const chooseBenefit = (index: number): void => {
@@ -214,7 +211,7 @@ const goToSchedule = (): void => {
</div>
<div
- class="grid flex-1 lg:grid-cols-[18rem_minmax(0,1fr)]"
+ class="grid flex-1 lg:grid-cols-[auto_minmax(0,1fr)]"
>
<div
class="flex flex-col gap-1 border-border bg-muted/40 p-2 max-md:hidden max-lg:border-b lg:border-e"
@@ -248,13 +245,13 @@ const goToSchedule = (): void => {
<component :is="benefit.icon" class="size-4" />
</span>
<span class="flex min-w-0 flex-col gap-0.5">
- <span class="text-sm font-medium text-foreground">
+ <span class="text-sm font-medium whitespace-nowrap text-foreground">
{{
$t(`welcome.mcp.benefits.${benefit.key}.title`)
}}
</span>
<span
- class="text-xs text-muted-foreground"
+ class="text-xs whitespace-nowrap text-muted-foreground"
>
{{
$t(`welcome.mcp.benefits.${benefit.key}.hint`)
@@ -290,7 +287,7 @@ const goToSchedule = (): void => {
</div>
<div class="flex flex-col">
- <div class="grid flex-1 px-4 pt-4 pb-3">
+ <div class="grid flex-1 p-4">
<McpChatExample
v-for="benefit in benefits"
:key="benefit.key"
@@ -313,27 +310,6 @@ const goToSchedule = (): void => {
/>
</Transition>
</div>
- <div class="px-4 pb-4 max-sm:hidden" aria-hidden="true">
- <div
- class="flex h-10 items-center gap-2.5 rounded-full border border-border bg-card ps-3 pe-1.5"
- data-testid="welcome-mcp-composer"
- >
- <IconPlus class="size-5 shrink-0 text-foreground" stroke-width="1.5" />
- <span
- class="min-w-0 flex-1 truncate text-sm text-muted-foreground"
- >
- {{ $t('welcome.mcp.composer') }}
- </span>
- <IconMicrophone
- class="size-4 shrink-0 text-muted-foreground"
- />
- <span
- class="inline-flex size-7 shrink-0 items-center justify-center rounded-full bg-secondary text-muted-foreground"
- >
- <IconArrowUp class="size-4" />
- </span>
- </div>
- </div>
</div>
</div>
</div>
diff --git a/resources/js/types/instagram.ts b/resources/js/types/instagram.ts
new file mode 100644
index 000000000..89842d505
--- /dev/null
+++ b/resources/js/types/instagram.ts
@@ -0,0 +1,14 @@
+/**
+ * An Instagram audio track: what the audio search and details return, and
+ * what a reel stores in `meta.audio` once picked (with the two volumes).
+ */
+export interface InstagramAudio {
+ id: string;
+ title: string;
+ artist: string | null;
+ cover_url: string | null;
+ duration_ms?: number | null;
+ preview_url: string | null;
+ audio_volume?: number | null;
+ video_volume?: number | null;
+}
diff --git a/resources/js/types/publish.ts b/resources/js/types/publish.ts
index 7282b5d4d..97d5a9133 100644
--- a/resources/js/types/publish.ts
+++ b/resources/js/types/publish.ts
@@ -141,6 +141,8 @@ export type PostCardMenuAction =
| 'recurrence'
| 'move_drafts'
| 'details'
+ | 'share_link'
+ | 'copy_link'
| 'delete';
export interface CalendarPost extends PostCard {
diff --git a/routes/api.php b/routes/api.php
index 330c7e5b1..e7d2ade52 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -7,9 +7,12 @@ use App\Http\Controllers\Api\ApiKeyController;
use App\Http\Controllers\Api\ChannelInsightsController;
use App\Http\Controllers\Api\ChannelPostingScheduleController;
use App\Http\Controllers\Api\ChannelQueueController;
+use App\Http\Controllers\Api\DiscordController;
use App\Http\Controllers\Api\IdeaController;
use App\Http\Controllers\Api\IdeaStageController;
+use App\Http\Controllers\Api\InstagramAudioController;
use App\Http\Controllers\Api\LabelController;
+use App\Http\Controllers\Api\PinterestBoardController;
use App\Http\Controllers\Api\PlatformController;
use App\Http\Controllers\Api\PostApprovalController;
use App\Http\Controllers\Api\PostController;
@@ -18,6 +21,7 @@ use App\Http\Controllers\Api\PostRecurrenceController;
use App\Http\Controllers\Api\RepurposeController;
use App\Http\Controllers\Api\SignatureController;
use App\Http\Controllers\Api\SocialAccountController;
+use App\Http\Controllers\Api\TikTokCreatorInfoController;
use App\Http\Controllers\Api\UploadController;
use App\Http\Controllers\Api\WebhookController;
use App\Http\Controllers\Api\WorkspaceController;
@@ -86,16 +90,23 @@ Route::middleware(['auth:api', 'workspace.token', 'throttle:api'])->group(functi
Route::delete('/labels/{label}', [LabelController::class, 'destroy'])->name('api.labels.destroy');
Route::get('/social-accounts', [SocialAccountController::class, 'index'])->name('api.social-accounts.index');
- Route::get('/social-accounts/{account}/boards', [SocialAccountController::class, 'boards'])
+ Route::get('/social-accounts/{account}/boards', [PinterestBoardController::class, 'index'])
->middleware('throttle:60,1')
->name('api.social-accounts.boards');
- Route::post('/social-accounts/{account}/boards', [SocialAccountController::class, 'storeBoard'])
+ Route::post('/social-accounts/{account}/boards', [PinterestBoardController::class, 'store'])
->middleware('throttle:60,1')
->name('api.social-accounts.boards.store');
- Route::get('/social-accounts/{account}/tiktok-creator-info', [SocialAccountController::class, 'tiktokCreatorInfo'])
+ Route::get('/social-accounts/{account}/tiktok-creator-info', [TikTokCreatorInfoController::class, 'show'])
->middleware('throttle:60,1')
->name('api.social-accounts.tiktok-creator-info');
- Route::get('/social-accounts/{account}/channels', [SocialAccountController::class, 'channels'])
+ Route::get('/social-accounts/{account}/instagram-audio', [InstagramAudioController::class, 'index'])
+ ->middleware('throttle:60,1')
+ ->name('api.social-accounts.instagram-audio');
+ Route::get('/social-accounts/{account}/instagram-audio/{audioId}', [InstagramAudioController::class, 'show'])
+ ->whereNumber('audioId')
+ ->middleware('throttle:60,1')
+ ->name('api.social-accounts.instagram-audio.show');
+ Route::get('/social-accounts/{account}/channels', [DiscordController::class, 'channels'])
->middleware('throttle:60,1')
->name('api.social-accounts.channels');
@@ -105,7 +116,7 @@ Route::middleware(['auth:api', 'workspace.token', 'throttle:api'])->group(functi
Route::get('/channels/{account}/insights/publications', [ChannelInsightsController::class, 'publications'])
->whereUuid('account')
->name('api.channels.insights.publications');
- Route::get('/channels/{account}/posting-schedule', [SocialAccountController::class, 'postingSchedule'])
+ Route::get('/channels/{account}/posting-schedule', [ChannelPostingScheduleController::class, 'show'])
->whereUuid('account')
->name('api.channels.posting-schedule.show');
Route::put('/channels/{account}/posting-schedule', [ChannelPostingScheduleController::class, 'update'])
@@ -117,7 +128,7 @@ Route::middleware(['auth:api', 'workspace.token', 'throttle:api'])->group(functi
Route::post('/channels/{account}/posting-schedule/copy', [ChannelPostingScheduleController::class, 'copy'])
->whereUuid('account')
->name('api.channels.posting-schedule.copy');
- Route::get('/channels/{account}/queue/slots', [SocialAccountController::class, 'freeSlots'])
+ Route::get('/channels/{account}/queue/slots', [ChannelQueueController::class, 'slots'])
->whereUuid('account')
->name('api.channels.queue.slots');
Route::put('/channels/{account}/queue/order', [ChannelQueueController::class, 'reorder'])
diff --git a/routes/app.php b/routes/app.php
index 005bbbee0..cbc5671ce 100644
--- a/routes/app.php
+++ b/routes/app.php
@@ -18,6 +18,7 @@ use App\Http\Controllers\App\IdeaController;
use App\Http\Controllers\App\IdeaGenerateController;
use App\Http\Controllers\App\IdeaStageController;
use App\Http\Controllers\App\InsightsController;
+use App\Http\Controllers\App\InstagramAudioController;
use App\Http\Controllers\App\LibraryTemplateController;
use App\Http\Controllers\App\LinkPreviewController;
use App\Http\Controllers\App\LinkPreviewMediaController;
@@ -42,10 +43,12 @@ use App\Http\Controllers\App\RepurposeController;
use App\Http\Controllers\App\RssFeedCollectionController;
use App\Http\Controllers\App\RssFeedController;
use App\Http\Controllers\App\RssFeedItemController;
-use App\Http\Controllers\App\Settings\AuthenticationController;
+use App\Http\Controllers\App\Settings\ConnectedAccountController;
use App\Http\Controllers\App\Settings\NotificationPreferenceController;
+use App\Http\Controllers\App\Settings\PasswordController;
use App\Http\Controllers\App\Settings\PreferencesController;
use App\Http\Controllers\App\Settings\ProfileController;
+use App\Http\Controllers\App\Settings\SessionController;
use App\Http\Controllers\App\UnsplashController;
use App\Http\Controllers\App\WebhookController;
use App\Http\Controllers\App\WelcomeController;
@@ -179,6 +182,14 @@ Route::middleware(['auth', EnsureAccountReady::class, EnsureHasWorkspace::class]
->middleware('throttle:60,1')
->name('app.discord.mentions');
+ Route::get('instagram/accounts/{account}/audio', [InstagramAudioController::class, 'index'])
+ ->middleware('throttle:60,1')
+ ->name('app.instagram.audio.index');
+ Route::get('instagram/accounts/{account}/audio/{audioId}', [InstagramAudioController::class, 'show'])
+ ->whereNumber('audioId')
+ ->middleware('throttle:60,1')
+ ->name('app.instagram.audio.show');
+
Route::get('pinterest/accounts/{account}/boards', [PinterestBoardController::class, 'index'])
->middleware('throttle:30,1')
->name('app.pinterest.boards.index');
@@ -407,16 +418,15 @@ Route::middleware(['auth'])->group(function () {
Route::middleware(['auth'])->group(function () {
Route::delete('settings/profile', [ProfileController::class, 'destroy'])->name('app.profile.destroy');
- Route::get('settings/authentication', [AuthenticationController::class, 'edit'])->name('app.authentication.edit');
- Route::put('settings/authentication/password', [AuthenticationController::class, 'updatePassword'])
+ Route::put('settings/profile/password', [PasswordController::class, 'update'])
->middleware('throttle:6,1')
- ->name('app.authentication.update-password');
- Route::delete('settings/authentication/sessions', [AuthenticationController::class, 'destroyOtherSessions'])
- ->name('app.authentication.destroy-other-sessions');
- Route::get('settings/authentication/providers/{provider}/connect', [AuthenticationController::class, 'connectProvider'])
- ->name('app.authentication.connect-provider');
- Route::delete('settings/authentication/providers/{provider}', [AuthenticationController::class, 'disconnectProvider'])
- ->name('app.authentication.disconnect-provider');
+ ->name('app.profile.password.update');
+ Route::delete('settings/profile/sessions', [SessionController::class, 'destroyOthers'])
+ ->name('app.profile.sessions.destroy-others');
+ Route::get('settings/profile/connected-accounts/{provider}/connect', [ConnectedAccountController::class, 'connect'])
+ ->name('app.profile.connected-accounts.connect');
+ Route::delete('settings/profile/connected-accounts/{provider}', [ConnectedAccountController::class, 'destroy'])
+ ->name('app.profile.connected-accounts.destroy');
Route::get('settings/profile/notifications', [NotificationPreferenceController::class, 'edit'])->name('app.notifications.preferences');
Route::patch('settings/profile/notifications', [NotificationPreferenceController::class, 'update'])->name('app.notifications.preferences.update');
diff --git a/tests/Browser/CalendarPageTest.php b/tests/Browser/CalendarPageTest.php
index 8cd5f01cb..ab3d56a18 100644
--- a/tests/Browser/CalendarPageTest.php
+++ b/tests/Browser/CalendarPageTest.php
@@ -458,7 +458,7 @@ test('a published post popover shows its metrics, go to post and the sent menu',
waitForCalendarTestId($page, "post-card-menu-content-{$post->id}");
expect($page->script("Array.from(document.querySelectorAll('[data-testid=\"post-card-menu-content-{$post->id}\"] [role=\"menuitem\"]')).map((element) => element.dataset.testid)"))
- ->toBe(["post-duplicate-{$post->id}", "post-details-open-{$post->id}"]);
+ ->toBe(["post-duplicate-{$post->id}", "post-details-open-{$post->id}", "post-share-link-{$post->id}", "post-copy-link-{$post->id}"]);
$page->click("@post-details-open-{$post->id}");
waitForCalendarTestId($page, "post-details-{$post->id}");
diff --git a/tests/Browser/ChannelInsightsFiltersTest.php b/tests/Browser/ChannelInsightsFiltersTest.php
index 46abd5252..bb4f6ee6c 100644
--- a/tests/Browser/ChannelInsightsFiltersTest.php
+++ b/tests/Browser/ChannelInsightsFiltersTest.php
@@ -152,3 +152,16 @@ test('on a phone both filters show only their icon and chevron', function () {
$page->assertScript('document.documentElement.scrollWidth <= window.innerWidth', true)
->assertNoJavaScriptErrors();
});
+
+test('the post type filter search matches each word typed in any order and ignores case', function () {
+ $page = visit(route('app.channels.insights', $this->instagram));
+ waitForInsightsFilterTestId($page, 'insights-post-type-filter');
+ $page->click('@insights-post-type-filter');
+ waitForInsightsFilterTestId($page, 'insights-post-type-search');
+
+ $page->type('@insights-post-type-search', 'POST feed');
+ waitForInsightsFilterScript($page, '!document.querySelector("[data-testid=insights-post-type-option-instagram_reel]")');
+
+ $page->assertScript('Array.from(document.querySelectorAll("[data-testid^=insights-post-type-option-]")).map((element) => element.dataset.testid.replace("insights-post-type-option-", "")).join(",")', 'instagram_feed')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/ChannelInsightsTest.php b/tests/Browser/ChannelInsightsTest.php
index 31a84620b..307ef5cf2 100644
--- a/tests/Browser/ChannelInsightsTest.php
+++ b/tests/Browser/ChannelInsightsTest.php
@@ -206,6 +206,79 @@ test('a publication with a TryPost post opens the post details on the insights p
->assertNoJavaScriptErrors();
});
+test('the post details opened from insights copy the link of the sent post', function () {
+ $post = Post::factory()->forAccount($this->instagram)->published()->create([
+ 'user_id' => $this->user->id,
+ 'content' => 'Published through TryPost',
+ 'published_at' => $this->mostReactions->provider_published_at,
+ ]);
+ $post->forceFill(['platform_url' => 'https://www.instagram.com/p/COPY/'])->save();
+ $this->mostReactions->update(['post_id' => $post->id]);
+
+ $page = visit(route('app.channels.insights', $this->instagram));
+ waitForChannelInsightsTestId($page, "insights-posts-link-{$this->mostReactions->id}");
+ $page->click("@insights-posts-link-{$this->mostReactions->id}");
+ waitForChannelInsightsTestId($page, "post-card-menu-details-{$post->id}");
+
+ $page->script('window.__copied = null; navigator.clipboard.writeText = async (text) => { window.__copied = text; };');
+ $page->click("@post-card-menu-details-{$post->id}");
+ waitForChannelInsightsTestId($page, "post-copy-link-details-{$post->id}");
+ $page->click("@post-copy-link-details-{$post->id}");
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100 && window.__copied === null; i++) {
+ await new Promise((r) => setTimeout(r, 50));
+ }
+ })();
+ JS);
+
+ expect($page->script('window.__copied'))->toBe('https://www.instagram.com/p/COPY/');
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the post details opened from insights share the link of the sent post in a new post', function () {
+ $post = Post::factory()->forAccount($this->instagram)->published()->create([
+ 'user_id' => $this->user->id,
+ 'content' => 'Published through TryPost',
+ 'published_at' => $this->mostReactions->provider_published_at,
+ ]);
+ $post->forceFill(['platform_url' => 'https://www.instagram.com/p/SHARE/'])->save();
+ $this->mostReactions->update(['post_id' => $post->id]);
+
+ $page = visit(route('app.channels.insights', $this->instagram));
+ waitForChannelInsightsTestId($page, "insights-posts-link-{$this->mostReactions->id}");
+ $page->click("@insights-posts-link-{$this->mostReactions->id}");
+ waitForChannelInsightsTestId($page, "post-card-menu-details-{$post->id}");
+ $page->click("@post-card-menu-details-{$post->id}");
+ waitForChannelInsightsTestId($page, "post-share-link-details-{$post->id}");
+ $page->click("@post-share-link-details-{$post->id}");
+ waitForChannelInsightsTestId($page, 'post-composer-dialog');
+
+ $page->assertSeeIn('@post-composer-dialog', 'https://www.instagram.com/p/SHARE/')
+ ->assertNoJavaScriptErrors();
+});
+
+test('the post details of a sent post without a link offer no share or copy link', function () {
+ $post = Post::factory()->forAccount($this->instagram)->published()->create([
+ 'user_id' => $this->user->id,
+ 'content' => 'Published through TryPost',
+ 'published_at' => $this->mostReactions->provider_published_at,
+ ]);
+ $post->forceFill(['platform_url' => null])->save();
+ $this->mostReactions->update(['post_id' => $post->id]);
+
+ $page = visit(route('app.channels.insights', $this->instagram));
+ waitForChannelInsightsTestId($page, "insights-posts-link-{$this->mostReactions->id}");
+ $page->click("@insights-posts-link-{$this->mostReactions->id}");
+ waitForChannelInsightsTestId($page, "post-card-menu-details-{$post->id}");
+ $page->click("@post-card-menu-details-{$post->id}");
+ waitForChannelInsightsTestId($page, "post-card-menu-content-details-{$post->id}");
+
+ $page->assertMissing("@post-share-link-details-{$post->id}")
+ ->assertMissing("@post-copy-link-details-{$post->id}")
+ ->assertNoJavaScriptErrors();
+});
+
test('on a phone the channel insights range presets collapse into a dropdown', function () {
$page = visit(route('app.channels.insights', ['account' => $this->instagram]))->resize(390, 844);
waitForChannelInsightsTestId($page, 'insights-range-mobile-trigger');
diff --git a/tests/Browser/ChannelReorderTest.php b/tests/Browser/ChannelReorderTest.php
index 9135ff902..4e1025951 100644
--- a/tests/Browser/ChannelReorderTest.php
+++ b/tests/Browser/ChannelReorderTest.php
@@ -67,40 +67,33 @@ function channelReorderDomOrder(mixed $page, string $prefix, array $channels): a
JS);
}
-test('dragging a channel on the settings page persists the order', function () {
+test('the channels settings page lists channels without reordering them', function () {
[$user, [$first, $second, $third]] = channelReorderSetup();
$this->actingAs($user);
$page = visit(route('app.workspace.channels'));
- waitForChannelReorderTestId($page, "channel-handle-{$first->id}");
- $page->drag("@channel-handle-{$first->id}", "@channel-list-row-{$third->id}");
- waitForChannelReorderDatabase($page, fn (): bool => $first->refresh()->position > $second->refresh()->position);
+ waitForChannelReorderTestId($page, "channel-list-row-{$third->id}");
+ $page->click("@channel-menu-{$second->id}");
+ waitForChannelReorderTestId($page, "channel-disconnect-{$second->id}");
- expect($first->refresh()->position)->toBeGreaterThan($second->refresh()->position)
- ->and(channelReorderDomOrder($page, 'channel-list-row-', [$first, $second, $third]))
- ->toBe($user->currentWorkspace->socialAccounts()->pluck('id')->all());
+ expect($page->script('document.querySelectorAll(\'[data-testid^="channel-handle-"], [data-testid^="channel-menu-move-"], [data-sortable-channel]\').length'))->toBe(0)
+ ->and(channelReorderDomOrder($page, 'channel-list-row-', [$first, $second, $third]))->toBe([$first->id, $second->id, $third->id]);
$page->assertNoJavaScriptErrors();
});
-test('channels can be moved with the keyboard and from the row menu', function () {
+test('a sidebar channel can be moved with the keyboard', function () {
[$user, [$first, $second, $third]] = channelReorderSetup();
$this->actingAs($user);
- $page = visit(route('app.workspace.channels'));
- waitForChannelReorderTestId($page, "channel-handle-{$third->id}");
- $page->keys("@channel-handle-{$third->id}", 'ArrowUp');
+ $page = visit(route('app.posts.index'));
+ waitForChannelReorderTestId($page, "sidebar-channel-row-{$third->id}");
+ $page->hover("@sidebar-channel-row-{$third->id}");
+ $page->keys("@sidebar-channel-handle-{$third->id}", 'ArrowUp');
waitForChannelReorderDatabase($page, fn (): bool => $third->refresh()->position === 1);
expect($user->currentWorkspace->socialAccounts()->pluck('id')->all())->toBe([$first->id, $third->id, $second->id])
- ->and($page->script('document.activeElement?.dataset.testid'))->toBe("channel-handle-{$third->id}");
-
- $page->click("@channel-menu-{$first->id}");
- waitForChannelReorderTestId($page, "channel-menu-move-down-{$first->id}");
- $page->click("@channel-menu-move-down-{$first->id}");
- waitForChannelReorderDatabase($page, fn (): bool => $first->refresh()->position === 1);
-
- expect($user->currentWorkspace->socialAccounts()->pluck('id')->all())->toBe([$third->id, $first->id, $second->id])
- ->and(channelReorderDomOrder($page, 'channel-list-row-', [$first, $second, $third]))->toBe([$third->id, $first->id, $second->id]);
+ ->and($page->script('document.activeElement?.dataset.testid'))->toBe("sidebar-channel-handle-{$third->id}")
+ ->and(channelReorderDomOrder($page, 'sidebar-channel-row-', [$first, $second, $third]))->toBe([$first->id, $third->id, $second->id]);
$page->assertNoJavaScriptErrors();
});
@@ -108,16 +101,17 @@ test('a stale reorder is rolled back and reported', function () {
[$user, [$first, $second, $third]] = channelReorderSetup();
$this->actingAs($user);
- $page = visit(route('app.workspace.channels'));
- waitForChannelReorderTestId($page, "channel-handle-{$second->id}");
+ $page = visit(route('app.posts.index'));
+ waitForChannelReorderTestId($page, "sidebar-channel-row-{$second->id}");
$late = SocialAccount::factory()->x()->create(['workspace_id' => $user->current_workspace_id]);
- $page->keys("@channel-handle-{$second->id}", 'ArrowUp');
+ $page->hover("@sidebar-channel-row-{$second->id}");
+ $page->keys("@sidebar-channel-handle-{$second->id}", 'ArrowUp');
waitForChannelReorderTestId($page, 'channels-reorder-error-toast');
$page->assertSeeIn('@channels-reorder-error-toast', __('channels.reorder.stale'));
- waitForChannelReorderTestId($page, "channel-row-{$late->id}");
+ waitForChannelReorderTestId($page, "sidebar-channel-row-{$late->id}");
expect($user->currentWorkspace->socialAccounts()->pluck('id')->all())->toBe([$first->id, $second->id, $third->id, $late->id])
- ->and(channelReorderDomOrder($page, 'channel-list-row-', [$first, $second, $third, $late]))->toBe([$first->id, $second->id, $third->id, $late->id]);
+ ->and(channelReorderDomOrder($page, 'sidebar-channel-row-', [$first, $second, $third, $late]))->toBe([$first->id, $second->id, $third->id, $late->id]);
$page->assertNoJavaScriptErrors();
});
diff --git a/tests/Browser/ChannelsSettingsTest.php b/tests/Browser/ChannelsSettingsTest.php
index 6610665d8..deccd1e46 100644
--- a/tests/Browser/ChannelsSettingsTest.php
+++ b/tests/Browser/ChannelsSettingsTest.php
@@ -2,6 +2,7 @@
declare(strict_types=1);
+use App\Enums\SocialAccount\Platform;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@@ -179,3 +180,36 @@ test('the disconnect dialog shows the keyword with a copy button, like the other
expect($page->script('window.__copied'))->toBe($keyword);
$page->assertNoJavaScriptErrors();
});
+
+test('an instagram login channel offers to link a facebook page, which reconnects that card through facebook', function () {
+ $user = channelsSettingsAdmin();
+ $instagram = SocialAccount::factory()->instagram()->create(['workspace_id' => $user->current_workspace_id]);
+ $viaFacebook = SocialAccount::factory()->create(['workspace_id' => $user->current_workspace_id, 'platform' => Platform::InstagramFacebook]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.workspace.channels'));
+ waitForChannelsSettingsTestId($page, "channel-row-{$viaFacebook->id}");
+ $page->click("@channel-menu-{$viaFacebook->id}");
+ waitForChannelsSettingsTestId($page, "channel-menu-reconnect-{$viaFacebook->id}");
+ $page->assertMissing("@channel-menu-link-facebook-{$viaFacebook->id}")
+ ->keys("@channel-menu-reconnect-{$viaFacebook->id}", 'Escape');
+
+ $page->click("@channel-menu-{$instagram->id}");
+ waitForChannelsSettingsTestId($page, "channel-menu-link-facebook-{$instagram->id}");
+ $page->assertSeeIn("@channel-menu-link-facebook-{$instagram->id}", __('channels.link_facebook_page'))
+ ->click("@channel-menu-link-facebook-{$instagram->id}");
+ waitForChannelsSettingsTestId($page, 'instagram-facebook-requirements');
+
+ $page->script(<<<'JS'
+ document.addEventListener('inertia:before', (event) => {
+ window.__connectUrl = event.detail.visit.url.href;
+ event.preventDefault();
+ });
+ JS);
+ $page->click('@instagram-facebook-requirements-connect');
+ $page->script('(async () => { for (let i = 0; i < 100 && window.__connectUrl === undefined; i++) await new Promise((r) => setTimeout(r, 50)); })()');
+
+ expect($page->script('window.__connectUrl'))->toContain("reconnect={$instagram->id}")
+ ->and($page->script('new URL(window.__connectUrl).pathname'))->toBe((string) parse_url(route('app.social.instagram-facebook.connect'), PHP_URL_PATH));
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/ComposerChannelSettingsTest.php b/tests/Browser/ComposerChannelSettingsTest.php
index 2eb436945..a40a1482a 100644
--- a/tests/Browser/ComposerChannelSettingsTest.php
+++ b/tests/Browser/ComposerChannelSettingsTest.php
@@ -219,7 +219,7 @@ test('the pinterest board picker searches, refreshes and creates boards', functi
->assertVisible('@pinterest-board-option-board_2');
expect($page->script("!!document.querySelector('[data-testid=\"pinterest-board-option-board_1\"] img')"))->toBeTrue();
- $page->fill('@pinterest-board-search', 'dis');
+ $page->fill('@pinterest-board-search', 'DÍS');
waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"pinterest-board-option-board_2\"]')");
$page->assertMissing('@pinterest-board-option-board_2')
->assertVisible('@pinterest-board-option-board_1')
@@ -540,6 +540,295 @@ test('the instagram card shows share to feed on reels, the AI label last and on
]);
});
+test('the instagram reel card adds collaborators and a checked trial reel, and asks to link Facebook for music', function () {
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-link-facebook');
+ $page->assertPresent('@instagram-music-save-and-link')
+ ->click('@instagram-music-maybe-later');
+ waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"instagram-music-link-facebook\"]')");
+
+ $page->type('@instagram-collaborator-input', '@alice')
+ ->keys('@instagram-collaborator-input', 'Enter');
+ waitForChannelSettingsTestId($page, 'instagram-collaborators-notice');
+ $page->assertPresent('@instagram-collaborator-alice')
+ ->assertPresent('@instagram-trial-reel-unavailable')
+ ->click('@instagram-collaborators-notice-dismiss');
+ waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"instagram-collaborators-notice\"]')");
+
+ $page->type('@instagram-collaborator-input', 'bob')
+ ->click('@instagram-collaborator-add');
+ waitForChannelSettingsTestId($page, 'instagram-collaborator-bob');
+
+ $page->click('@instagram-collaborator-remove-alice')
+ ->click('@instagram-collaborator-remove-bob');
+ waitForChannelSettingsTestId($page, 'instagram-trial-reel-MANUAL');
+ $page->click('@instagram-trial-reel-MANUAL');
+ waitForChannelSettingsTestId($page, 'instagram-trial-reel-check');
+ $page->assertVisible('@instagram-trial-reel-illustration')
+ ->click('@instagram-trial-reel-check-no');
+ waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"instagram-trial-reel-check\"]')");
+ $page->assertAttribute('@instagram-trial-reel-off', 'aria-checked', 'true')
+ ->click('@instagram-trial-reel-MANUAL');
+ waitForChannelSettingsTestId($page, 'instagram-trial-reel-check');
+ $page->click('@instagram-trial-reel-check-yes');
+ waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"instagram-trial-reel-MANUAL\"]')?.getAttribute('aria-checked') === 'true'");
+ $page->assertNoJavaScriptErrors();
+
+ $page->click('@composer-save-draft')->assertMissing('@post-composer-dialog');
+
+ expect(data_get($post->fresh()->meta, 'trial_graduation'))->toBe('MANUAL')
+ ->and(data_get($post->fresh()->meta, 'collaborators'))->toBe([]);
+});
+
+test('save and link keeps a scheduled reel scheduled and opens the Facebook requirements to reconnect the account', function () {
+ fakeChannelSettingsApis();
+ $video = [['id' => (string) Str::uuid(), 'type' => 'video', 'path' => 'medias/clip.mp4', 'url' => 'https://example.com/clip.mp4', 'mime_type' => 'video/mp4', 'original_filename' => 'clip.mp4']];
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel, $video);
+ $post->update(['status' => Status::Scheduled, 'scheduled_at' => now()->addDay()]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-save-and-link');
+ $page->click('@instagram-music-save-and-link');
+ waitForChannelSettingsTestId($page, 'instagram-facebook-requirements');
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertPresent('@instagram-facebook-requirements-connect')
+ ->assertNoJavaScriptErrors();
+ expect($post->fresh()->status)->toBe(Status::Scheduled);
+
+ $page->script(<<<'JS'
+ document.addEventListener('inertia:before', (event) => {
+ window.__connectUrl = event.detail.visit.url.href;
+ event.preventDefault();
+ });
+ JS);
+ $page->click('@instagram-facebook-requirements-connect');
+ waitForChannelSettingsCondition($page, 'window.__connectUrl !== undefined');
+
+ expect($page->script('window.__connectUrl'))->toContain("reconnect={$post->social_account_id}");
+});
+
+test('save and link never publishes a scheduled reel switched to share now', function () {
+ fakeChannelSettingsApis();
+ $video = [['id' => (string) Str::uuid(), 'type' => 'video', 'path' => 'medias/clip.mp4', 'url' => 'https://example.com/clip.mp4', 'mime_type' => 'video/mp4', 'original_filename' => 'clip.mp4']];
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel, $video);
+ $post->update(['status' => Status::Scheduled, 'scheduled_at' => now()->addDay()]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'composer-schedule-trigger');
+ $page->click('@composer-schedule-trigger');
+ waitForChannelSettingsTestId($page, 'composer-schedule-more-actions');
+ $page->click('@composer-schedule-more-actions');
+ waitForChannelSettingsTestId($page, 'composer-schedule-now');
+ $page->click('@composer-schedule-now');
+ waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"composer-submit\"]')?.dataset.scheduleMode === 'now'");
+
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-save-and-link');
+ $page->click('@instagram-music-save-and-link');
+ waitForChannelSettingsTestId($page, 'instagram-facebook-requirements');
+
+ $page->assertNoJavaScriptErrors();
+ expect($post->fresh()->status)->toBe(Status::Draft);
+});
+
+test('save and link explains why a scheduled reel that cannot be saved stays open', function () {
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel);
+ $post->update(['status' => Status::Scheduled, 'scheduled_at' => now()->addDay()]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-save-and-link');
+ $page->click('@instagram-music-save-and-link');
+ waitForChannelSettingsTestId($page, 'instagram-music-save-and-link-blocked');
+
+ $page->assertSee(__('posts.form.instagram.music.save_and_link_blocked'))
+ ->assertVisible('@post-composer-dialog')
+ ->assertMissing('@instagram-facebook-requirements')
+ ->assertNoJavaScriptErrors();
+ expect($post->fresh()->status)->toBe(Status::Scheduled);
+});
+
+test('save and link keeps a pending reel pending for a member who needs approval', function () {
+ fakeChannelSettingsApis();
+ $video = [['id' => (string) Str::uuid(), 'type' => 'video', 'path' => 'medias/clip.mp4', 'url' => 'https://example.com/clip.mp4', 'mime_type' => 'video/mp4', 'original_filename' => 'clip.mp4']];
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel, $video);
+ $post->workspace->members()->updateExistingPivot($post->user_id, membershipPivot('approval'));
+ $post->update(['status' => Status::PendingApproval, 'scheduled_at' => now()->addDay()]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-save-and-link');
+ $page->click('@instagram-music-save-and-link');
+ waitForChannelSettingsTestId($page, 'instagram-facebook-requirements');
+
+ $page->assertNoJavaScriptErrors();
+ expect($post->fresh()->status)->toBe(Status::PendingApproval);
+});
+
+test('save and link asks an approver to decide on a pending reel first', function () {
+ fakeChannelSettingsApis();
+ $video = [['id' => (string) Str::uuid(), 'type' => 'video', 'path' => 'medias/clip.mp4', 'url' => 'https://example.com/clip.mp4', 'mime_type' => 'video/mp4', 'original_filename' => 'clip.mp4']];
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel, $video);
+ $post->update(['status' => Status::PendingApproval, 'scheduled_at' => now()->addDay()]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-save-and-link');
+ $page->click('@instagram-music-save-and-link');
+ waitForChannelSettingsTestId($page, 'instagram-music-save-and-link-pending');
+
+ $page->assertSee(__('posts.form.instagram.music.save_and_link_pending'))
+ ->assertVisible('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+ expect($post->fresh()->status)->toBe(Status::PendingApproval);
+});
+
+test('save and link saves a draft reel as a draft before linking Facebook', function () {
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-save-and-link');
+ $page->click('@instagram-music-save-and-link');
+ waitForChannelSettingsTestId($page, 'instagram-facebook-requirements');
+
+ $page->assertMissing('@post-composer-dialog')->assertNoJavaScriptErrors();
+ expect($post->fresh()->status)->toBe(Status::Draft);
+});
+
+test('an invalid collaborator in any position shows its error', function () {
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-collaborator-input');
+
+ $page->type('@instagram-collaborator-input', 'good_user')
+ ->keys('@instagram-collaborator-input', 'Enter');
+ waitForChannelSettingsTestId($page, 'instagram-collaborators-notice');
+ $page->click('@instagram-collaborators-notice-dismiss')
+ ->type('@instagram-collaborator-input', 'bad-name!')
+ ->click('@instagram-collaborator-add');
+ waitForChannelSettingsTestId($page, 'instagram-collaborator-bad-name!');
+
+ $page->click('@composer-save-draft');
+ waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"instagram-collaborators\"]')?.closest('[data-testid=\"channel-settings-row\"]')?.textContent.includes(".json_encode(__('posts.form.instagram.collaborators.invalid')).')');
+
+ $page->assertSee(__('posts.form.instagram.collaborators.invalid'))->assertNoJavaScriptErrors();
+ expect(data_get($post->fresh()->meta, 'collaborators'))->toBeNull();
+});
+
+test('a picked track whose cover link expired gets a fresh cover from instagram', function () {
+ $freshCover = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
+ Http::fake([config('trypost.platforms.instagram-facebook.graph_api').'/846373660299207*' => Http::response([
+ 'audio_id' => '846373660299207',
+ 'title' => 'Summer Song',
+ 'audio_type' => 'music',
+ 'cover_artwork_thumbnail_url' => $freshCover,
+ ])]);
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::InstagramFacebook, ContentType::InstagramReel);
+ $post->update(['meta' => ['audio' => [
+ 'id' => '846373660299207',
+ 'title' => 'Summer Song',
+ 'cover_url' => 'http://127.0.0.1:9/expired-cover.jpg',
+ 'preview_url' => null,
+ ]]]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-selected');
+ waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"instagram-music-selected-cover\"]')?.getAttribute('src')?.startsWith('data:image/gif')");
+
+ expect($page->script("document.querySelector('[data-testid=\"instagram-music-selected-cover\"]')?.getAttribute('src')"))->toBe($freshCover);
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a picked track whose cover cannot be refreshed shows the music icon instead', function () {
+ Http::fake([config('trypost.platforms.instagram-facebook.graph_api').'/846373660299207*' => Http::response(['error' => ['code' => 100]], 400)]);
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::InstagramFacebook, ContentType::InstagramReel);
+ $post->update(['meta' => ['audio' => [
+ 'id' => '846373660299207',
+ 'title' => 'Summer Song',
+ 'cover_url' => 'http://127.0.0.1:9/expired-cover.jpg',
+ 'preview_url' => null,
+ ]]]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-selected');
+ waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"instagram-music-selected-cover\"]')");
+
+ $page->assertMissing('@instagram-music-selected-cover')
+ ->assertSeeIn('@instagram-music-selected', 'Summer Song');
+});
+
+test('the instagram reel card picks music for an account connected through Facebook', function () {
+ Http::fake([config('trypost.platforms.instagram-facebook.graph_api').'/ig_audio*' => Http::response(['audio' => [[
+ 'audio_id' => '1234567890',
+ 'title' => 'Summer Song',
+ 'display_artist' => 'The Band',
+ 'cover_artwork_thumbnail_uri' => null,
+ 'download_url' => null,
+ ]]])]);
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::InstagramFacebook, ContentType::InstagramReel);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-track-1234567890');
+ $page->click('@instagram-music-track-1234567890');
+ waitForChannelSettingsTestId($page, 'instagram-music-selected');
+ $page->assertSeeIn('@instagram-music-selected', 'Summer Song')
+ ->assertSeeIn('@instagram-preview-audio', 'Summer Song')
+ ->assertPresent('@instagram-music-part-hint')
+ ->assertNoJavaScriptErrors();
+
+ $page->click('@instagram-music-volume');
+ waitForChannelSettingsTestId($page, 'instagram-music-video_volume');
+ $page->script(<<<'JS'
+ (() => {
+ const slider = document.querySelector('[data-testid="instagram-music-video_volume"]');
+ slider.value = '30';
+ slider.dispatchEvent(new Event('input', { bubbles: true }));
+ })()
+ JS);
+ waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"instagram-music-volume-panel\"]')?.textContent.includes('30%')");
+ $page->assertSeeIn('@instagram-music-volume-panel', '30%')
+ ->keys('@instagram-music-video_volume', 'Escape');
+ waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"instagram-music-volume-panel\"]')");
+
+ $page->click('@composer-save-draft')->assertMissing('@post-composer-dialog');
+
+ expect(data_get($post->fresh()->meta, 'audio'))->toEqual([
+ 'id' => '1234567890',
+ 'title' => 'Summer Song',
+ 'artist' => 'The Band',
+ 'cover_url' => null,
+ 'preview_url' => null,
+ 'video_volume' => 30,
+ ]);
+});
+
test('the instagram card counts hashtags down to five and warns past the limit', function () {
fakeChannelSettingsApis();
$post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramFeed);
@@ -1159,3 +1448,224 @@ test('every character counter in the composer shares one design', function (Plat
})->with([
'characters left' => [Platform::X, ContentType::XPost, 'composer-char-count-{id}'],
]);
+
+test('a failed instagram music search says so and lets the picker close', function () {
+ Http::fake([config('trypost.platforms.instagram-facebook.graph_api').'/ig_audio*' => Http::response(['error' => ['code' => 2]], 500)]);
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::InstagramFacebook, ContentType::InstagramReel);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-failed');
+
+ $page->assertSeeIn('@instagram-music-failed', __('posts.form.instagram.music.search_failed'))
+ ->keys('@instagram-music-search', 'Escape');
+ waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"instagram-music-picker\"]')");
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('searching instagram music asks instagram once the typing stops', function () {
+ $graph = config('trypost.platforms.instagram-facebook.graph_api');
+ Http::fake(["{$graph}/ig_audio*" => fn (Request $request) => Http::response(['audio' => str_contains($request->url(), 'search_query=grudge')
+ ? [['audio_id' => 'audio-grudge', 'title' => 'Grudge', 'display_artist' => 'Tash']]
+ : [['audio_id' => 'audio-trending', 'title' => 'Trending', 'display_artist' => 'Band']]])]);
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::InstagramFacebook, ContentType::InstagramReel);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+ $page->click('@instagram-music-add');
+ waitForChannelSettingsTestId($page, 'instagram-music-track-audio-trending');
+
+ $page->type('@instagram-music-search', 'grudge');
+ waitForChannelSettingsTestId($page, 'instagram-music-track-audio-grudge');
+
+ $page->assertMissing('@instagram-music-track-audio-trending')->assertNoJavaScriptErrors();
+ $musicSearches = collect(Http::recorded())
+ ->map(fn (array $pair): string => $pair[0]->url())
+ ->filter(fn (string $url): bool => str_contains($url, 'audio_type=music') && str_contains($url, 'search_query='))
+ ->values();
+
+ expect($musicSearches)->toHaveCount(1)
+ ->and($musicSearches->first())->toContain('search_query=grudge');
+});
+
+test('the picked track plays and pauses from its card and can be removed', function () {
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::InstagramFacebook, ContentType::InstagramReel);
+ $post->update(['meta' => ['audio' => [
+ 'id' => '1234567890',
+ 'title' => 'Summer Song',
+ 'preview_url' => 'https://example.com/preview.mp3',
+ ]]]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-selected-preview');
+ $page->script('HTMLMediaElement.prototype.play = function () { return Promise.resolve(); }; HTMLMediaElement.prototype.pause = function () {};');
+
+ $page->click('@instagram-music-selected-preview');
+ waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"instagram-music-selected-preview\"]')?.getAttribute('aria-label') === '".__('posts.form.instagram.music.pause')."'");
+ $page->assertAttribute('@instagram-music-selected-preview', 'aria-label', __('posts.form.instagram.music.pause'));
+
+ $page->click('@instagram-music-selected-preview');
+ waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"instagram-music-selected-preview\"]')?.getAttribute('aria-label') === '".__('posts.form.instagram.music.play')."'");
+ $page->assertAttribute('@instagram-music-selected-preview', 'aria-label', __('posts.form.instagram.music.play'));
+
+ $page->click('@instagram-music-remove');
+ waitForChannelSettingsTestId($page, 'instagram-music-add');
+ $page->assertMissing('@instagram-music-selected')
+ ->click('@composer-save-draft');
+ waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertNoJavaScriptErrors();
+ expect(data_get($post->fresh()->meta, 'audio'))->toBeNull();
+});
+
+test('a trial reel shows its explanation under the options and its badge on the preview', function () {
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel);
+ $post->update(['meta' => ['trial_graduation' => 'MANUAL']]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-trial-reel-hint');
+
+ $page->assertSeeIn('@instagram-trial-reel-hint', __('posts.form.instagram.trial_reel.manual_hint'))
+ ->assertSeeIn('@instagram-preview-trial', __('posts.form.instagram.trial_reel.badge'))
+ ->assertNoJavaScriptErrors();
+});
+
+test('collaborators added on the instagram card are saved with the post', function () {
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-collaborator-input');
+ $page->type('@instagram-collaborator-input', '@alice')
+ ->keys('@instagram-collaborator-input', 'Enter');
+ waitForChannelSettingsTestId($page, 'instagram-collaborators-notice');
+ $page->click('@instagram-collaborators-notice-dismiss')
+ ->type('@instagram-collaborator-input', 'bob')
+ ->click('@instagram-collaborator-add');
+ waitForChannelSettingsTestId($page, 'instagram-collaborator-bob');
+
+ $page->click('@composer-save-draft');
+ waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertNoJavaScriptErrors();
+ expect(data_get($post->fresh()->meta, 'collaborators'))->toBe(['alice', 'bob']);
+});
+
+test('a collaborator typed without pressing Enter is added when the field loses focus and saved with the post', function () {
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-collaborator-input');
+ $page->type('@instagram-collaborator-input', '@alice')
+ ->click('@composer-save-draft');
+ waitForChannelSettingsCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertNoJavaScriptErrors();
+ expect(data_get($post->fresh()->meta, 'collaborators'))->toBe(['alice']);
+});
+
+test('playing the reel preview video plays the picked track at the chosen music volume and pausing it stops the track', function () {
+ fakeChannelSettingsApis();
+ $video = [['id' => (string) Str::uuid(), 'type' => 'video', 'path' => 'medias/clip.mp4', 'url' => 'https://example.com/clip.mp4', 'mime_type' => 'video/mp4', 'original_filename' => 'clip.mp4']];
+ $post = seedChannelSettingsPost(Platform::InstagramFacebook, ContentType::InstagramReel, $video);
+ $post->update(['meta' => ['audio' => [
+ 'id' => '1234567890',
+ 'title' => 'Summer Song',
+ 'artist' => 'The Band',
+ 'preview_url' => 'https://example.com/preview.mp3',
+ 'audio_volume' => 40,
+ 'video_volume' => 30,
+ ]]]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-selected-preview');
+ waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"instagram-reel-preview\"] video')");
+ $page->script(<<<'JS'
+ (() => {
+ const where = (media, suffix = '') => `${media.closest?.('[data-testid="instagram-reel-preview"]') ? 'PREVIEW' : media.tagName}${suffix}`;
+ window.__played = [];
+ window.__audioVolume = null;
+ HTMLMediaElement.prototype.play = function () {
+ window.__played.push(where(this));
+ if (this.tagName === 'AUDIO') window.__audioVolume = Math.round(this.volume * 100);
+ Object.defineProperty(this, 'paused', { value: false, configurable: true });
+ this.dispatchEvent(new Event('play'));
+ return Promise.resolve();
+ };
+ HTMLMediaElement.prototype.pause = function () {
+ window.__played.push(where(this, ':paused'));
+ Object.defineProperty(this, 'paused', { value: true, configurable: true });
+ this.dispatchEvent(new Event('pause'));
+ };
+ return true;
+ })()
+ JS);
+
+ $page->script("document.querySelector('[data-testid=\"instagram-reel-preview\"] video').parentElement.click()");
+ waitForChannelSettingsCondition($page, "window.__played.includes('AUDIO')");
+
+ expect($page->script('window.__played'))->toBe(['PREVIEW', 'AUDIO'])
+ ->and($page->script('window.__audioVolume'))->toBe(40)
+ ->and($page->script("Math.round(document.querySelector('[data-testid=\"instagram-reel-preview\"] video').volume * 100)"))->toBe(30);
+
+ $page->script("document.querySelector('[data-testid=\"instagram-reel-preview\"] video').parentElement.click()");
+ waitForChannelSettingsCondition($page, "window.__played.includes('AUDIO:paused')");
+
+ expect($page->script("window.__played.includes('PREVIEW:paused') && window.__played.includes('AUDIO:paused')"))->toBeTrue();
+ $page->assertNoJavaScriptErrors();
+});
+
+test('playing the picked track from its card plays the music only and leaves the reel preview video still', function () {
+ fakeChannelSettingsApis();
+ $video = [['id' => (string) Str::uuid(), 'type' => 'video', 'path' => 'medias/clip.mp4', 'url' => 'https://example.com/clip.mp4', 'mime_type' => 'video/mp4', 'original_filename' => 'clip.mp4']];
+ $post = seedChannelSettingsPost(Platform::InstagramFacebook, ContentType::InstagramReel, $video);
+ $post->update(['meta' => ['audio' => [
+ 'id' => '1234567890',
+ 'title' => 'Summer Song',
+ 'artist' => 'The Band',
+ 'preview_url' => 'https://example.com/preview.mp3',
+ 'video_volume' => 30,
+ ]]]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-music-selected-preview');
+ waitForChannelSettingsCondition($page, "document.querySelector('[data-testid=\"instagram-reel-preview\"] video')");
+ $page->script(<<<'JS'
+ (() => {
+ const where = (media, suffix = '') => `${media.closest?.('[data-testid="instagram-reel-preview"]') ? 'PREVIEW' : media.tagName}${suffix}`;
+ window.__played = [];
+ HTMLMediaElement.prototype.play = function () { window.__played.push(where(this)); return Promise.resolve(); };
+ HTMLMediaElement.prototype.pause = function () { window.__played.push(where(this, ':paused')); };
+ return true;
+ })()
+ JS);
+
+ $page->assertSeeIn('@instagram-preview-audio', 'Summer Song · The Band')
+ ->click('@instagram-music-selected-preview');
+ waitForChannelSettingsCondition($page, "window.__played.includes('AUDIO')");
+ $page->script('new Promise((resolve) => setTimeout(resolve, 300))');
+
+ expect($page->script('window.__played'))->not->toContain('PREVIEW');
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a collaborator link shows the link cursor of a link that opens a new tab', function () {
+ fakeChannelSettingsApis();
+ $post = seedChannelSettingsPost(Platform::Instagram, ContentType::InstagramReel);
+ $post->update(['meta' => ['collaborators' => ['alice']]]);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForChannelSettingsTestId($page, 'instagram-collaborator-alice');
+
+ expect($page->script("getComputedStyle(document.querySelector('[data-testid=\"instagram-collaborator-alice\"]')).cursor"))->toBe('alias')
+ ->and($page->script("document.querySelector('[data-testid=\"instagram-collaborator-alice\"]').target"))->toBe('_blank');
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/ComposerPreviewTest.php b/tests/Browser/ComposerPreviewTest.php
index 5f91f9f03..5e6360a5e 100644
--- a/tests/Browser/ComposerPreviewTest.php
+++ b/tests/Browser/ComposerPreviewTest.php
@@ -2,10 +2,12 @@
declare(strict_types=1);
+use App\Models\Post;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Str;
function waitForComposerPreviewTestId(mixed $page, string $testId): void
{
@@ -102,3 +104,77 @@ test('the preview panel lists one labelled card per network and renders each net
$page->assertNoJavaScriptErrors();
});
+
+test('a pdf preview crops the browser viewer frame around the page', function () {
+ Http::fake();
+ [$user] = composerPreviewWorkspace();
+ $linkedin = SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
+ $post = Post::factory()->forAccount($linkedin)->create([
+ 'user_id' => $user->id,
+ 'content' => 'A deck',
+ 'media' => [['id' => (string) Str::uuid(), 'type' => 'document', 'path' => 'medias/deck.pdf', 'url' => 'https://example.com/deck.pdf', 'mime_type' => 'application/pdf', 'original_filename' => 'deck.pdf']],
+ ]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1440, 900);
+ waitForComposerPreviewTestId($page, 'linkedin-preview');
+
+ $crop = $page->script(<<<'JS'
+ (() => {
+ const frame = document.querySelector('[data-testid="linkedin-preview"] [data-testid="preview-media"] > div');
+ const viewer = frame.querySelector('iframe');
+ const outer = frame.getBoundingClientRect();
+ const inner = viewer.getBoundingClientRect();
+
+ return {
+ clipped: getComputedStyle(frame).overflow === 'hidden',
+ left: Math.round(outer.left - inner.left),
+ top: Math.round(outer.top - inner.top),
+ right: Math.round(inner.right - outer.right),
+ bottom: Math.round(inner.bottom - outer.bottom),
+ };
+ })()
+ JS);
+
+ expect($crop)->toBe(['clipped' => true, 'left' => 8, 'top' => 8, 'right' => 8, 'bottom' => 8]);
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the x preview lays two images side by side and three as one tall image beside two', function (int $count) {
+ Http::fake();
+ [$user, $accounts] = composerPreviewWorkspace();
+ $media = collect(range(1, $count))->map(fn (int $index): array => [
+ 'id' => (string) Str::uuid(),
+ 'type' => 'image',
+ 'path' => "medias/photo-{$index}.png",
+ 'url' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==',
+ 'mime_type' => 'image/png',
+ 'original_filename' => "photo-{$index}.png",
+ 'meta' => ['width' => 1200, 'height' => 800],
+ ])->all();
+ $post = Post::factory()->forAccount($accounts['x'])->create(['user_id' => $user->id, 'content' => 'Photos', 'media' => $media]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1440, 900);
+ waitForComposerPreviewTestId($page, 'x-preview');
+
+ $tiles = $page->script(<<<'JS'
+ [...document.querySelectorAll('[data-testid="x-preview"] [data-testid="preview-media"] img')].map((image) => {
+ const box = image.getBoundingClientRect();
+ return [Math.round(box.left), Math.round(box.top), Math.round(box.height)];
+ })
+ JS);
+
+ expect($page->script('document.querySelector(\'[data-testid="x-preview"] [data-testid="preview-media"]\').dataset.layout'))->toBe('grid')
+ ->and($tiles)->toHaveCount($count)
+ ->and($tiles[1][0])->toBeGreaterThan($tiles[0][0])
+ ->and($tiles[1][1])->toBe($tiles[0][1]);
+
+ if ($count === 3) {
+ expect($tiles[2][0])->toBe($tiles[1][0])
+ ->and($tiles[2][1])->toBeGreaterThan($tiles[1][1])
+ ->and($tiles[0][2])->toBeGreaterThan($tiles[1][2]);
+ }
+
+ $page->assertNoJavaScriptErrors();
+})->with([2, 3]);
diff --git a/tests/Browser/ComposerUnsavedChangesTest.php b/tests/Browser/ComposerUnsavedChangesTest.php
new file mode 100644
index 000000000..c7362ebbe
--- /dev/null
+++ b/tests/Browser/ComposerUnsavedChangesTest.php
@@ -0,0 +1,1076 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\Post\ScheduleMode;
+use App\Enums\Post\Status as PostStatus;
+use App\Enums\PostPlatform\ContentType;
+use App\Enums\SocialAccount\Platform;
+use App\Models\Post;
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+use App\Services\Social\Discord\DiscordClient;
+use Illuminate\Support\Facades\Http;
+use Mockery\MockInterface;
+
+function seedUnsavedChangesReel(): Post
+{
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('member'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $account = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::Instagram]);
+ $post = Post::factory()->forAccount($account, ContentType::InstagramReel)->create([
+ 'user_id' => $user->id,
+ 'content' => 'Unsaved changes',
+ 'meta' => [],
+ ]);
+ test()->actingAs($user);
+
+ return $post;
+}
+
+function waitForUnsavedChangesCondition(mixed $page, string $condition): void
+{
+ $page->script(<<<JS
+ (async () => {
+ for (let i = 0; i < 300; i++) {
+ if ({$condition}) return;
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ }
+ })();
+ JS);
+}
+
+function waitForUnsavedChangesTestId(mixed $page, string $testId): void
+{
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"{$testId}\"]')?.getBoundingClientRect().height > 0");
+}
+
+test('closing an edited post without changes asks nothing', function () {
+ $post = seedUnsavedChangesReel();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->click('@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('closing an edited post with unsaved changes asks first, keeps it open on cancel and drops the changes on discard', function () {
+ $post = seedUnsavedChangesReel();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->click('@instagram-share-to-feed')
+ ->click('@composer-close');
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-dialog');
+
+ $page->click('@unsaved-changes-keep');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+ $page->assertVisible('@post-composer-dialog')
+ ->click('@composer-close');
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-discard');
+ $page->click('@unsaved-changes-discard');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@post-composer-dialog')->assertNoJavaScriptErrors();
+ expect($post->fresh()->meta)->toBe([]);
+});
+
+test('saving an edited post closes it without asking', function () {
+ $post = seedUnsavedChangesReel();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->click('@instagram-share-to-feed')
+ ->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@unsaved-changes-dialog')->assertNoJavaScriptErrors();
+ expect(data_get($post->fresh()->meta, 'share_to_feed'))->toBeFalse();
+});
+
+test('after saving an edited post the list shows the saved post and one back leaves it for the page before', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post, route('app.settings.preferences'));
+
+ $page->fill("@composer-caption-{$post->social_account_id}", 'Saved from the composer')
+ ->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]') && !location.search.includes('edit=') && document.querySelector('[data-testid=\"post-card-{$post->id}\"]')?.textContent.includes('Saved from the composer')");
+
+ $page->assertPathIs(unsavedChangesListPath())
+ ->assertSeeIn("@post-card-{$post->id}", 'Saved from the composer');
+ $page->back();
+ waitForUnsavedChangesCondition($page, "location.pathname === '".parse_url(route('app.settings.preferences'), PHP_URL_PATH)."'");
+
+ $page->assertPathIs((string) parse_url(route('app.settings.preferences'), PHP_URL_PATH))
+ ->assertNoJavaScriptErrors();
+ expect($post->fresh()->content)->toContain('Saved from the composer');
+});
+
+test('a query parameter added to the edit entry after it opened still lets one back after saving reach the page before', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post, route('app.settings.preferences'));
+ $page->script("window.history.replaceState(window.history.state, '', window.location.href + '&queue_days=14')");
+
+ $page->fill("@composer-caption-{$post->social_account_id}", 'Saved after a partial reload')
+ ->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]') && !location.search.includes('edit=') && document.querySelector('[data-testid=\"post-card-{$post->id}\"]')?.textContent.includes('Saved after a partial reload')");
+ $page->back();
+ waitForUnsavedChangesCondition($page, "location.pathname === '".parse_url(route('app.settings.preferences'), PHP_URL_PATH)."'");
+
+ $page->assertPathIs((string) parse_url(route('app.settings.preferences'), PHP_URL_PATH))
+ ->assertNoJavaScriptErrors();
+});
+
+test('closing an untouched post with X then one back leaves the list for the page before', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post, route('app.settings.preferences'));
+
+ $page->click('@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]') && !location.search.includes('edit=')");
+ $page->assertPathIs(unsavedChangesListPath())->assertMissing('@unsaved-changes-dialog');
+
+ $page->back();
+ waitForUnsavedChangesCondition($page, "location.pathname === '".parse_url(route('app.settings.preferences'), PHP_URL_PATH)."'");
+
+ $page->assertPathIs((string) parse_url(route('app.settings.preferences'), PHP_URL_PATH))
+ ->assertNoJavaScriptErrors();
+});
+
+test('a post opened by its edit link saves and closes onto the list without stepping back', function (string $leave) {
+ $post = seedUnsavedChangesReel();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->script(<<<'JS'
+ (() => {
+ window.__backs = 0;
+ window.__entries = history.length;
+ const back = window.history.back.bind(window.history);
+ window.history.back = () => { window.__backs++; back(); };
+ })()
+ JS);
+
+ $page->click($leave === 'save' ? '@composer-save-draft' : '@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]') && !location.search.includes('edit=')");
+ $page->script('new Promise((resolve) => setTimeout(resolve, 500))');
+
+ $page->assertPathIs(unsavedChangesListPath())
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertNoJavaScriptErrors();
+ expect($page->script('window.__backs'))->toBe(0)
+ ->and($page->script('history.length === window.__entries'))->toBeTrue();
+})->with(['save', 'close']);
+
+test('after saving a post edited from the calendar, a channel drafts tab or the approvals tab, it lands back there and one back reaches the page before', function (string $from) {
+ $post = seedUnsavedChangesReel();
+ $account = $post->socialAccount;
+ $state = match ($from) {
+ 'calendar' => ['status' => PostStatus::Scheduled, 'schedule_mode' => ScheduleMode::Custom, 'scheduled_at' => now()->addHour()],
+ 'approvals' => ['status' => PostStatus::PendingApproval, 'scheduled_at' => now()->addHour(), 'approval_requested_by' => $post->user_id],
+ default => [],
+ };
+ $post->forceFill($state)->saveQuietly();
+ $list = match ($from) {
+ 'calendar' => route('app.calendar', ['view' => 'week']),
+ 'channel drafts' => route('app.channels.publish', ['account' => $account, 'tab' => 'drafts']),
+ 'approvals' => route('app.posts.index', ['tab' => 'approvals']),
+ };
+ $listPath = (string) parse_url($list, PHP_URL_PATH);
+ $before = (string) parse_url(route('app.settings.preferences'), PHP_URL_PATH);
+
+ $page = visit(route('app.settings.preferences'))->resize(1280, 900)->navigate($list);
+ if ($from === 'calendar') {
+ waitForUnsavedChangesTestId($page, "calendar-post-{$post->id}");
+ $page->click("@calendar-post-{$post->id}");
+ }
+ waitForUnsavedChangesTestId($page, "post-edit-{$post->id}");
+ $page->click("@post-edit-{$post->id}");
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+
+ $page->click('@instagram-share-to-feed')
+ ->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+ $page->script('new Promise((resolve) => setTimeout(resolve, 500))');
+ waitForUnsavedChangesCondition($page, "location.pathname === '{$listPath}' && !location.search.includes('edit=')");
+ $page->assertPathIs($listPath)->assertMissing('@unsaved-changes-dialog');
+
+ $page->back();
+ waitForUnsavedChangesCondition($page, "location.pathname === '{$before}'");
+
+ $page->assertPathIs($before)->assertNoJavaScriptErrors();
+ expect(data_get($post->fresh()->meta, 'share_to_feed'))->toBeFalse();
+})->with(['calendar', 'channel drafts', 'approvals']);
+
+test('saving an edited post never moves through history before the saved page lands', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+ $page->script(<<<'JS'
+ (() => {
+ window.__saved = false;
+ window.__backsBeforeSaved = 0;
+ const open = XMLHttpRequest.prototype.open;
+ XMLHttpRequest.prototype.open = function (method, url, ...rest) {
+ if (String(method).toUpperCase() === 'PUT') {
+ this.addEventListener('loadend', () => { window.__saved = true; });
+ }
+ return open.call(this, method, url, ...rest);
+ };
+ const back = window.history.back.bind(window.history);
+ window.history.back = () => {
+ if (!window.__saved) window.__backsBeforeSaved++;
+ back();
+ };
+ })()
+ JS);
+
+ $page->click('@instagram-share-to-feed')
+ ->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+ $page->script('new Promise((resolve) => setTimeout(resolve, 500))');
+
+ expect($page->script('window.__saved'))->toBeTrue()
+ ->and($page->script('window.__backsBeforeSaved'))->toBe(0);
+ expect(data_get($post->fresh()->meta, 'share_to_feed'))->toBeFalse();
+});
+
+test('closing an untouched post of any network asks nothing, even when its settings fill in on their own', function (Platform $platform, ContentType $contentType, array $meta, bool $clickTextFirst) {
+ Http::fake([
+ config('trypost.platforms.pinterest.api').'/boards*' => Http::response(['items' => [['id' => 'board_1', 'name' => 'Ideas']]]),
+ '*' => Http::response([], 200),
+ ]);
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('member'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $workspace->id,
+ 'platform' => $platform,
+ 'access_token' => 'channel-token',
+ 'token_expires_at' => now()->addDays(20),
+ ]);
+ $post = Post::factory()->forAccount($account, $contentType)->create([
+ 'user_id' => $user->id,
+ 'content' => 'Untouched post',
+ 'meta' => $meta,
+ ]);
+ $this->mock(DiscordClient::class, function (MockInterface $discord): void {
+ $discord->shouldReceive('channels')->andReturn([['id' => '111', 'name' => 'general', 'type' => 0]]);
+ $discord->shouldReceive('cachedChannels')->andReturnNull();
+ });
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ if ($clickTextFirst) {
+ waitForUnsavedChangesTestId($page, 'composer-editor-column');
+ $page->script(<<<'JS'
+ (() => {
+ const target = document.querySelector('[data-testid="composer-editor-column"] [contenteditable="true"]') ?? document.querySelector('[data-testid="composer-editor-column"]');
+ const options = { bubbles: true, cancelable: true, pointerType: 'mouse', button: 0 };
+ target.dispatchEvent(new PointerEvent('pointerdown', options));
+ target.dispatchEvent(new PointerEvent('pointerup', options));
+ target.dispatchEvent(new MouseEvent('click', options));
+ })()
+ JS);
+ }
+ waitForUnsavedChangesTestId($page, 'channel-settings-rows');
+ $page->script('new Promise((resolve) => setTimeout(resolve, 1000))');
+ $page->click('@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]') || document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+
+ $page->assertMissing('@unsaved-changes-dialog')
+ ->assertMissing('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+})->with([
+ 'youtube without a title' => [Platform::YouTube, ContentType::YouTubeShort, []],
+ 'pinterest with a board' => [Platform::Pinterest, ContentType::PinterestPin, ['board_id' => 'board_1']],
+ 'tiktok' => [Platform::TikTok, ContentType::TikTokVideo, []],
+ 'google business' => [Platform::GoogleBusiness, ContentType::GoogleBusinessPost, []],
+ 'discord without a channel name' => [Platform::Discord, ContentType::DiscordMessage, ['channel_id' => '111']],
+])->with([
+ 'closed after the settings load' => [false],
+ 'text clicked right away' => [true],
+]);
+
+test('closing an untouched post with media, a time or a queue slot asks nothing', function (ContentType $contentType, array $media, array $schedule) {
+ $post = seedUnsavedChangesReel();
+ $post->forceFill(['content_type' => $contentType, 'media' => $media, ...$schedule])->save();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'channel-settings-rows');
+ $page->script('new Promise((resolve) => setTimeout(resolve, 1000))');
+ $page->click('@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@unsaved-changes-dialog')->assertNoJavaScriptErrors();
+})->with([
+ 'reel video, scheduled' => [ContentType::InstagramReel, [[
+ 'id' => 'video-1', 'type' => 'video', 'path' => 'medias/clip.mp4', 'url' => 'https://example.com/clip.mp4',
+ 'mime_type' => 'video/mp4', 'original_filename' => 'clip.mp4', 'meta' => ['cover_offset_ms' => 1200],
+ ]], ['status' => PostStatus::Scheduled, 'scheduled_at' => now()->addDay()]],
+ 'carousel with tags, draft' => [ContentType::InstagramFeed, [
+ ['id' => 'image-1', 'type' => 'image', 'path' => 'medias/a.jpg', 'url' => 'https://example.com/a.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'a.jpg', 'meta' => ['user_tags' => [['username' => 'alice', 'x' => 0.5, 'y' => 0.5]]]],
+ ['id' => 'image-2', 'type' => 'image', 'path' => 'medias/b.jpg', 'url' => 'https://example.com/b.jpg', 'mime_type' => 'image/jpeg', 'original_filename' => 'b.jpg'],
+ ], []],
+]);
+
+test('switching only the schedule of an edited post asks before closing', function () {
+ $post = seedUnsavedChangesReel();
+ $post->forceFill(['status' => PostStatus::Scheduled, 'scheduled_at' => now()->addDay()])->save();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'composer-schedule-trigger');
+ $page->click('@composer-schedule-trigger');
+ waitForUnsavedChangesTestId($page, 'composer-schedule-more-actions');
+ $page->click('@composer-schedule-more-actions');
+ waitForUnsavedChangesTestId($page, 'composer-schedule-now');
+ $page->click('@composer-schedule-now');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"composer-submit\"]')?.dataset.scheduleMode === 'now'");
+
+ $page->click('@composer-close');
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-dialog');
+
+ $page->assertVisible('@unsaved-changes-dialog')->assertNoJavaScriptErrors();
+});
+
+test('picking a discord channel stores its name for the preview', function () {
+ Http::fake(['*' => Http::response([], 200)]);
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('member'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $account = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::Discord]);
+ $post = Post::factory()->forAccount($account, ContentType::DiscordMessage)->create([
+ 'user_id' => $user->id,
+ 'content' => 'Release notes',
+ 'meta' => [],
+ ]);
+ $this->mock(DiscordClient::class, function (MockInterface $discord): void {
+ $discord->shouldReceive('channels')->andReturn([['id' => '111', 'name' => 'general', 'type' => 0]]);
+ $discord->shouldReceive('cachedChannels')->andReturn([['id' => '111', 'name' => 'general']]);
+ });
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"channel-settings-rows\"] [role=\"combobox\"]:not([disabled])')");
+ $page->assertNoJavaScriptErrors()
+ ->script("document.querySelector('[data-testid=\"channel-settings-rows\"] [role=\"combobox\"]').click()");
+ waitForUnsavedChangesCondition($page, "[...document.querySelectorAll('[role=\"option\"]')].some((option) => option.textContent.includes('general'))");
+ $page->script("[...document.querySelectorAll('[role=\"option\"]')].find((option) => option.textContent.includes('general')).click()");
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"channel-settings-rows\"] [role=\"combobox\"]')?.textContent.includes('general')");
+
+ $page->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ expect($post->fresh()->meta)->toMatchArray(['channel_id' => '111', 'channel_name' => 'general']);
+});
+
+test('following an app link away from an edited post asks first and leaves only on discard', function () {
+ $post = seedUnsavedChangesReel();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->click('@instagram-share-to-feed')
+ ->script("document.querySelector('[data-testid=\"sidebar-logo\"]').click()");
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-dialog');
+
+ $page->assertVisible('@post-composer-dialog')
+ ->click('@unsaved-changes-keep');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+ $page->assertVisible('@post-composer-dialog')
+ ->script("document.querySelector('[data-testid=\"sidebar-logo\"]').click()");
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-discard');
+ $page->click('@unsaved-changes-discard');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@post-composer-dialog')->assertNoJavaScriptErrors();
+ expect($post->fresh()->meta)->toBe([]);
+});
+
+function unsavedChangesListPath(): string
+{
+ return (string) parse_url(route('app.posts.index'), PHP_URL_PATH);
+}
+
+function openUnsavedChangesFromList(Post $post, ?string $from = null, string $readyTestId = 'instagram-share-to-feed'): mixed
+{
+ $list = route('app.posts.index', ['tab' => 'drafts']);
+ $page = $from === null
+ ? visit($list)->resize(1280, 900)
+ : visit($from)->resize(1280, 900)->navigate($list);
+ waitForUnsavedChangesTestId($page, "post-edit-{$post->id}");
+ $page->click("@post-edit-{$post->id}");
+ waitForUnsavedChangesTestId($page, $readyTestId);
+
+ return $page;
+}
+
+test('the browser back button on an edited post asks first, keeps the edit on cancel and goes back on discard', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'false'");
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-dialog');
+
+ $page->assertVisible('@post-composer-dialog')
+ ->click('@unsaved-changes-keep');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+ $page->assertVisible('@post-composer-dialog')
+ ->assertAttribute('@instagram-share-to-feed', 'aria-checked', 'false');
+
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-discard');
+ $page->click('@unsaved-changes-discard');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertPathIs(unsavedChangesListPath())
+ ->assertNoJavaScriptErrors();
+ expect($post->fresh()->meta)->toBe([]);
+});
+
+test('the browser back button on an untouched post closes it without asking', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+
+ $page->back();
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertPathIs(unsavedChangesListPath())
+ ->assertNoJavaScriptErrors();
+ expect($page->script("location.search.includes('edit=')"))->toBeFalse();
+});
+
+test('after saving an edited post the browser back button does not reopen it or ask', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post, route('app.settings.preferences'));
+
+ $page->click('@instagram-share-to-feed')
+ ->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]') && !location.search.includes('edit=')");
+ $page->back();
+ $page->script('new Promise((resolve) => setTimeout(resolve, 800))');
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertPathIs((string) parse_url(route('app.settings.preferences'), PHP_URL_PATH))
+ ->assertNoJavaScriptErrors();
+ expect(data_get($post->fresh()->meta, 'share_to_feed'))->toBeFalse();
+});
+
+test('after discarding an edited post the browser back button does not reopen it or ask', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+
+ $page->click('@instagram-share-to-feed')
+ ->click('@composer-close');
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-discard');
+ $page->click('@unsaved-changes-discard');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+ $page->back();
+ $page->script('new Promise((resolve) => setTimeout(resolve, 800))');
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertNoJavaScriptErrors();
+ expect($post->fresh()->meta)->toBe([]);
+});
+
+test('closing an untouched tiktok post asks nothing when the creator settings turn interactions off', function (Platform $platform, ContentType $contentType, array $meta, string $settledCondition) {
+ Http::fake([
+ config('trypost.platforms.tiktok.api').'/post/publish/creator_info/query/' => Http::response(['data' => [
+ 'creator_nickname' => 'Tik',
+ 'creator_username' => 'tiktoker',
+ 'privacy_level_options' => ['PUBLIC_TO_EVERYONE', 'SELF_ONLY'],
+ 'comment_disabled' => true,
+ 'duet_disabled' => true,
+ 'stitch_disabled' => true,
+ 'max_video_post_duration_sec' => 600,
+ ]]),
+ '*' => Http::response([], 200),
+ ]);
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('member'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $workspace->id,
+ 'platform' => $platform,
+ 'access_token' => 'channel-token',
+ 'token_expires_at' => now()->addDays(20),
+ ]);
+ $post = Post::factory()->forAccount($account, $contentType)->create([
+ 'user_id' => $user->id,
+ 'content' => 'Untouched post',
+ 'meta' => $meta,
+ ]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'channel-settings-rows');
+ waitForUnsavedChangesCondition($page, $settledCondition);
+ $page->click('@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@unsaved-changes-dialog')
+ ->assertMissing('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+})->with([
+ 'tiktok creator turns interactions off' => [Platform::TikTok, ContentType::TikTokVideo, ['allow_comments' => true, 'allow_duet' => true, 'allow_stitch' => true], "document.querySelector('[data-testid=\"tiktok-allow-comments\"]')?.disabled === true"],
+]);
+
+test('a music cover renewed after the post opened does not count as an unsaved change', function () {
+ $pixel = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==';
+ Http::fake([
+ config('trypost.platforms.instagram-facebook.graph_api').'/846373660299207*' => Http::response([
+ 'audio_id' => '846373660299207', 'title' => 'Summer Song', 'cover_artwork_thumbnail_uri' => "{$pixel}#fresh",
+ ]),
+ '*' => Http::response([], 200),
+ ]);
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('member'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $account = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::InstagramFacebook]);
+ $post = Post::factory()->forAccount($account, ContentType::InstagramReel)->create([
+ 'user_id' => $user->id,
+ 'content' => 'Reel with music',
+ 'meta' => ['audio' => ['id' => '846373660299207', 'title' => 'Summer Song', 'cover_url' => $pixel]],
+ ]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-music-selected-cover');
+ $page->script('new Promise((resolve) => setTimeout(resolve, 500))');
+ $page->script("document.querySelector('[data-testid=\"instagram-music-selected-cover\"]').dispatchEvent(new Event('error'))");
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-music-selected-cover\"]')?.getAttribute('src')?.endsWith('#fresh')");
+ $page->assertAttributeContains('@instagram-music-selected-cover', 'src', '#fresh')
+ ->click('@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@unsaved-changes-dialog')
+ ->assertMissing('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('after leaving an edited post through an app link the browser back button returns to the post once', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+
+ $page->click('@instagram-share-to-feed')
+ ->script("document.querySelector('[data-testid=\"sidebar-logo\"]').click()");
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-discard');
+ $page->click('@unsaved-changes-discard');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->assertAttribute('@instagram-share-to-feed', 'aria-checked', 'true');
+
+ $page->back();
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertPathIs(unsavedChangesListPath())
+ ->assertNoJavaScriptErrors();
+});
+
+test('after keeping an edited post on back and then leaving through an app link the browser back button returns to the post once', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'false'");
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-keep');
+ $page->click('@unsaved-changes-keep');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+ $page->script("document.querySelector('[data-testid=\"sidebar-logo\"]').click()");
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-discard');
+ $page->click('@unsaved-changes-discard');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->assertVisible('@post-composer-dialog')
+ ->assertAttribute('@instagram-share-to-feed', 'aria-checked', 'true');
+
+ $page->back();
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertPathIs(unsavedChangesListPath())
+ ->assertNoJavaScriptErrors();
+});
+
+test('saving an edited post after keeping it on back leaves the list page restorable from history', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+ $listPath = unsavedChangesListPath();
+
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'false'");
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-keep');
+ $page->click('@unsaved-changes-keep');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+ $page->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+ $page->script("document.querySelector('[data-testid=\"sidebar-logo\"]').click()");
+ waitForUnsavedChangesCondition($page, "location.pathname !== '{$listPath}'");
+
+ $page->back();
+ waitForUnsavedChangesTestId($page, "post-edit-{$post->id}");
+
+ $page->assertMissing('@unsaved-changes-dialog')
+ ->assertPathIs($listPath);
+ expect($page->script('window.history.state !== null'))->toBeTrue();
+ $page->assertNoJavaScriptErrors();
+});
+
+test('pressing escape on an edited post asks first', function () {
+ $post = seedUnsavedChangesReel();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->click('@instagram-share-to-feed')
+ ->keys('@instagram-share-to-feed', 'Escape');
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-dialog');
+
+ $page->assertVisible('@unsaved-changes-dialog')
+ ->assertVisible('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('closing a new post with text never asks, since it is kept as an autosaved draft', function () {
+ $post = seedUnsavedChangesReel();
+ $account = $post->socialAccount;
+
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'posts-new-post');
+ $page->click('@posts-new-post');
+ waitForUnsavedChangesTestId($page, 'composer-add-account');
+ $page->click('@composer-add-account')
+ ->click("@composer-account-option-{$account->id}")
+ ->fill("@composer-caption-{$account->id}", 'A new idea')
+ ->click('@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@unsaved-changes-dialog')
+ ->assertMissing('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('a discord channel missing from the list shows its stored name and keeps only its id on save', function () {
+ Http::fake(['*' => Http::response([], 200)]);
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('member'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $account = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::Discord]);
+ $post = Post::factory()->forAccount($account, ContentType::DiscordMessage)->create([
+ 'user_id' => $user->id,
+ 'content' => 'Release notes',
+ 'meta' => ['channel_id' => '999', 'channel_name' => 'announcements'],
+ ]);
+ $this->mock(DiscordClient::class, function (MockInterface $discord): void {
+ $discord->shouldReceive('channels')->andReturn([['id' => '111', 'name' => 'general', 'type' => 0]]);
+ $discord->shouldReceive('cachedChannels')->andReturnNull();
+ });
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"channel-settings-rows\"] [role=\"combobox\"]:not([disabled])')?.textContent.includes('announcements')");
+
+ expect($page->script("document.querySelector('[data-testid=\"channel-settings-rows\"] [role=\"combobox\"]').textContent.trim()"))->toBe('#announcements');
+ $page->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertNoJavaScriptErrors();
+ expect($post->fresh()->meta)->toHaveKey('channel_id', '999')
+ ->not->toHaveKey('channel_name');
+});
+
+test('pressing back again while the unsaved changes question is open keeps the edit and still asks', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'false'");
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-dialog');
+ $page->back();
+ $page->script('new Promise((resolve) => setTimeout(resolve, 500))');
+
+ $page->assertVisible('@unsaved-changes-dialog')
+ ->click('@unsaved-changes-keep');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+
+ $page->assertVisible('@post-composer-dialog')
+ ->assertAttribute('@instagram-share-to-feed', 'aria-checked', 'false')
+ ->assertNoJavaScriptErrors();
+});
+
+test('discarding after back closes a post opened straight from a link, with no page to go back to', function () {
+ $post = seedUnsavedChangesReel();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'false'");
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-discard');
+ $page->click('@unsaved-changes-discard');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertVisible('@sidebar-logo')
+ ->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertPathIs(unsavedChangesListPath())
+ ->assertNoJavaScriptErrors();
+ expect($post->fresh()->meta)->toBe([]);
+});
+
+test('the command palette shortcut and the workspace switcher cannot leave an edited post without asking', function () {
+ $post = seedUnsavedChangesReel();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->click('@instagram-share-to-feed');
+ $page->script("window.dispatchEvent(new KeyboardEvent('keydown', { key: 'k', metaKey: true, bubbles: true, cancelable: true }))");
+ $page->assertMissing('@command-palette')
+ ->assertVisible('@post-composer-dialog');
+
+ $switcherCovered = $page->script(<<<'JS'
+ (() => {
+ const menu = document.querySelector('[data-testid="sidebar-workspace-menu"]');
+ const box = menu.getBoundingClientRect();
+
+ return !menu.contains(document.elementFromPoint(box.left + box.width / 2, box.top + box.height / 2));
+ })()
+ JS);
+
+ expect($switcherCovered)->toBeTrue();
+ $page->assertMissing('@sidebar-workspaces-trigger')
+ ->assertVisible('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('clicking outside an edited post asks first', function () {
+ $post = seedUnsavedChangesReel();
+
+ $page = visit(route('app.posts.edit', $post))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+ $page->click('@instagram-share-to-feed');
+ $page->script(<<<'JS'
+ (() => {
+ const outside = document.elementFromPoint(5, 5);
+ const options = { bubbles: true, cancelable: true, clientX: 5, clientY: 5, pointerType: 'mouse', button: 0 };
+ outside.dispatchEvent(new PointerEvent('pointerdown', options));
+ outside.dispatchEvent(new PointerEvent('pointerup', options));
+ outside.dispatchEvent(new MouseEvent('click', options));
+ })()
+ JS);
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-dialog');
+
+ $page->assertVisible('@unsaved-changes-dialog')
+ ->assertVisible('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('the list behind an edited post keeps what a reload brought in after backs, leaving and coming back', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'false'");
+ $arrived = Post::factory()->forAccount($post->socialAccount, ContentType::InstagramReel)->create([
+ 'user_id' => $post->user_id,
+ 'content' => 'Arrived while editing',
+ 'meta' => [],
+ ]);
+ $page->script("document.getElementById('app').__vue_app__.config.globalProperties.\$inertia.reload({ only: ['queue', 'posts', 'counts', 'hasData', 'channels'], reset: ['posts'] })");
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"post-edit-{$arrived->id}\"]')");
+
+ foreach (range(1, 2) as $attempt) {
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-keep');
+ $page->click('@unsaved-changes-keep');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+ }
+ $page->script("document.querySelector('[data-testid=\"sidebar-logo\"]').click()");
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-discard');
+ $page->click('@unsaved-changes-discard');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'instagram-share-to-feed');
+
+ expect($page->script("Boolean(document.querySelector('[data-testid=\"post-edit-{$arrived->id}\"]'))"))->toBeTrue();
+ $page->assertNoJavaScriptErrors();
+});
+
+test('jumping further back in history from an edited post leaves without asking or rewriting history', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post, route('app.settings.preferences'));
+
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'false'");
+ $length = $page->script('window.history.length');
+ $page->script('window.history.go(-2)');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+ $page->script('new Promise((resolve) => setTimeout(resolve, 800))');
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertPathIs(unsavedChangesListPath());
+ expect($page->script('window.history.length'))->toBe($length)
+ ->and($page->script('window.history.state !== null'))->toBeTrue();
+
+ $page->back();
+ waitForUnsavedChangesCondition($page, "location.pathname === '".parse_url(route('app.settings.preferences'), PHP_URL_PATH)."'");
+
+ $page->assertPathIs((string) parse_url(route('app.settings.preferences'), PHP_URL_PATH))
+ ->assertNoJavaScriptErrors();
+});
+
+test('a save that fails validation keeps the edited post open and still asks before closing, then saves once fixed', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post);
+
+ $page->type('@instagram-collaborator-input', 'bad-name!')
+ ->click('@instagram-collaborator-add');
+ waitForUnsavedChangesTestId($page, 'instagram-collaborators-notice');
+ $page->click('@instagram-collaborators-notice-dismiss');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"instagram-collaborators-notice\"]')");
+ $page->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, 'document.body.textContent.includes('.json_encode(__('posts.form.instagram.collaborators.invalid')).')');
+
+ $page->assertSee(__('posts.form.instagram.collaborators.invalid'))
+ ->assertVisible('@post-composer-dialog')
+ ->click('@composer-close');
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-keep');
+ $page->click('@unsaved-changes-keep');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+
+ $page->click('@instagram-collaborator-remove-bad-name!')
+ ->type('@instagram-collaborator-input', 'alice')
+ ->click('@instagram-collaborator-add');
+ waitForUnsavedChangesTestId($page, 'instagram-collaborator-alice');
+ $page->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+ $page->back();
+ $page->script('new Promise((resolve) => setTimeout(resolve, 800))');
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertNoJavaScriptErrors();
+ expect(data_get($post->fresh()->meta, 'collaborators'))->toBe(['alice']);
+});
+
+test('undoing the edit after keeping it on back closes without asking and back leaves the post', function () {
+ $post = seedUnsavedChangesReel();
+ $post->update(['meta' => ['share_to_feed' => true]]);
+ $page = openUnsavedChangesFromList($post, route('app.settings.preferences'));
+
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'false'");
+ $page->back();
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-keep');
+ $page->click('@unsaved-changes-keep');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'true'");
+ $page->script('new Promise((resolve) => setTimeout(resolve, 500))');
+
+ $page->click('@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]') && !location.search.includes('edit=')");
+ $page->assertMissing('@unsaved-changes-dialog')
+ ->assertPathIs(unsavedChangesListPath());
+
+ $page->back();
+ waitForUnsavedChangesCondition($page, "location.pathname === '".parse_url(route('app.settings.preferences'), PHP_URL_PATH)."'");
+
+ $page->assertPathIs((string) parse_url(route('app.settings.preferences'), PHP_URL_PATH))
+ ->assertNoJavaScriptErrors();
+ expect($post->fresh()->meta)->toBe(['share_to_feed' => true]);
+});
+
+test('saving an edited post that was published meanwhile closes it and back does not reopen it', function () {
+ $post = seedUnsavedChangesReel();
+ $page = openUnsavedChangesFromList($post, route('app.settings.preferences'));
+
+ $page->click('@instagram-share-to-feed');
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"instagram-share-to-feed\"]')?.getAttribute('aria-checked') === 'false'");
+ $post->forceFill(['status' => PostStatus::Published, 'published_at' => now()])->save();
+ $page->click('@composer-save-draft');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]') && !location.search.includes('edit=')");
+ $page->back();
+ $page->script('new Promise((resolve) => setTimeout(resolve, 800))');
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog')
+ ->assertPathIs((string) parse_url(route('app.settings.preferences'), PHP_URL_PATH))
+ ->assertNoJavaScriptErrors();
+ expect($post->fresh()->meta)->toBe([]);
+});
+
+test('a tiktok post clicked before its creator settings load asks nothing on close', function () {
+ Http::fake([
+ config('trypost.platforms.tiktok.api').'/post/publish/creator_info/query/' => Http::response(['data' => [
+ 'creator_nickname' => 'Tik',
+ 'creator_username' => 'tiktoker',
+ 'privacy_level_options' => ['PUBLIC_TO_EVERYONE', 'SELF_ONLY'],
+ 'comment_disabled' => true,
+ 'duet_disabled' => true,
+ 'stitch_disabled' => true,
+ 'max_video_post_duration_sec' => 600,
+ ]]),
+ '*' => Http::response([], 200),
+ ]);
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('member'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $workspace->id,
+ 'platform' => Platform::TikTok,
+ 'access_token' => 'channel-token',
+ 'token_expires_at' => now()->addDays(20),
+ ]);
+ $post = Post::factory()->forAccount($account, ContentType::TikTokVideo)->create([
+ 'user_id' => $user->id,
+ 'content' => 'Untouched post',
+ 'meta' => ['allow_comments' => true, 'allow_duet' => true, 'allow_stitch' => true],
+ ]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index', ['tab' => 'drafts']))->resize(1280, 900);
+ waitForUnsavedChangesTestId($page, "post-edit-{$post->id}");
+ $page->script(<<<'JS'
+ (() => {
+ const open = XMLHttpRequest.prototype.open;
+ const send = XMLHttpRequest.prototype.send;
+ XMLHttpRequest.prototype.open = function (method, url, ...rest) {
+ this.__url = String(url);
+ return open.call(this, method, url, ...rest);
+ };
+ XMLHttpRequest.prototype.send = function (body) {
+ if (this.__url.includes('/posts/composer/accounts/')) {
+ setTimeout(() => send.call(this, body), 1500);
+ return;
+ }
+ return send.call(this, body);
+ };
+ })()
+ JS);
+ $page->click("@post-edit-{$post->id}");
+ waitForUnsavedChangesTestId($page, 'composer-editor-column');
+ $page->script(<<<'JS'
+ (() => {
+ const target = document.querySelector('[data-testid="composer-editor-column"] [contenteditable="true"]') ?? document.querySelector('[data-testid="composer-editor-column"]');
+ const options = { bubbles: true, cancelable: true, pointerType: 'mouse', button: 0 };
+ target.dispatchEvent(new PointerEvent('pointerdown', options));
+ target.dispatchEvent(new PointerEvent('pointerup', options));
+ })()
+ JS);
+ expect($page->script("document.querySelector('[data-testid=\"tiktok-allow-comments\"]')?.disabled === true"))->toBeFalse();
+ waitForUnsavedChangesCondition($page, "document.querySelector('[data-testid=\"tiktok-allow-comments\"]')?.disabled === true");
+ $page->click('@composer-close');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]') || document.querySelector('[data-testid=\"unsaved-changes-dialog\"]')");
+
+ $page->assertMissing('@unsaved-changes-dialog')
+ ->assertMissing('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('closing an edited post while a file is still uploading asks first', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('member'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $account = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::LinkedIn]);
+ $post = Post::factory()->forAccount($account, ContentType::LinkedInPost)->create([
+ 'user_id' => $user->id,
+ 'content' => 'Uploading',
+ 'meta' => [],
+ ]);
+ $this->actingAs($user);
+
+ $page = openUnsavedChangesFromList($post, null, "composer-{$account->id}-dropzone");
+ $page->script(<<<'JS'
+ (() => {
+ const open = XMLHttpRequest.prototype.open;
+ const send = XMLHttpRequest.prototype.send;
+ XMLHttpRequest.prototype.open = function (method, url, ...rest) {
+ this.__url = String(url);
+ return open.call(this, method, url, ...rest);
+ };
+ XMLHttpRequest.prototype.send = function (body) {
+ if (this.__url.includes('/media/chunked')) {
+ return;
+ }
+ return send.call(this, body);
+ };
+ })()
+ JS);
+ $png = base64_encode((string) file_get_contents(base_path('tests/fixtures/crop-quadrants.png')));
+ $page->script(<<<JS
+ (() => {
+ const bytes = Uint8Array.from(atob('{$png}'), (character) => character.charCodeAt(0));
+ const input = document.querySelector('[data-testid="composer-{$account->id}-file-input"]');
+ const transfer = new DataTransfer();
+ transfer.items.add(new File([bytes], 'uploading.png', { type: 'image/png' }));
+ input.files = transfer.files;
+ input.dispatchEvent(new Event('change', { bubbles: true }));
+ })()
+ JS);
+ waitForUnsavedChangesTestId($page, "composer-{$account->id}-upload-item");
+ $page->click('@composer-close');
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-dialog');
+
+ $page->assertVisible('@unsaved-changes-dialog')
+ ->click('@unsaved-changes-discard');
+ waitForUnsavedChangesCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ $page->assertMissing('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('manage posting times in the schedule menu of an edited post asks first instead of the browser prompt', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('admin'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $account = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::LinkedIn]);
+ $post = Post::factory()->forAccount($account, ContentType::LinkedInPost)->create([
+ 'user_id' => $user->id,
+ 'content' => 'Queue me',
+ 'meta' => [],
+ ]);
+ $this->actingAs($user);
+
+ $page = openUnsavedChangesFromList($post, null, "composer-caption-{$account->id}");
+ $page->click("@composer-caption-{$account->id}")
+ ->type("@composer-caption-{$account->id}", ' later')
+ ->click('@composer-schedule-trigger');
+ waitForUnsavedChangesTestId($page, 'composer-queue-manage-slots');
+ $page->click('@composer-queue-manage-slots');
+ waitForUnsavedChangesTestId($page, 'unsaved-changes-dialog');
+
+ $page->assertVisible('@unsaved-changes-dialog')
+ ->assertVisible('@post-composer-dialog')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/ConnectChannelDialogTest.php b/tests/Browser/ConnectChannelDialogTest.php
index ed3323f89..5ebfaf65e 100644
--- a/tests/Browser/ConnectChannelDialogTest.php
+++ b/tests/Browser/ConnectChannelDialogTest.php
@@ -213,7 +213,7 @@ function openInstagramConnectStep(): mixed
return $page;
}
-test('the instagram step offers the professional card, links its help, opens the facebook requirements and asks before closing', function () {
+test('the instagram step offers the instagram login and facebook cards side by side, links its help and asks before closing', function () {
$this->actingAs(connectDialogAdmin());
$page = openInstagramConnectStep();
@@ -224,12 +224,48 @@ test('the instagram step offers the professional card, links its help, opens the
->assertSeeIn('@instagram-connect-professional', trans('accounts.instagram_connect.features.automatic.description'))
->assertSeeIn('@instagram-connect-professional', trans('accounts.instagram_connect.features.metrics.description'))
->assertSeeIn('@instagram-connect-standalone', trans('accounts.instagram_connect.connect'))
- ->assertSeeIn('@instagram-connect-facebook', trans('accounts.instagram_connect.facebook_link'))
+ ->assertSeeIn('@instagram-connect-facebook-card', trans('accounts.instagram_connect.facebook_types'))
+ ->assertSeeIn('@instagram-connect-facebook-feature-music', trans('accounts.instagram_connect.features.music.title'))
+ ->assertSeeIn('@instagram-connect-facebook-card', trans('accounts.instagram_facebook_requirements.heading'))
+ ->assertSeeIn('@instagram-connect-facebook', trans('accounts.instagram_facebook_requirements.connect'))
->assertNoJavaScriptErrors();
+ $layout = $page->script(<<<'JS'
+ (() => {
+ const instagram = document.querySelector('[data-testid="instagram-connect-professional"]').getBoundingClientRect();
+ const facebook = document.querySelector('[data-testid="instagram-connect-facebook-card"]').getBoundingClientRect();
+
+ const instagramButton = document.querySelector('[data-testid="instagram-connect-standalone"]').getBoundingClientRect();
+ const facebookButton = document.querySelector('[data-testid="instagram-connect-facebook"]').getBoundingClientRect();
+
+ return {
+ sideBySide: facebook.left >= instagram.right && Math.abs(facebook.top - instagram.top) < 1,
+ sameHeight: Math.abs(facebook.height - instagram.height) < 1,
+ buttonsAligned: Math.abs(facebookButton.top - instagramButton.top) < 1,
+ };
+ })();
+ JS);
+
+ expect($layout)->toBe(['sideBySide' => true, 'sameHeight' => true, 'buttonsAligned' => true]);
+
+ $page->assertSeeIn('@instagram-connect-standalone-requirements', trans('accounts.instagram_connect.convert_hint'))
+ ->assertVisible('@instagram-connect-facebook-requirements')
+ ->click('@instagram-connect-facebook-requirements-toggle');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100 && document.querySelector('[data-testid="instagram-connect-facebook-requirements"]'); i++) {
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ }
+ })()
+ JS);
+ $page->assertMissing('@instagram-connect-facebook-requirements')
+ ->assertVisible('@instagram-connect-standalone-requirements');
+
$dialogText = $page->script('document.querySelector(\'[data-testid="connect-channel-dialog"]\').textContent');
+ $instagramCardText = $page->script('document.querySelector(\'[data-testid="instagram-connect-professional"]\').textContent');
- expect($dialogText)->not->toContain('Personal')->not->toContain('Notification');
+ expect($dialogText)->not->toContain('Notification')
+ ->and($instagramCardText)->not->toContain('Personal');
$page->click('@instagram-connect-help');
waitForConnectDialogTestId($page, 'instagram-connect-help-convert');
@@ -256,21 +292,6 @@ test('the instagram step offers the professional card, links its help, opens the
})();
JS);
- $page->click('@instagram-connect-facebook');
- waitForConnectDialogTestId($page, 'instagram-facebook-requirements');
-
- expect($page->script('window.location.search'))->toBe('');
- $page->assertVisible('@instagram-facebook-requirements')
- ->assertSee(trans('accounts.instagram_facebook_requirements.title'))
- ->assertMissing('@instagram-connect-professional');
-
- $page->click('@connect-channel-back');
- waitForConnectDialogTestId($page, 'instagram-connect-professional');
-
- $page->assertVisible('@instagram-connect-professional')
- ->assertMissing('@instagram-facebook-requirements')
- ->assertNoJavaScriptErrors();
-
$page->click('@dialog-close');
waitForConnectDialogTestId($page, 'connect-channel-exit-confirm');
@@ -292,6 +313,29 @@ test('the instagram step offers the professional card, links its help, opens the
->assertNoJavaScriptErrors();
});
+test('on a phone the instagram step stacks the facebook card under the instagram login card', function () {
+ $this->actingAs(connectDialogAdmin());
+
+ $page = visit(route('app.workspace.channels'))->resize(390, 844);
+ waitForConnectDialogTestId($page, 'channels-empty-connect');
+ $page->click('@channels-empty-connect');
+ waitForConnectDialogTestId($page, 'connect-channel-instagram');
+ $page->click('@connect-channel-instagram');
+ waitForConnectDialogTestId($page, 'instagram-connect-facebook-card');
+
+ $stacked = $page->script(<<<'JS'
+ (() => {
+ const instagram = document.querySelector('[data-testid="instagram-connect-professional"]').getBoundingClientRect();
+ const facebook = document.querySelector('[data-testid="instagram-connect-facebook-card"]').getBoundingClientRect();
+
+ return facebook.top >= instagram.bottom && document.documentElement.scrollWidth <= window.innerWidth;
+ })();
+ JS);
+
+ expect($stacked)->toBeTrue();
+ $page->assertNoJavaScriptErrors();
+});
+
test('connect to instagram leaves for the instagram login', function () {
$this->actingAs(connectDialogAdmin());
stubConnectDialogProviders();
@@ -303,13 +347,11 @@ test('connect to instagram leaves for the instagram login', function () {
$page->assertMissing('@connect-channel-dialog')->assertNoJavaScriptErrors();
});
-test('connect through facebook leaves for the facebook login', function () {
+test('connect through facebook on the instagram step leaves for the facebook login', function () {
$this->actingAs(connectDialogAdmin());
stubConnectDialogProviders();
$page = openInstagramConnectStep();
- $page->click('@instagram-connect-facebook');
- waitForConnectDialogTestId($page, 'instagram-facebook-requirements-connect');
$learnHow = $page->script(<<<'JS'
(() => {
@@ -321,7 +363,7 @@ test('connect through facebook leaves for the facebook login', function () {
expect($learnHow)->toBe(['host' => 'www.facebook.com', 'target' => '_blank']);
- $page->click('@instagram-facebook-requirements-connect');
+ $page->click('@instagram-connect-facebook');
expect(connectDialogReachedProvider($page))->toBe('facebook');
$page->assertMissing('@connect-channel-dialog')->assertNoJavaScriptErrors();
diff --git a/tests/Browser/ConnectConfirmationTest.php b/tests/Browser/ConnectConfirmationTest.php
index 0b13cb341..7f748dd70 100644
--- a/tests/Browser/ConnectConfirmationTest.php
+++ b/tests/Browser/ConnectConfirmationTest.php
@@ -453,3 +453,40 @@ test('the fragment a network appends to the callback is gone once the confirmati
expect($page->script('window.history.state?.page?.url ?? ""'))->not->toContain('#');
$page->assertNoJavaScriptErrors();
})->with(['#_=_']);
+
+test('finish shows its loading state and stays disabled while the connection is saved', function () {
+ $user = connectConfirmAdmin();
+ $this->actingAs($user);
+ connectConfirmFacebookPages();
+
+ $page = visit(route('app.social.facebook.connect', ['return_to' => connectConfirmPath('app.workspace.channels')]))->resize(1280, 900);
+ waitForConnectConfirmTestId($page, 'connect-identities');
+ $page->script(<<<'JS'
+ (() => {
+ const open = XMLHttpRequest.prototype.open;
+ const send = XMLHttpRequest.prototype.send;
+ XMLHttpRequest.prototype.open = function (method, url, ...rest) {
+ this.__method = String(method).toUpperCase();
+ return open.call(this, method, url, ...rest);
+ };
+ XMLHttpRequest.prototype.send = function (body) {
+ if (this.__method === 'POST') {
+ setTimeout(() => send.call(this, body), 1500);
+ return;
+ }
+ return send.call(this, body);
+ };
+ })()
+ JS);
+
+ $page->click('[data-testid="connect-identity-facebook:page-1"]')
+ ->click('@connect-finish');
+
+ expect($page->script(<<<'JS'
+ (() => {
+ const button = document.querySelector('[data-testid="connect-finish"]');
+ return { disabled: button.disabled, loading: !!button.querySelector('.animate-spin') };
+ })()
+ JS))->toBe(['disabled' => true, 'loading' => true]);
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/CreateIdeaEditorTest.php b/tests/Browser/CreateIdeaEditorTest.php
index 80b0c1973..19140e46e 100644
--- a/tests/Browser/CreateIdeaEditorTest.php
+++ b/tests/Browser/CreateIdeaEditorTest.php
@@ -858,3 +858,22 @@ test('the generate ideas dialog keeps its footer on screen at 390px in the form
->and($page->script("document.querySelector('[data-testid=\"ideas-generate-use\"]').getBoundingClientRect().bottom <= window.innerHeight"))->toBeTrue();
$page->assertNoJavaScriptErrors();
});
+
+test('the stage picker search ignores accents and matches each word in any order', function () {
+ [$user, $workspace, $stage] = createIdeaEditorSetup();
+ $stage->update(['name' => 'Revisão final']);
+ $other = $workspace->ideaStages()->whereKeyNot($stage->id)->firstOrFail();
+ $this->actingAs($user);
+
+ $page = visit(route('app.create.ideas.create'));
+ waitForCreateIdeaEditorDialog($page);
+ $page->click('@idea-editor-stage');
+ waitForCreateIdeaEditorTestId($page, 'idea-editor-stage-search');
+ $page->type('@idea-editor-stage-search', 'FINAL revisao');
+ waitForCreateIdeaEditorTestId($page, "idea-editor-stage-option-{$stage->id}");
+
+ $page->assertPresent("@idea-editor-stage-option-{$stage->id}")
+ ->assertMissing("@idea-editor-stage-option-{$other->id}")
+ ->assertMissing('@idea-editor-stage-option-unassigned')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/CreateIdeasBoardTest.php b/tests/Browser/CreateIdeasBoardTest.php
index 255fd271e..3595fc02e 100644
--- a/tests/Browser/CreateIdeasBoardTest.php
+++ b/tests/Browser/CreateIdeasBoardTest.php
@@ -743,3 +743,22 @@ test('dragging a card into a partly loaded column keeps the unloaded ideas in or
$page->assertSeeIn("@idea-column-count-{$stages['done']->id}", '13')
->assertNoJavaScriptErrors();
});
+
+test('the gallery stage filter search ignores accents and matches each word in any order', function () {
+ [$user, $workspace, $stages] = createIdeasBoardSetup();
+ $stages['in_progress']->update(['name' => 'Revisão final']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.create.ideas.index', ['view' => 'gallery']));
+ waitForCreateIdeasBoardTestId($page, 'ideas-filter-stages-filter');
+ $page->click('@ideas-filter-stages-filter');
+ waitForCreateIdeasBoardTestId($page, 'ideas-filter-stages-search');
+ $page->type('@ideas-filter-stages-search', 'FINAL revisao');
+ waitForCreateIdeasBoardCondition($page, "!document.querySelector('[data-testid=\"ideas-filter-stages-option-{$stages['todo']->id}\"]')");
+
+ $page->assertPresent("@ideas-filter-stages-option-{$stages['in_progress']->id}")
+ ->assertMissing("@ideas-filter-stages-option-{$stages['todo']->id}")
+ ->assertMissing("@ideas-filter-stages-option-{$stages['done']->id}")
+ ->assertMissing('@ideas-filter-stages-unassigned')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/ImportedPostCardTest.php b/tests/Browser/ImportedPostCardTest.php
index 382b6f5b3..2b5e5e583 100644
--- a/tests/Browser/ImportedPostCardTest.php
+++ b/tests/Browser/ImportedPostCardTest.php
@@ -137,7 +137,7 @@ test('an imported sent card looks like a sent post and offers only the allowed a
$page->click("@post-card-menu-{$post->id}");
waitForImportedCardTestId($page, "post-card-menu-content-{$post->id}");
- expect(importedCardMenuItems($page, $post->id))->toBe(['post-duplicate', 'post-details-open']);
+ expect(importedCardMenuItems($page, $post->id))->toBe(['post-duplicate', 'post-details-open', 'post-share-link', 'post-copy-link']);
$page->click("@post-details-open-{$post->id}");
waitForImportedCardTestId($page, "post-details-{$post->id}");
diff --git a/tests/Browser/LabelFilterPopoverTest.php b/tests/Browser/LabelFilterPopoverTest.php
index b033a7443..01899bde7 100644
--- a/tests/Browser/LabelFilterPopoverTest.php
+++ b/tests/Browser/LabelFilterPopoverTest.php
@@ -107,3 +107,28 @@ test('the label filter offers to create a label when the workspace has none', fu
$page->assertNoJavaScriptErrors();
});
+
+test('the label filter search ignores accents and hides untagged when it does not match', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['account_id' => $user->account_id, 'user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('admin'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ subscribeAccount($user->account);
+ $promo = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Promoção']);
+ $launch = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Launch']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index', ['tab' => 'drafts']));
+ waitForLabelPopoverTestId($page, 'posts-label-filter');
+ $page->click('@posts-label-filter');
+ waitForLabelPopoverTestId($page, 'posts-label-untagged');
+
+ $page->fill('@posts-label-search', 'promocao')
+ ->assertVisible("@posts-label-option-{$promo->id}")
+ ->assertMissing("@posts-label-option-{$launch->id}")
+ ->assertMissing('@posts-label-untagged')
+ ->fill('@posts-label-search', '')
+ ->assertVisible('@posts-label-untagged')
+ ->assertVisible("@posts-label-option-{$launch->id}")
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/MediaEditorTest.php b/tests/Browser/MediaEditorTest.php
index 89c1b4aa4..4881071c0 100644
--- a/tests/Browser/MediaEditorTest.php
+++ b/tests/Browser/MediaEditorTest.php
@@ -213,6 +213,61 @@ test('one apply saves edits made to several images', function () {
->and($media[1]['meta']['alt_text'])->toBe('Four coloured squares');
});
+test('a tagged person can be moved to a new position on the image', function () {
+ [$post] = seedMediaEditorPost();
+ $page = visit(route('app.posts.edit', $post));
+ openMediaEditor($page, $post->social_account_id);
+
+ $page->click('@media-editor-tags-tab')
+ ->click('@media-editor-tags-start');
+ clickMediaEditorStage($page, 0.25, 0.75);
+ $page->fill('@media-editor-tag-username', 'paulo')
+ ->click('@media-editor-tag-save')
+ ->assertSeeIn('@media-editor-tags-count', '1 / 20')
+ ->click('@media-editor-tags-finish')
+ ->click('@media-editor-tag-move-0')
+ ->assertVisible('@media-editor-tag-move-pill')
+ ->assertVisible('@media-editor-tag-move-hint');
+ clickMediaEditorStage($page, 0.6, 0.3);
+ $page->assertMissing('@media-editor-tag-move-pill')
+ ->assertMissing('@media-editor-tag-form')
+ ->click('@media-editor-apply');
+ saveMediaEditorDraft($page);
+
+ $tags = $post->fresh()->media[0]['meta']['user_tags'];
+ expect($tags)->toHaveCount(1)
+ ->and($tags[0]['username'])->toBe('paulo')
+ ->and($tags[0]['x'])->toEqualWithDelta(0.6, 0.02)
+ ->and($tags[0]['y'])->toEqualWithDelta(0.3, 0.02);
+ $page->assertNoJavaScriptErrors();
+});
+
+test('removing one of several tagged people keeps the others', function () {
+ [$post] = seedMediaEditorPost();
+ $page = visit(route('app.posts.edit', $post));
+ openMediaEditor($page, $post->social_account_id);
+
+ $page->click('@media-editor-tags-tab')
+ ->click('@media-editor-tags-start');
+ clickMediaEditorStage($page, 0.25, 0.75);
+ $page->fill('@media-editor-tag-username', 'alice')
+ ->click('@media-editor-tag-save');
+ clickMediaEditorStage($page, 0.6, 0.3);
+ $page->fill('@media-editor-tag-username', 'bob')
+ ->click('@media-editor-tag-save')
+ ->assertSeeIn('@media-editor-tags-count', '2 / 20')
+ ->click('@media-editor-tags-finish')
+ ->click('@media-editor-tag-remove-0')
+ ->assertSeeIn('@media-editor-tags-count', '1 / 20')
+ ->click('@media-editor-apply');
+ saveMediaEditorDraft($page);
+
+ $tags = $post->fresh()->media[0]['meta']['user_tags'];
+ expect($tags)->toHaveCount(1)
+ ->and($tags[0]['username'])->toBe('bob');
+ $page->assertNoJavaScriptErrors();
+});
+
test('people tagged on an Instagram image are saved with their position', function () {
[$post] = seedMediaEditorPost();
$page = visit(route('app.posts.edit', $post));
@@ -227,6 +282,8 @@ test('people tagged on an Instagram image are saved with their position', functi
->fill('@media-editor-tag-username', '@paulo.castellano')
->click('@media-editor-tag-save')
->assertVisible('@media-editor-tag-0')
+ ->assertAttribute('@media-editor-tag-link-0', 'href', 'https://www.instagram.com/paulo.castellano/')
+ ->assertAttribute('@media-editor-tag-link-0', 'target', '_blank')
->click('@media-editor-apply');
saveMediaEditorDraft($page);
diff --git a/tests/Browser/PostComposerDialogTest.php b/tests/Browser/PostComposerDialogTest.php
index e507f5842..1b59eef27 100644
--- a/tests/Browser/PostComposerDialogTest.php
+++ b/tests/Browser/PostComposerDialogTest.php
@@ -157,7 +157,10 @@ test('posts channel filter keeps accounts distinct and persists across tabs', fu
waitForComposerCondition($page, "document.querySelector('[data-testid=\"posts-channel-search\"]')?.getBoundingClientRect().height > 0");
}
- $page->fill('@posts-channel-search', 'first_channel')
+ $page->fill('@posts-channel-search', 'SECOND instagram')
+ ->assertVisible("@posts-channel-option-{$secondInstagram->id}")
+ ->assertMissing("@posts-channel-option-{$firstInstagram->id}")
+ ->fill('@posts-channel-search', 'first_channel')
->assertVisible("@posts-channel-option-{$firstInstagram->id}")
->assertMissing("@posts-channel-option-{$secondInstagram->id}")
->click("@posts-channel-checkbox-{$firstInstagram->id}")
@@ -893,7 +896,9 @@ test('post notes open after creation while the edit dialog still has its AI assi
$page = visit(route('app.posts.index', ['notes' => $post->id, 'note' => $note->id]));
$page->assertVisible("@post-notes-trigger-{$post->id}")
->assertSee('Please review the opening line');
- expect($page->script("document.querySelector('[data-testid=\"post-notes-trigger-{$post->id}\"]').textContent.trim()"))->toBe('');
+ waitForComposerCondition($page, "document.querySelector('[data-note-id=\"{$note->id}\"]')?.classList.contains('bg-primary-subtle')");
+ $page->assertScript("document.querySelector('[data-note-id=\"{$note->id}\"]').classList.contains('bg-primary-subtle')", true);
+ expect($page->script("document.querySelector('[data-testid=\"post-notes-trigger-{$post->id}\"]').textContent.replace(/\\s+/g, ' ').trim()"))->toBe(__('notes.title').' 1');
$layout = $page->script(<<<'JS'
(() => {
@@ -903,14 +908,14 @@ test('post notes open after creation while the edit dialog still has its AI assi
return {
grid: getComputedStyle(row).display,
- notesBesideCard: notes.left >= card.right,
+ notesInsideCard: notes.left >= card.left && notes.right <= card.right,
hasTable: Boolean(document.querySelector('#posts-body table')),
};
})()
JS);
expect($layout)->toEqual([
'grid' => 'grid',
- 'notesBesideCard' => true,
+ 'notesInsideCard' => true,
'hasTable' => false,
]);
@@ -1380,3 +1385,61 @@ test('the composer channel search finds channels by network name, even one witho
->assertMissing("@composer-account-option-{$linkedin->id}")
->assertNoJavaScriptErrors();
});
+
+test('the channel search ignores accents and matches each word in any field', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('admin'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::Instagram, 'display_name' => 'São Paulo Café', 'username' => 'spcafe']);
+ $x = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::X, 'display_name' => 'Agência Norte', 'username' => 'norte']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.create'));
+ waitForComposerReady($page);
+ $page->click('@composer-add-account')
+ ->fill('@composer-account-search', 'sao paulo')
+ ->assertVisible("@composer-account-option-{$instagram->id}")
+ ->assertMissing("@composer-account-option-{$x->id}")
+ ->fill('@composer-account-search', 'agencia x')
+ ->assertVisible("@composer-account-option-{$x->id}")
+ ->assertMissing("@composer-account-option-{$instagram->id}")
+ ->fill('@composer-account-search', 'cafe x')
+ ->assertMissing("@composer-account-option-{$instagram->id}")
+ ->assertMissing("@composer-account-option-{$x->id}")
+ ->fill('@composer-account-search', '')
+ ->assertVisible("@composer-account-option-{$instagram->id}")
+ ->assertVisible("@composer-account-option-{$x->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('select all picks only the channels the search shows, and the last used shortcut brings back the previous post channels', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('admin'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::Instagram, 'display_name' => 'Studio']);
+ $x = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::X, 'display_name' => 'Studio']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.create'));
+ waitForComposerReady($page);
+ $page->click('@composer-add-account')
+ ->fill('@composer-account-search', 'instagram')
+ ->click('@composer-select-all')
+ ->assertVisible("@composer-account-{$instagram->id}")
+ ->assertMissing("@composer-account-{$x->id}")
+ ->fill('@composer-account-search', '')
+ ->keys('@composer-account-search', 'Escape')
+ ->fill("@composer-caption-{$instagram->id}", 'First post')
+ ->click('@composer-save-draft');
+ waitForComposerCondition($page, "!document.querySelector('[data-testid=\"post-composer-dialog\"]')");
+
+ waitForComposerReady($page, 'posts-new-post');
+ $page->click('@posts-new-post');
+ waitForComposerReady($page, 'composer-last-used');
+ $page->click('@composer-last-used')
+ ->assertVisible("@composer-account-{$instagram->id}")
+ ->assertMissing("@composer-account-{$x->id}")
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/PostNotesTest.php b/tests/Browser/PostNotesTest.php
index 0f44ef00c..c4fb12159 100644
--- a/tests/Browser/PostNotesTest.php
+++ b/tests/Browser/PostNotesTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
use App\Mail\PostNoteAdded;
use App\Models\Post;
use App\Models\PostNote;
+use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
use Illuminate\Support\Facades\Mail;
@@ -52,12 +53,14 @@ test('adding a note from the popover shows it and emails the other members', fun
$page->click("@post-notes-trigger-{$post->id}");
waitForPostNotesTestId($page, 'note-input');
- $page->assertScript('Math.round(document.querySelector("[data-testid=note-input]").getBoundingClientRect().height) === Math.round(document.querySelector("[data-testid=note-send]").getBoundingClientRect().height)', true);
+ $page->assertScript('(() => { const field = document.querySelector("[data-testid=note-composer]").getBoundingClientRect(); const send = document.querySelector("[data-testid=note-send]").getBoundingClientRect(); return Math.abs((field.top + field.height / 2) - (send.top + send.height / 2)) <= 1 && send.right <= field.right; })()', true);
$page->fill('@note-input', 'Please check the @image before Friday');
$page->click('@note-send');
waitForPostNotesTestId($page, 'note-body');
+ $page->assertScript('(() => { const list = document.querySelector("[data-testid=notes-list]"); return list.scrollWidth <= list.clientWidth; })()', true);
+
$page->assertSeeIn('@note-body', 'Please check the @image before Friday')
->assertVisible('@note-actions')
->assertMissing('@note-react')
@@ -94,7 +97,7 @@ test('the note composer enables send only with text and sends on Enter but not S
waitForPostNotesTestId($page, 'notes-empty');
$page->assertVisible('@notes-empty')
- ->assertMissing('@post-notes-count')
+ ->assertMissing("@post-notes-count-{$post->id}")
->assertDisabled('@note-send');
$page->fill('@note-input', ' ');
@@ -114,7 +117,7 @@ test('the note composer enables send only with text and sends on Enter but not S
$page->assertSeeIn('@note-body', 'First line')
->assertValue('@note-input', '')
->assertDisabled('@note-send')
- ->assertSeeIn('@post-notes-count', '1')
+ ->assertSeeIn("@post-notes-count-{$post->id}", '1')
->assertVisible("@post-notes-filled-icon-{$post->id}")
->assertNoJavaScriptErrors();
@@ -169,3 +172,124 @@ test('a note created an hour ago reads as past for a user whose zone is not the
->toBe('an hour ago');
$page->assertNoJavaScriptErrors();
});
+
+test('the notes toggle says whether it shows or hides the notes', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('admin'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $post = Post::factory()->create(['workspace_id' => $workspace->id, 'user_id' => $user->id, 'content' => 'hello team']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index', ['tab' => 'drafts']));
+ waitForPostNotesTestId($page, "post-notes-trigger-{$post->id}");
+
+ $page->hover("@post-notes-trigger-{$post->id}");
+ waitForPostNotesTestId($page, "post-notes-tooltip-{$post->id}");
+ $page->assertSeeIn("@post-notes-tooltip-{$post->id}", __('notes.show'));
+
+ $page->click("@post-notes-trigger-{$post->id}");
+ waitForPostNotesTestId($page, 'note-input');
+ $page->hover('@note-input')->hover("@post-notes-trigger-{$post->id}");
+ waitForPostNotesTestId($page, "post-notes-tooltip-{$post->id}");
+
+ $page->assertSeeIn("@post-notes-tooltip-{$post->id}", __('notes.hide'))
+ ->assertNoJavaScriptErrors();
+});
+
+test('the notes count follows the thread when it opens and when a note is deleted', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('admin'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ $post = Post::factory()->create(['workspace_id' => $workspace->id, 'user_id' => $user->id, 'content' => 'hello team']);
+ PostNote::factory()->create(['post_id' => $post->id, 'user_id' => $user->id, 'body' => 'First']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index', ['tab' => 'drafts']));
+ waitForPostNotesTestId($page, "post-notes-count-{$post->id}");
+ $page->assertSeeIn("@post-notes-count-{$post->id}", '1');
+
+ PostNote::factory()->create(['post_id' => $post->id, 'user_id' => $user->id, 'body' => 'Second']);
+ $page->click("@post-notes-trigger-{$post->id}");
+ waitForPostNotesTestId($page, 'note-body');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100; i++) {
+ if (document.querySelectorAll('[data-testid="note-item"]').length === 2) return;
+ await new Promise((r) => setTimeout(r, 50));
+ }
+ })();
+ JS);
+ $page->assertSeeIn("@post-notes-count-{$post->id}", '2');
+
+ $page->hover('@note-item')->click('@note-actions');
+ waitForPostNotesTestId($page, 'note-delete');
+ $page->click('@note-delete');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100; i++) {
+ if (document.querySelectorAll('[data-testid="note-item"]').length === 1) return;
+ await new Promise((r) => setTimeout(r, 50));
+ }
+ })();
+ JS);
+
+ $page->assertSeeIn("@post-notes-count-{$post->id}", '1')->assertNoJavaScriptErrors();
+});
+
+test('notes open, grow, send, edit and fit the card on every tab, on desktop and on a phone', function (string $tab, string $state, int $width) {
+ Mail::fake();
+
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
+ $workspace->members()->attach($user->id, membershipPivot('admin'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ subscribeAccount($user->account);
+ $account = SocialAccount::factory()->linkedin()->create(['workspace_id' => $workspace->id]);
+ $post = Post::factory()->forAccount($account)->{$state}()->create(['user_id' => $user->id, 'content' => 'hello team']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index', ['tab' => $tab]))->resize($width, 900);
+ waitForPostNotesTestId($page, "post-notes-trigger-{$post->id}");
+ $page->click("@post-notes-trigger-{$post->id}");
+ waitForPostNotesTestId($page, 'note-input');
+
+ $singleLine = $page->script("document.querySelector('[data-testid=\"note-input\"]').getBoundingClientRect().height");
+ $page->fill('@note-input', "First line\nSecond line\nThird line");
+ $grown = $page->script("document.querySelector('[data-testid=\"note-input\"]').getBoundingClientRect().height");
+ expect($grown)->toBeGreaterThan($singleLine);
+
+ $page->keys('@note-input', ['Enter']);
+ waitForPostNotesTestId($page, 'note-body');
+ $page->assertSeeIn("@post-notes-count-{$post->id}", '1')
+ ->assertScript('document.documentElement.scrollWidth <= window.innerWidth', true);
+
+ $page->hover('@note-item')->click('@note-actions');
+ waitForPostNotesTestId($page, 'note-edit');
+ $page->click('@note-edit');
+ waitForPostNotesTestId($page, 'note-edit-input');
+ $page->fill('@note-edit-input', 'Edited note')
+ ->click('@note-edit-save');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100; i++) {
+ if (!document.querySelector('[data-testid="note-edit-input"]') && document.querySelector('[data-testid="note-body"]')?.textContent.includes('Edited note')) return;
+ await new Promise((r) => setTimeout(r, 50));
+ }
+ })();
+ JS);
+
+ $page->assertSeeIn('@note-body', 'Edited note')
+ ->assertScript('document.documentElement.scrollWidth <= window.innerWidth', true)
+ ->assertNoJavaScriptErrors();
+ expect(PostNote::query()->where('post_id', $post->id)->sole()->body)->toBe('Edited note');
+})->with([
+ 'drafts' => ['drafts', 'draft'],
+ 'queue' => ['queue', 'scheduled'],
+ 'approvals' => ['approvals', 'pendingApproval'],
+ 'sent' => ['sent', 'published'],
+])->with([
+ 'desktop' => [1280],
+ 'phone' => [390],
+]);
diff --git a/tests/Browser/PreferencesPageTest.php b/tests/Browser/PreferencesPageTest.php
index dba9eb1ae..9871b8aa4 100644
--- a/tests/Browser/PreferencesPageTest.php
+++ b/tests/Browser/PreferencesPageTest.php
@@ -112,6 +112,11 @@ test('the language picker suggests the browser language, filters as you type and
$page->assertMissing('@preferences-language-suggestions')
->assertVisible('@preferences-language-option-de');
+ $page->fill('@preferences-language-search', 'francais');
+ waitForPreferencesTestId($page, 'preferences-language-option-fr');
+ $page->assertVisible('@preferences-language-option-fr')
+ ->assertMissing('@preferences-language-option-de');
+
$page->fill('@preferences-language-search', 'Portug');
waitForPreferencesTestId($page, 'preferences-language-option-pt-BR');
$page->assertVisible('@preferences-language-option-pt-BR')
@@ -241,3 +246,48 @@ test('the time format offers two clocks, keeps its value after a language change
$page->assertScript("document.body.innerText.includes('2 PM')", true)
->assertNoJavaScriptErrors();
});
+
+test('the time zone search ignores accents and matches each word typed', function () {
+ $user = preferencesUser(['timezone' => 'UTC']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.settings.preferences'))->withTimezone('UTC');
+ waitForPreferencesTestId($page, 'preferences-timezone-trigger');
+ $page->click('@preferences-timezone-trigger');
+ waitForPreferencesTestId($page, 'preferences-timezone-search');
+
+ $page->type('@preferences-timezone-search', 'sao paulo');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100 && !document.querySelector('[data-testid^="preferences-timezone-option-America-Sao"]'); i++) {
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ }
+ })()
+ JS);
+
+ $page->assertScript('Boolean(document.querySelector(\'[data-testid^="preferences-timezone-option-America-Sao"]\'))', true)
+ ->assertMissing('@preferences-timezone-option-UTC')
+ ->assertNoJavaScriptErrors();
+});
+
+test('the time zone search matches the offset shown next to each zone', function () {
+ $user = preferencesUser(['timezone' => 'UTC']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.settings.preferences'))->withTimezone('UTC');
+ waitForPreferencesTestId($page, 'preferences-timezone-trigger');
+ $page->click('@preferences-timezone-trigger');
+ waitForPreferencesTestId($page, 'preferences-timezone-search');
+
+ $page->type('@preferences-timezone-search', 'gmt-3 paulo');
+ $page->script(<<<'JS'
+ (async () => {
+ for (let i = 0; i < 100 && document.querySelector('[data-testid="preferences-timezone-option-UTC"]'); i++) {
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ }
+ })()
+ JS);
+
+ $page->assertScript('Array.from(document.querySelectorAll(\'[data-testid^="preferences-timezone-option-"]\')).map((option) => option.dataset.testid.replace("preferences-timezone-option-", "")).join(",")', 'America-Sao_Paulo')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/ProfilePasswordRequirementsTest.php b/tests/Browser/ProfilePasswordRequirementsTest.php
new file mode 100644
index 000000000..17d6db3b6
--- /dev/null
+++ b/tests/Browser/ProfilePasswordRequirementsTest.php
@@ -0,0 +1,41 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Models\User;
+
+function waitForProfilePasswordRequirement(mixed $page, string $key, string $met): void
+{
+ $page->script(<<<JS
+ (async () => {
+ const selector = '[data-testid="password-requirement-{$key}"][data-met="{$met}"]';
+ for (let attempt = 0; attempt < 200; attempt++) {
+ const element = document.querySelector(selector);
+ if (element && element.getBoundingClientRect().height > 0) return;
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ }
+ })();
+ JS);
+}
+
+test('setting or changing a password shows the same requirements as sign up', function (bool $hasPassword) {
+ $user = User::factory()->create($hasPassword ? [] : ['password' => null]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.profile.edit', ['tab' => 'login']));
+ waitForProfilePasswordRequirement($page, 'min', 'false');
+
+ $page->assertSeeIn('@password-requirement-min', 'At least 12 characters')
+ ->assertAttribute('@password-requirement-mixed_case', 'data-met', 'false')
+ ->assertAttribute('@password-requirement-number', 'data-met', 'false')
+ ->assertAttribute('@password-requirement-symbol', 'data-met', 'false');
+
+ $page->type('@profile-new-password', 'abcD1!abcdef');
+ waitForProfilePasswordRequirement($page, 'min', 'true');
+
+ $page->assertAttribute('@password-requirement-min', 'data-met', 'true')
+ ->assertAttribute('@password-requirement-mixed_case', 'data-met', 'true')
+ ->assertAttribute('@password-requirement-number', 'data-met', 'true')
+ ->assertAttribute('@password-requirement-symbol', 'data-met', 'true')
+ ->assertNoJavaScriptErrors();
+})->with(['with a password' => true, 'signed up with Google or GitHub' => false]);
diff --git a/tests/Browser/ProfileTabsTest.php b/tests/Browser/ProfileTabsTest.php
new file mode 100644
index 000000000..46834d567
--- /dev/null
+++ b/tests/Browser/ProfileTabsTest.php
@@ -0,0 +1,158 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\User\Theme;
+use App\Models\User;
+use Illuminate\Support\Facades\DB;
+
+function waitForProfileTabsTestId(mixed $page, string $testId): void
+{
+ $page->script(<<<JS
+ (async () => {
+ const selector = '[data-testid="{$testId}"]';
+ for (let attempt = 0; attempt < 200; attempt++) {
+ const element = document.querySelector(selector);
+ if (element && element.getBoundingClientRect().height > 0) return;
+ await new Promise((resolve) => setTimeout(resolve, 50));
+ }
+ })();
+ JS);
+}
+
+test('the profile tabs keep password, login and sessions apart and remember the open tab in the url', function () {
+ $this->actingAs(User::factory()->create());
+
+ $page = visit(route('app.profile.edit'));
+ waitForProfileTabsTestId($page, 'profile-tab-login');
+
+ $page->assertVisible('[data-test="update-profile-button"]')
+ ->assertMissing('@profile-new-password')
+ ->click('@profile-tab-login');
+ waitForProfileTabsTestId($page, 'profile-new-password');
+
+ $page->assertVisible('[data-test="connected-account-google"]')
+ ->assertQueryStringHas('tab', 'login')
+ ->click('@profile-tab-sessions');
+ waitForProfileTabsTestId($page, 'profile-sessions');
+
+ $page->assertQueryStringHas('tab', 'sessions')
+ ->assertMissing('@profile-new-password')
+ ->assertNoJavaScriptErrors();
+});
+
+test('a link to the login tab opens it', function () {
+ $this->actingAs(User::factory()->create());
+
+ $page = visit(route('app.profile.edit', ['tab' => 'login']));
+ waitForProfileTabsTestId($page, 'profile-new-password');
+
+ $page->assertVisible('@profile-new-password')
+ ->assertMissing('[data-test="update-profile-button"]')
+ ->assertNoJavaScriptErrors();
+});
+
+test('the delete account button sits under a neutral warning', function () {
+ $this->actingAs(User::factory()->create());
+
+ $page = visit(route('app.profile.edit'));
+ waitForProfileTabsTestId($page, 'delete-account-warning');
+
+ expect($page->script(<<<'JS'
+ (() => {
+ const warning = document.querySelector('[data-testid="delete-account-warning"]').getBoundingClientRect();
+ const button = document.querySelector('[data-test="delete-user-button"]').getBoundingClientRect();
+ const warningColor = getComputedStyle(document.querySelector('[data-testid="delete-account-warning"]')).backgroundColor;
+ const buttonColor = getComputedStyle(document.querySelector('[data-test="delete-user-button"]')).backgroundColor;
+ return button.top >= warning.bottom && Math.round(button.left) === Math.round(warning.left) && warningColor !== buttonColor;
+ })()
+ JS))->toBeTrue();
+ $page->assertNoJavaScriptErrors();
+});
+
+test('each session shows its browser and system icons under the log out button', function () {
+ config(['session.driver' => 'database']);
+ $user = User::factory()->create();
+ DB::table(config('session.table', 'sessions'))->insert([
+ 'id' => 'firefox-on-windows',
+ 'user_id' => $user->id,
+ 'ip_address' => '203.0.113.7',
+ 'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0',
+ 'payload' => '',
+ 'last_activity' => now()->subHour()->timestamp,
+ ]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.profile.edit', ['tab' => 'sessions']));
+ waitForProfileTabsTestId($page, 'session-browser-icon-firefox-on-windows');
+
+ $page->assertAttribute('@session-browser-icon-firefox-on-windows', 'src', '/images/browsers/firefox.svg')
+ ->assertAttribute('@session-os-icon-firefox-on-windows', 'src', '/images/os/windows.png')
+ ->assertSeeIn('@session-last-activity-firefox-on-windows', 'Last activity 1 hour ago');
+
+ expect($page->script(<<<'JS'
+ (() => {
+ const button = document.querySelector('[data-test="log-out-other-sessions-button"]').getBoundingClientRect();
+ const firstRow = document.querySelector('[data-test="session-row"]').getBoundingClientRect();
+ return button.bottom <= firstRow.top;
+ })()
+ JS))->toBeTrue();
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the apple logo of a mac session turns light on the dark theme', function () {
+ config(['session.driver' => 'database']);
+ $user = User::factory()->create(['theme' => Theme::Dark]);
+ DB::table(config('session.table', 'sessions'))->insert([
+ 'id' => 'safari-on-mac',
+ 'user_id' => $user->id,
+ 'ip_address' => '203.0.113.8',
+ 'user_agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15',
+ 'payload' => '',
+ 'last_activity' => now()->subHour()->timestamp,
+ ]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.profile.edit', ['tab' => 'sessions']));
+ waitForProfileTabsTestId($page, 'session-os-icon-safari-on-mac');
+
+ expect($page->script('getComputedStyle(document.querySelector(\'[data-testid="session-os-icon-safari-on-mac"]\')).filter'))->toBe('invert(1)');
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the github mark turns light on the dark theme while google keeps its colors', function () {
+ $this->actingAs(User::factory()->create(['theme' => Theme::Dark]));
+
+ $page = visit(route('app.profile.edit', ['tab' => 'login']));
+ waitForProfileTabsTestId($page, 'connected-account-icon-github');
+
+ expect($page->script('getComputedStyle(document.querySelector(\'[data-testid="connected-account-icon-github"]\')).filter'))->toBe('invert(1)')
+ ->and($page->script('getComputedStyle(document.querySelector(\'[data-testid="connected-account-icon-google"]\')).filter'))->toBe('none');
+ $page->assertNoJavaScriptErrors();
+});
+
+test('logging out other devices asks for a plain confirmation without a password', function () {
+ config(['session.driver' => 'database']);
+ $user = User::factory()->create();
+ $table = config('session.table', 'sessions');
+ DB::table($table)->insert([
+ ['id' => 'phone', 'user_id' => $user->id, 'ip_address' => '203.0.113.9', 'user_agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1', 'payload' => '', 'last_activity' => now()->subHour()->timestamp],
+ ['id' => 'laptop', 'user_id' => $user->id, 'ip_address' => '203.0.113.10', 'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0', 'payload' => '', 'last_activity' => now()->subDay()->timestamp],
+ ]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.profile.edit', ['tab' => 'sessions']));
+ waitForProfileTabsTestId($page, 'session-browser-icon-phone');
+ $page->click('[data-test="log-out-other-sessions-button"]');
+ waitForProfileTabsTestId($page, 'confirm-log-out-other-sessions');
+
+ expect($page->script('document.querySelectorAll(\'[data-testid="confirm-delete-modal"] input\').length'))->toBe(0);
+
+ $page->click('@confirm-log-out-other-sessions');
+ for ($attempt = 0; $attempt < 50 && DB::table($table)->whereIn('id', ['phone', 'laptop'])->exists(); $attempt++) {
+ $page->script('new Promise((resolve) => setTimeout(resolve, 100))');
+ }
+
+ expect(DB::table($table)->whereIn('id', ['phone', 'laptop'])->exists())->toBeFalse();
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/PublishCardActionsTest.php b/tests/Browser/PublishCardActionsTest.php
index 26cf3d73f..4ae072a1c 100644
--- a/tests/Browser/PublishCardActionsTest.php
+++ b/tests/Browser/PublishCardActionsTest.php
@@ -119,6 +119,7 @@ test('a queued card shows publish now, edit and the menu in order', function ()
JS);
expect($footer)->toBe([
+ "post-notes-trigger-{$queued->id}",
"post-publish-now-{$queued->id}",
"post-edit-{$queued->id}",
"post-card-menu-{$queued->id}",
@@ -268,6 +269,9 @@ test('draft and sent menus only offer the actions valid for their status', funct
expect(cardActionsMenuItems($page, $published->id))->toBe([
'post-duplicate',
'post-details-open',
+ '---',
+ 'post-share-link',
+ 'post-copy-link',
]);
$page->assertMissing("@post-publish-now-{$published->id}")
->assertMissing("@post-copy-id-{$published->id}")
@@ -275,3 +279,42 @@ test('draft and sent menus only offer the actions valid for their status', funct
->assertMissing("@post-edit-{$published->id}")
->assertNoJavaScriptErrors();
});
+
+test('a sent post with a link offers to share it in a new post and to copy it', function () {
+ [$user, $workspace, $channel] = cardActionsSetup();
+ $url = 'https://www.instagram.com/p/DeUigjqFOr_/';
+ $published = Post::factory()->forAccount($channel)->published()->create([
+ 'user_id' => $user->id,
+ 'published_at' => now()->subHour(),
+ ]);
+ $published->forceFill(['platform_url' => $url])->save();
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index', ['tab' => 'sent']));
+ openCardActionsMenu($page, $published->id);
+
+ expect(cardActionsMenuItems($page, $published->id))->toBe([
+ 'post-duplicate',
+ 'post-details-open',
+ '---',
+ 'post-share-link',
+ 'post-copy-link',
+ ]);
+
+ $page->script('window.__copied = null; navigator.clipboard.writeText = async (text) => { window.__copied = text; };');
+ $page->click("@post-copy-link-{$published->id}");
+ waitForCardActionsCondition($page, 'window.__copied !== null');
+ expect($page->script('window.__copied'))->toBe($url);
+
+ openCardActionsMenu($page, $published->id);
+ $page->click("@post-share-link-{$published->id}");
+ waitForCardActionsTestId($page, 'post-composer-dialog');
+ waitForCardActionsTestId($page, "composer-account-{$channel->id}");
+ waitForCardActionsTestId($page, "composer-caption-{$channel->id}");
+
+ $page->assertVisible("@composer-account-{$channel->id}")
+ ->assertValue("@composer-caption-{$channel->id}", $url)
+ ->assertSeeIn('@composer-header', __('posts.create.title'))
+ ->assertDontSeeIn('@composer-header', __('posts.edit.title'))
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/PublishPageTest.php b/tests/Browser/PublishPageTest.php
index 05bb15cd1..770b1cab6 100644
--- a/tests/Browser/PublishPageTest.php
+++ b/tests/Browser/PublishPageTest.php
@@ -8,6 +8,7 @@ use App\Enums\Post\ScheduleMode;
use App\Enums\Post\Status as PostStatus;
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
+use App\Enums\User\Locale;
use App\Models\AnalyticsPublication;
use App\Models\AnalyticsPublicationDailySnapshot;
use App\Models\Post;
@@ -145,7 +146,7 @@ test('a draft is added to the queue from the drafts tab', function () {
$page->assertNoJavaScriptErrors();
});
-test('add to queue is disabled for a draft whose channel has no posting times', function () {
+test('add to queue explains how to set up the queue when the channel has no posting times', function () {
[$user, $workspace] = publishPageSetup();
$channel = SocialAccount::factory()->linkedin()->create([
'workspace_id' => $workspace->id,
@@ -158,9 +159,60 @@ test('add to queue is disabled for a draft whose channel has no posting times',
$page = visit(route('app.channels.publish', ['account' => $channel, 'tab' => 'drafts']));
waitForPublishPageTestId($page, "post-add-to-queue-{$draft->id}");
- $page->assertAttribute("@post-add-to-queue-{$draft->id}", 'disabled', '')
+ $page->assertEnabled("@post-add-to-queue-{$draft->id}")
+ ->click("@post-add-to-queue-{$draft->id}");
+ waitForPublishPageTestId($page, "post-queue-setup-{$draft->id}");
+
+ $page->assertVisible("@post-queue-setup-illustration-{$draft->id}")
+ ->assertSeeIn("@post-queue-setup-{$draft->id}", __('posts.publish.actions.queue_setup.title'))
+ ->assertSeeIn("@post-queue-setup-{$draft->id}", __('posts.publish.actions.queue_setup.body'))
->assertNoJavaScriptErrors();
expect($draft->refresh()->status)->toBe(PostStatus::Draft);
+
+ $page->click("@post-queue-setup-action-{$draft->id}");
+ waitForPublishPageTestId($page, 'channel-settings-page');
+
+ $page->assertPathIs(parse_url(route('app.channels.settings', $channel), PHP_URL_PATH))
+ ->assertNoJavaScriptErrors();
+});
+
+test('a member who cannot manage channels is told to ask an admin for posting times', function () {
+ [$owner, $workspace] = publishPageSetup();
+ $member = User::factory()->create(['account_id' => $owner->account_id, 'current_workspace_id' => $workspace->id]);
+ $workspace->members()->attach($member->id, membershipPivot('member'));
+ $channel = SocialAccount::factory()->linkedin()->create([
+ 'workspace_id' => $workspace->id,
+ 'timezone' => 'UTC',
+ 'posting_schedule' => null,
+ ]);
+ $draft = publishPagePost($owner, $workspace, $channel, ['status' => 'draft', 'queue' => null]);
+ $this->actingAs($member);
+
+ $page = visit(route('app.posts.index', ['tab' => 'drafts']));
+ waitForPublishPageTestId($page, "post-add-to-queue-{$draft->id}");
+ $page->click("@post-add-to-queue-{$draft->id}");
+ waitForPublishPageTestId($page, "post-queue-setup-{$draft->id}");
+
+ $page->assertSeeIn("@post-queue-setup-{$draft->id}", __('posts.publish.actions.queue_setup.body_member'))
+ ->assertMissing("@post-queue-setup-action-{$draft->id}")
+ ->click("@post-queue-setup-not-now-{$draft->id}");
+
+ $page->assertMissing("@post-queue-setup-{$draft->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('add to queue explains where the post goes when the channel has posting times', function () {
+ [$user, $workspace, $channel] = publishPageSetup();
+ $draft = publishPagePost($user, $workspace, $channel, ['status' => 'draft', 'queue' => null]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.channels.publish', ['account' => $channel, 'tab' => 'drafts']));
+ waitForPublishPageTestId($page, "post-add-to-queue-{$draft->id}");
+ $page->hover("@post-add-to-queue-{$draft->id}");
+ waitForPublishPageTestId($page, "post-add-to-queue-tooltip-{$draft->id}");
+
+ $page->assertSeeIn("@post-add-to-queue-tooltip-{$draft->id}", __('posts.publish.actions.add_to_queue_hint'))
+ ->assertNoJavaScriptErrors();
});
test('editing a draft from a channel page keeps the channel page and tab', function () {
@@ -466,8 +518,8 @@ test('the channel page adapts its filters, tabs, calendar link and notes button
expect($page->script($notes))->toBe(['inside' => true, 'beside' => false]);
$page->resize(1280, 800);
- waitForPublishPageScript($page, 'document.querySelector(\'[data-testid^="post-notes-trigger-"]\').getBoundingClientRect().left >= document.querySelector(\'[data-testid^="post-card-"] article\').getBoundingClientRect().right');
- expect($page->script($notes))->toBe(['inside' => false, 'beside' => true]);
+ waitForPublishPageTestId($page, "post-notes-trigger-{$post->id}");
+ expect($page->script($notes))->toBe(['inside' => true, 'beside' => false]);
$page->resize(390, 844);
waitForPublishPageTestId($page, 'publish-tabs-mobile-trigger');
@@ -554,3 +606,63 @@ test('the channel page adapts its filters, tabs, calendar link and notes button
$page->assertNoJavaScriptErrors();
});
+
+test('a draft without a channel shows no add to queue button', function () {
+ [$user, $workspace] = publishPageSetup();
+ $draft = Post::factory()->create([
+ 'workspace_id' => $workspace->id,
+ 'user_id' => $user->id,
+ 'content' => 'Draft without a channel',
+ 'status' => PostStatus::Draft,
+ ]);
+ $draft->forceFill(['social_account_id' => null, 'platform' => null, 'content_type' => null])->save();
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index', ['tab' => 'drafts']));
+ waitForPublishPageTestId($page, "post-card-{$draft->id}");
+
+ $page->assertVisible("@post-card-{$draft->id}")
+ ->assertMissing("@post-add-to-queue-{$draft->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('on a phone the view switch and the new post button fit inside the card, on all channels and on a channel', function (bool $allChannels, string $tab) {
+ [$user, $workspace, $channel] = publishPageSetup();
+ $user->update(['locale' => Locale::from('pt-BR')]);
+ SocialAccount::factory()->instagram()->create(['workspace_id' => $workspace->id]);
+ $this->actingAs($user->fresh());
+
+ $url = $allChannels ? route('app.posts.index', ['tab' => $tab]) : route('app.channels.publish', ['account' => $channel, 'tab' => $tab]);
+ $page = visit($url)->resize(390, 844);
+ waitForPublishPageTestId($page, 'posts-new-post');
+
+ $fits = $page->script(<<<'JS'
+ (() => {
+ const card = document.querySelector('[data-testid="publish-page"]').getBoundingClientRect();
+ return ['posts-new-post', 'schedule-view-calendar'].every((testId) => {
+ const box = document.querySelector(`[data-testid="${testId}"]`).getBoundingClientRect();
+ return box.width > 0 && box.left >= card.left && box.right <= card.right;
+ });
+ })()
+ JS);
+
+ expect($fits)->toBeTrue();
+ $page->assertScript('document.documentElement.scrollWidth <= window.innerWidth', true)
+ ->assertNoJavaScriptErrors();
+})->with([
+ 'all channels' => [true],
+ 'a channel' => [false],
+])->with(['approvals', 'sent']);
+
+test('the reel and story badges on a post card show a 16px icon', function (ContentType $contentType) {
+ [$user, $workspace] = publishPageSetup();
+ $instagram = SocialAccount::factory()->instagram()->create(['workspace_id' => $workspace->id]);
+ $post = Post::factory()->forAccount($instagram, $contentType)->create(['user_id' => $user->id, 'content' => 'Badge']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index', ['tab' => 'drafts']));
+ waitForPublishPageTestId($page, "post-content-type-icon-{$post->id}");
+
+ expect($page->script("(() => { const box = document.querySelector('[data-testid=\"post-content-type-icon-{$post->id}\"]').getBoundingClientRect(); return [Math.round(box.width), Math.round(box.height)]; })()"))->toBe([16, 16]);
+ $page->assertNoJavaScriptErrors();
+})->with([ContentType::InstagramReel, ContentType::InstagramStory]);
diff --git a/tests/Browser/SettingsSidebarTest.php b/tests/Browser/SettingsSidebarTest.php
index 810ffa263..111426752 100644
--- a/tests/Browser/SettingsSidebarTest.php
+++ b/tests/Browser/SettingsSidebarTest.php
@@ -105,7 +105,7 @@ test('settings pages swap the app sidebar for the settings sidebar', function ()
->assertSeeIn('@settings-nav-api-keys', 'API')
->assertDontSeeIn('@settings-nav-api-keys', 'Keys')
->assertPresent('[data-testid="settings-nav-api-keys"] svg.tabler-icon-code')
- ->assertPresent('[data-testid="settings-nav-authentication"] svg.tabler-icon-fingerprint')
+ ->assertMissing('@settings-nav-authentication')
->assertPresent('[data-testid="settings-nav-general"] svg.tabler-icon-building')
->assertPresent('[data-testid="settings-nav-mcp"] svg.tabler-icon-plug')
->assertSeeIn('@settings-sidebar', 'Content')
diff --git a/tests/Browser/WelcomeMcpTest.php b/tests/Browser/WelcomeMcpTest.php
index 71fdcad4d..2270f0eec 100644
--- a/tests/Browser/WelcomeMcpTest.php
+++ b/tests/Browser/WelcomeMcpTest.php
@@ -266,7 +266,7 @@ test('the MCP step opens a dialog with the steps and the app link, and can be sk
expect(welcomeMcpTestIds($page, '[data-testid^=welcome-mcp-benefit-]:not([data-testid*=-icon-])'))->toBe(['welcome-mcp-benefit-ideas', 'welcome-mcp-benefit-schedule', 'welcome-mcp-benefit-queue', 'welcome-mcp-benefit-analytics']);
$page->assertSee('Run your social media from a chat')
- ->assertSeeIn('@welcome-mcp-composer', 'Ask anything')
+ ->assertMissing('@welcome-mcp-composer')
->assertVisible('@welcome-mcp-benefit-schedule')
->assertVisible('@welcome-mcp-benefit-ideas')
->click('@welcome-mcp-benefit-schedule');
@@ -410,11 +410,11 @@ test('on a phone the MCP step keeps the example and connects through an AI picke
expect([
'compact' => $actions['height'] < 120,
'windowAboveFooter' => welcomeMcpRect($page, 'welcome-mcp-window')['bottom'] <= $actions['top'],
- 'composerHidden' => (float) welcomeMcpRect($page, 'welcome-mcp-composer')['height'] === 0.0,
'connectBeforeSkip' => round($skip['top']) === round($connect['top']) && $connect['left'] < $skip['left'],
- ])->toBe(['compact' => true, 'windowAboveFooter' => true, 'composerHidden' => true, 'connectBeforeSkip' => true]);
+ ])->toBe(['compact' => true, 'windowAboveFooter' => true, 'connectBeforeSkip' => true]);
- $page->assertSeeIn('@welcome-mcp-connect-ai', 'Connect your AI')
+ $page->assertMissing('@welcome-mcp-composer')
+ ->assertSeeIn('@welcome-mcp-connect-ai', 'Connect your AI')
->assertVisible('@welcome-mcp-skip-link')
->assertMissing('@welcome-mcp-connect-claude')
->assertMissing('@welcome-mcp-connect-other')
@@ -549,7 +549,7 @@ test('the MCP examples rotate on their own until the user picks a tab', function
$page->click('@welcome-mcp-benefit-queue')
->hover('@welcome-title');
- welcomeMcpPause($page, 9000);
+ welcomeMcpPause($page, 4000);
expect(welcomeMcpSelectedBenefit($page))->toBe('welcome-mcp-benefit-queue');
@@ -584,7 +584,7 @@ test('keyboard focus on the examples pauses the rotation', function () {
waitForWelcomeMcpTestId($page, 'welcome-mcp-benefit-ideas');
welcomeMcpFocus($page, 'welcome-mcp-benefit-ideas');
- welcomeMcpPause($page, 9000);
+ welcomeMcpPause($page, 4000);
expect(welcomeMcpSelectedBenefit($page))->toBe('welcome-mcp-benefit-ideas');
diff --git a/tests/Feature/Api/ApiRouteSweepTest.php b/tests/Feature/Api/ApiRouteSweepTest.php
index c86c1186c..afe9078b8 100644
--- a/tests/Feature/Api/ApiRouteSweepTest.php
+++ b/tests/Feature/Api/ApiRouteSweepTest.php
@@ -46,7 +46,8 @@ function apiSweepMethod(string $name): string
}
/**
- * The route's URI with each parameter replaced by the matching id.
+ * The route's URI with each parameter replaced by the matching id. An Instagram
+ * audio id is numeric by its route constraint, so it always gets a valid one.
*
* @param array<string, string> $ids
*/
@@ -54,6 +55,8 @@ function apiSweepUri(string $name, array $ids, string $fallback = 'not-a-uuid'):
{
$uri = Route::getRoutes()->getByName($name)->uri();
+ $ids = ['audioId' => '17841400000000001', ...$ids];
+
return '/'.preg_replace_callback('/\{([^}?]+)\??\}/', fn (array $match): string => data_get($ids, $match[1], $fallback), $uri);
}
diff --git a/tests/Feature/Api/PostApiPlatformMetaTest.php b/tests/Feature/Api/PostApiPlatformMetaTest.php
index d809b0b4d..9435355c5 100644
--- a/tests/Feature/Api/PostApiPlatformMetaTest.php
+++ b/tests/Feature/Api/PostApiPlatformMetaTest.php
@@ -1273,3 +1273,130 @@ it('rejects more than 24 thread replies', function () {
'meta' => ['thread_replies' => array_fill(0, 25, 'Reply')],
])->assertUnprocessable()->assertJsonValidationErrors(['meta.thread_replies']);
});
+
+it('persists instagram collaborators, trial reel and music', function () {
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::InstagramFacebook]);
+
+ $this->withHeaders($this->headers)->postJson(route('api.posts.store'), [
+ 'content' => 'Reel',
+ 'social_account_id' => $instagram->id,
+ 'content_type' => ContentType::InstagramReel->value,
+ 'meta' => [
+ 'collaborators' => ['@alice', 'bob', 'Alice'],
+ 'trial_graduation' => 'MANUAL',
+ 'audio' => ['id' => '1234567890', 'title' => 'Song', 'artist' => 'Band'],
+ ],
+ ])->assertCreated();
+
+ expect(Post::where('social_account_id', $instagram->id)->sole()->meta)->toEqual([
+ 'collaborators' => ['alice', 'bob'],
+ 'trial_graduation' => 'MANUAL',
+ 'audio' => ['id' => '1234567890', 'title' => 'Song', 'artist' => 'Band'],
+ ]);
+});
+
+it('rejects invalid instagram collaborators and trial reels', function (array $meta, string $error) {
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Instagram]);
+
+ $this->withHeaders($this->headers)->postJson(route('api.posts.store'), [
+ 'content' => 'Reel',
+ 'social_account_id' => $instagram->id,
+ 'content_type' => ContentType::InstagramReel->value,
+ 'meta' => $meta,
+ ])->assertUnprocessable()->assertJsonValidationErrors($error);
+})->with([
+ 'more than three' => [['collaborators' => ['a', 'b', 'c', 'd']], 'meta.collaborators'],
+ 'invalid username' => [['collaborators' => ['not a user']], 'meta.collaborators.0'],
+ 'unknown strategy' => [['trial_graduation' => 'SOMETIMES'], 'meta.trial_graduation'],
+]);
+
+it('rejects publishing instagram music without Facebook and a trial reel with collaborators', function (Platform $platform, array $meta, string $error) {
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => $platform]);
+ $post = Post::factory()->forAccount($instagram, ContentType::InstagramReel)->create([
+ 'user_id' => $this->user->id,
+ 'content' => 'Reel',
+ 'status' => PostStatus::Draft,
+ 'media' => [[
+ 'id' => 'video-1', 'type' => 'video', 'path' => 'medias/video.mp4', 'url' => 'https://example.com/video.mp4',
+ 'mime_type' => 'video/mp4', 'original_filename' => 'video.mp4',
+ ]],
+ 'meta' => $meta,
+ ]);
+
+ $this->withHeaders($this->headers)
+ ->putJson(route('api.posts.update', $post), ['status' => PostStatus::Publishing->value])
+ ->assertUnprocessable()
+ ->assertJsonValidationErrors($error);
+})->with([
+ 'music on instagram login' => [Platform::Instagram, ['audio' => ['id' => '1234567890']], 'meta.audio'],
+ 'music without id' => [Platform::InstagramFacebook, ['audio' => ['title' => 'Song']], 'meta.audio.id'],
+ 'trial with collaborators' => [Platform::InstagramFacebook, ['collaborators' => ['alice'], 'trial_graduation' => 'MANUAL'], 'meta.trial_graduation'],
+]);
+
+it('ignores instagram reel-only meta on a feed post', function (Platform $platform, array $meta) {
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => $platform]);
+ $post = Post::factory()->forAccount($instagram, ContentType::InstagramFeed)->create([
+ 'user_id' => $this->user->id,
+ 'content' => 'Feed post',
+ 'status' => PostStatus::Draft,
+ 'media' => [[
+ 'id' => 'image-1', 'type' => 'image', 'path' => 'medias/photo.jpg', 'url' => 'https://example.com/photo.jpg',
+ 'mime_type' => 'image/jpeg', 'original_filename' => 'photo.jpg',
+ ]],
+ 'meta' => $meta,
+ ]);
+
+ $this->withHeaders($this->headers)
+ ->putJson(route('api.posts.update', $post), [
+ 'status' => PostStatus::Scheduled->value,
+ 'scheduled_at' => now()->addDay()->toIso8601String(),
+ ])
+ ->assertOk();
+
+ expect($post->fresh()->status)->toBe(PostStatus::Scheduled);
+})->with([
+ 'music on instagram login' => [Platform::Instagram, ['audio' => ['id' => '1234567890']]],
+ 'trial with collaborators' => [Platform::InstagramFacebook, ['collaborators' => ['alice'], 'trial_graduation' => 'MANUAL']],
+]);
+
+it('refuses scheduling a new instagram login reel with music, alone and in a batch', function (string $route, array $payload, string $error) {
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Instagram]);
+ $upload = Media::factory()->temporaryUpload($this->workspace)->stored()->video()->create();
+ $destination = [
+ 'social_account_id' => $instagram->id,
+ 'content_type' => ContentType::InstagramReel->value,
+ 'meta' => ['audio' => ['id' => '1234567890']],
+ ];
+
+ $this->withHeaders($this->headers)
+ ->postJson(route($route), [
+ 'content' => 'Reel',
+ 'status' => PostStatus::Scheduled->value,
+ 'scheduled_at' => now()->addDay()->toIso8601String(),
+ 'media' => [['upload_token' => $upload->upload_token]],
+ ...($payload === [] ? $destination : ['destinations' => [$destination]]),
+ ])
+ ->assertUnprocessable()
+ ->assertJsonValidationErrors([$error => __('posts.form.instagram.music.requires_facebook')]);
+
+ expect(Post::query()->where('social_account_id', $instagram->id)->exists())->toBeFalse();
+})->with([
+ 'single post' => ['api.posts.store', [], 'meta.audio'],
+ 'batch' => ['api.posts.batch.store', ['batch' => true], 'destinations.0.meta.audio'],
+]);
+
+it('refuses music volumes outside 0 to 100, a cover that is not a link and a track id that is not numeric', function (array $audio, string $error) {
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::InstagramFacebook]);
+
+ $this->withHeaders($this->headers)->postJson(route('api.posts.store'), [
+ 'content' => 'Reel',
+ 'social_account_id' => $instagram->id,
+ 'content_type' => ContentType::InstagramReel->value,
+ 'meta' => ['audio' => ['id' => '1234567890', ...$audio]],
+ ])->assertUnprocessable()->assertJsonValidationErrors($error);
+})->with([
+ 'music volume above 100' => [['audio_volume' => 101], 'meta.audio.audio_volume'],
+ 'video volume below 0' => [['video_volume' => -1], 'meta.audio.video_volume'],
+ 'cover not a link' => [['cover_url' => 'not a link'], 'meta.audio.cover_url'],
+ 'track id not numeric' => [['id' => 'abc'], 'meta.audio.id'],
+]);
diff --git a/tests/Feature/Auth/ConnectProviderTest.php b/tests/Feature/Auth/ConnectProviderTest.php
index ebc3fb155..8038860dd 100644
--- a/tests/Feature/Auth/ConnectProviderTest.php
+++ b/tests/Feature/Auth/ConnectProviderTest.php
@@ -17,7 +17,7 @@ test('authenticated user can hit the connect-provider route for github', functio
Socialite::shouldReceive('driver')->with('github')->andReturn($driver);
$this->actingAs($user)
- ->get(route('app.authentication.connect-provider', 'github'))
+ ->get(route('app.profile.connected-accounts.connect', 'github'))
->assertRedirect('https://github.com/login/oauth/authorize');
});
@@ -30,7 +30,7 @@ test('authenticated user can hit the connect-provider route for google', functio
Socialite::shouldReceive('driver')->with('google-auth')->andReturn($driver);
$this->actingAs($user)
- ->get(route('app.authentication.connect-provider', 'google'))
+ ->get(route('app.profile.connected-accounts.connect', 'google'))
->assertRedirect('https://accounts.google.com/o/oauth2/auth');
});
@@ -38,7 +38,7 @@ test('connect-provider route rejects unknown provider', function () {
$user = User::factory()->create();
$this->actingAs($user)
- ->get(route('app.authentication.connect-provider', 'twitter'))
+ ->get(route('app.profile.connected-accounts.connect', 'twitter'))
->assertNotFound();
});
@@ -47,12 +47,12 @@ test('connect-provider route 404s when the provider is disabled', function () {
$user = User::factory()->create();
$this->actingAs($user)
- ->get(route('app.authentication.connect-provider', 'github'))
+ ->get(route('app.profile.connected-accounts.connect', 'github'))
->assertNotFound();
});
test('connect-provider route requires authentication', function () {
- $this->get(route('app.authentication.connect-provider', 'github'))
+ $this->get(route('app.profile.connected-accounts.connect', 'github'))
->assertRedirect(route('login'));
});
@@ -74,7 +74,7 @@ test('authenticated callback connects github to the current user', function () {
$this->actingAs($user)
->get(route('auth.github.callback'))
- ->assertRedirect(route('app.authentication.edit'))
+ ->assertRedirect(route('app.profile.edit', ['tab' => 'login']))
->assertSessionHas('flash.success');
expect($user->fresh()->github_id)->toBe('gh-me');
@@ -98,7 +98,7 @@ test('authenticated callback links github by current user, not by email', functi
$this->actingAs($user)
->get(route('auth.github.callback'))
- ->assertRedirect(route('app.authentication.edit'))
+ ->assertRedirect(route('app.profile.edit', ['tab' => 'login']))
->assertSessionHas('flash.success');
expect($user->fresh()->github_id)->toBe('gh-personal');
@@ -122,7 +122,7 @@ test('authenticated callback rejects when github account is already linked to an
$this->actingAs($me)
->get(route('auth.github.callback'))
- ->assertRedirect(route('app.authentication.edit'))
+ ->assertRedirect(route('app.profile.edit', ['tab' => 'login']))
->assertSessionHas('flash.error');
expect($me->fresh()->github_id)->toBeNull();
@@ -147,7 +147,7 @@ test('authenticated callback connects google to the current user', function () {
$this->actingAs($user)
->get(route('auth.google.callback'))
- ->assertRedirect(route('app.authentication.edit'))
+ ->assertRedirect(route('app.profile.edit', ['tab' => 'login']))
->assertSessionHas('flash.success');
expect($user->fresh()->google_id)->toBe('g-me');
@@ -169,7 +169,7 @@ test('authenticated callback rejects when google account is already linked to an
$this->actingAs($me)
->get(route('auth.google.callback'))
- ->assertRedirect(route('app.authentication.edit'))
+ ->assertRedirect(route('app.profile.edit', ['tab' => 'login']))
->assertSessionHas('flash.error');
expect($me->fresh()->google_id)->toBeNull();
diff --git a/tests/Feature/Auth/ListActiveSessionsTest.php b/tests/Feature/Auth/ListActiveSessionsTest.php
new file mode 100644
index 000000000..15c9268cf
--- /dev/null
+++ b/tests/Feature/Auth/ListActiveSessionsTest.php
@@ -0,0 +1,33 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Actions\Auth\ListActiveSessions;
+use App\Models\User;
+use Illuminate\Support\Facades\DB;
+
+test('lists the user sessions, most recent first, flagging the current one', function () {
+ config(['session.driver' => 'database']);
+ $user = User::factory()->create();
+ $otherUser = User::factory()->create();
+ $table = config('session.table', 'sessions');
+
+ DB::table($table)->insert([
+ ['id' => 'older', 'user_id' => $user->id, 'ip_address' => '203.0.113.1', 'user_agent' => 'Firefox', 'payload' => '', 'last_activity' => now()->subDay()->timestamp],
+ ['id' => 'current', 'user_id' => $user->id, 'ip_address' => '203.0.113.2', 'user_agent' => 'Chrome', 'payload' => '', 'last_activity' => now()->timestamp],
+ ['id' => 'someone-else', 'user_id' => $otherUser->id, 'ip_address' => '203.0.113.3', 'user_agent' => 'Safari', 'payload' => '', 'last_activity' => now()->timestamp],
+ ]);
+
+ $sessions = ListActiveSessions::execute($user, 'current');
+
+ expect(array_column($sessions, 'id'))->toBe(['current', 'older'])
+ ->and(array_column($sessions, 'is_current'))->toBe([true, false])
+ ->and($sessions[1])->toMatchArray(['user_agent' => 'Firefox'])
+ ->and($sessions[1])->not->toHaveKey('ip_address');
+});
+
+test('lists nothing when sessions are not kept in the database', function () {
+ config(['session.driver' => 'array']);
+
+ expect(ListActiveSessions::execute(User::factory()->create(), 'any'))->toBe([]);
+});
diff --git a/tests/Feature/Auth/ListConnectedAccountsTest.php b/tests/Feature/Auth/ListConnectedAccountsTest.php
new file mode 100644
index 000000000..4a9cf2027
--- /dev/null
+++ b/tests/Feature/Auth/ListConnectedAccountsTest.php
@@ -0,0 +1,22 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Actions\Auth\ListConnectedAccounts;
+use App\Models\User;
+
+test('lists every provider with whether the user is linked to it', function () {
+ $user = User::factory()->create(['github_id' => 'gh-1', 'google_id' => null]);
+
+ expect(ListConnectedAccounts::execute($user))->toBe([
+ ['provider' => 'google', 'label' => 'Google', 'connected' => false, 'can_disconnect' => false],
+ ['provider' => 'github', 'label' => 'GitHub', 'connected' => true, 'can_disconnect' => true],
+ ]);
+});
+
+test('the only sign-in method of a user without a password cannot be disconnected', function () {
+ $user = User::factory()->create(['password' => null, 'github_id' => 'gh-1', 'google_id' => null]);
+
+ expect(collect(ListConnectedAccounts::execute($user))->firstWhere('provider', 'github'))
+ ->toMatchArray(['connected' => true, 'can_disconnect' => false]);
+});
diff --git a/tests/Feature/Auth/LogoutOtherSessionsTest.php b/tests/Feature/Auth/LogoutOtherSessionsTest.php
new file mode 100644
index 000000000..7862e80db
--- /dev/null
+++ b/tests/Feature/Auth/LogoutOtherSessionsTest.php
@@ -0,0 +1,35 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Actions\Auth\LogoutOtherSessions;
+use App\Models\User;
+use Illuminate\Support\Facades\DB;
+
+test('ends the other sessions of the user and keeps the current one and other users', function () {
+ config(['session.driver' => 'database']);
+ $user = User::factory()->create();
+ $otherUser = User::factory()->create();
+ $table = config('session.table', 'sessions');
+
+ DB::table($table)->insert([
+ ['id' => 'current', 'user_id' => $user->id, 'ip_address' => null, 'user_agent' => null, 'payload' => '', 'last_activity' => now()->timestamp],
+ ['id' => 'phone', 'user_id' => $user->id, 'ip_address' => null, 'user_agent' => null, 'payload' => '', 'last_activity' => now()->timestamp],
+ ['id' => 'someone-else', 'user_id' => $otherUser->id, 'ip_address' => null, 'user_agent' => null, 'payload' => '', 'last_activity' => now()->timestamp],
+ ]);
+
+ LogoutOtherSessions::execute($user, 'current');
+
+ expect(DB::table($table)->orderBy('id')->pluck('id')->all())->toBe(['current', 'someone-else']);
+});
+
+test('touches nothing when sessions are not kept in the database', function () {
+ config(['session.driver' => 'array']);
+ $user = User::factory()->create();
+ $table = config('session.table', 'sessions');
+ DB::table($table)->insert(['id' => 'phone', 'user_id' => $user->id, 'ip_address' => null, 'user_agent' => null, 'payload' => '', 'last_activity' => now()->timestamp]);
+
+ LogoutOtherSessions::execute($user, 'current');
+
+ expect(DB::table($table)->where('id', 'phone')->exists())->toBeTrue();
+});
diff --git a/tests/Feature/Auth/VerificationNotificationTest.php b/tests/Feature/Auth/VerificationNotificationTest.php
index 60e6e0f0f..bf8e56f86 100644
--- a/tests/Feature/Auth/VerificationNotificationTest.php
+++ b/tests/Feature/Auth/VerificationNotificationTest.php
@@ -29,3 +29,20 @@ test('does not send verification notification if email is verified', function ()
Notification::assertNothingSent();
});
+
+test('resending from the profile confirms with a toast instead of a line in the form', function () {
+ Notification::fake();
+
+ $user = User::factory()->unverified()->create();
+
+ $this->actingAs($user)
+ ->from(route('app.profile.edit'))
+ ->post(route('verification.send'))
+ ->assertRedirect(route('app.profile.edit'))
+ ->assertSessionHas('flash.success', __('settings.profile.verification_sent'))
+ ->assertSessionHas('status', 'verification-link-sent');
+
+ $this->actingAs($user)
+ ->get(route('app.profile.edit'))
+ ->assertInertia(fn ($page) => $page->missing('status'));
+});
diff --git a/tests/Feature/Discord/DiscordLookupTest.php b/tests/Feature/Discord/DiscordLookupTest.php
index 5d437f97c..75fd99f42 100644
--- a/tests/Feature/Discord/DiscordLookupTest.php
+++ b/tests/Feature/Discord/DiscordLookupTest.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
+use App\Services\Social\Discord\DiscordClient;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
@@ -134,3 +135,20 @@ test('forbids looking up a discord account in another workspace', function () {
->getJson(route('app.discord.channels', $other->id))
->assertForbidden();
});
+
+test('the cached channel list is read without asking discord, and only after a lookup filled it', function () {
+ Http::fake([
+ config('trypost.platforms.discord.api').'/guilds/111222333/channels' => Http::response([['id' => '1', 'name' => 'general', 'type' => 0]], 200),
+ config('trypost.platforms.discord.api').'/guilds/111222333/roles' => Http::response([['id' => '111222333', 'permissions' => '3072']], 200),
+ config('trypost.platforms.discord.api').'/guilds/111222333/members/*' => Http::response(['roles' => []], 200),
+ ]);
+ $discord = app(DiscordClient::class);
+
+ expect($discord->cachedChannels('111222333'))->toBeNull();
+ Http::assertNothingSent();
+
+ $channels = $discord->channels('111222333');
+
+ expect($discord->cachedChannels('111222333'))->toBe($channels)
+ ->and($channels)->toBe([['id' => '1', 'name' => 'general']]);
+});
diff --git a/tests/Feature/Instagram/InstagramAudioControllerTest.php b/tests/Feature/Instagram/InstagramAudioControllerTest.php
new file mode 100644
index 000000000..5f01fd145
--- /dev/null
+++ b/tests/Feature/Instagram/InstagramAudioControllerTest.php
@@ -0,0 +1,322 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\SocialAccount\Platform;
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+use App\Support\Social\InstagramAudio;
+use Illuminate\Http\Client\Request;
+use Illuminate\Support\Facades\Http;
+
+beforeEach(function () {
+ $this->user = User::factory()->create();
+ $this->workspace = Workspace::factory()->create(['account_id' => $this->user->account_id, 'user_id' => $this->user->id]);
+ $this->workspace->members()->attach($this->user->id, membershipPivot('admin'));
+ $this->user->update(['current_workspace_id' => $this->workspace->id]);
+ $this->user->refresh();
+
+ $this->account = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::InstagramFacebook,
+ 'platform_user_id' => 'ig_1',
+ 'access_token' => 'page-token',
+ ]);
+
+ $this->graph = config('trypost.platforms.instagram-facebook.graph_api');
+});
+
+test('searches instagram music for an account connected through facebook', function () {
+ Http::fake([
+ "{$this->graph}/ig_audio*" => Http::response(['audio' => [[
+ 'audio_id' => '1234567890',
+ 'title' => 'Song',
+ 'display_artist' => 'Band',
+ 'cover_artwork_thumbnail_uri' => 'https://example.com/cover.jpg',
+ 'duration_in_ms' => 30000,
+ 'download_url' => 'https://example.com/preview.mp3',
+ 'audio_type' => 'music',
+ ]]]),
+ ]);
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => 'song']))
+ ->assertOk()
+ ->assertExactJson([[
+ 'id' => '1234567890',
+ 'type' => 'music',
+ 'title' => 'Song',
+ 'artist' => 'Band',
+ 'cover_url' => 'https://example.com/cover.jpg',
+ 'duration_ms' => 30000,
+ 'preview_url' => 'https://example.com/preview.mp3',
+ ]]);
+
+ Http::assertSent(fn (Request $request): bool => str_starts_with($request->url(), "{$this->graph}/ig_audio")
+ && in_array($request['audio_type'], ['music', 'original_sound'], true)
+ && $request['user_id'] === 'ig_1'
+ && $request['search_query'] === 'song'
+ && $request['access_token'] === 'page-token');
+});
+
+test('lists original sounds by their creator when music is unavailable', function () {
+ Http::fake([
+ "{$this->graph}/ig_audio?audio_type=music*" => Http::response(['error' => ['code' => 10]], 400),
+ "{$this->graph}/ig_audio?audio_type=original_sound*" => Http::response(['audio' => [[
+ 'audio_id' => 'sound-1',
+ 'title' => 'Original audio',
+ 'ig_username' => 'creator',
+ 'profile_picture_url' => 'https://example.com/creator.jpg',
+ 'duration_in_ms' => 10000,
+ ]]]),
+ ]);
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', $this->account))
+ ->assertOk()
+ ->assertExactJson([[
+ 'id' => 'sound-1',
+ 'type' => null,
+ 'title' => 'Original audio',
+ 'artist' => 'creator',
+ 'cover_url' => 'https://example.com/creator.jpg',
+ 'duration_ms' => 10000,
+ 'preview_url' => null,
+ ]]);
+});
+
+test('lists trending music without a search', function () {
+ Http::fake(["{$this->graph}/ig_audio*" => Http::response(['audio' => []])]);
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', $this->account))
+ ->assertOk()
+ ->assertExactJson([]);
+
+ Http::assertSent(fn (Request $request): bool => ! str_contains($request->url(), 'search_query'));
+});
+
+test('reports a failed instagram music search', function () {
+ Http::fake(["{$this->graph}/ig_audio*" => Http::response(['error' => ['code' => 10]], 400)]);
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', $this->account))
+ ->assertUnprocessable()
+ ->assertJsonValidationErrors(['q' => __('posts.form.instagram.music.search_failed')]);
+});
+
+test('asks an instagram account connected without facebook to link it', function () {
+ $instagram = SocialAccount::factory()->instagram()->create(['workspace_id' => $this->workspace->id]);
+ Http::fake();
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', $instagram))
+ ->assertUnprocessable()
+ ->assertJsonValidationErrors(['q' => __('posts.form.instagram.music.requires_facebook')]);
+
+ Http::assertNothingSent();
+});
+
+test('offers no audio to an account of another network', function () {
+ $linkedIn = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::LinkedIn]);
+ Http::fake();
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', $linkedIn))->assertNotFound();
+
+ Http::assertNothingSent();
+});
+
+test('serves a repeated search from the cache', function () {
+ Http::fake(["{$this->graph}/ig_audio*" => Http::response(['audio' => [['audio_id' => 'music-1', 'title' => 'Track', 'audio_type' => 'music']]])]);
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => ' Track ']))->assertOk();
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => 'track']))
+ ->assertOk()
+ ->assertJsonPath('0.id', 'music-1')
+ ->assertJsonPath('0.type', 'music');
+
+ Http::assertSentCount(2);
+});
+
+test('searches one catalogue when a type is given', function () {
+ Http::fake(["{$this->graph}/ig_audio*" => Http::response(['audio' => []])]);
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'type' => 'music']))
+ ->assertOk();
+
+ Http::assertSentCount(1);
+ Http::assertSent(fn (Request $request): bool => $request['audio_type'] === 'music');
+});
+
+test('returns one audio asset with fresh links and keeps it for an hour', function () {
+ Http::fake(["{$this->graph}/846373660299207*" => Http::response([
+ 'audio_id' => '846373660299207',
+ 'title' => 'Grudge',
+ 'display_artist' => 'Tash',
+ 'audio_type' => 'music',
+ 'duration_in_ms' => 15000,
+ 'cover_artwork_thumbnail_url' => 'https://example.com/fresh-cover.jpg',
+ 'download_url' => 'https://example.com/fresh-preview.mp4',
+ ])]);
+
+ foreach (range(1, 2) as $attempt) {
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.show', [$this->account, '846373660299207']))
+ ->assertOk()
+ ->assertExactJson([
+ 'id' => '846373660299207',
+ 'type' => 'music',
+ 'title' => 'Grudge',
+ 'artist' => 'Tash',
+ 'cover_url' => 'https://example.com/fresh-cover.jpg',
+ 'duration_ms' => 15000,
+ 'preview_url' => 'https://example.com/fresh-preview.mp4',
+ ]);
+ }
+
+ Http::assertSentCount(1);
+});
+
+test('refuses lookups past the workspace allowance without calling instagram', function () {
+ Http::fake(["{$this->graph}/*" => Http::response(['audio' => []])]);
+
+ foreach (range(1, InstagramAudio::LOOKUPS_PER_MINUTE) as $lookup) {
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => "song {$lookup}"]))->assertOk();
+ }
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => 'one more']))
+ ->assertTooManyRequests()
+ ->assertJsonPath('name', 'rate_limit_exceeded')
+ ->assertHeader('Retry-After');
+
+ Http::assertSentCount(InstagramAudio::LOOKUPS_PER_MINUTE * 2);
+});
+
+test('hides an account from another workspace', function () {
+ $foreign = SocialAccount::factory()->create(['platform' => Platform::InstagramFacebook]);
+ Http::fake();
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', $foreign))
+ ->assertNotFound();
+
+ Http::assertNothingSent();
+});
+
+test('a search keeps only the music naming the searched words, before original sounds', function () {
+ Http::fake([
+ "{$this->graph}/ig_audio?audio_type=music*" => Http::response(['audio' => [
+ ['audio_id' => 'unrelated', 'title' => 'Grudge', 'display_artist' => 'Tash'],
+ ['audio_id' => 'match', 'title' => 'In Da Club', 'display_artist' => '50 Cent'],
+ ]]),
+ "{$this->graph}/ig_audio?audio_type=original_sound*" => Http::response(['audio' => [
+ ['audio_id' => 'sound-1', 'title' => 'Candy Shop 50 Cent', 'ig_username' => 'creator'],
+ ]]),
+ ]);
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => '50 cent']))
+ ->assertOk()
+ ->assertJsonCount(2)
+ ->assertJsonPath('0.id', 'match')
+ ->assertJsonPath('1.id', 'sound-1');
+});
+
+test('an original sound shows its creator picture as the cover', function () {
+ Http::fake([
+ "{$this->graph}/ig_audio?audio_type=music*" => Http::response(['audio' => []]),
+ "{$this->graph}/ig_audio?audio_type=original_sound*" => Http::response(['audio' => [
+ ['audio_id' => 'sound-1', 'title' => 'In Da Club - 50 Cent', 'ig_username' => 'leveviolao'],
+ ]]),
+ "{$this->graph}/sound-1*" => Http::response(['audio_id' => 'sound-1', 'profile_picture_url' => 'https://example.com/leveviolao.jpg']),
+ ]);
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => '50 cent']))
+ ->assertOk()
+ ->assertJsonPath('0.cover_url', 'https://example.com/leveviolao.jpg');
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => '50 cent']))
+ ->assertJsonPath('0.cover_url', 'https://example.com/leveviolao.jpg');
+
+ Http::assertSentCount(3);
+});
+
+test('looks up creator pictures for the first ten original sounds and remembers a failed lookup', function () {
+ $sounds = collect(range(1, 12))->map(fn (int $i): array => ['audio_id' => "sound-{$i}", 'title' => "Sound {$i}", 'ig_username' => "creator{$i}"])->all();
+
+ Http::fake([
+ "{$this->graph}/ig_audio?audio_type=music*" => Http::response(['audio' => []]),
+ "{$this->graph}/ig_audio?audio_type=original_sound*" => Http::response(['audio' => $sounds]),
+ "{$this->graph}/sound-*" => Http::response(['error' => ['code' => 1]], 500),
+ ]);
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => 'sound']))->assertOk();
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => 'sound again']))->assertOk();
+
+ Http::assertSentCount(2 + 10 + 2);
+});
+
+test('keeps a search missing a catalogue for a minute only', function () {
+ Http::fake([
+ "{$this->graph}/ig_audio?audio_type=music*" => Http::response(['error' => ['code' => 2]], 500),
+ "{$this->graph}/ig_audio?audio_type=original_sound*" => Http::response(['audio' => []]),
+ ]);
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => 'song']))->assertOk();
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => 'song']))->assertOk();
+ Http::assertSentCount(2);
+
+ $this->travel(2)->minutes();
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => 'song']))->assertOk();
+ Http::assertSentCount(4);
+});
+
+test('a failed creator picture lookup is skipped only by the account whose lookup failed', function () {
+ $other = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::InstagramFacebook,
+ 'platform_user_id' => 'ig_2',
+ 'access_token' => 'other-page-token',
+ ]);
+
+ Http::fake([
+ "{$this->graph}/ig_audio?audio_type=music*" => Http::response(['audio' => []]),
+ "{$this->graph}/ig_audio?audio_type=original_sound*" => Http::response(['audio' => [['audio_id' => 'sound-1', 'title' => 'Sound', 'ig_username' => 'creator']]]),
+ "{$this->graph}/sound-1*" => Http::sequence()
+ ->push(['error' => ['code' => 190]], 400)
+ ->push(['profile_picture_url' => 'https://example.com/creator.jpg']),
+ ]);
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => 'sound']))
+ ->assertOk()
+ ->assertJsonPath('0.cover_url', null);
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', ['account' => $other, 'q' => 'sound']))
+ ->assertOk()
+ ->assertJsonPath('0.cover_url', 'https://example.com/creator.jpg');
+});
+
+test('a search in a script without latin letters keeps only the music naming it', function (string $query, string $match) {
+ Http::fake([
+ "{$this->graph}/ig_audio?audio_type=music*" => Http::response(['audio' => [
+ ['audio_id' => 'unrelated', 'title' => 'Grudge', 'display_artist' => 'Tash'],
+ ['audio_id' => 'match', 'title' => $match, 'display_artist' => 'Artist'],
+ ]]),
+ "{$this->graph}/ig_audio?audio_type=original_sound*" => Http::response(['audio' => []]),
+ ]);
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.instagram.audio.index', ['account' => $this->account, 'q' => $query]))
+ ->assertOk()
+ ->assertJsonCount(1)
+ ->assertJsonPath('0.id', 'match');
+})->with([
+ 'japanese' => ['夜に駆ける', '夜に駆ける'],
+ 'korean' => ['봄날', '봄날 (Spring Day)'],
+ 'mixed with latin' => ['yoasobi 夜に駆ける', 'YOASOBI - 夜に駆ける'],
+ 'accents' => ['cafe', 'Café Tacvba'],
+]);
diff --git a/tests/Feature/Mcp/PostPlatformMetaToolTest.php b/tests/Feature/Mcp/PostPlatformMetaToolTest.php
index eb4ea2600..43039a3a7 100644
--- a/tests/Feature/Mcp/PostPlatformMetaToolTest.php
+++ b/tests/Feature/Mcp/PostPlatformMetaToolTest.php
@@ -166,20 +166,22 @@ test('update post merges per-platform meta', function () {
$post = Post::factory()->forAccount($this->discordAccount)->create([
'user_id' => $this->user->id,
'status' => PostStatus::Draft,
- 'meta' => ['channel_name' => 'general'],
+ 'meta' => ['channel_id' => '444555666', 'embeds' => [['title' => 'Release']]],
]);
$response = TryPostServer::actingAs($this->user)
->tool(UpdatePostTool::class, [
'post_id' => $post->id,
- 'meta' => ['channel_id' => '444555666'],
+ 'meta' => ['mentions' => [['token' => '@everyone', 'label' => '@everyone']]],
]);
$response->assertOk();
- $meta = $post->fresh()->meta;
- expect($meta['channel_id'])->toBe('444555666')
- ->and($meta['channel_name'])->toBe('general'); // merged, not overwritten
+ expect($post->fresh()->meta)->toMatchArray([
+ 'channel_id' => '444555666',
+ 'embeds' => [['title' => 'Release']],
+ 'mentions' => [['token' => '@everyone', 'label' => '@everyone']],
+ ]);
});
test('publish post rejects a Discord platform without a channel', function () {
@@ -1034,3 +1036,32 @@ test('publishing a youtube post with neither a title nor text is rejected in MCP
->assertHasErrors([__('posts.form.youtube.title_required')]);
Queue::assertNotPushed(PublishPost::class);
});
+
+test('create post persists instagram collaborators and trial reel meta', function () {
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Instagram]);
+
+ TryPostServer::actingAs($this->user)
+ ->tool(CreatePostTool::class, [
+ 'content' => 'Reel',
+ 'social_account_id' => $instagram->id,
+ 'content_type' => ContentType::InstagramReel->value,
+ 'meta' => ['collaborators' => ['@alice'], 'trial_graduation' => 'SS_PERFORMANCE'],
+ ])
+ ->assertOk();
+
+ expect(Post::where('social_account_id', $instagram->id)->sole()->meta)
+ ->toEqual(['collaborators' => ['alice'], 'trial_graduation' => 'SS_PERFORMANCE']);
+});
+
+test('publish post rejects instagram music on an account not connected through Facebook', function () {
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Instagram]);
+ $post = Post::factory()->forAccount($instagram, ContentType::InstagramReel)->create([
+ 'user_id' => $this->user->id,
+ 'status' => PostStatus::Draft,
+ 'meta' => ['audio' => ['id' => '1234567890']],
+ ]);
+
+ TryPostServer::actingAs($this->user)
+ ->tool(PublishPostTool::class, ['post_id' => $post->id])
+ ->assertHasErrors([__('posts.form.instagram.music.requires_facebook')]);
+});
diff --git a/tests/Feature/Parity/ChannelsParityTest.php b/tests/Feature/Parity/ChannelsParityTest.php
index e4dde972a..a27ebd699 100644
--- a/tests/Feature/Parity/ChannelsParityTest.php
+++ b/tests/Feature/Parity/ChannelsParityTest.php
@@ -6,15 +6,19 @@ use App\Enums\SocialAccount\Platform;
use App\Exceptions\PlatformUnavailableException;
use App\Mcp\Servers\TryPostServer;
use App\Mcp\Tools\SocialAccount\CreatePinterestBoardTool;
+use App\Mcp\Tools\SocialAccount\GetInstagramAudioTool;
use App\Mcp\Tools\SocialAccount\ListDiscordChannelsTool;
use App\Mcp\Tools\SocialAccount\ListPinterestBoardsTool;
use App\Mcp\Tools\SocialAccount\ListSocialAccountsTool;
+use App\Mcp\Tools\SocialAccount\SearchInstagramAudioTool;
use App\Models\SocialAccount;
use App\Models\Workspace;
use App\Services\Social\Discord\DiscordClient;
+use App\Support\Social\InstagramAudio;
use Illuminate\Http\Client\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
use Symfony\Component\HttpFoundation\Response;
@@ -40,14 +44,14 @@ test('listing channels returns the same accounts on the api and mcp, including t
->and(collect($api)->firstWhere('id', $first->id)['timezone'])->toBe('America/Sao_Paulo');
});
-test('the api exposes exactly the channel list, boards, discord channels, insights, posting schedule and queue routes', function () {
+test('the api exposes exactly the channel list, boards, instagram audio, discord channels, insights, posting schedule and queue routes', function () {
$apiChannelRoutes = collect(Route::getRoutes()->getRoutesByName())
->keys()
->filter(fn (string $name): bool => str_starts_with($name, 'api.social-accounts') || str_starts_with($name, 'api.channels'))
->values()
->all();
- expect($apiChannelRoutes)->toEqual(['api.social-accounts.index', 'api.social-accounts.boards', 'api.social-accounts.boards.store', 'api.social-accounts.tiktok-creator-info', 'api.social-accounts.channels', 'api.channels.insights.show', 'api.channels.insights.publications', 'api.channels.posting-schedule.show', 'api.channels.posting-schedule.update', 'api.channels.posting-schedule.generate', 'api.channels.posting-schedule.copy', 'api.channels.queue.slots', 'api.channels.queue.order', 'api.channels.queue.slot'])
+ expect($apiChannelRoutes)->toEqual(['api.social-accounts.index', 'api.social-accounts.boards', 'api.social-accounts.boards.store', 'api.social-accounts.tiktok-creator-info', 'api.social-accounts.instagram-audio', 'api.social-accounts.instagram-audio.show', 'api.social-accounts.channels', 'api.channels.insights.show', 'api.channels.insights.publications', 'api.channels.posting-schedule.show', 'api.channels.posting-schedule.update', 'api.channels.posting-schedule.generate', 'api.channels.posting-schedule.copy', 'api.channels.queue.slots', 'api.channels.queue.order', 'api.channels.queue.slot'])
->and(Route::has('app.channels.disconnect'))->toBeTrue()
->and(Route::has('app.channels.posting-schedule.update'))->toBeTrue()
->and(Route::has('app.channels.reorder'))->toBeTrue();
@@ -168,3 +172,126 @@ test('pinterest board creation refuses the same names and accounts on the web, a
Http::assertNotSent(fn (Request $request): bool => str_ends_with($request->url(), '/boards'));
});
+
+test('instagram audio search and details return the same tracks on the web, api and mcp', function () {
+ $graph = config('trypost.platforms.instagram-facebook.graph_api');
+ Http::fake([
+ "{$graph}/ig_audio?audio_type=music*" => Http::response(['audio' => [['audio_id' => '111', 'title' => 'Grudge', 'display_artist' => 'Tash', 'audio_type' => 'music', 'duration_in_ms' => 15000]]]),
+ "{$graph}/ig_audio?audio_type=original_sound*" => Http::response(['audio' => []]),
+ "{$graph}/111*" => Http::response(['audio_id' => '111', 'title' => 'Grudge', 'display_artist' => 'Tash', 'audio_type' => 'music', 'duration_in_ms' => 15000]),
+ ]);
+ $instagram = SocialAccount::factory()->instagram()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::InstagramFacebook]);
+ $track = ['id' => '111', 'type' => 'music', 'title' => 'Grudge', 'artist' => 'Tash', 'cover_url' => null, 'duration_ms' => 15000, 'preview_url' => null];
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', [$instagram, 'q' => 'grudge']))->assertOk()->assertExactJson([$track]);
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.show', [$instagram, '111']))->assertOk()->assertExactJson($track);
+ auth()->forgetGuards();
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio', [$instagram, 'q' => 'grudge']))->assertOk()->assertExactJson([$track]);
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio.show', [$instagram, '111']))->assertOk()->assertExactJson($track);
+ TryPostServer::actingAs($this->user)->tool(SearchInstagramAudioTool::class, ['account_id' => $instagram->id, 'q' => 'grudge'])->assertOk()->assertStructuredContent(['audio' => [$track]]);
+ TryPostServer::actingAs($this->user)->tool(GetInstagramAudioTool::class, ['account_id' => $instagram->id, 'audio_id' => '111'])->assertOk()->assertStructuredContent($track);
+});
+
+test('instagram audio asks an account connected without facebook to link it on the web, api and mcp', function () {
+ $instagram = SocialAccount::factory()->instagram()->create(['workspace_id' => $this->workspace->id]);
+ $message = __('posts.form.instagram.music.requires_facebook');
+ Http::fake();
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', $instagram))->assertUnprocessable()->assertJsonValidationErrors(['q' => $message]);
+ auth()->forgetGuards();
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio', $instagram))->assertUnprocessable()->assertJsonPath('message', $message);
+ TryPostServer::actingAs($this->user)->tool(SearchInstagramAudioTool::class, ['account_id' => $instagram->id])->assertHasErrors([$message]);
+ TryPostServer::actingAs($this->user)->tool(GetInstagramAudioTool::class, ['account_id' => $instagram->id, 'audio_id' => '111'])->assertHasErrors([$message]);
+
+ Http::assertNothingSent();
+});
+
+test('instagram audio says the lookup failed when instagram does not answer on the web, api and mcp', function (string $failure) {
+ $graph = config('trypost.platforms.instagram-facebook.graph_api');
+ Http::fake(["{$graph}/*" => fn () => $failure === 'server error' ? Http::response(['error' => ['message' => 'Boom']], Response::HTTP_INTERNAL_SERVER_ERROR) : Http::failedConnection()]);
+ $instagram = SocialAccount::factory()->instagram()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::InstagramFacebook]);
+ $message = __('posts.form.instagram.music.search_failed');
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', [$instagram, 'q' => 'grudge']))->assertUnprocessable()->assertJsonValidationErrors(['q' => $message]);
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.show', [$instagram, '111']))->assertUnprocessable()->assertJsonValidationErrors(['q' => $message]);
+ auth()->forgetGuards();
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio', [$instagram, 'q' => 'grudge']))->assertStatus(Response::HTTP_BAD_GATEWAY)->assertJsonPath('message', $message);
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio.show', [$instagram, '111']))->assertStatus(Response::HTTP_BAD_GATEWAY)->assertJsonPath('message', $message);
+ TryPostServer::actingAs($this->user)->tool(SearchInstagramAudioTool::class, ['account_id' => $instagram->id, 'q' => 'grudge'])->assertHasErrors([$message]);
+ TryPostServer::actingAs($this->user)->tool(GetInstagramAudioTool::class, ['account_id' => $instagram->id, 'audio_id' => '111'])->assertHasErrors([$message]);
+})->with(['server error', 'failed connection']);
+
+test('instagram audio says the lookup failed for a removed track on the web, api and mcp', function () {
+ $graph = config('trypost.platforms.instagram-facebook.graph_api');
+ Http::fake(["{$graph}/111*" => Http::response(['error' => ['message' => 'Unsupported get request.']], Response::HTTP_NOT_FOUND)]);
+ $instagram = SocialAccount::factory()->instagram()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::InstagramFacebook]);
+ $message = __('posts.form.instagram.music.search_failed');
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.show', [$instagram, '111']))->assertUnprocessable()->assertJsonValidationErrors(['q' => $message]);
+ auth()->forgetGuards();
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio.show', [$instagram, '111']))->assertStatus(Response::HTTP_BAD_GATEWAY)->assertJsonPath('message', $message);
+ TryPostServer::actingAs($this->user)->tool(GetInstagramAudioTool::class, ['account_id' => $instagram->id, 'audio_id' => '111'])->assertHasErrors([$message]);
+});
+
+test('instagram audio refuses an account of another network on the web, api and mcp', function () {
+ $linkedIn = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::LinkedIn]);
+ $apiMessage = 'Instagram audio is only available for Instagram accounts.';
+ $mcpMessage = 'This tool only works with Instagram social accounts.';
+ Http::fake();
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', [$linkedIn, 'q' => 'grudge']))->assertNotFound();
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.show', [$linkedIn, '111']))->assertNotFound();
+ auth()->forgetGuards();
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio', [$linkedIn, 'q' => 'grudge']))->assertUnprocessable()->assertJsonPath('message', $apiMessage);
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio.show', [$linkedIn, '111']))->assertUnprocessable()->assertJsonPath('message', $apiMessage);
+ TryPostServer::actingAs($this->user)->tool(SearchInstagramAudioTool::class, ['account_id' => $linkedIn->id, 'q' => 'grudge'])->assertHasErrors([$mcpMessage]);
+ TryPostServer::actingAs($this->user)->tool(GetInstagramAudioTool::class, ['account_id' => $linkedIn->id, 'audio_id' => '111'])->assertHasErrors([$mcpMessage]);
+
+ Http::assertNothingSent();
+});
+
+test('instagram audio lookups of another workspace are refused on the api and mcp', function () {
+ $foreign = SocialAccount::factory()->instagram()->create(['workspace_id' => Workspace::factory()->create()->id, 'platform' => Platform::InstagramFacebook]);
+ Http::fake();
+
+ auth()->forgetGuards();
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio', $foreign))->assertNotFound();
+ TryPostServer::actingAs($this->user)->tool(SearchInstagramAudioTool::class, ['account_id' => $foreign->id])->assertHasErrors();
+
+ Http::assertNothingSent();
+});
+
+test('instagram audio refuses lookups past the workspace allowance on the api and mcp', function () {
+ $instagram = SocialAccount::factory()->instagram()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::InstagramFacebook]);
+ $message = __('posts.form.instagram.music.too_many_searches');
+ Http::fake();
+
+ foreach (range(1, InstagramAudio::LOOKUPS_PER_MINUTE) as $lookup) {
+ RateLimiter::hit("instagram-audio:{$this->workspace->id}", 60);
+ }
+
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio', [$instagram, 'q' => 'grudge']))
+ ->assertTooManyRequests()
+ ->assertHeader('Retry-After');
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio.show', [$instagram, '111']))
+ ->assertTooManyRequests();
+ TryPostServer::actingAs($this->user)->tool(SearchInstagramAudioTool::class, ['account_id' => $instagram->id, 'q' => 'grudge'])->assertHasErrors([$message]);
+ TryPostServer::actingAs($this->user)->tool(GetInstagramAudioTool::class, ['account_id' => $instagram->id, 'audio_id' => '111'])->assertHasErrors([$message]);
+
+ Http::assertNothingSent();
+});
+
+test('instagram audio refuses an id that is not a number and a search that is too long on the web, api and mcp', function () {
+ $instagram = SocialAccount::factory()->instagram()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::InstagramFacebook]);
+ Http::fake();
+
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.show', [$instagram, 'not-a-number']))->assertNotFound();
+ $this->actingAs($this->user)->getJson(route('app.instagram.audio.index', [$instagram, 'q' => str_repeat('a', 101)]))->assertUnprocessable()->assertJsonValidationErrors('q');
+ auth()->forgetGuards();
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio.show', [$instagram, 'not-a-number']))->assertNotFound();
+ $this->withHeaders(parityApi($this->token))->getJson(route('api.social-accounts.instagram-audio', [$instagram, 'q' => str_repeat('a', 101)]))->assertUnprocessable()->assertJsonValidationErrors('q');
+ TryPostServer::actingAs($this->user)->tool(GetInstagramAudioTool::class, ['account_id' => $instagram->id, 'audio_id' => 'not-a-number'])->assertHasErrors([__('validation.regex', ['attribute' => 'audio id'])]);
+ TryPostServer::actingAs($this->user)->tool(SearchInstagramAudioTool::class, ['account_id' => $instagram->id, 'q' => str_repeat('a', 101)])->assertHasErrors([__('validation.max.string', ['attribute' => 'q', 'max' => 100])]);
+
+ Http::assertNothingSent();
+});
diff --git a/tests/Feature/Parity/DiscordChannelNameParityTest.php b/tests/Feature/Parity/DiscordChannelNameParityTest.php
new file mode 100644
index 000000000..88ce6c23a
--- /dev/null
+++ b/tests/Feature/Parity/DiscordChannelNameParityTest.php
@@ -0,0 +1,185 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Actions\Post\CreatePosts;
+use App\Enums\Post\Status;
+use App\Enums\PostPlatform\ContentType;
+use App\Enums\SocialAccount\Platform;
+use App\Mcp\Servers\TryPostServer;
+use App\Mcp\Tools\Post\CreatePostTool;
+use App\Mcp\Tools\Post\UpdatePostTool;
+use App\Models\Post;
+use App\Models\SocialAccount;
+use App\Services\Social\Discord\DiscordClient;
+use App\Support\PostingSchedule;
+use Illuminate\Support\Facades\Http;
+use Mockery\MockInterface;
+
+beforeEach(function () {
+ ['user' => $this->user, 'workspace' => $this->workspace, 'token' => $this->token] = parityContext();
+ $this->discord = SocialAccount::factory()->discord()->create(['workspace_id' => $this->workspace->id]);
+});
+
+/**
+ * Creates a Discord draft through one surface with only the channel id.
+ *
+ * @param array<string, mixed> $meta
+ */
+function discordChannelNameCreate(string $surface, array $meta): Post
+{
+ $before = Post::query()->pluck('id')->all();
+ $destination = ['social_account_id' => test()->discord->id, 'content_type' => ContentType::DiscordMessage->value, 'meta' => $meta];
+
+ match ($surface) {
+ 'web' => test()->actingAs(test()->user)->post(route('app.posts.store'), ['status' => 'draft', 'content' => 'Release notes', 'destinations' => [$destination]])->assertSessionHasNoErrors(),
+ 'api' => test()->withHeaders(parityApi(test()->token))->postJson(route('api.posts.store'), ['status' => 'draft', 'content' => 'Release notes', ...$destination])->assertCreated(),
+ 'mcp' => TryPostServer::actingAs(test()->user)->tool(CreatePostTool::class, ['status' => 'draft', 'content' => 'Release notes', ...$destination])->assertOk(),
+ };
+
+ return Post::query()->whereNotIn('id', $before)->sole();
+}
+
+/**
+ * @param array<string, mixed> $meta
+ */
+function discordChannelNameUpdate(string $surface, Post $post, array $meta): void
+{
+ $payload = ['status' => Status::Draft->value, 'content' => $post->content, 'content_type' => ContentType::DiscordMessage->value, 'meta' => $meta];
+
+ match ($surface) {
+ 'web' => test()->actingAs(test()->user)->put(route('app.posts.update', $post), [...$payload, 'media' => []])->assertSessionHasNoErrors()->assertRedirect(),
+ 'api' => test()->withHeaders(parityApi(test()->token))->putJson(route('api.posts.update', $post), $payload)->assertOk(),
+ 'mcp' => TryPostServer::actingAs(test()->user)->tool(UpdatePostTool::class, ['post_id' => $post->id, ...$payload])->assertOk(),
+ };
+}
+
+test('a discord post created or edited with only the channel id stores its name on the web, api and mcp', function (string $surface) {
+ $this->mock(DiscordClient::class, function (MockInterface $discord): void {
+ $discord->shouldReceive('cachedChannels')->andReturn([
+ ['id' => '111', 'name' => 'general'],
+ ['id' => '222', 'name' => 'announcements'],
+ ]);
+ $discord->shouldNotReceive('channels');
+ });
+
+ $post = discordChannelNameCreate($surface, ['channel_id' => '111']);
+ expect(data_get($post->meta, 'channel_name'))->toBe('general');
+
+ auth()->forgetGuards();
+ discordChannelNameUpdate($surface, $post, ['channel_id' => '222']);
+ expect(data_get($post->fresh()->meta, 'channel_name'))->toBe('announcements');
+})->with(['web', 'api', 'mcp']);
+
+test('a discord channel name sent by the client is never stored on the web, api and mcp', function (string $surface, ?array $cached, ?string $stored) {
+ $this->mock(DiscordClient::class)->shouldReceive('cachedChannels')->andReturn($cached);
+
+ $post = discordChannelNameCreate($surface, ['channel_id' => '111', 'channel_name' => 'sent-by-client']);
+
+ expect(data_get($post->meta, 'channel_name'))->toBe($stored);
+})->with(['web', 'api', 'mcp'])->with([
+ 'the cached list names the channel' => [[['id' => '111', 'name' => 'general']], 'general'],
+ 'no cached list' => [null, null],
+]);
+
+test('without the channel in the cached list a discord post stores no channel name, even for the same channel', function (string $surface, ?array $cached) {
+ $this->mock(DiscordClient::class, function (MockInterface $discord) use ($cached): void {
+ $discord->shouldReceive('cachedChannels')->andReturn($cached);
+ $discord->shouldNotReceive('channels');
+ });
+ $post = Post::factory()->forAccount($this->discord, ContentType::DiscordMessage)->create([
+ 'user_id' => $this->user->id,
+ 'content' => 'Release notes',
+ 'meta' => ['channel_id' => '999', 'channel_name' => 'old-channel'],
+ ]);
+
+ discordChannelNameUpdate($surface, $post, ['channel_id' => '999', 'channel_name' => 'old-channel']);
+
+ expect($post->fresh()->meta)->toHaveKey('channel_id', '999')
+ ->not->toHaveKey('channel_name');
+})->with(['web', 'api', 'mcp'])->with([
+ 'channel not in the cached list' => [[['id' => '111', 'name' => 'general']]],
+ 'no cached list' => [null],
+]);
+
+test('only discord posts look up a channel name', function () {
+ $this->mock(DiscordClient::class)->shouldNotReceive('cachedChannels');
+ $linkedin = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::LinkedIn]);
+
+ $this->withHeaders(parityApi($this->token))->postJson(route('api.posts.store'), [
+ 'status' => 'draft',
+ 'content' => 'Hello',
+ 'social_account_id' => $linkedin->id,
+ 'content_type' => ContentType::LinkedInPost->value,
+ 'meta' => ['channel_id' => '111'],
+ ])->assertCreated();
+});
+
+test('duplicating a discord post reads its channel name from the cached list without asking discord', function () {
+ $this->mock(DiscordClient::class, function (MockInterface $discord): void {
+ $discord->shouldReceive('cachedChannels')->andReturn([['id' => '111', 'name' => 'general']]);
+ $discord->shouldNotReceive('channels');
+ });
+ $post = Post::factory()->forAccount($this->discord, ContentType::DiscordMessage)->create([
+ 'user_id' => $this->user->id,
+ 'content' => 'Release notes',
+ 'meta' => ['channel_id' => '111', 'channel_name' => 'old-name'],
+ ]);
+
+ $this->actingAs($this->user)->post(route('app.posts.duplicate', $post))->assertRedirect();
+
+ $copy = Post::query()->where('id', '!=', $post->id)->sole();
+ expect($copy->meta)->toMatchArray(['channel_id' => '111', 'channel_name' => 'general']);
+});
+
+test('the channel list the web loads is the one a later save reads the name from', function () {
+ config(['trypost.platforms.discord.bot_token' => 'BOTTOKEN', 'services.discord.client_id' => '999000111']);
+ $guild = (string) $this->discord->platform_user_id;
+ $api = config('trypost.platforms.discord.api');
+ Http::fake([
+ "{$api}/guilds/{$guild}/channels" => Http::response([['id' => '111', 'name' => 'general', 'type' => 0]]),
+ "{$api}/guilds/{$guild}/roles" => Http::response([['id' => $guild, 'permissions' => '3072']]),
+ "{$api}/guilds/{$guild}/members/*" => Http::response(['roles' => []]),
+ ]);
+
+ $this->actingAs($this->user)->getJson(route('app.discord.channels', $this->discord))->assertOk();
+ auth()->forgetGuards();
+ Http::fake();
+
+ $post = discordChannelNameCreate('api', ['channel_id' => '111']);
+
+ expect(data_get($post->meta, 'channel_name'))->toBe('general');
+ Http::assertNothingSent();
+});
+
+test('approving, moving to drafts or adding to the queue keeps a discord post channel name while the channel list is cached and drops it without', function (string $action, ?array $cached, ?string $stored) {
+ $this->mock(DiscordClient::class, function (MockInterface $discord) use ($cached): void {
+ $discord->shouldReceive('cachedChannels')->andReturn($cached);
+ $discord->shouldNotReceive('channels');
+ });
+ $this->discord->update(['posting_schedule' => PostingSchedule::empty()->withTime(1, '09:00')->withTime(3, '09:00')]);
+ $requester = workspaceMember($this->workspace, 'approval');
+
+ $post = CreatePosts::execute($this->workspace, $action === 'approve' ? $requester : $this->user, [
+ 'status' => $action === 'queue_next' ? 'draft' : 'scheduled',
+ 'scheduled_at' => $action === 'queue_next' ? null : now()->addDays(3)->toIso8601String(),
+ 'content' => 'Release notes',
+ 'media' => [],
+ 'destinations' => [['social_account_id' => $this->discord->id, 'content_type' => ContentType::DiscordMessage->value, 'meta' => ['channel_id' => '111', 'channel_name' => 'general']]],
+ ])->sole();
+ $post->forceFill(['meta' => ['channel_id' => '111', 'channel_name' => 'general']])->saveQuietly();
+
+ expect($post->status)->toBe($action === 'approve' ? Status::PendingApproval : ($action === 'queue_next' ? Status::Draft : Status::Scheduled));
+
+ $response = $action === 'approve'
+ ? $this->actingAs($this->user)->put(route('app.posts.approve', $post))
+ : $this->actingAs($this->user)->put(route('app.posts.schedule.update', $post), ['action' => $action]);
+
+ $response->assertSessionHasNoErrors();
+ expect(data_get($post->fresh()->meta, 'channel_id'))->toBe('111')
+ ->and($post->fresh()->status)->toBe($action === 'draft' ? Status::Draft : Status::Scheduled)
+ ->and(data_get($post->fresh()->meta, 'channel_name'))->toBe($stored);
+})->with(['approve', 'draft', 'queue_next'])->with([
+ 'channel list cached' => [[['id' => '111', 'name' => 'general']], 'general'],
+ 'no cached list' => [null, null],
+]);
diff --git a/tests/Feature/Parity/FullPostParityTest.php b/tests/Feature/Parity/FullPostParityTest.php
index 28eb29396..75cfa4571 100644
--- a/tests/Feature/Parity/FullPostParityTest.php
+++ b/tests/Feature/Parity/FullPostParityTest.php
@@ -38,6 +38,7 @@ function fullPostRouter(): Closure
$facebook = config('trypost.platforms.facebook.graph_api');
$rupload = config('trypost.platforms.facebook.rupload_host');
$instagram = config('trypost.platforms.instagram.graph_api');
+ $instagramFacebook = config('trypost.platforms.instagram-facebook.graph_api');
$threads = config('trypost.platforms.threads.graph_api');
$linkedin = config('trypost.platforms.linkedin.api');
$pinterest = config('trypost.platforms.pinterest.api');
@@ -62,6 +63,9 @@ function fullPostRouter(): Closure
str_starts_with($url, $instagram) && str_ends_with(parse_url($url, PHP_URL_PATH), '/media') => Http::response(['id' => "ig-container-{$counter}"], 200),
str_starts_with($url, $instagram) && str_ends_with(parse_url($url, PHP_URL_PATH), '/media_publish') => Http::response(['id' => "ig-media-{$counter}"], 200),
str_starts_with($url, $instagram) => Http::response(['status_code' => 'FINISHED', 'status' => 'Finished', 'permalink' => 'https://www.instagram.com/p/1/'], 200),
+ str_starts_with($url, "{$instagramFacebook}/igf_user/media_publish") => Http::response(['id' => "ig-media-{$counter}"], 200),
+ str_starts_with($url, "{$instagramFacebook}/igf_user/media") => Http::response(['id' => "ig-container-{$counter}"], 200),
+ str_starts_with($url, "{$instagramFacebook}/ig-") => Http::response(['status_code' => 'FINISHED', 'status' => 'Finished', 'permalink' => 'https://www.instagram.com/reel/1/'], 200),
str_contains($url, $rupload) => Http::response(['success' => true], 200),
str_starts_with($url, $facebook) && data_get($data, 'upload_phase') === 'start' => Http::response(['video_id' => "fb-video-{$counter}", 'upload_url' => "https://{$rupload}/video-upload/v25.0/fb-video-{$counter}"], 200),
str_starts_with($url, $facebook) && data_get($data, 'upload_phase') === 'finish' => Http::response(['success' => true, 'id' => "fb-reel-{$counter}", 'post_id' => "fb-story-{$counter}"], 200),
@@ -247,14 +251,25 @@ function fullPostCase(string $name): array
['upload_token' => fullPostImage()->upload_token, 'alt' => 'First alt', 'meta' => ['user_tags' => [['username' => 'friend.one', 'x' => 0.25, 'y' => 0.75]]]],
['upload_token' => fullPostImage()->upload_token, 'alt' => 'Second alt'],
],
- 'meta' => ['is_ai_generated' => true],
+ 'meta' => ['is_ai_generated' => true, 'collaborators' => ['@friend.two']],
],
'instagram reel' => [
'account' => $account('instagram', ['platform_user_id' => 'ig_user']),
'content_type' => 'instagram_reel',
'content' => 'Reel caption',
'media' => [['upload_token' => fullPostVideo()->upload_token, 'meta' => ['cover_offset_ms' => 3500]]],
- 'meta' => ['is_ai_generated' => true, 'share_to_feed' => false],
+ 'meta' => ['is_ai_generated' => true, 'share_to_feed' => false, 'trial_graduation' => 'SS_PERFORMANCE'],
+ ],
+ 'instagram via facebook reel with music' => [
+ 'account' => $account('instagram', [
+ 'platform' => 'instagram-facebook',
+ 'platform_user_id' => 'igf_user',
+ 'scopes' => ['instagram_basic', 'instagram_content_publish', 'pages_read_engagement'],
+ ]),
+ 'content_type' => 'instagram_reel',
+ 'content' => 'Reel with music',
+ 'media' => [['upload_token' => fullPostVideo()->upload_token]],
+ 'meta' => ['collaborators' => ['friend.three'], 'audio' => ['id' => '1122334455', 'title' => 'Song', 'audio_volume' => 100, 'video_volume' => 0]],
],
'instagram story' => [
'account' => $account('instagram', ['platform_user_id' => 'ig_user']),
@@ -354,7 +369,6 @@ function fullPostCase(string $name): array
'media' => [['upload_token' => fullPostImage()->upload_token, 'alt' => 'Discord alt']],
'meta' => [
'channel_id' => '444555666',
- 'channel_name' => 'general',
'mentions' => [['token' => '@everyone', 'label' => 'everyone']],
'embeds' => [['title' => 'Embed title', 'description' => 'Embed body', 'url' => 'https://example.com', 'image' => 'https://example.com/i.png', 'color' => '#FF8800']],
],
@@ -748,6 +762,7 @@ function fullPostExpected(string $name): array
'caption' => 'Carousel caption #one',
'children' => 'ig-container-#,ig-container-#',
'is_ai_generated' => 'true',
+ 'collaborators' => '["friend.two"]',
],
],
[
@@ -769,6 +784,7 @@ function fullPostExpected(string $name): array
'thumb_offset' => 3500,
'is_ai_generated' => 'true',
'share_to_feed' => 'false',
+ 'trial_params' => '{"graduation_strategy":"SS_PERFORMANCE"}',
],
],
[
@@ -779,6 +795,27 @@ function fullPostExpected(string $name): array
],
],
],
+ 'instagram via facebook reel with music' => [
+ [
+ 'POST',
+ 'https://graph.facebook.com/v25.0/igf_user/media',
+ [
+ 'video_url' => '/storage/media/{month}/{uuid}.mp4',
+ 'caption' => 'Reel with music',
+ 'media_type' => 'REELS',
+ 'collaborators' => '["friend.three"]',
+ 'share_to_feed' => 'true',
+ 'audio_configuration' => '{"audio_id":"1122334455","audio_volume":100,"video_volume":0}',
+ ],
+ ],
+ [
+ 'POST',
+ 'https://graph.facebook.com/v25.0/igf_user/media_publish',
+ [
+ 'creation_id' => 'ig-container-#',
+ ],
+ ],
+ ],
'instagram story' => [
[
'POST',
@@ -1248,6 +1285,7 @@ dataset('complete posts', [
'threads ghost post',
'instagram carousel',
'instagram reel',
+ 'instagram via facebook reel with music',
'instagram story',
'facebook post',
'facebook link without preview',
diff --git a/tests/Feature/Parity/InstagramSettingsParityTest.php b/tests/Feature/Parity/InstagramSettingsParityTest.php
new file mode 100644
index 000000000..d9c9bc666
--- /dev/null
+++ b/tests/Feature/Parity/InstagramSettingsParityTest.php
@@ -0,0 +1,165 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\Post\Status;
+use App\Enums\PostPlatform\ContentType;
+use App\Enums\SocialAccount\Platform;
+use App\Mcp\Servers\TryPostServer;
+use App\Mcp\Tools\Post\PublishPostTool;
+use App\Mcp\Tools\Post\UpdatePostTool;
+use App\Models\Post;
+use App\Models\SocialAccount;
+use Illuminate\Testing\TestResponse;
+use Laravel\Mcp\Server\Testing\TestResponse as McpTestResponse;
+
+beforeEach(function () {
+ ['user' => $this->user, 'workspace' => $this->workspace, 'token' => $this->token] = parityContext();
+});
+
+function instagramSettingsParityReel(Platform $platform): Post
+{
+ $account = SocialAccount::factory()->create(['workspace_id' => test()->workspace->id, 'platform' => $platform]);
+
+ return Post::factory()->forAccount($account, ContentType::InstagramReel)->create([
+ 'user_id' => test()->user->id,
+ 'content' => 'Reel',
+ 'status' => Status::Draft,
+ 'media' => [[
+ 'id' => 'video-1', 'type' => 'video', 'path' => 'medias/clip.mp4', 'url' => 'https://example.com/clip.mp4',
+ 'mime_type' => 'video/mp4', 'original_filename' => 'clip.mp4',
+ ]],
+ 'meta' => [],
+ ]);
+}
+
+/**
+ * Sends the same post update through one surface: the web composer, the REST
+ * API or the MCP tool.
+ *
+ * @param array<string, mixed> $changes
+ */
+function instagramSettingsParityUpdate(string $surface, Post $post, array $changes): TestResponse|McpTestResponse
+{
+ $payload = [
+ 'content' => $post->content,
+ 'content_type' => $post->content_type->value,
+ 'status' => Status::Draft->value,
+ ...$changes,
+ ];
+
+ return match ($surface) {
+ 'web' => test()->actingAs(test()->user)->putJson(route('app.posts.update', $post), [...$payload, 'media' => $post->media]),
+ 'api' => test()->withHeaders(parityApi(test()->token))->putJson(route('api.posts.update', $post), $payload),
+ 'mcp' => TryPostServer::actingAs(test()->user)->tool(UpdatePostTool::class, ['post_id' => $post->id, ...$payload]),
+ };
+}
+
+test('instagram collaborators, trial reels and music are stored the same on the web, api and mcp', function (string $surface, Platform $platform, array $meta, array $stored) {
+ $post = instagramSettingsParityReel($platform);
+
+ $response = instagramSettingsParityUpdate($surface, $post, ['meta' => $meta]);
+
+ $surface === 'mcp' ? $response->assertOk() : $response->assertSessionHasNoErrors();
+ expect($post->fresh()->meta)->toEqual($stored);
+})->with(['web', 'api', 'mcp'])->with([
+ 'collaborators' => [Platform::Instagram, ['collaborators' => ['@alice', 'bob']], ['collaborators' => ['alice', 'bob']]],
+ 'trial reel' => [Platform::Instagram, ['trial_graduation' => 'MANUAL'], ['trial_graduation' => 'MANUAL']],
+ 'music through facebook' => [
+ Platform::InstagramFacebook,
+ ['audio' => ['id' => '1234567890', 'title' => 'Song', 'artist' => 'Band', 'audio_volume' => 80, 'video_volume' => 20, 'unknown' => 'dropped']],
+ ['audio' => ['id' => '1234567890', 'title' => 'Song', 'artist' => 'Band', 'audio_volume' => 80, 'video_volume' => 20]],
+ ],
+ 'music without a track id on a draft' => [Platform::InstagramFacebook, ['audio' => ['title' => 'Song']], ['audio' => ['title' => 'Song']]],
+]);
+
+test('scheduling refuses a trial reel with collaborators and music without facebook on the web, api and mcp', function (string $surface, Platform $platform, array $meta, string $field, string $message) {
+ $post = instagramSettingsParityReel($platform);
+
+ $response = instagramSettingsParityUpdate($surface, $post, [
+ 'meta' => $meta,
+ 'status' => Status::Scheduled->value,
+ 'scheduled_at' => now()->addDay()->toIso8601String(),
+ ]);
+
+ $surface === 'mcp'
+ ? $response->assertHasErrors([__($message)])
+ : $response->assertUnprocessable()->assertJsonValidationErrors(["meta.{$field}" => __($message)]);
+ expect($post->fresh()->status)->toBe(Status::Draft);
+})->with(['web', 'api', 'mcp'])->with([
+ 'trial reel with collaborators' => [Platform::InstagramFacebook, ['collaborators' => ['alice'], 'trial_graduation' => 'MANUAL'], 'trial_graduation', 'posts.form.instagram.trial_reel.no_collaborators'],
+ 'music on instagram login' => [Platform::Instagram, ['audio' => ['id' => '1234567890']], 'audio', 'posts.form.instagram.music.requires_facebook'],
+]);
+
+test('scheduling refuses music without a track id on the web, api and mcp', function (string $surface) {
+ $post = instagramSettingsParityReel(Platform::InstagramFacebook);
+
+ $response = instagramSettingsParityUpdate($surface, $post, [
+ 'meta' => ['audio' => ['title' => 'Song']],
+ 'status' => Status::Scheduled->value,
+ 'scheduled_at' => now()->addDay()->toIso8601String(),
+ ]);
+
+ $surface === 'mcp'
+ ? $response->assertHasErrors([__('validation.required', ['attribute' => 'audio id'])])
+ : $response->assertUnprocessable()->assertJsonValidationErrors(['meta.audio.id' => __('validation.required', ['attribute' => 'audio id'])]);
+ expect($post->fresh()->status)->toBe(Status::Draft);
+})->with(['web', 'api', 'mcp']);
+
+test('publishing a stored reel with music without a track id is refused on mcp', function () {
+ $post = instagramSettingsParityReel(Platform::InstagramFacebook);
+ $post->forceFill(['meta' => ['audio' => ['title' => 'Song']]])->save();
+
+ TryPostServer::actingAs($this->user)
+ ->tool(PublishPostTool::class, ['post_id' => $post->id])
+ ->assertHasErrors([__('validation.required', ['attribute' => 'audio id'])]);
+
+ expect($post->fresh()->status)->toBe(Status::Draft);
+});
+
+test('collaborators beyond three and an unknown trial strategy are refused on the web, api and mcp', function (string $surface, array $meta, string $field) {
+ $post = instagramSettingsParityReel(Platform::Instagram);
+
+ $response = instagramSettingsParityUpdate($surface, $post, ['meta' => $meta]);
+
+ $surface === 'mcp'
+ ? $response->assertHasErrors()
+ : $response->assertUnprocessable()->assertJsonValidationErrors("meta.{$field}");
+ expect($post->fresh()->meta)->toBe([]);
+})->with(['web', 'api', 'mcp'])->with([
+ 'four collaborators' => [['collaborators' => ['a', 'b', 'c', 'd']], 'collaborators'],
+ 'unknown trial strategy' => [['trial_graduation' => 'SOMETIMES'], 'trial_graduation'],
+]);
+
+test('a content type that is not text is refused with a validation error on the web, api and mcp', function (string $surface) {
+ $post = instagramSettingsParityReel(Platform::Instagram);
+
+ $response = instagramSettingsParityUpdate($surface, $post, [
+ 'content_type' => 5,
+ 'status' => Status::Scheduled->value,
+ 'scheduled_at' => now()->addDay()->toIso8601String(),
+ 'meta' => ['audio' => ['id' => '1234567890']],
+ ]);
+
+ $surface === 'mcp'
+ ? $response->assertHasErrors(['content type'])
+ : $response->assertUnprocessable()->assertJsonValidationErrors('content_type');
+ expect($post->fresh()->status)->toBe(Status::Draft);
+})->with(['web', 'api', 'mcp']);
+
+test('scheduling without sending the content type checks the reel rules against the stored one on the web, api and mcp', function (string $surface) {
+ $post = instagramSettingsParityReel(Platform::Instagram);
+ $post->forceFill(['meta' => ['audio' => ['id' => '1234567890']]])->save();
+ $payload = ['status' => Status::Scheduled->value, 'scheduled_at' => now()->addDay()->toIso8601String(), 'content' => $post->content];
+
+ $response = match ($surface) {
+ 'web' => $this->actingAs($this->user)->putJson(route('app.posts.update', $post), [...$payload, 'media' => $post->media]),
+ 'api' => $this->withHeaders(parityApi($this->token))->putJson(route('api.posts.update', $post), $payload),
+ 'mcp' => TryPostServer::actingAs($this->user)->tool(UpdatePostTool::class, ['post_id' => $post->id, ...$payload]),
+ };
+
+ $surface === 'mcp'
+ ? $response->assertHasErrors([__('posts.form.instagram.music.requires_facebook')])
+ : $response->assertUnprocessable()->assertJsonValidationErrors(['meta.audio' => __('posts.form.instagram.music.requires_facebook')]);
+ expect($post->fresh()->status)->toBe(Status::Draft);
+})->with(['web', 'api', 'mcp']);
diff --git a/tests/Feature/Parity/McpAuthorizationParityTest.php b/tests/Feature/Parity/McpAuthorizationParityTest.php
index 3ebcd352a..0ebaeaa9f 100644
--- a/tests/Feature/Parity/McpAuthorizationParityTest.php
+++ b/tests/Feature/Parity/McpAuthorizationParityTest.php
@@ -70,6 +70,7 @@ use App\Mcp\Tools\Signature\UpdateSignatureTool;
use App\Mcp\Tools\SocialAccount\CopyPostingScheduleTool;
use App\Mcp\Tools\SocialAccount\CreatePinterestBoardTool;
use App\Mcp\Tools\SocialAccount\GeneratePostingScheduleTool;
+use App\Mcp\Tools\SocialAccount\GetInstagramAudioTool;
use App\Mcp\Tools\SocialAccount\GetPostingScheduleTool;
use App\Mcp\Tools\SocialAccount\GetTikTokCreatorInfoTool;
use App\Mcp\Tools\SocialAccount\ListDiscordChannelsTool;
@@ -78,6 +79,7 @@ use App\Mcp\Tools\SocialAccount\ListPinterestBoardsTool;
use App\Mcp\Tools\SocialAccount\ListSocialAccountsTool;
use App\Mcp\Tools\SocialAccount\MovePostToSlotTool;
use App\Mcp\Tools\SocialAccount\ReorderQueueTool;
+use App\Mcp\Tools\SocialAccount\SearchInstagramAudioTool;
use App\Mcp\Tools\SocialAccount\UpdatePostingScheduleTool;
use App\Mcp\Tools\Webhook\CreateWebhookTool;
use App\Mcp\Tools\Webhook\DeleteWebhookTool;
@@ -205,6 +207,7 @@ function mcpAuthParityFixture(Workspace $workspace, User $owner, ?User $actor =
'signature' => WorkspaceSignature::factory()->create(['workspace_id' => $workspace->id]),
'discord' => SocialAccount::factory()->discord()->create(['workspace_id' => $workspace->id, 'platform_user_id' => (string) Str::uuid()]),
'pinterest' => SocialAccount::factory()->pinterest()->create(['workspace_id' => $workspace->id, 'platform_user_id' => (string) Str::uuid()]),
+ 'instagramFacebook' => SocialAccount::factory()->instagram()->create(['workspace_id' => $workspace->id, 'platform' => Platform::InstagramFacebook, 'platform_user_id' => (string) Str::uuid()]),
'uploadToken' => $uploadToken,
'publicationId' => (string) Str::uuid(),
'missingId' => (string) Str::uuid(),
@@ -293,6 +296,8 @@ function mcpAuthParityTools(): array
'update-signature-tool' => [UpdateSignatureTool::class, $everyMember, fn (TestCase $t, array $f) => $t->put(route('app.signatures.update', $f['signature']), $signature), fn (array $f) => ['signature_id' => $f['signature']->id, ...$signature]],
'list-discord-channels-tool' => [ListDiscordChannelsTool::class, $everyMember, fn (TestCase $t, array $f) => $t->getJson(route('app.discord.channels', $f['discord'])), fn (array $f) => ['account_id' => $f['discord']->id]],
'create-pinterest-board-tool' => [CreatePinterestBoardTool::class, $everyMember, fn (TestCase $t, array $f) => $t->postJson(route('app.pinterest.boards.store', $f['pinterest']), ['name' => 'Ideas']), fn (array $f) => ['account_id' => $f['pinterest']->id, 'name' => 'Ideas']],
+ 'search-instagram-audio-tool' => [SearchInstagramAudioTool::class, $everyMember, fn (TestCase $t, array $f) => $t->getJson(route('app.instagram.audio.index', $f['instagramFacebook'])), fn (array $f) => ['account_id' => $f['instagramFacebook']->id]],
+ 'get-instagram-audio-tool' => [GetInstagramAudioTool::class, $everyMember, fn (TestCase $t, array $f) => $t->getJson(route('app.instagram.audio.show', [$f['instagramFacebook'], '846373660299207'])), fn (array $f) => ['account_id' => $f['instagramFacebook']->id, 'audio_id' => '846373660299207']],
'list-pinterest-boards-tool' => [ListPinterestBoardsTool::class, $everyMember, fn (TestCase $t, array $f) => $t->getJson(route('app.pinterest.boards.index', $f['pinterest'])), fn (array $f) => ['account_id' => $f['pinterest']->id]],
'get-posting-schedule-tool' => [GetPostingScheduleTool::class, $everyMember, fn (TestCase $t, array $f) => $t->getJson(route('app.posts.composer.live')), fn (array $f) => ['account_id' => $f['linkedin']->id]],
'update-posting-schedule-tool' => [UpdatePostingScheduleTool::class, $admins, fn (TestCase $t, array $f) => $t->putJson(route('app.channels.posting-schedule.update', $f['linkedin']), ['timezone' => 'UTC', 'posting_goal' => 2, 'posting_schedule' => null]), fn (array $f) => ['account_id' => $f['linkedin']->id, 'timezone' => 'UTC', 'posting_goal' => 2, 'posting_schedule' => null]],
diff --git a/tests/Feature/Parity/MediaParityTest.php b/tests/Feature/Parity/MediaParityTest.php
index 7bc233176..e27165944 100644
--- a/tests/Feature/Parity/MediaParityTest.php
+++ b/tests/Feature/Parity/MediaParityTest.php
@@ -106,6 +106,77 @@ test('attaching an upload gives the same media through api and mcp', function ()
->and($mcpPost->ownedMedia()->count())->toBe(1);
});
+test('attaching an upload prefers the meta alt text over the alt shorthand and ignores an empty alt through api and mcp', function (array $input, ?string $stored) {
+ $apiPost = mediaParityPost($this);
+ $mcpPost = mediaParityPost($this);
+
+ $this->withHeaders(parityApi($this->token))
+ ->postJson(route('api.posts.attach-media-from-upload', $apiPost), ['upload_token' => mediaParityUpload($this)->upload_token, ...$input])
+ ->assertSuccessful();
+ TryPostServer::actingAs($this->user)
+ ->tool(AttachMediaFromUploadTool::class, ['post_id' => $mcpPost->id, 'upload_token' => mediaParityUpload($this)->upload_token, ...$input])
+ ->assertOk();
+
+ expect(data_get($apiPost->fresh()->media, '0.meta.alt_text'))->toBe($stored)
+ ->and(data_get($mcpPost->fresh()->media, '0.meta.alt_text'))->toBe($stored);
+})->with([
+ 'both given' => [['alt' => 'A', 'meta' => ['alt_text' => 'B']], 'B'],
+ 'empty alt' => [['alt' => ''], null],
+]);
+
+test('people tagged while attaching an upload or a url are stored the same through api and mcp', function () {
+ Http::fake(['example.com/*' => fn () => Http::response(file_get_contents(base_path('tests/fixtures/1x1.png')), 200, ['Content-Type' => 'image/png'])]);
+ $tags = [['username' => 'alice', 'x' => 0.25, 'y' => 0.5], ['username' => 'bob', 'x' => 0.75, 'y' => 0.5]];
+ $posts = collect(['api upload', 'mcp upload', 'api url', 'mcp url'])->mapWithKeys(fn (string $leg): array => [$leg => mediaParityPost($this)]);
+
+ $this->withHeaders(parityApi($this->token))
+ ->postJson(route('api.posts.attach-media-from-upload', $posts['api upload']), ['upload_token' => mediaParityUpload($this)->upload_token, 'meta' => ['user_tags' => $tags]])
+ ->assertSuccessful();
+ $this->withHeaders(parityApi($this->token))
+ ->postJson(route('api.posts.attach-media-from-url', $posts['api url']), ['urls' => [['url' => 'https://example.com/a.png', 'meta' => ['user_tags' => $tags]]]])
+ ->assertSuccessful();
+ TryPostServer::actingAs($this->user)
+ ->tool(AttachMediaFromUploadTool::class, ['post_id' => $posts['mcp upload']->id, 'upload_token' => mediaParityUpload($this)->upload_token, 'meta' => ['user_tags' => $tags]])
+ ->assertOk();
+ TryPostServer::actingAs($this->user)
+ ->tool(AttachMediaFromUrlTool::class, ['post_id' => $posts['mcp url']->id, 'urls' => [['url' => 'https://example.com/a.png', 'meta' => ['user_tags' => $tags]]]])
+ ->assertOk();
+
+ expect($posts->map(fn (Post $post): mixed => data_get($post->fresh()->media, '0.meta.user_tags'))->all())
+ ->toEqual(['api upload' => $tags, 'mcp upload' => $tags, 'api url' => $tags, 'mcp url' => $tags]);
+});
+
+test('a video cover frame set while attaching an upload is stored the same through api and mcp', function () {
+ $apiPost = mediaParityPost($this);
+ $mcpPost = mediaParityPost($this);
+
+ $this->withHeaders(parityApi($this->token))
+ ->postJson(route('api.posts.attach-media-from-upload', $apiPost), ['upload_token' => mediaParityUpload($this, 'video')->upload_token, 'meta' => ['cover_offset_ms' => 1500]])
+ ->assertSuccessful();
+ TryPostServer::actingAs($this->user)
+ ->tool(AttachMediaFromUploadTool::class, ['post_id' => $mcpPost->id, 'upload_token' => mediaParityUpload($this, 'video')->upload_token, 'meta' => ['cover_offset_ms' => 1500]])
+ ->assertOk();
+
+ expect(data_get($apiPost->fresh()->media, '0.meta.cover_offset_ms'))->toBe(1500)
+ ->and(data_get($mcpPost->fresh()->media, '0.meta.cover_offset_ms'))->toBe(1500);
+});
+
+test('more than twenty people tagged while attaching are refused through api and mcp', function () {
+ $tags = collect(range(1, 21))->map(fn (int $index): array => ['username' => "person{$index}", 'x' => 0.5, 'y' => 0.5])->all();
+ $apiPost = mediaParityPost($this);
+ $mcpPost = mediaParityPost($this);
+
+ $this->withHeaders(parityApi($this->token))
+ ->postJson(route('api.posts.attach-media-from-upload', $apiPost), ['upload_token' => mediaParityUpload($this)->upload_token, 'meta' => ['user_tags' => $tags]])
+ ->assertUnprocessable()
+ ->assertJsonValidationErrors('meta');
+ TryPostServer::actingAs($this->user)
+ ->tool(AttachMediaFromUploadTool::class, ['post_id' => $mcpPost->id, 'upload_token' => mediaParityUpload($this)->upload_token, 'meta' => ['user_tags' => $tags]])
+ ->assertHasErrors();
+
+ expect($apiPost->fresh()->media)->toBeEmpty()->and($mcpPost->fresh()->media)->toBeEmpty();
+});
+
test('an expired or unknown upload token is refused by both surfaces', function () {
$apiPost = mediaParityPost($this);
$mcpPost = mediaParityPost($this);
@@ -266,6 +337,38 @@ test('user tags and a video cover frame set through the api update and the mcp u
->toEqual([['cover_offset_ms' => 1500, 'user_tags' => null], ['cover_offset_ms' => null, 'user_tags' => $tags]]);
});
+test('several people tagged on one photo are kept up to twenty and refused beyond it on the api and mcp', function () {
+ $tags = fn (int $count): array => collect(range(1, $count))
+ ->map(fn (int $index): array => ['username' => "person{$index}", 'x' => 0.5, 'y' => 0.5])
+ ->all();
+
+ foreach ([20 => true, 21 => false] as $count => $accepted) {
+ $apiPost = mediaParityPost($this);
+ $mcpPost = mediaParityPost($this);
+ auth()->forgetGuards();
+ $api = $this->withHeaders(parityApi($this->token))
+ ->putJson(route('api.posts.update', $apiPost), ['status' => 'draft', 'media' => [
+ ['upload_token' => mediaParityUpload($this)->upload_token, 'meta' => ['user_tags' => $tags($count)]],
+ ]]);
+ $mcp = TryPostServer::actingAs($this->user)
+ ->tool(UpdatePostTool::class, ['post_id' => $mcpPost->id, 'media' => [
+ ['upload_token' => mediaParityUpload($this)->upload_token, 'meta' => ['user_tags' => $tags($count)]],
+ ]]);
+
+ if ($accepted) {
+ $api->assertSuccessful();
+ $mcp->assertOk();
+ expect(data_get($apiPost->fresh()->media, '0.meta.user_tags'))->toHaveCount(20)
+ ->and(data_get($mcpPost->fresh()->media, '0.meta.user_tags'))->toHaveCount(20);
+ } else {
+ $api->assertUnprocessable()->assertJsonValidationErrors('media.0.meta');
+ $mcp->assertHasErrors();
+ expect($apiPost->fresh()->media)->toBeEmpty()
+ ->and($mcpPost->fresh()->media)->toBeEmpty();
+ }
+ }
+});
+
test('a media type the network does not accept gets the same translated message on both surfaces', function () {
$apiPost = mediaParityPost($this, 'youtube');
$mcpPost = mediaParityPost($this, 'youtube');
diff --git a/tests/Feature/Posts/ChannelMetaRoundTripTest.php b/tests/Feature/Posts/ChannelMetaRoundTripTest.php
new file mode 100644
index 000000000..0204b2076
--- /dev/null
+++ b/tests/Feature/Posts/ChannelMetaRoundTripTest.php
@@ -0,0 +1,183 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Dto\MediaItem;
+use App\Enums\PostPlatform\ContentType;
+use App\Enums\SocialAccount\Platform;
+use App\Models\Media;
+use App\Models\Post;
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+use Illuminate\Support\Arr;
+use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Facades\Queue;
+use Illuminate\Support\Facades\Storage;
+
+beforeEach(function () {
+ Queue::fake();
+ Storage::fake();
+ Http::fake();
+
+ $this->owner = User::factory()->create();
+ $this->workspace = Workspace::factory()->create(['account_id' => $this->owner->account_id, 'user_id' => $this->owner->id]);
+ $this->workspace->members()->attach($this->owner->id, membershipPivot('admin'));
+ $this->owner->update(['current_workspace_id' => $this->workspace->id]);
+ subscribeAccount($this->owner->account);
+});
+
+/**
+ * Whether two meta arrays hold the same values, whatever the key order.
+ *
+ * @param array<string, mixed> $expected
+ */
+function channelMetaRoundTripMatches(mixed $actual, array $expected): bool
+{
+ return json_decode((string) json_encode($actual), true) == $expected;
+}
+
+/**
+ * Creates a draft through the composer, edits it with the same meta and new
+ * text, and checks the meta after each step and on the edit page.
+ *
+ * @param array<string, mixed> $meta
+ * @param array<string, mixed> $systemMeta meta only the system writes, set on the stored post before the edit
+ */
+function channelMetaRoundTrip(SocialAccount $account, ContentType $contentType, array $meta, array $systemMeta = []): Post
+{
+ test()->actingAs(test()->owner)
+ ->post(route('app.posts.store'), [
+ 'status' => 'draft',
+ 'content' => 'First caption',
+ 'media' => [],
+ 'destinations' => [['social_account_id' => $account->id, 'content_type' => $contentType->value, 'meta' => $meta]],
+ ])
+ ->assertSessionHasNoErrors();
+
+ $post = Post::query()->where('social_account_id', $account->id)->sole();
+ $stored = $post->meta;
+
+ foreach (Arr::except($meta, 'thread_replies') as $key => $value) {
+ expect(data_get($stored, $key))->toEqual($value);
+ }
+
+ if ($systemMeta !== []) {
+ $post->forceFill(['meta' => [...$stored, ...$systemMeta]])->saveQuietly();
+ }
+
+ test()->actingAs(test()->owner)
+ ->put(route('app.posts.update', $post), [
+ 'status' => 'draft',
+ 'content' => 'Edited caption',
+ 'content_type' => $contentType->value,
+ 'meta' => $stored,
+ 'media' => [],
+ ])
+ ->assertSessionHasNoErrors()
+ ->assertRedirect();
+
+ $edited = $post->fresh();
+ $expected = [...$stored, ...$systemMeta];
+
+ expect($edited->content)->toContain('Edited caption')
+ ->and($edited->meta)->toEqual($expected);
+
+ test()->actingAs(test()->owner)
+ ->get(route('app.posts.edit', $edited))
+ ->assertRedirect(route('app.posts.index', ['edit' => $edited->id]));
+
+ test()->actingAs(test()->owner)
+ ->get(route('app.posts.index', ['edit' => $edited->id]))
+ ->assertOk()
+ ->assertInertia(fn ($page) => $page
+ ->where('editPost.id', $edited->id)
+ ->where('editPost.meta', fn (mixed $editMeta): bool => channelMetaRoundTripMatches($editMeta, $expected)));
+
+ return $edited;
+}
+
+test('a post keeps every setting of its network through create, edit and reopen', function (Closure $account, ContentType $contentType, array $meta) {
+ $post = channelMetaRoundTrip($account($this->workspace), $contentType, $meta);
+
+ foreach ($meta as $key => $value) {
+ expect(data_get($post->meta, $key))->toEqual($value);
+ }
+})->with([
+ 'linkedin page post' => [fn (Workspace $workspace) => SocialAccount::factory()->linkedinPage()->create(['workspace_id' => $workspace->id]), ContentType::LinkedInPagePost, ['document_title' => 'Quarterly report']],
+ 'linkedin pdf title' => [fn (Workspace $workspace) => SocialAccount::factory()->linkedin()->create(['workspace_id' => $workspace->id]), ContentType::LinkedInPost, ['document_title' => 'Launch deck 2026']],
+ 'facebook post without link preview' => [fn (Workspace $workspace) => SocialAccount::factory()->facebook()->create(['workspace_id' => $workspace->id]), ContentType::FacebookPost, ['link_preview' => false]],
+ 'facebook story' => [fn (Workspace $workspace) => SocialAccount::factory()->facebook()->create(['workspace_id' => $workspace->id]), ContentType::FacebookStory, ['is_ai_generated' => true]],
+ 'tiktok privacy and interactions' => [fn (Workspace $workspace) => SocialAccount::factory()->tiktok()->create(['workspace_id' => $workspace->id]), ContentType::TikTokVideo, [
+ 'privacy_level' => 'SELF_ONLY',
+ 'allow_comments' => false,
+ 'allow_duet' => true,
+ 'allow_stitch' => false,
+ 'auto_add_music' => true,
+ 'is_aigc' => true,
+ 'disclose' => true,
+ 'brand_content_toggle' => false,
+ 'brand_organic_toggle' => true,
+ ]],
+ 'threads topic tag' => [fn (Workspace $workspace) => SocialAccount::factory()->threads()->create(['workspace_id' => $workspace->id]), ContentType::ThreadsPost, ['topic_tag' => 'Launches']],
+ 'mastodon content warning and thread' => [fn (Workspace $workspace) => SocialAccount::factory()->mastodon()->create(['workspace_id' => $workspace->id]), ContentType::MastodonPost, [
+ 'spoiler_text' => 'Spoilers ahead',
+ 'thread_replies' => [['text' => 'Second toot', 'media' => []]],
+ ]],
+ 'bluesky thread' => [fn (Workspace $workspace) => SocialAccount::factory()->bluesky()->create(['workspace_id' => $workspace->id]), ContentType::BlueskyPost, [
+ 'thread_replies' => [['text' => 'Second skeet', 'media' => []], ['text' => 'Third skeet', 'media' => []]],
+ ]],
+ 'pinterest board, title and link' => [fn (Workspace $workspace) => SocialAccount::factory()->pinterest()->create(['workspace_id' => $workspace->id]), ContentType::PinterestPin, [
+ 'board_id' => 'board_1',
+ 'title' => 'Summer recipes',
+ 'link' => 'https://example.com/recipes',
+ ]],
+ 'youtube title, category and privacy' => [fn (Workspace $workspace) => SocialAccount::factory()->youtube()->create(['workspace_id' => $workspace->id]), ContentType::YouTubeShort, [
+ 'title' => 'Behind the scenes',
+ 'description' => 'How we film',
+ 'category_id' => '22',
+ 'privacy_status' => 'unlisted',
+ 'notify_subscribers' => false,
+ 'made_for_kids' => false,
+ ]],
+ 'google business event' => [fn (Workspace $workspace) => SocialAccount::factory()->googleBusiness()->create(['workspace_id' => $workspace->id]), ContentType::GoogleBusinessPost, [
+ 'topic_type' => 'EVENT',
+ 'event' => [
+ 'title' => 'Open house',
+ 'start_date' => '2026-11-10',
+ 'end_date' => '2026-11-11',
+ 'start_time' => '09:00',
+ 'end_time' => '18:00',
+ ],
+ 'call_to_action' => ['action_type' => 'LEARN_MORE', 'url' => 'https://example.com/open-house'],
+ ]],
+]);
+
+test('editing a telegram post keeps the reactions it already has', function () {
+ $telegram = SocialAccount::factory()->telegram()->create(['workspace_id' => $this->workspace->id]);
+ $reactions = ['enabled' => true, 'emojis' => ['👍', '🔥']];
+
+ $post = channelMetaRoundTrip($telegram, ContentType::TelegramPost, [], ['reactions' => $reactions]);
+
+ expect(data_get($post->meta, 'reactions'))->toEqual($reactions)
+ ->and($post->platform)->toBe(Platform::Telegram);
+});
+
+test('an x thread keeps the media of its reply through create, edit and reopen', function () {
+ $x = SocialAccount::factory()->x()->create(['workspace_id' => $this->workspace->id]);
+ $image = Media::factory()->stored()->temporaryUpload($this->workspace)->create();
+
+ $post = channelMetaRoundTrip($x, ContentType::XPost, [
+ 'thread_replies' => [
+ ['text' => 'Second post', 'media' => [MediaItem::fromMedia($image)->toArray()]],
+ ['text' => 'Third post', 'media' => []],
+ ],
+ ]);
+
+ $replies = data_get($post->meta, 'thread_replies');
+
+ expect(collect($replies[0]['media'])->pluck('id')->all())->toBe([$image->id])
+ ->and($replies[0]['text'])->toBe('Second post')
+ ->and($replies[1])->toEqual(['text' => 'Third post', 'media' => []])
+ ->and($image->fresh()->post_id)->toBe($post->id);
+});
diff --git a/tests/Feature/Posts/PostRecurrenceTest.php b/tests/Feature/Posts/PostRecurrenceTest.php
index 4a894fa39..29801b9a5 100644
--- a/tests/Feature/Posts/PostRecurrenceTest.php
+++ b/tests/Feature/Posts/PostRecurrenceTest.php
@@ -17,9 +17,11 @@ use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
use App\Models\WorkspaceLabel;
+use App\Services\Social\Discord\DiscordClient;
use Carbon\CarbonImmutable;
use Illuminate\Support\Facades\Exceptions;
use Illuminate\Support\Facades\Queue;
+use Mockery\MockInterface;
beforeEach(function () {
Queue::fake();
@@ -317,6 +319,34 @@ test('the last occurrence carries no rule and ends the series', function () {
expect(Post::count())->toBe(2);
});
+test('the next occurrence of a Discord post reads the channel name from the cached list', function (?array $cached, array $expected) {
+ $discord = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::Discord,
+ 'platform_user_id' => '999',
+ 'timezone' => 'UTC',
+ ]);
+ $this->mock(DiscordClient::class, function (MockInterface $client) use ($cached): void {
+ $client->shouldReceive('cachedChannels')->andReturn($cached);
+ $client->shouldNotReceive('channels');
+ });
+ $post = recurringPost($discord, $this->user, [
+ 'content_type' => ContentType::DiscordMessage,
+ 'scheduled_at' => now()->subMinute(),
+ 'recurrence_interval' => 1,
+ 'recurrence_frequency' => RecurrenceFrequency::Day,
+ 'recurrence_remaining' => 3,
+ 'meta' => ['channel_id' => '111', 'channel_name' => 'old-name'],
+ ]);
+
+ publishRecurringPost($post);
+
+ expect(nextOccurrence($post)->meta)->toEqual($expected);
+})->with([
+ 'cached list' => [[['id' => '111', 'name' => 'general']], ['channel_id' => '111', 'channel_name' => 'general']],
+ 'nothing cached' => [null, ['channel_id' => '111']],
+]);
+
test('a retried settlement never creates a second occurrence', function () {
$post = recurringPost($this->channel, $this->user, [
'scheduled_at' => now()->subMinute(),
diff --git a/tests/Feature/Repurpose/AccountHealthTest.php b/tests/Feature/Repurpose/AccountHealthTest.php
index 96868f9f9..046e1a7f3 100644
--- a/tests/Feature/Repurpose/AccountHealthTest.php
+++ b/tests/Feature/Repurpose/AccountHealthTest.php
@@ -706,3 +706,42 @@ test('an active repurpose cannot drop the meta its destination needs to publish'
expect(data_get($repurpose->fresh()->destinations, '0.meta.privacy_level'))->toBe(PrivacyLevel::PublicToEveryone->value);
});
+
+test('a repurpose refuses music on an instagram login reel destination when it is updated or activated', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create([
+ 'account_id' => $user->account_id,
+ 'user_id' => $user->id,
+ ]);
+ $user->update(['current_workspace_id' => $workspace->id]);
+
+ $source = SocialAccount::factory()->for($workspace)->create(['platform' => Platform::TikTok]);
+ $instagram = SocialAccount::factory()->for($workspace)->create(['platform' => Platform::Instagram]);
+ $destination = [
+ 'social_account_id' => $instagram->id,
+ 'content_type' => ContentType::InstagramReel->value,
+ 'meta' => ['audio' => ['id' => '1234567890']],
+ ];
+
+ $active = Repurpose::factory()->for($workspace)->create([
+ 'source_social_account_id' => $source->id,
+ 'status' => Status::Active,
+ 'destinations' => [[...$destination, 'meta' => []]],
+ ]);
+
+ $this->actingAs($user)
+ ->put(route('app.repurposes.update', $active), ['destinations' => [$destination]])
+ ->assertSessionHasErrors(['destinations.0.meta.audio' => __('posts.form.instagram.music.requires_facebook')]);
+
+ $draft = Repurpose::factory()->for($workspace)->create([
+ 'source_social_account_id' => SocialAccount::factory()->for($workspace)->create(['platform' => Platform::TikTok])->id,
+ 'status' => Status::Draft,
+ 'destinations' => [$destination],
+ ]);
+
+ $this->actingAs($user)
+ ->post(route('app.repurposes.activate', $draft))
+ ->assertSessionHasErrors(['destinations' => __('posts.form.instagram.music.requires_facebook')]);
+
+ expect($draft->fresh()->status)->toBe(Status::Draft);
+});
diff --git a/tests/Feature/Repurpose/ProcessItemTest.php b/tests/Feature/Repurpose/ProcessItemTest.php
index 451c66683..b5023f835 100644
--- a/tests/Feature/Repurpose/ProcessItemTest.php
+++ b/tests/Feature/Repurpose/ProcessItemTest.php
@@ -32,12 +32,14 @@ use App\Models\Workspace;
use App\Services\Post\MediaAttacher;
use App\Services\Repurpose\CaptionAdapter;
use App\Services\Social\ContentSanitizer;
+use App\Services\Social\Discord\DiscordClient;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Storage;
+use Mockery\MockInterface;
beforeEach(function () {
Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
@@ -213,6 +215,23 @@ test('a mastodon caption leaves room for the content warning', function () {
->and($account->contentOverflow($caption, Platform::Mastodon->reservedLength(['spoiler_text' => $warning])))->toBe(0);
});
+test('a discord destination stores the channel name from the cached list, not the one it was saved with', function () {
+ Bus::fake([PublishPost::class]);
+ fakeVideoDownload();
+ $this->mock(DiscordClient::class, function (MockInterface $client): void {
+ $client->shouldReceive('cachedChannels')->andReturn([['id' => '111', 'name' => 'general']]);
+ $client->shouldNotReceive('channels');
+ });
+
+ $account = SocialAccount::factory()->create(['platform' => Platform::Discord, 'platform_user_id' => '999']);
+ $item = repurposeItemTo($account, ['channel_id' => '111', 'channel_name' => 'sent-by-client']);
+
+ processItem($item);
+
+ expect(Post::query()->where('repurpose_item_id', $item->id)->sole()->meta)
+ ->toEqual(['channel_id' => '111', 'channel_name' => 'general']);
+});
+
test('a failed download throws so the job retries, leaving no post behind', function () {
Bus::fake([PublishPost::class]);
Http::fake([REPURPOSE_VIDEO_URL => Http::response('', 404)]);
diff --git a/tests/Feature/Repurpose/WebTest.php b/tests/Feature/Repurpose/WebTest.php
index ec315b68d..89471fadb 100644
--- a/tests/Feature/Repurpose/WebTest.php
+++ b/tests/Feature/Repurpose/WebTest.php
@@ -339,7 +339,6 @@ test('every per-platform meta key the web surface accepts is stored, not strippe
$meta = [
'channel_id' => '9001',
- 'channel_name' => 'reels',
'embeds' => [['title' => 'Watch', 'url' => 'https://trypost.it', 'color' => '#ff8800']],
];
diff --git a/tests/Feature/Services/Social/ConnectionVerifierEndpointsTest.php b/tests/Feature/Services/Social/ConnectionVerifierEndpointsTest.php
new file mode 100644
index 000000000..a0457cf29
--- /dev/null
+++ b/tests/Feature/Services/Social/ConnectionVerifierEndpointsTest.php
@@ -0,0 +1,83 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\SocialAccount\Platform;
+use App\Models\SocialAccount;
+use App\Services\Social\ConnectionVerifier;
+use App\Services\Social\Telegram\TelegramApi;
+use Illuminate\Http\Client\Request;
+use Illuminate\Support\Facades\Http;
+
+/*
+| The daily check calls one documented endpoint per network. These tests pin
+| that endpoint exactly: any other request is refused (`preventStrayRequests`),
+| the way the network would answer a wrong path with a 404, which the verifier
+| reads as "unavailable" and never fails on. A loose `host/*` fake let
+| LinkedIn's `/rest/userinfo` (a path that does not exist) pass for months.
+| Every path here answered 200 against a real account on 2026-10-14.
+*/
+
+beforeEach(function () {
+ config([
+ 'trypost.platforms.telegram.bot_token' => 'TELEGRAM-TOKEN',
+ 'trypost.platforms.discord.bot_token' => 'DISCORD-TOKEN',
+ ]);
+ Http::preventStrayRequests();
+});
+
+/**
+ * @return array{0: SocialAccount, 1: string}
+ */
+function verifierEndpointCase(string $case): array
+{
+ $future = ['token_expires_at' => now()->addDays(30)];
+
+ return match ($case) {
+ 'linkedin' => [SocialAccount::factory()->linkedin()->create($future), config('trypost.platforms.linkedin.api').'/v2/userinfo'],
+ 'linkedin page' => [SocialAccount::factory()->linkedinPage()->create($future), config('trypost.platforms.linkedin-page.api').'/rest/organizationAcls'],
+ 'x' => [SocialAccount::factory()->x()->create($future), config('trypost.platforms.x.api').'/users/me'],
+ 'tiktok' => [SocialAccount::factory()->tiktok()->create($future), config('trypost.platforms.tiktok.api').'/user/info/'],
+ 'youtube' => [SocialAccount::factory()->youtube()->create($future), config('trypost.platforms.youtube.data_api').'/channels'],
+ 'facebook' => [SocialAccount::factory()->facebook()->create($future), config('trypost.platforms.facebook.graph_api').'/me'],
+ 'instagram' => [SocialAccount::factory()->instagram()->create($future), Platform::Instagram->instagramGraphBaseUrl().'/me'],
+ 'instagram via facebook' => [SocialAccount::factory()->create(['platform' => Platform::InstagramFacebook, ...$future]), Platform::InstagramFacebook->instagramGraphBaseUrl().'/me'],
+ 'threads' => [SocialAccount::factory()->threads()->create($future), config('trypost.platforms.threads.graph_api').'/me'],
+ 'pinterest' => [SocialAccount::factory()->pinterest()->create($future), config('trypost.platforms.pinterest.api').'/user_account'],
+ 'bluesky' => [SocialAccount::factory()->bluesky()->create($future), 'https://bsky.social/xrpc/app.bsky.actor.getProfile'],
+ 'mastodon' => [SocialAccount::factory()->mastodon()->create($future), 'https://mastodon.social/api/v1/accounts/verify_credentials'],
+ 'telegram' => [SocialAccount::factory()->telegram()->create($future), TelegramApi::endpoint('getChat')],
+ 'discord' => [$discord = SocialAccount::factory()->discord()->create($future), config('trypost.platforms.discord.api')."/guilds/{$discord->platform_user_id}"],
+ 'google business' => [SocialAccount::factory()->googleBusiness()->create($future), config('trypost.platforms.google_business.business_information_api').'/locations/987654321'],
+ };
+}
+
+test('the daily check calls the documented endpoint of each network and nothing else', function (string $case, array $body) {
+ [$account, $endpoint] = verifierEndpointCase($case);
+ Http::fake([
+ $endpoint => Http::response($body),
+ "{$endpoint}?*" => Http::response($body),
+ ]);
+
+ expect((new ConnectionVerifier)->verify($account))->toBeTrue();
+
+ $expected = parse_url($endpoint);
+ Http::assertSent(fn (Request $request): bool => parse_url($request->url(), PHP_URL_HOST) === $expected['host']
+ && parse_url($request->url(), PHP_URL_PATH) === $expected['path']);
+})->with([
+ 'linkedin' => ['linkedin', ['sub' => 'member-1']],
+ 'linkedin page' => ['linkedin page', ['elements' => [['role' => 'ADMINISTRATOR', 'state' => 'APPROVED']]]],
+ 'x' => ['x', ['data' => ['id' => '1', 'username' => 'someone']]],
+ 'tiktok' => ['tiktok', ['data' => ['user' => ['open_id' => 'open-1']], 'error' => ['code' => 'ok']]],
+ 'youtube' => ['youtube', ['items' => [['id' => 'channel-1']]]],
+ 'facebook' => ['facebook', ['id' => 'page-1', 'name' => 'Page']],
+ 'instagram' => ['instagram', ['id' => 'app-scoped-1', 'username' => 'someone', 'user_id' => '17841400000000001']],
+ 'instagram via facebook' => ['instagram via facebook', ['id' => 'page-1', 'name' => 'Page']],
+ 'threads' => ['threads', ['id' => 'threads-1']],
+ 'pinterest' => ['pinterest', ['username' => 'someone']],
+ 'bluesky' => ['bluesky', ['did' => 'did:plc:someone', 'handle' => 'someone.bsky.social']],
+ 'mastodon' => ['mastodon', ['id' => '1', 'username' => 'someone']],
+ 'telegram' => ['telegram', ['ok' => true, 'result' => ['id' => -1001234567890]]],
+ 'discord' => ['discord', ['id' => 'guild-1', 'name' => 'Guild']],
+ 'google business' => ['google business', ['name' => 'locations/987654321']],
+]);
diff --git a/tests/Feature/Services/Social/ConnectionVerifierTest.php b/tests/Feature/Services/Social/ConnectionVerifierTest.php
index 6ec1f3aa7..60be48a78 100644
--- a/tests/Feature/Services/Social/ConnectionVerifierTest.php
+++ b/tests/Feature/Services/Social/ConnectionVerifierTest.php
@@ -9,7 +9,9 @@ use App\Jobs\Analytics\BootstrapAccountAnalytics;
use App\Jobs\Analytics\CollectAccountDailySnapshot;
use App\Models\SocialAccount;
use App\Services\Social\ConnectionVerifier;
+use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Http\Client\ConnectionException;
+use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Str;
@@ -20,7 +22,7 @@ beforeEach(function () {
test('verifies account without refresh when token is not expired', function () {
Http::fake([
- config('trypost.platforms.linkedin.api').'/*' => Http::response(['sub' => '123'], 200),
+ config('trypost.platforms.linkedin.api').'/v2/userinfo' => Http::response(['sub' => '123'], 200),
]);
$account = SocialAccount::factory()->linkedin()->create([
@@ -33,7 +35,7 @@ test('verifies account without refresh when token is not expired', function () {
expect($result)->toBeTrue();
Http::assertSentCount(1);
- Http::assertSent(fn ($request) => str_contains($request->url(), config('trypost.platforms.linkedin.api').'/rest/userinfo'));
+ Http::assertSent(fn ($request) => str_contains($request->url(), config('trypost.platforms.linkedin.api').'/v2/userinfo'));
});
test('refreshes linkedin token before verifying when expired', function () {
@@ -43,7 +45,7 @@ test('refreshes linkedin token before verifying when expired', function () {
'refresh_token' => 'new_refresh_token',
'expires_in' => 5184000,
], 200),
- config('trypost.platforms.linkedin.api').'/*' => Http::response(['sub' => '123'], 200),
+ config('trypost.platforms.linkedin.api').'/v2/userinfo' => Http::response(['sub' => '123'], 200),
]);
$account = SocialAccount::factory()->linkedin()->create([
@@ -517,7 +519,7 @@ test('instagram refresh records a 60-day expiry when the response omits expires_
test('does NOT refresh proactively when token still works (lazy refresh)', function () {
Http::fake([
- config('trypost.platforms.linkedin.api').'/*' => Http::response(['sub' => '123'], 200),
+ config('trypost.platforms.linkedin.api').'/v2/userinfo' => Http::response(['sub' => '123'], 200),
]);
// Token is "expiring soon" but access_token still works.
@@ -532,13 +534,13 @@ test('does NOT refresh proactively when token still works (lazy refresh)', funct
// Refresh endpoint must NOT have been called — verify worked without it.
Http::assertNotSent(fn ($request) => str_contains($request->url(), 'oauth/v2/accessToken'));
- Http::assertSent(fn ($request) => str_contains($request->url(), config('trypost.platforms.linkedin.api').'/rest/userinfo'));
+ Http::assertSent(fn ($request) => str_contains($request->url(), config('trypost.platforms.linkedin.api').'/v2/userinfo'));
});
test('refreshes lazily on 401 then retries verify', function () {
Http::fake([
// First verify call returns 401, second (after refresh) returns 200.
- config('trypost.platforms.linkedin.api').'/*' => Http::sequence()
+ config('trypost.platforms.linkedin.api').'/v2/userinfo' => Http::sequence()
->push(['error' => 'unauthorized'], 401)
->push(['sub' => '123'], 200),
config('trypost.platforms.linkedin.oauth_api').'/oauth/v2/accessToken' => Http::response([
@@ -562,7 +564,7 @@ test('refreshes lazily on 401 then retries verify', function () {
test('throws when verify returns 401 AND refresh also fails', function () {
Http::fake([
- config('trypost.platforms.linkedin.api').'/*' => Http::response(['error' => 'unauthorized'], 401),
+ config('trypost.platforms.linkedin.api').'/v2/userinfo' => Http::response(['error' => 'unauthorized'], 401),
config('trypost.platforms.linkedin.oauth_api').'/oauth/v2/accessToken' => Http::response(['error' => 'invalid_grant'], 400),
]);
@@ -583,7 +585,7 @@ test('forces refresh when token is hard-expired', function () {
'refresh_token' => 'new_refresh_token',
'expires_in' => 5184000,
], 200),
- config('trypost.platforms.linkedin.api').'/*' => Http::response(['sub' => '123'], 200),
+ config('trypost.platforms.linkedin.api').'/v2/userinfo' => Http::response(['sub' => '123'], 200),
]);
$account = SocialAccount::factory()->linkedin()->create([
@@ -1143,7 +1145,7 @@ test('throws PlatformUnavailableException when the discord guild lookup fails tr
test('linkedin verify treats a 5xx as platform unavailable, not a disconnect', function () {
Http::fake([
- config('trypost.platforms.linkedin.api').'/rest/userinfo' => Http::response(['message' => 'Internal Server Error'], 500),
+ config('trypost.platforms.linkedin.api').'/v2/userinfo' => Http::response(['message' => 'Internal Server Error'], 500),
]);
$account = SocialAccount::factory()->linkedin()->create();
@@ -1155,7 +1157,7 @@ test('linkedin verify treats a 5xx as platform unavailable, not a disconnect', f
test('linkedin verify throws TokenExpiredException on a bare 401', function () {
Http::fake([
config('trypost.platforms.linkedin.oauth_api').'/oauth/v2/accessToken' => Http::response(['error' => 'invalid_grant'], 400),
- config('trypost.platforms.linkedin.api').'/rest/userinfo' => Http::response(['message' => 'Unauthorized'], 401),
+ config('trypost.platforms.linkedin.api').'/v2/userinfo' => Http::response(['message' => 'Unauthorized'], 401),
]);
$account = SocialAccount::factory()->linkedin()->create();
@@ -1531,3 +1533,95 @@ test('a refresh that loses the race reuses the token the winner stored instead o
->and($loser->refresh_token)->toBe('winner-refresh');
Http::assertNothingSent();
});
+
+test('instagram login verify remembers the professional account id of an account connected before it was stored', function () {
+ Http::fake([
+ config('trypost.platforms.instagram.graph_api').'/me*' => Http::response(['id' => 'app-scoped-1', 'username' => 'trypost', 'user_id' => '17841400000000001']),
+ ]);
+
+ $account = SocialAccount::factory()->instagram()->create([
+ 'token_expires_at' => now()->addDays(30),
+ 'meta' => ['username' => 'trypost'],
+ ]);
+
+ expect((new ConnectionVerifier)->verify($account))->toBeTrue()
+ ->and($account->fresh()->meta)->toEqual(['username' => 'trypost', 'ig_user_id' => '17841400000000001']);
+ Http::assertSent(fn ($request): bool => str_contains($request->url(), 'fields=id%2Cusername%2Cuser_id'));
+});
+
+test('instagram via facebook verify asks for no user_id, which a page token does not have', function () {
+ Http::fake([
+ config('trypost.platforms.instagram-facebook.graph_api').'/me*' => Http::response(['id' => 'page-1', 'username' => 'trypost']),
+ ]);
+
+ $account = SocialAccount::factory()->instagram()->create([
+ 'platform' => 'instagram-facebook',
+ 'token_expires_at' => now()->addDays(30),
+ 'meta' => [],
+ ]);
+
+ expect((new ConnectionVerifier)->verify($account))->toBeTrue()
+ ->and(data_get($account->fresh()->meta, 'ig_user_id'))->toBeNull();
+ Http::assertSent(fn ($request): bool => str_contains($request->url(), 'fields=id%2Cusername&'));
+});
+
+test('remembering the instagram account id keeps meta saved meanwhile by a reconnect', function () {
+ Http::fake([
+ config('trypost.platforms.instagram.graph_api').'/me*' => Http::response(['id' => 'app-scoped-1', 'username' => 'trypost', 'user_id' => '17841400000000001']),
+ ]);
+ $account = SocialAccount::factory()->instagram()->create([
+ 'token_expires_at' => now()->addDays(30),
+ 'meta' => ['username' => 'trypost'],
+ ]);
+ SocialAccount::query()->whereKey($account->id)->update(['meta->account_type' => 'BUSINESS']);
+
+ (new ConnectionVerifier)->verify($account);
+
+ expect($account->fresh()->meta)->toEqual(['username' => 'trypost', 'account_type' => 'BUSINESS', 'ig_user_id' => '17841400000000001']);
+});
+
+test('remembering the instagram account id works on an account with empty meta', function (?array $meta) {
+ Http::fake([
+ config('trypost.platforms.instagram.graph_api').'/me*' => Http::response(['id' => 'app-scoped-1', 'username' => 'trypost', 'user_id' => '17841400000000001']),
+ ]);
+ $account = SocialAccount::factory()->instagram()->create([
+ 'token_expires_at' => now()->addDays(30),
+ 'meta' => $meta,
+ ]);
+
+ expect((new ConnectionVerifier)->verify($account))->toBeTrue()
+ ->and($account->fresh()->meta)->toEqual(['ig_user_id' => '17841400000000001']);
+})->with(['no meta' => [null], 'empty meta' => [[]]]);
+
+test('instagram login verify leaves meta alone when the profile has no professional account id', function () {
+ Http::fake([
+ config('trypost.platforms.instagram.graph_api').'/me*' => Http::response(['id' => 'app-scoped-1', 'username' => 'trypost']),
+ ]);
+ $account = SocialAccount::factory()->instagram()->create([
+ 'token_expires_at' => now()->addDays(30),
+ 'meta' => ['username' => 'trypost'],
+ ]);
+
+ expect((new ConnectionVerifier)->verify($account))->toBeTrue()
+ ->and($account->fresh()->meta)->toEqual(['username' => 'trypost']);
+});
+
+test('instagram login verify writes nothing when the professional account id is already stored', function () {
+ Http::fake([
+ config('trypost.platforms.instagram.graph_api').'/me*' => Http::response(['id' => 'app-scoped-1', 'username' => 'trypost', 'user_id' => 17841400000000001]),
+ ]);
+ $account = SocialAccount::factory()->instagram()->create([
+ 'token_expires_at' => now()->addDays(30),
+ 'meta' => ['username' => 'trypost', 'ig_user_id' => '17841400000000001'],
+ ]);
+ $metaWrites = [];
+ DB::listen(function (QueryExecuted $query) use (&$metaWrites): void {
+ if (str_starts_with(strtolower($query->sql), 'update') && str_contains($query->sql.json_encode($query->bindings), 'ig_user_id')) {
+ $metaWrites[] = $query->sql;
+ }
+ });
+
+ expect((new ConnectionVerifier)->verify($account))->toBeTrue()
+ ->and($metaWrites)->toBe([])
+ ->and($account->fresh()->meta)->toEqual(['username' => 'trypost', 'ig_user_id' => '17841400000000001']);
+});
diff --git a/tests/Feature/Services/Social/InstagramPublisherTest.php b/tests/Feature/Services/Social/InstagramPublisherTest.php
index dd0a53283..798511333 100644
--- a/tests/Feature/Services/Social/InstagramPublisherTest.php
+++ b/tests/Feature/Services/Social/InstagramPublisherTest.php
@@ -199,6 +199,42 @@ test('instagram publisher fits an image story to 9:16 and posts the hosted copy'
});
});
+test('instagram publisher sends no collaborators on a story that still has them in its meta', function () {
+ Storage::fake();
+ $this->post->update([
+ 'content_type' => ContentType::InstagramStory,
+ 'meta' => ['collaborators' => ['alice', 'bob']],
+ 'media' => [[
+ 'id' => 'test-media-story',
+ 'path' => 'media/2026-01/story.jpg',
+ 'url' => 'https://example.com/media/2026-01/story.jpg',
+ 'mime_type' => 'image/jpeg',
+ 'original_filename' => 'story.jpg',
+ ]],
+ ]);
+ $optimizer = Mockery::mock(MediaOptimizer::class);
+ $optimizer->shouldReceive('fitToCanvas')->andReturnUsing(function (string $tempFile): string {
+ $out = tempnam(sys_get_temp_dir(), 'ig_fit_');
+ copy($tempFile, $out);
+
+ return $out;
+ });
+ app()->instance(MediaOptimizer::class, $optimizer);
+
+ Http::fake([
+ 'https://graph.instagram.com/v25.0/ig_123456789/media' => Http::response(['id' => 'story-container-123'], 200),
+ 'https://graph.instagram.com/v25.0/story-container-123*' => Http::response(['status_code' => 'FINISHED'], 200),
+ 'https://graph.instagram.com/v25.0/ig_123456789/media_publish' => Http::response(['id' => 'story-123456789'], 200),
+ 'https://graph.instagram.com/v25.0/story-123456789*' => Http::response(['permalink' => 'https://www.instagram.com/stories/testuser/123/'], 200),
+ '*' => Http::response(file_get_contents(__DIR__.'/../../../fixtures/1x1.png'), 200, ['Content-Type' => 'image/png']),
+ ]);
+
+ expect($this->publisher->publish($this->post)['id'])->toBe('story-123456789');
+
+ Http::assertSent(fn (Request $request): bool => str_ends_with($request->url(), '/ig_123456789/media'));
+ Http::assertNotSent(fn (Request $request): bool => data_get($request->data(), 'collaborators') !== null);
+});
+
test('instagram publisher fits a real off-ratio story image to a 1080x1920 jpeg', function () {
Storage::fake();
$this->post->update(['content_type' => ContentType::InstagramStory]);
@@ -2531,3 +2567,195 @@ test('an instagram story is not measured against the caption length', function (
Http::assertSent(fn (Request $request): bool => str_ends_with($request->url(), '/ig_123456789/media_publish'));
});
+
+test('instagram publisher sends collaborators and a trial reel on a reel', function () {
+ $this->post->update([
+ 'content_type' => ContentType::InstagramReel,
+ 'meta' => [
+ 'collaborators' => ['@alice', 'bob'],
+ 'trial_graduation' => 'SS_PERFORMANCE',
+ ],
+ 'media' => instagramVideo(),
+ ]);
+ fakeInstagramReelFlow();
+
+ $this->publisher->publish($this->post);
+
+ Http::assertSent(fn (Request $request): bool => str_ends_with($request->url(), '/ig_123456789/media')
+ && data_get($request->data(), 'media_type') === 'REELS'
+ && json_decode((string) data_get($request->data(), 'collaborators'), true) === ['alice', 'bob']
+ && json_decode((string) data_get($request->data(), 'trial_params'), true) === ['graduation_strategy' => 'SS_PERFORMANCE']
+ && data_get($request->data(), 'audio_configuration') === null);
+});
+
+test('instagram publisher fails a reel with music on an account connected through Instagram Login', function () {
+ $this->post->update([
+ 'content_type' => ContentType::InstagramReel,
+ 'meta' => ['audio' => ['id' => '1234567890']],
+ 'media' => instagramVideo(),
+ ]);
+ fakeInstagramReelFlow();
+
+ expect(fn () => $this->publisher->publish($this->post))
+ ->toThrow(function (InstagramPublishException $exception): void {
+ expect($exception->getMessage())->toBe(__('posts.form.instagram.music.requires_facebook'))
+ ->and($exception->category)->toBe(ErrorCategory::ContentPolicy);
+ });
+
+ Http::assertNothingSent();
+});
+
+test('a feed video with a leftover track on an account connected through Instagram Login publishes without music', function () {
+ $this->post->update([
+ 'content_type' => ContentType::InstagramFeed,
+ 'meta' => ['audio' => ['id' => '1234567890']],
+ 'media' => instagramVideo(),
+ ]);
+ fakeInstagramReelFlow();
+
+ $this->publisher->publish($this->post->fresh());
+
+ Http::assertSent(fn (Request $request): bool => str_ends_with($request->url(), '/ig_123456789/media')
+ && data_get($request->data(), 'media_type') === 'REELS'
+ && ! array_key_exists('audio_configuration', $request->data()));
+ Http::assertSent(fn (Request $request): bool => str_ends_with($request->url(), '/ig_123456789/media_publish'));
+});
+
+test('instagram publisher attaches music to a reel of an account connected through Facebook', function (int|string $videoVolume) {
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::InstagramFacebook,
+ 'platform_user_id' => 'igf_1',
+ 'token_expires_at' => now()->addDays(60),
+ ]);
+ $post = Post::factory()->forAccount($account, ContentType::InstagramReel)->create([
+ 'user_id' => $this->user->id,
+ 'content' => 'With music',
+ 'meta' => ['audio' => ['id' => '1234567890', 'title' => 'Song', 'video_volume' => $videoVolume]],
+ 'media' => [[
+ 'id' => 'test-media-video',
+ 'path' => 'media/2026-01/test-video.mp4',
+ 'url' => 'https://example.com/media/2026-01/test-video.mp4',
+ 'mime_type' => 'video/mp4',
+ 'original_filename' => 'test.mp4',
+ ]],
+ ]);
+ $post->setRelation('socialAccount', $account);
+ $graph = config('trypost.platforms.instagram-facebook.graph_api');
+
+ Http::fake([
+ "{$graph}/igf_1/media" => Http::response(['id' => 'container-9'], 200),
+ "{$graph}/container-9*" => Http::response(['status_code' => 'FINISHED'], 200),
+ "{$graph}/igf_1/media_publish" => Http::response(['id' => 'reel-9'], 200),
+ "{$graph}/reel-9*" => Http::response(['permalink' => 'https://www.instagram.com/reel/R9/'], 200),
+ ]);
+
+ $this->publisher->publish($post);
+
+ Http::assertSent(fn (Request $request): bool => str_ends_with($request->url(), '/igf_1/media')
+ && json_decode((string) data_get($request->data(), 'audio_configuration'), true) === ['audio_id' => '1234567890', 'video_volume' => 20]
+ && data_get($request->data(), 'collaborators') === null && data_get($request->data(), 'trial_params') === null);
+})->with(['volume as a number' => [20], 'volume as text' => ['20']]);
+
+test('instagram publisher sends collaborators on the carousel container only', function () {
+ $this->post->update([
+ 'meta' => ['collaborators' => ['alice']],
+ 'media' => collect(range(0, 1))->map(fn (int $i): array => [
+ 'id' => "test-media-{$i}",
+ 'path' => "media/2026-01/test-image-{$i}.jpg",
+ 'url' => "https://example.com/media/2026-01/test-image-{$i}.jpg",
+ 'mime_type' => 'image/jpeg',
+ 'original_filename' => "test-{$i}.jpg",
+ ])->all(),
+ ]);
+
+ $graph = config('trypost.platforms.instagram.graph_api');
+
+ Http::fake([
+ "{$graph}/ig_123456789/media" => Http::sequence()
+ ->push(['id' => 'child-1'], 200)
+ ->push(['id' => 'child-2'], 200)
+ ->push(['id' => 'carousel-1'], 200),
+ "{$graph}/carousel-1*" => Http::response(['status_code' => 'FINISHED'], 200),
+ "{$graph}/ig_123456789/media_publish" => Http::response(['id' => 'post-1'], 200),
+ "{$graph}/post-1*" => Http::response(['permalink' => 'https://www.instagram.com/p/P1/'], 200),
+ ]);
+
+ $this->publisher->publish($this->post);
+
+ Http::assertSent(fn (Request $request): bool => data_get($request->data(), 'media_type') === 'CAROUSEL'
+ && json_decode((string) data_get($request->data(), 'collaborators'), true) === ['alice']);
+ Http::assertNotSent(fn (Request $request): bool => data_get($request->data(), 'is_carousel_item') === 'true'
+ && data_get($request->data(), 'collaborators') !== null);
+});
+
+test('instagram publisher sends no collaborators on a story', function () {
+ $this->post->update([
+ 'content_type' => ContentType::InstagramStory,
+ 'meta' => ['collaborators' => ['alice']],
+ 'media' => [[
+ 'id' => 'test-media-video',
+ 'path' => 'media/2026-01/test-video.mp4',
+ 'url' => 'https://example.com/media/2026-01/test-video.mp4',
+ 'mime_type' => 'video/mp4',
+ 'original_filename' => 'test.mp4',
+ ]],
+ ]);
+
+ fakeInstagramReelFlow();
+
+ $this->publisher->publish($this->post);
+
+ Http::assertNotSent(fn (Request $request): bool => data_get($request->data(), 'collaborators') !== null);
+});
+
+test('instagram publisher sends collaborators on a single image feed post', function () {
+ $this->post->update([
+ 'meta' => ['collaborators' => ['@alice', 'bob']],
+ 'media' => [[
+ 'id' => 'test-media-image',
+ 'path' => 'media/2026-01/test-image.jpg',
+ 'url' => 'https://example.com/media/2026-01/test-image.jpg',
+ 'mime_type' => 'image/jpeg',
+ 'original_filename' => 'test.jpg',
+ ]],
+ ]);
+ fakeInstagramReelFlow();
+
+ $this->publisher->publish($this->post);
+
+ Http::assertSent(fn (Request $request): bool => str_ends_with($request->url(), '/ig_123456789/media')
+ && data_get($request->data(), 'image_url') === 'https://example.com/media/2026-01/test-image.jpg'
+ && data_get($request->data(), 'collaborators') === '["alice","bob"]');
+});
+
+test('a feed video on an account connected through Facebook sends no trial or music', function () {
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::InstagramFacebook,
+ 'platform_user_id' => 'igf_1',
+ 'token_expires_at' => now()->addDays(60),
+ ]);
+ $post = Post::factory()->forAccount($account, ContentType::InstagramFeed)->create([
+ 'user_id' => $this->user->id,
+ 'content' => 'Feed video',
+ 'meta' => ['trial_graduation' => 'MANUAL', 'audio' => ['id' => '1234567890']],
+ 'media' => instagramVideo(),
+ ]);
+ $post->setRelation('socialAccount', $account);
+ $graph = config('trypost.platforms.instagram-facebook.graph_api');
+
+ Http::fake([
+ "{$graph}/igf_1/media" => Http::response(['id' => 'container-9'], 200),
+ "{$graph}/container-9*" => Http::response(['status_code' => 'FINISHED'], 200),
+ "{$graph}/igf_1/media_publish" => Http::response(['id' => 'reel-9'], 200),
+ "{$graph}/reel-9*" => Http::response(['permalink' => 'https://www.instagram.com/reel/R9/'], 200),
+ ]);
+
+ $this->publisher->publish($post);
+
+ Http::assertSent(fn (Request $request): bool => str_ends_with($request->url(), '/igf_1/media')
+ && data_get($request->data(), 'media_type') === 'REELS'
+ && ! array_key_exists('trial_params', $request->data())
+ && ! array_key_exists('audio_configuration', $request->data()));
+});
diff --git a/tests/Feature/Settings/AuthenticationTest.php b/tests/Feature/Settings/ProfileLoginAndSessionsTest.php
similarity index 66%
rename from tests/Feature/Settings/AuthenticationTest.php
rename to tests/Feature/Settings/ProfileLoginAndSessionsTest.php
index 9874f40ed..ffa1aa6e5 100644
--- a/tests/Feature/Settings/AuthenticationTest.php
+++ b/tests/Feature/Settings/ProfileLoginAndSessionsTest.php
@@ -3,6 +3,7 @@
declare(strict_types=1);
use App\Models\User;
+use App\Support\Auth\PasswordRequirements;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
@@ -10,13 +11,14 @@ test('authentication page is displayed', function () {
$user = User::factory()->create();
$this->actingAs($user)
- ->get(route('app.authentication.edit'))
+ ->get(route('app.profile.edit', ['tab' => 'login']))
->assertOk()
->assertInertia(fn ($page) => $page
- ->component('settings/profile/Authentication')
+ ->component('settings/profile/Profile')
->has('sessions')
->where('hasPassword', true)
->has('connectedAccounts')
+ ->where('passwordRequirements', PasswordRequirements::checklist())
);
});
@@ -24,14 +26,14 @@ test('password can be updated', function () {
$user = User::factory()->create();
$this->actingAs($user)
- ->from(route('app.authentication.edit'))
- ->put(route('app.authentication.update-password'), [
+ ->from(route('app.profile.edit', ['tab' => 'login']))
+ ->put(route('app.profile.password.update'), [
'current_password' => 'password',
'password' => strongPassword(),
'password_confirmation' => strongPassword(),
])
->assertSessionHasNoErrors()
- ->assertRedirect(route('app.authentication.edit'));
+ ->assertRedirect(route('app.profile.edit', ['tab' => 'login']));
expect(Hash::check(strongPassword(), $user->refresh()->password))->toBeTrue();
});
@@ -40,8 +42,8 @@ test('password cannot be updated to a weak or compromised password', function (s
$user = User::factory()->create();
$this->actingAs($user)
- ->from(route('app.authentication.edit'))
- ->put(route('app.authentication.update-password'), [
+ ->from(route('app.profile.edit', ['tab' => 'login']))
+ ->put(route('app.profile.password.update'), [
'current_password' => 'password',
'password' => $password,
'password_confirmation' => $password,
@@ -58,18 +60,18 @@ test('correct password must be provided to update password', function () {
$user = User::factory()->create();
$this->actingAs($user)
- ->from(route('app.authentication.edit'))
- ->put(route('app.authentication.update-password'), [
+ ->from(route('app.profile.edit', ['tab' => 'login']))
+ ->put(route('app.profile.password.update'), [
'current_password' => 'wrong-password',
'password' => strongPassword(),
'password_confirmation' => strongPassword(),
])
->assertSessionHasErrors('current_password')
- ->assertRedirect(route('app.authentication.edit'));
+ ->assertRedirect(route('app.profile.edit', ['tab' => 'login']));
});
test('password update requires authentication', function () {
- $this->put(route('app.authentication.update-password'), [])
+ $this->put(route('app.profile.password.update'), [])
->assertRedirect(route('login'));
});
@@ -77,8 +79,8 @@ test('password must be confirmed', function () {
$user = User::factory()->create();
$this->actingAs($user)
- ->from(route('app.authentication.edit'))
- ->put(route('app.authentication.update-password'), [
+ ->from(route('app.profile.edit', ['tab' => 'login']))
+ ->put(route('app.profile.password.update'), [
'current_password' => 'password',
'password' => strongPassword(),
'password_confirmation' => 'wrong-confirmation',
@@ -90,8 +92,8 @@ test('user without a password can set one without current_password', function ()
$user = User::factory()->create(['password' => null, 'google_id' => 'google-123']);
$this->actingAs($user)
- ->from(route('app.authentication.edit'))
- ->put(route('app.authentication.update-password'), [
+ ->from(route('app.profile.edit', ['tab' => 'login']))
+ ->put(route('app.profile.password.update'), [
'password' => strongPassword(),
'password_confirmation' => strongPassword(),
])
@@ -104,9 +106,9 @@ test('disconnect provider removes the link', function () {
$user = User::factory()->create(['google_id' => 'google-123', 'password' => bcrypt('password')]);
$this->actingAs($user)
- ->from(route('app.authentication.edit'))
- ->delete(route('app.authentication.disconnect-provider', 'google'))
- ->assertRedirect(route('app.authentication.edit'));
+ ->from(route('app.profile.edit', ['tab' => 'login']))
+ ->delete(route('app.profile.connected-accounts.destroy', 'google'))
+ ->assertRedirect(route('app.profile.edit', ['tab' => 'login']));
expect($user->refresh()->google_id)->toBeNull();
});
@@ -115,8 +117,8 @@ test('disconnect provider blocked when it is the only sign-in method', function
$user = User::factory()->create(['google_id' => 'google-123', 'password' => null]);
$this->actingAs($user)
- ->from(route('app.authentication.edit'))
- ->delete(route('app.authentication.disconnect-provider', 'google'))
+ ->from(route('app.profile.edit', ['tab' => 'login']))
+ ->delete(route('app.profile.connected-accounts.destroy', 'google'))
->assertSessionHas('flash.error');
expect($user->refresh()->google_id)->toBe('google-123');
@@ -126,16 +128,14 @@ test('disconnect provider rejects unknown provider', function () {
$user = User::factory()->create();
$this->actingAs($user)
- ->delete(route('app.authentication.disconnect-provider', 'twitter'))
+ ->delete(route('app.profile.connected-accounts.destroy', 'twitter'))
->assertNotFound();
});
-test('destroy other sessions removes other rows for the user', function () {
- if (config('session.driver') !== 'database') {
- $this->markTestSkipped('Session driver is not database.');
- }
+test('logging out other devices needs no password, with or without one set', function (?string $password) {
+ config(['session.driver' => 'database']);
- $user = User::factory()->create();
+ $user = User::factory()->create(['password' => $password]);
$sessionsTable = config('session.table', 'sessions');
DB::table($sessionsTable)->insert([
@@ -150,11 +150,10 @@ test('destroy other sessions removes other rows for the user', function () {
]);
$this->actingAs($user)
- ->from(route('app.authentication.edit'))
- ->delete(route('app.authentication.destroy-other-sessions'), [
- 'password' => 'password',
- ])
- ->assertRedirect(route('app.authentication.edit'));
+ ->from(route('app.profile.edit', ['tab' => 'sessions']))
+ ->delete(route('app.profile.sessions.destroy-others'))
+ ->assertSessionHasNoErrors()
+ ->assertRedirect(route('app.profile.edit', ['tab' => 'sessions']));
expect(DB::table($sessionsTable)->where('id', 'other-session-id')->exists())->toBeFalse();
-});
+})->with(['with a password' => 'password', 'signed up with Google or GitHub' => null]);
diff --git a/tests/Feature/Social/InstagramControllerTest.php b/tests/Feature/Social/InstagramControllerTest.php
index 567b0f964..40ff17d76 100644
--- a/tests/Feature/Social/InstagramControllerTest.php
+++ b/tests/Feature/Social/InstagramControllerTest.php
@@ -2,8 +2,11 @@
declare(strict_types=1);
+use App\Enums\Post\Status as PostStatus;
+use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
use App\Enums\SocialAccount\Status;
+use App\Models\Post;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
@@ -187,6 +190,36 @@ test('instagram callback refuses an identity already connected via the facebook
expect($this->workspace->socialAccounts()->where('platform_user_id', 'shared-ig-id')->count())->toBe(1);
});
+test('instagram callback refuses an account seated through facebook under its professional account id', function () {
+ SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::InstagramFacebook,
+ 'platform_user_id' => '17841400000000001',
+ 'username' => 'brand',
+ ]);
+
+ startSocialConnect($this->workspace->id, Platform::Instagram);
+
+ $socialiteUser = Mockery::mock(SocialiteUser::class);
+ $socialiteUser->shouldReceive('getId')->andReturn('app-scoped-1');
+ $socialiteUser->shouldReceive('getNickname')->andReturn('brand');
+ $socialiteUser->shouldReceive('getName')->andReturn('Brand');
+ $socialiteUser->shouldReceive('getAvatar')->andReturn(null);
+ $socialiteUser->token = 'test-access-token';
+ $socialiteUser->refreshToken = null;
+ $socialiteUser->expiresIn = 5184000;
+ $socialiteUser->user = ['account_type' => 'BUSINESS', 'user_id' => 17841400000000001];
+
+ Socialite::shouldReceive('driver')->with('instagram')->andReturn(Mockery::mock(['user' => $socialiteUser]));
+
+ $this->actingAs($this->user)
+ ->get(route('app.social.instagram.callback'))
+ ->assertRedirect(route('app.social.connect.show', Platform::Instagram));
+
+ expect(socialConnectFailure())->toBe('all_connected')
+ ->and($this->workspace->socialAccounts()->count())->toBe(1);
+});
+
test('instagram callback reconnects the original card', function () {
$account = SocialAccount::factory()->create([
'workspace_id' => $this->workspace->id,
@@ -299,3 +332,66 @@ test('a connect racing another on the same network says it is busy without filin
Log::shouldNotHaveReceived('error');
});
+
+test('instagram callback stores the professional account id', function () {
+ startSocialConnect($this->workspace->id, Platform::Instagram);
+
+ $socialiteUser = Mockery::mock(SocialiteUser::class);
+ $socialiteUser->shouldReceive('getId')->andReturn('app-scoped-1');
+ $socialiteUser->shouldReceive('getNickname')->andReturn('testuser');
+ $socialiteUser->shouldReceive('getName')->andReturn('Test User');
+ $socialiteUser->shouldReceive('getAvatar')->andReturn(null);
+ $socialiteUser->token = 'test-access-token';
+ $socialiteUser->refreshToken = null;
+ $socialiteUser->expiresIn = 5184000;
+ $socialiteUser->user = ['account_type' => 'BUSINESS', 'user_id' => 17841400000000001];
+
+ Socialite::shouldReceive('driver')->with('instagram')->andReturn(Mockery::mock(['user' => $socialiteUser]));
+
+ $this->actingAs($this->user)->get(route('app.social.instagram.callback'));
+ finishSocialConnect(Platform::Instagram)->assertRedirect();
+
+ expect(SocialAccount::where('platform_user_id', 'app-scoped-1')->sole()->meta)
+ ->toEqual(['account_type' => 'BUSINESS', 'ig_user_id' => '17841400000000001']);
+});
+
+test('instagram callback moves a card connected through facebook back to instagram login', function () {
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::InstagramFacebook,
+ 'platform_user_id' => '17841400000000001',
+ 'username' => 'old',
+ ]);
+ $reel = Post::factory()->forAccount($account, ContentType::InstagramReel)->create([
+ 'user_id' => $this->user->id,
+ 'status' => PostStatus::Scheduled,
+ 'scheduled_at' => now()->addDay(),
+ 'meta' => ['audio' => ['id' => '123', 'title' => 'Song']],
+ ]);
+
+ startSocialConnect($this->workspace->id, Platform::Instagram, $account->id);
+
+ $socialiteUser = Mockery::mock(SocialiteUser::class);
+ $socialiteUser->shouldReceive('getId')->andReturn('app-scoped-1');
+ $socialiteUser->shouldReceive('getNickname')->andReturn('testuser');
+ $socialiteUser->shouldReceive('getName')->andReturn('Test User');
+ $socialiteUser->shouldReceive('getAvatar')->andReturn(null);
+ $socialiteUser->token = 'fresh-access-token';
+ $socialiteUser->refreshToken = null;
+ $socialiteUser->expiresIn = 5184000;
+ $socialiteUser->user = ['account_type' => 'BUSINESS', 'user_id' => '17841400000000001'];
+
+ Socialite::shouldReceive('driver')->with('instagram')->andReturn(Mockery::mock(['user' => $socialiteUser]));
+
+ $this->actingAs($this->user)
+ ->get(route('app.social.instagram.callback'))
+ ->assertRedirect(route('app.social.connect.show', Platform::Instagram));
+ finishSocialConnect(Platform::Instagram)->assertRedirect();
+
+ expect($this->workspace->socialAccounts()->count())->toBe(1)
+ ->and($account->fresh()->platform)->toBe(Platform::Instagram)
+ ->and($account->fresh()->platform_user_id)->toBe('app-scoped-1')
+ ->and($account->fresh()->access_token)->toBe('fresh-access-token')
+ ->and($reel->fresh()->platform)->toBe(Platform::Instagram)
+ ->and(data_get($reel->fresh()->meta, 'audio.id'))->toBe('123');
+});
diff --git a/tests/Feature/Social/InstagramFacebookControllerTest.php b/tests/Feature/Social/InstagramFacebookControllerTest.php
index f8e60dca2..bb513a655 100644
--- a/tests/Feature/Social/InstagramFacebookControllerTest.php
+++ b/tests/Feature/Social/InstagramFacebookControllerTest.php
@@ -466,6 +466,62 @@ test('instagram-facebook callback hides an instagram already connected standalon
->and($this->workspace->socialAccounts()->count())->toBe(1);
});
+test('instagram-facebook callback hides a standalone instagram whose login reports another id', function () {
+ SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::Instagram,
+ 'platform_user_id' => 'app-scoped-ig',
+ 'meta' => ['ig_user_id' => 'shared-ig'],
+ ]);
+
+ startSocialConnect($this->workspace->id, Platform::InstagramFacebook);
+
+ $socialiteUser = Mockery::mock(SocialiteUser::class);
+ $socialiteUser->token = 'test-user-token';
+
+ Socialite::shouldReceive('driver')
+ ->with('facebook')
+ ->andReturn(Mockery::mock()
+ ->shouldReceive('usingGraphVersion')->andReturnSelf()
+ ->shouldReceive('redirectUrl')->andReturnSelf()
+ ->shouldReceive('user')->andReturn($socialiteUser)
+ ->getMock());
+
+ $graphApi = config('trypost.platforms.instagram-facebook.graph_api');
+
+ Http::fake([
+ "{$graphApi}/me/permissions*" => Http::response(['data' => [['permission' => 'pages_show_list', 'status' => 'granted']]], 200),
+ "{$graphApi}/me?*" => Http::response(['id' => 'facebook_user_123', 'name' => 'User'], 200),
+ "{$graphApi}/me/businesses*" => Http::response(['data' => []], 200),
+ "{$graphApi}/me/accounts*" => Http::response([
+ 'data' => [
+ [
+ 'id' => 'page-1',
+ 'name' => 'Shared Page',
+ 'access_token' => 'page-token',
+ 'instagram_business_account' => ['id' => 'shared-ig'],
+ ],
+ ],
+ ], 200),
+ "{$graphApi}/*" => Http::response([
+ 'id' => 'shared-ig',
+ 'username' => 'shared',
+ 'name' => 'Shared',
+ ], 200),
+ ]);
+
+ $this->actingAs($this->user)
+ ->get(route('app.social.instagram-facebook.callback'))
+ ->assertRedirect(route('app.social.connect.show', Platform::InstagramFacebook));
+
+ expect(socialConnectFailure())->toBe('all_connected');
+
+ expect($this->workspace->socialAccounts()
+ ->where('platform', Platform::InstagramFacebook->value)
+ ->exists())->toBeFalse()
+ ->and($this->workspace->socialAccounts()->count())->toBe(1);
+});
+
test('instagram via facebook connects a page reached through a business portfolio', function () {
startSocialConnect($this->workspace->id, Platform::InstagramFacebook);
@@ -769,3 +825,107 @@ test('a reconnect keeps the handle it had when the lookup never ran', function (
->and($account->getRawOriginal('avatar_url'))->toBe('avatars/kept.jpg')
->and($account->access_token)->toBe('fresh-token');
});
+
+test('reconnecting a standalone instagram card through facebook moves it to instagram via facebook', function () {
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::Instagram,
+ 'platform_user_id' => 'app-scoped-1',
+ 'username' => 'mybiz',
+ 'access_token' => 'instagram-token',
+ 'meta' => ['account_type' => 'BUSINESS', 'ig_user_id' => 'ig-pro-1'],
+ ]);
+ Http::fake();
+
+ startSocialConnect($this->workspace, Platform::InstagramFacebook, $account)->offer([
+ PendingConnection::identity(Platform::InstagramFacebook, 'ig-pro-1', 'My Biz', 'mybiz', null, 'profile', [
+ 'username' => 'mybiz',
+ 'display_name' => 'My Biz',
+ 'access_token' => 'page-token',
+ 'scopes' => ['instagram_content_publish'],
+ 'meta' => ['page_id' => 'page-1', 'page_name' => 'My Page'],
+ ]),
+ ]);
+
+ $this->actingAs($this->user);
+
+ finishSocialConnect(Platform::InstagramFacebook)->assertInertiaFlash('connectedChannel.created', false);
+
+ $account->refresh();
+
+ expect($this->workspace->socialAccounts()->count())->toBe(1)
+ ->and($account->platform)->toBe(Platform::InstagramFacebook)
+ ->and($account->platform_user_id)->toBe('ig-pro-1')
+ ->and($account->access_token)->toBe('page-token');
+});
+
+test('reconnecting through facebook still refuses another instagram account', function () {
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::Instagram,
+ 'platform_user_id' => 'app-scoped-1',
+ 'meta' => ['ig_user_id' => 'ig-pro-1'],
+ ]);
+
+ startSocialConnect($this->workspace, Platform::InstagramFacebook, $account)->offer([
+ PendingConnection::identity(Platform::InstagramFacebook, 'ig-pro-2', 'Other', 'other', null, 'profile', [
+ 'username' => 'other',
+ 'access_token' => 'page-token',
+ 'scopes' => ['instagram_content_publish'],
+ ]),
+ ]);
+
+ $this->actingAs($this->user);
+ finishSocialConnect(Platform::InstagramFacebook)->assertRedirect(route('app.social.connect.show', Platform::InstagramFacebook));
+
+ expect(socialConnectFailure())->toBe('wrong_account')
+ ->and($this->workspace->socialAccounts()->count())->toBe(1)
+ ->and($account->fresh()->platform)->toBe(Platform::Instagram)
+ ->and($account->fresh()->platform_user_id)->toBe('app-scoped-1');
+});
+
+test('a facebook callback reconnecting a standalone instagram card that finds another instagram account says the page is missing', function () {
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::Instagram,
+ 'platform_user_id' => 'app-scoped-1',
+ 'meta' => ['ig_user_id' => 'ig-pro-1'],
+ ]);
+
+ startSocialConnect($this->workspace, Platform::InstagramFacebook, $account);
+
+ $socialiteUser = Mockery::mock(SocialiteUser::class);
+ $socialiteUser->token = 'test-user-token';
+
+ Socialite::shouldReceive('driver')
+ ->with('facebook')
+ ->andReturn(Mockery::mock()
+ ->shouldReceive('usingGraphVersion')->andReturnSelf()
+ ->shouldReceive('redirectUrl')->andReturnSelf()
+ ->shouldReceive('user')->andReturn($socialiteUser)
+ ->getMock());
+
+ $graphApi = config('trypost.platforms.instagram-facebook.graph_api');
+
+ Http::fake([
+ "{$graphApi}/me/permissions*" => Http::response(['data' => [['permission' => 'pages_show_list', 'status' => 'granted']]], 200),
+ "{$graphApi}/me?*" => Http::response(['id' => 'facebook_user_123', 'name' => 'User'], 200),
+ "{$graphApi}/me/businesses*" => Http::response(['data' => []], 200),
+ "{$graphApi}/me/accounts*" => Http::response(['data' => [[
+ 'id' => 'page-2',
+ 'name' => 'Other Page',
+ 'access_token' => 'page-token',
+ 'instagram_business_account' => ['id' => 'ig-pro-2'],
+ ]]], 200),
+ "{$graphApi}/*" => Http::response(['id' => 'ig-pro-2', 'username' => 'other', 'name' => 'Other'], 200),
+ ]);
+
+ $this->actingAs($this->user)
+ ->get(route('app.social.instagram-facebook.callback'))
+ ->assertRedirect(route('app.social.connect.show', Platform::InstagramFacebook));
+
+ expect(socialConnectFailure())->toBe('page_not_found')
+ ->and($this->workspace->socialAccounts()->count())->toBe(1)
+ ->and($account->fresh()->platform)->toBe(Platform::Instagram)
+ ->and($account->fresh()->platform_user_id)->toBe('app-scoped-1');
+});
diff --git a/tests/Feature/Social/SwitchAccountTest.php b/tests/Feature/Social/SwitchAccountTest.php
index 28c69d845..d2fb5bc85 100644
--- a/tests/Feature/Social/SwitchAccountTest.php
+++ b/tests/Feature/Social/SwitchAccountTest.php
@@ -59,7 +59,7 @@ test('a plain connect keeps the parameters it always sends', function (string $r
})->with([
'facebook re-asks declined permissions' => ['app.social.facebook.connect', 'auth_type=rerequest'],
'instagram via facebook re-asks declined permissions' => ['app.social.instagram-facebook.connect', 'auth_type=rerequest'],
- 'google business asks for consent' => ['app.social.google-business.connect', 'consent&include_granted_scopes=true'],
+ 'google business asks for consent' => ['app.social.google-business.connect', 'consent'],
'youtube always shows the account chooser' => ['app.social.youtube.connect', 'prompt=select_account consent'],
'tiktok always shows its authorization page' => ['app.social.tiktok.connect', 'disable_auto_auth=1'],
'instagram always asks for the instagram login' => ['app.social.instagram.connect', 'force_reauth=true'],
@@ -168,3 +168,14 @@ test('switch account is offered only while there is an account to confirm', func
->get(route('app.social.connect.show', Platform::X))
->assertInertia(fn (AssertableInertia $page) => $page->where('state', 'cancelled')->where('switchUrl', null));
});
+
+test('google connects ask only for their own scopes, never the ones granted to other features of the same app', function (string $route, string $scope) {
+ $url = urldecode(switchAccountAuthorizeUrl($route));
+
+ expect($url)->toContain($scope)
+ ->not->toContain('include_granted_scopes')
+ ->not->toContain('drive.file');
+})->with([
+ 'youtube' => ['app.social.youtube.connect', 'https://www.googleapis.com/auth/youtube.upload'],
+ 'google business' => ['app.social.google-business.connect', 'https://www.googleapis.com/auth/business.manage'],
+]);
diff --git a/tests/Feature/Social/YouTubeControllerTest.php b/tests/Feature/Social/YouTubeControllerTest.php
index 39c795e3d..00f947f3c 100644
--- a/tests/Feature/Social/YouTubeControllerTest.php
+++ b/tests/Feature/Social/YouTubeControllerTest.php
@@ -33,7 +33,6 @@ test('youtube connect redirects to oauth provider', function () {
$driverMock->shouldReceive('with')->with([
'access_type' => 'offline',
'prompt' => 'select_account consent',
- 'include_granted_scopes' => 'true',
])->once()->andReturnSelf();
$driverMock->shouldReceive('redirect')->andReturn(Mockery::mock([
'getTargetUrl' => 'https://accounts.google.com/o/oauth2/v2/auth?test=1',
diff --git a/tests/Feature/SocialAccount/NetworkUniquenessTest.php b/tests/Feature/SocialAccount/NetworkUniquenessTest.php
index ab992d2b9..a62e7a04e 100644
--- a/tests/Feature/SocialAccount/NetworkUniquenessTest.php
+++ b/tests/Feature/SocialAccount/NetworkUniquenessTest.php
@@ -2,6 +2,8 @@
declare(strict_types=1);
+use App\Enums\Analytics\SyncCollector;
+use App\Enums\Analytics\SyncStatus;
use App\Enums\Post\PublishStatus;
use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
@@ -9,12 +11,16 @@ use App\Enums\SocialAccount\Status;
use App\Exceptions\SocialAccount\NetworkAlreadyConnectedException;
use App\Jobs\Analytics\BootstrapAccountAnalytics;
use App\Jobs\Analytics\CollectAccountDailySnapshot;
+use App\Models\AnalyticsAccountDailySnapshot;
+use App\Models\AnalyticsPublication;
+use App\Models\AnalyticsSyncState;
use App\Models\Post;
use App\Models\SocialAccount;
use App\Models\Workspace;
use Illuminate\Database\QueryException;
use Illuminate\Database\UniqueConstraintViolationException;
use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Queue;
beforeEach(function () {
@@ -504,3 +510,94 @@ test('reconnecting across a network variant moves only the posts still waiting t
->content_type->toBe(ContentType::LinkedInPost)
->and($failed->fresh()->platform)->toBe(Platform::LinkedIn);
});
+
+test('an instagram login account without a stored account id is not matched across variants and asks instagram nothing', function () {
+ $account = SocialAccount::factory()->instagram()->create(['platform_user_id' => 'app-scoped-1', 'meta' => []]);
+ Http::fake();
+
+ expect($account->isIdentity(Platform::InstagramFacebook, 'ig-pro-1'))->toBeFalse();
+
+ Http::assertNothingSent();
+});
+
+test('reconnecting through facebook carries the card analytics over to the new identity', function () {
+ $account = SocialAccount::factory()->instagram()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform_user_id' => 'app-scoped-id',
+ 'meta' => ['ig_user_id' => 'ig-account-id'],
+ ]);
+ $backfill = AnalyticsSyncState::factory()->create([
+ ...AnalyticsSyncState::identityFor($account),
+ 'social_account_id' => $account->id,
+ 'status' => SyncStatus::Complete,
+ ]);
+ $publication = AnalyticsPublication::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'social_account_id' => $account->id,
+ 'platform' => Platform::Instagram,
+ 'platform_user_id' => 'app-scoped-id',
+ ]);
+ $snapshot = AnalyticsAccountDailySnapshot::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'social_account_id' => $account->id,
+ 'network' => Platform::Instagram->network(),
+ 'platform' => Platform::Instagram,
+ 'platform_user_id' => 'app-scoped-id',
+ ]);
+
+ SocialAccount::connectIdentity(
+ $this->workspace,
+ Platform::InstagramFacebook,
+ 'ig-account-id',
+ ['status' => Status::Connected],
+ $account,
+ );
+
+ expect($backfill->fresh())
+ ->social_account_id->toBe($account->id)
+ ->platform_user_id->toBe('ig-account-id')
+ ->identity_key->toBe(AnalyticsSyncState::identityFor($account->fresh())['identity_key'])
+ ->and($publication->fresh())
+ ->platform->toBe(Platform::InstagramFacebook)
+ ->platform_user_id->toBe('ig-account-id')
+ ->and($snapshot->fresh())
+ ->platform->toBe(Platform::InstagramFacebook)
+ ->platform_user_id->toBe('ig-account-id');
+});
+
+test('a card moved onto an identity it was connected as before takes that sync history back', function () {
+ $account = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::InstagramFacebook,
+ 'platform_user_id' => 'ig-account-id',
+ ]);
+ $facebookBackfill = AnalyticsSyncState::factory()->create([
+ ...AnalyticsSyncState::identityFor($account),
+ 'social_account_id' => $account->id,
+ 'status' => SyncStatus::Complete,
+ ]);
+ $earlierLoginBackfill = AnalyticsSyncState::factory()->create([
+ ...AnalyticsSyncState::identityFor(new SocialAccount([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::Instagram,
+ 'platform_user_id' => 'app-scoped-id',
+ ])),
+ 'social_account_id' => null,
+ 'status' => SyncStatus::Complete,
+ ]);
+
+ SocialAccount::connectIdentity(
+ $this->workspace,
+ Platform::Instagram,
+ 'app-scoped-id',
+ ['status' => Status::Connected, 'meta' => ['ig_user_id' => 'ig-account-id']],
+ $account,
+ );
+ (new BootstrapAccountAnalytics($account->id, true))->handleFor($account->id);
+
+ expect($earlierLoginBackfill->fresh()->social_account_id)->toBe($account->id)
+ ->and($facebookBackfill->fresh())
+ ->social_account_id->toBeNull()
+ ->platform_user_id->toBe('ig-account-id')
+ ->and(AnalyticsSyncState::query()->where('social_account_id', $account->id)->where('collector', SyncCollector::PublicationBackfill)->count())->toBe(1);
+});
diff --git a/tests/Feature/Webhook/WebhookPostLifecycleTest.php b/tests/Feature/Webhook/WebhookPostLifecycleTest.php
index 081d57f8d..325e61b99 100644
--- a/tests/Feature/Webhook/WebhookPostLifecycleTest.php
+++ b/tests/Feature/Webhook/WebhookPostLifecycleTest.php
@@ -124,6 +124,36 @@ test('creating a channel post includes labels and its channel in the payload', f
});
});
+test('creating an instagram reel with music and collaborators carries them in the post.created payload', function () {
+ subscribeToWebhook($this->workspace, [EventType::PostCreated]);
+
+ $account = SocialAccount::factory()->recycle($this->workspace)->create(['platform' => Platform::InstagramFacebook]);
+
+ $post = createWebhookPost($this->workspace, $this->user, [
+ 'content' => 'Reel with music',
+ 'created_via' => CreatedVia::Api,
+ 'destination' => [
+ 'social_account_id' => $account->id,
+ 'content_type' => ContentType::InstagramReel->value,
+ 'meta' => [
+ 'audio' => ['id' => '1234567890', 'title' => 'Summer Song', 'artist' => 'The Band', 'audio_volume' => 40, 'video_volume' => 30],
+ 'collaborators' => ['alice', 'bob'],
+ 'share_to_feed' => false,
+ ],
+ ],
+ ]);
+
+ Queue::assertPushed(DispatchWebhook::class, fn (DispatchWebhook $job): bool => $job->eventType === EventType::PostCreated->value
+ && data_get($job->payload, 'id') === $post->id
+ && data_get($job->payload, 'platform') === Platform::InstagramFacebook->value
+ && data_get($job->payload, 'content_type') === ContentType::InstagramReel->value
+ && data_get($job->payload, 'meta.audio.id') === '1234567890'
+ && data_get($job->payload, 'meta.audio.audio_volume') === 40
+ && data_get($job->payload, 'meta.audio.video_volume') === 30
+ && data_get($job->payload, 'meta.collaborators') === ['alice', 'bob']
+ && data_get($job->payload, 'meta.share_to_feed') === false);
+});
+
test('scheduling a post through UpdatePost includes labels and meta from the same save', function () {
subscribeToWebhook($this->workspace, [EventType::PostScheduled]);
diff --git a/tests/Unit/PostPlatformMetaRulesTest.php b/tests/Unit/PostPlatformMetaRulesTest.php
index d7bbee8a3..d2ae6e72e 100644
--- a/tests/Unit/PostPlatformMetaRulesTest.php
+++ b/tests/Unit/PostPlatformMetaRulesTest.php
@@ -3,17 +3,20 @@
declare(strict_types=1);
use App\Enums\GoogleBusiness\TopicType;
+use App\Enums\PostPlatform\ContentType;
use App\Enums\SocialAccount\Platform;
use App\Enums\TikTok\PrivacyLevel;
use App\Rules\ContentFitsPlatformLimits;
use App\Support\PostPlatformMetaRules;
use Illuminate\Support\Facades\Validator;
-test('custom meta messages only cover pinterest title and link', function () {
+test('custom meta messages cover pinterest, instagram collaborators and google business', function () {
expect(PostPlatformMetaRules::messages())->toBe([
'meta.link.url' => __('posts.form.pinterest.link_invalid'),
'meta.link.max' => __('posts.form.pinterest.link_max'),
'meta.title.max' => __('posts.form.pinterest.title_max'),
+ 'meta.collaborators.max' => __('posts.form.instagram.collaborators.max', ['max' => PostPlatformMetaRules::INSTAGRAM_MAX_COLLABORATORS]),
+ 'meta.collaborators.*.regex' => __('posts.form.instagram.collaborators.invalid'),
'meta.event.end_date.after_or_equal' => __('posts.form.google_business.event_end_date_before_start'),
'meta.event.title.max' => __('posts.form.google_business.title_max'),
]);
@@ -454,3 +457,15 @@ test('the documentation describes the youtube title as the first line of the con
->toContain('derived from the first non-empty line of the content')
->not->toContain('first sentence');
});
+
+test('instagram music and trial reel rules apply only to reels', function () {
+ $trialWithCollaborators = ['collaborators' => ['alice'], 'trial_graduation' => 'MANUAL'];
+ $music = ['audio' => ['id' => '1234567890']];
+
+ expect(PostPlatformMetaRules::requiredMetaViolation(Platform::InstagramFacebook, $trialWithCollaborators, ContentType::InstagramReel)[0] ?? null)->toBe('trial_graduation')
+ ->and(PostPlatformMetaRules::requiredMetaViolation(Platform::Instagram, $music, 'instagram_reel')[0] ?? null)->toBe('audio')
+ ->and(PostPlatformMetaRules::requiredMetaViolation(Platform::InstagramFacebook, ['audio' => ['title' => 'Song']], 'instagram_reel')[0] ?? null)->toBe('audio.id')
+ ->and(PostPlatformMetaRules::requiredMetaViolation(Platform::LinkedIn, ['audio' => ['title' => 'Song']], ContentType::LinkedInPost))->toBeNull()
+ ->and(PostPlatformMetaRules::requiredMetaViolation(Platform::InstagramFacebook, $trialWithCollaborators, ContentType::InstagramFeed))->toBeNull()
+ ->and(PostPlatformMetaRules::requiredMetaViolation(Platform::Instagram, $music, ContentType::InstagramStory))->toBeNull();
+});
diff --git a/tests/Unit/Socialite/InstagramProviderTest.php b/tests/Unit/Socialite/InstagramProviderTest.php
index edacc5a63..a5e5ed37f 100644
--- a/tests/Unit/Socialite/InstagramProviderTest.php
+++ b/tests/Unit/Socialite/InstagramProviderTest.php
@@ -6,6 +6,7 @@ use App\Socialite\InstagramProvider;
use GuzzleHttp\Client;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
+use GuzzleHttp\Middleware;
use GuzzleHttp\Psr7\Response as GuzzleResponse;
use Illuminate\Http\Request;
@@ -102,3 +103,24 @@ test('instagram provider reports the permissions the login granted as its scopes
'documented shape' => [['data' => [['access_token' => 'short-token', 'user_id' => '1', 'permissions' => 'instagram_business_basic,instagram_business_content_publish']]]],
'flat shape' => [['access_token' => 'short-token', 'user_id' => '1', 'permissions' => ['instagram_business_basic', 'instagram_business_content_publish']]],
]);
+
+test('instagram provider asks for the professional account id with the profile', function () {
+ $history = [];
+ $stack = HandlerStack::create(new MockHandler([
+ new GuzzleResponse(200, ['Content-Type' => 'application/json'], json_encode(['id' => 'app-scoped-1', 'user_id' => '17841400000000001', 'username' => 'brand'])),
+ ]));
+ $stack->push(Middleware::history($history));
+
+ $provider = new InstagramProvider(Request::create('/'), 'client-id', 'client-secret', 'https://example.com/callback');
+ $provider->setHttpClient(new Client(['handler' => $stack]));
+
+ $user = $provider->userFromToken('token-1');
+
+ parse_str($history[0]['request']->getUri()->getQuery(), $query);
+
+ expect((string) $history[0]['request']->getUri()->withQuery(''))->toBe(config('trypost.platforms.instagram.graph_api').'/me')
+ ->and(explode(',', $query['fields']))->toContain('id', 'user_id', 'username')
+ ->and($query['access_token'])->toBe('token-1')
+ ->and($user->getId())->toBe('app-scoped-1')
+ ->and($user->user['user_id'])->toBe('17841400000000001');
+});
diff --git a/tests/fixtures/single-line-copy.php b/tests/fixtures/single-line-copy.php
index e945ecbef..5a8305f72 100644
--- a/tests/fixtures/single-line-copy.php
+++ b/tests/fixtures/single-line-copy.php
@@ -50,9 +50,11 @@ return [
'calendar.title' => 10,
'channels.description' => 43,
'channels.goal_dialog.description' => 57,
+ 'channels.link_facebook_page' => 35,
'channels.grid.title' => 10,
'channels.settings_page.cancel' => 9,
'channels.settings_page.timezone_confirm' => 22,
+ 'common.unsaved_changes.discard' => 17,
'create.tabs.feeds' => 10,
'create.tabs.ideas' => 8,
'create.tabs.templates' => 10,
@@ -63,6 +65,7 @@ return [
'mcp.authorize.cancel' => 9,
'mcp.authorize.select_workspace' => 28,
'mcp.subtitle' => 45,
+ 'notes.title' => 10,
'posts.approvals.approve' => 10,
'posts.approvals.reject' => 9,
'posts.approvals.revert' => 32,
@@ -71,6 +74,13 @@ return [
'posts.composer.edit_view' => 11,
'posts.composer.hashtags_remaining' => 16,
'posts.composer.link_preview.replace_with_media' => 40,
+ 'posts.composer.media_editor.alt_tab' => 10,
+ 'posts.composer.media_editor.edit_tab' => 10,
+ 'posts.composer.media_editor.tags_cancel' => 9,
+ 'posts.composer.media_editor.tags_move' => 11,
+ 'posts.composer.media_editor.tags_move_pill' => 25,
+ 'posts.composer.media_editor.tags_tab' => 10,
+ 'posts.composer.media_editor.thumbnail_tab' => 10,
'posts.composer.schedule_picker.done' => 8,
'posts.composer.schedule_picker.more_actions' => 16,
'posts.composer.select_all' => 17,
@@ -92,7 +102,22 @@ return [
'posts.form.google_business.topic_type.event' => 13,
'posts.form.google_business.topic_type.offer' => 11,
'posts.form.google_business.topic_type.standard' => 14,
+ 'posts.form.instagram.collaborators.got_it' => 10,
+ 'posts.form.instagram.collaborators.label' => 16,
+ 'posts.form.instagram.music.add' => 16,
+ 'posts.form.instagram.music.audio_volume' => 8,
+ 'posts.form.instagram.music.label' => 8,
+ 'posts.form.instagram.music.maybe_later' => 11,
+ 'posts.form.instagram.music.save_and_link' => 19,
+ 'posts.form.instagram.music.video_volume' => 7,
'posts.form.instagram.share_to_feed' => 20,
+ 'posts.form.instagram.trial_reel.auto' => 8,
+ 'posts.form.instagram.trial_reel.badge' => 6,
+ 'posts.form.instagram.trial_reel.checked' => 19,
+ 'posts.form.instagram.trial_reel.label' => 16,
+ 'posts.form.instagram.trial_reel.manual' => 11,
+ 'posts.form.instagram.trial_reel.not_checked' => 5,
+ 'posts.form.instagram.trial_reel.off' => 6,
'posts.form.mastodon.content_warning' => 20,
'posts.form.thread.start' => 17,
'posts.form.threads.topic' => 9,
@@ -103,6 +128,10 @@ return [
'posts.form.youtube.visibility' => 13,
'posts.list_view' => 6,
'posts.publish.actions.add_to_queue' => 28,
+ 'posts.publish.actions.copy_link' => 19,
+ 'posts.publish.actions.queue_setup.action' => 20,
+ 'posts.publish.actions.queue_setup.not_now' => 11,
+ 'posts.publish.actions.share_link' => 29,
'posts.publish.in_google_review' => 28,
'settings.api_keys.description' => 42,
'settings.members.access.admin_description' => 41,
@@ -151,6 +180,14 @@ return [
'mcp.connect_other' => 10,
'mcp.tabs.connected' => 23,
'mcp.tabs.connect' => 21,
+ 'welcome.mcp.benefits.analytics.hint' => 34,
+ 'welcome.mcp.benefits.analytics.title' => 31,
+ 'welcome.mcp.benefits.ideas.hint' => 37,
+ 'welcome.mcp.benefits.ideas.title' => 23,
+ 'welcome.mcp.benefits.queue.hint' => 30,
+ 'welcome.mcp.benefits.queue.title' => 25,
+ 'welcome.mcp.benefits.schedule.hint' => 40,
+ 'welcome.mcp.benefits.schedule.title' => 35,
'welcome.mcp.pick_ai' => 41,
'welcome.mcp.skip' => 21,
'welcome.mcp.connect_ai' => 20,
@@ -165,6 +202,9 @@ return [
'settings.sidebar.groups.integrations' => 14,
'settings.sidebar.groups.content' => 11,
'settings.sidebar.items.api_keys' => 3,
+ 'settings.profile.tabs.profile' => 12,
+ 'settings.profile.tabs.login' => 25,
+ 'settings.profile.tabs.sessions' => 9,
'welcome.personas.agency' => 10,
'welcome.personas.creator' => 23,
'welcome.personas.developer' => 15,