Skip to content

Flag people with multiple user accounts and link to merging them - #2661

Merged
maebeale merged 4 commits into
mainfrom
maebeale/multiple-accounts-flag
Oct 15, 2026
Merged

maebeale merged 4 commits into
mainfrom
maebeale/multiple-accounts-flag

Conversation

@maebeale

@maebeale maebeale commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 admin-only warning + small return_to hook in the shared dedupe preview

Admins can now see when a person has more than one user account, open each one, and merge the extras from the person's page. A merge can leave a person with two logins, and until now the profile only showed one.

  • Mirrors the "Multiple memberships" warning on person show and edit (admin-only, gated by UserPolicy#index?).
  • Each account shows its last sign-in. "Shown on profile" uses Person#user's ordering.
  • "Suggested keeper" matches the logins deduper (Add a users (logins) deduper #2662): the most recent login that can sign in.
  • Every other account gets "Preview merge →", which opens the logins deduper with the suggested keeper preselected.
  • Dedupable gains return_to=person_show|person_edit + person_id. With those params, the preview's back link, Cancel, Swap, and the post-merge redirect all return to the person. Other dedupers are unchanged.
  • Queries User.where(person_id:) in the decorator. It doesn't add a has_many :users association, because AhoyTrackable reflects on every association.
  • Removes the "Internal notes on people" features entry (Show internal notes to admins behind ?admin on people and organizations #2689), since those notes sit behind the unlisted ?admin switch.

🤖 Generated with Claude Code

@maebeale
maebeale force-pushed the maebeale/multiple-accounts-flag branch 3 times, most recently from 79738be to 0de8ef9 Compare October 14, 2026 13:09
@maebeale maebeale changed the title Flag people with multiple user accounts on person show and edit Flag people with multiple user accounts and link to merging them Oct 14, 2026

label = mc.model_name.human.pluralize
redirect_to url_for(action: :index),
redirect_to dedupe_return&.dig(:path) || url_for(action: :index),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: This is in the shared Dedupable concern, so every deduper honors return_to. Only the person warning sends it, though, and it only targets the logins merge, where the person survives. A people merge with return_to would land on the deleted person.

@maebeale
maebeale marked this pull request as ready for review October 14, 2026 13:20
@maebeale
maebeale requested a review from jmilljr24 October 14, 2026 13:20
@maebeale
maebeale force-pushed the maebeale/multiple-accounts-flag branch from 0de8ef9 to cdc8169 Compare October 14, 2026 13:24
@maebeale maebeale changed the title Flag people with multiple user accounts and link to merging them JM: Flag people with multiple user accounts and link to merging them Oct 14, 2026
@maebeale
maebeale force-pushed the maebeale/multiple-accounts-flag branch 2 times, most recently from 6f04a2e to ad1393c Compare October 14, 2026 16:07
@maebeale
maebeale force-pushed the maebeale/multiple-accounts-flag branch from ad1393c to 71d3815 Compare October 15, 2026 00:03
@maebeale maebeale changed the title JM: Flag people with multiple user accounts and link to merging them Flag people with multiple user accounts and link to merging them Oct 15, 2026
maebeale and others added 3 commits October 14, 2026 20:20
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A merge can leave a person with two logins. The profile shows only the most
recently used one, so admins had no way to see or reach the others. The new
warning mirrors the multiple-memberships flag and links to every account.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Main now has a logins deduper. Linking each extra account to its merge preview,
with the deduper's suggested keeper picked, turns the warning into a fix. The
preview and the finished merge return to the person page the admin started on.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@maebeale
maebeale force-pushed the maebeale/multiple-accounts-flag branch from 71d3815 to a484cdd Compare October 15, 2026 00:21
Internal notes sit behind an unlisted ?admin switch, so the features page
shouldn't advertise them. Also drops two stale pro-tip lines an earlier rebase
left in the seed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@maebeale
maebeale force-pushed the maebeale/multiple-accounts-flag branch from a484cdd to 7b6a215 Compare October 15, 2026 00:27
@maebeale
maebeale merged commit 58ad73d into main Oct 15, 2026
3 checks passed
@maebeale
maebeale deleted the maebeale/multiple-accounts-flag branch October 15, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants