Skip to content

feat: admin can add a team member to the impersonated organization#1743

Merged
nevo-david merged 1 commit into
mainfrom
feat/admin-add-team-member
Jul 23, 2026
Merged

feat: admin can add a team member to the impersonated organization#1743
nevo-david merged 1 commit into
mainfrom
feat/admin-add-team-member

Conversation

@giladresisi

Copy link
Copy Markdown
Collaborator

Why

Support flow: while helping a user (already in a thread with them), an admin needs to attach an existing Postiz account to that user's organization without the invitation-email round trip and without approval from the added account. Since team invitations are stateless JWT links (nothing is stored in the DB), "approving" an already-sent invitation is the same operation as adding the member directly — so this also covers the case where the org owner already sent an invite that the user never completed.

What changed

  • Impersonation bar: a new Add Team Member button, shown only while impersonating and only when the impersonated organization's plan includes team members (pricing[tier].team_members — TEAM and above). Opens a modal with email + role (USER/ADMIN), mirroring the existing team invite form.
  • Backend: superadmin-only POST /settings/team/addOrganizationService.addTeamMemberByEmail, which gates on the plan, looks the email up across all auth providers, and returns clear errors for: no account with that email, multiple accounts sharing the email on different providers (refuses to guess rather than attach the wrong account), and already-a-member. The add itself reuses the existing addUserToOrg path.
  • No emails are sent by design — the admin performs this inside a support thread with the users involved, and the regular invite-acceptance flow sends no notification emails either, so behavior stays consistent.

Manually verified on the admin panel: an existing account is added successfully and appears in the org's team, and a non-existing email fires an error toast.

Other information

🤖 Generated with Claude Code

Adds an Add Team Member button to the impersonation bar, shown only when
the impersonated organization plan includes team members (TEAM and above).
The modal takes an email and role (USER/ADMIN) and directly adds an
existing Postiz account to the organization with no approval needed,
via a new superadmin-only POST /settings/team/add endpoint. Since team
invitations are stateless JWT links, adding directly also covers the
case of approving a previously sent invitation. Errors are returned for
unknown emails, ambiguous multi-provider emails and existing members.

Manually verified on the admin panel: adding an existing account
succeeds, and a non-existing email fires an error toast.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@postiz-contribution postiz-contribution Bot added the contribution:approved Approved contributor label Jul 19, 2026
@postiz-contribution

Copy link
Copy Markdown

Contribution-checker quality warning
Heuristic score: 20/100 (low). This is a non-blocking warning surfaced by the project's quality settings.

Heuristics that flagged:

  • Excessive inline code references: 6 inline refs (>3)
  • PR doesn't use the repo's PR template: 5 required checkbox items missing (max 1, match ≥80%)
  • Body adds too many extra headers beyond the template: 3 extra headers (>1)
  • AI watermark phrase: Matched: "Generated with Claude Code"
  • Commit message too long: Longest: 813 chars

If this is a genuine contribution, please add detail to your PR description and tighten the diff scope before reviewers look at it.

@postiz-agent

postiz-agent Bot commented Jul 19, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@nevo-david
nevo-david merged commit c53276c into main Jul 23, 2026
11 checks passed
@nevo-david
nevo-david deleted the feat/admin-add-team-member branch July 23, 2026 03:37
giladresisi added a commit that referenced this pull request Jul 23, 2026
Resolves the impersonate.tsx and users.controller.ts conflicts with the
Switch User (#1730) and Add Team Member (#1743) features that landed on
main — both sides kept everywhere. Also drops the duplicate useToaster
import that #1730 + #1743 left on main (same fix as #1764; the two
deletions merge cleanly whichever lands first), so this branch builds
against current main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pull Bot pushed a commit to dubbypanda/postiz-app that referenced this pull request Jul 23, 2026
PRs gitroomhq#1730 and gitroomhq#1743 each added the same useToaster import to
impersonate.tsx next to different neighboring lines, so merging both
into main kept both copies without a textual conflict. Turbopack
rejects the duplicate identifier, breaking every frontend build of
main since the gitroomhq#1743 merge. Verified pnpm run build:frontend passes
with the duplicate removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution:approved Approved contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants