Skip to content

fix(connect): send to follow-primary profiles via custom-invite deeplink#514

Draft
maree217 wants to merge 1 commit into
stickerdaniel:mainfrom
maree217:fix/connect-follow-primary-more-menu
Draft

fix(connect): send to follow-primary profiles via custom-invite deeplink#514
maree217 wants to merge 1 commit into
stickerdaniel:mainfrom
maree217:fix/connect-follow-primary-more-menu

Conversation

@maree217

Copy link
Copy Markdown

Fixes #454.

Problem

connect_with_person returns connect_unavailable ("LinkedIn did not expose a usable Connect action for this profile.") on profiles where the Connect control isn't a /preload/custom-invite/?vanityName= anchor — most commonly follow-primary / creator-mode profiles where Follow is the primary button and Connect sits under the More (⋯) menu as a JS button.

detect_connection_state classifies these follow_only; the connect path opens the More menu and re-reads signals, but the menu's Connect is a button, not the invite anchor, so has_invite_anchor stays False and the write-gate bails — even though the custom-invite deeplink opens the invite dialog regardless of where Connect lives.

This is exactly "Profile A" in #454, which the reporter tentatively flagged as a possibly-correct rejection — it isn't; Connect is reachable via the deeplink.

Fix

Remove the has_invite_anchor pre-gate and rely on _submit_invite_dialog as the write-gate. It already:

  • returns submitted=False without sending when no invite dialog opens (_dialog_is_open) — so genuinely unconnectable profiles still return connect_unavailable, no accidental sends;
  • surfaces the Premium note-quota block (custom_note_limit_reached).

+11 / −29. The follow_only More-menu reread is now redundant for gating (left in place to keep the diff focused; can be removed in a follow-up, along with the now-unused _probe_invite_note_limit).

Verification (live)

Verified end-to-end against two live UK creator-mode profiles (Follow primary; Connect under ⋯), both classified follow_only with has_invite_anchor=False (→ connect_unavailable on main):

  • Navigating to https://www.linkedin.com/preload/custom-invite/?vanityName=<user> opened the "Add a note to your invitation?" dialog — the exact dialog _submit_invite_dialog drives.
  • Add a note + Send flipped the profile to Pending.

Safety / locale-independence

No text-label matching added; detection logic is unchanged. The change only removes a pre-gate and routes through the existing deeplink-submit path, whose write-gate is the structural _dialog_is_open check. Per the repo's Scraping Rules, classification stays on URL patterns + attribute presence.

Synthetic prompt

connect_with_person returns connect_unavailable on follow-primary / creator-mode profiles (Connect under the ⋯ menu). The has_invite_anchor pre-gate bails because the menu's Connect is a button, not a /preload/custom-invite anchor. Remove the pre-gate and let _submit_invite_dialog (which no-sends when no dialog opens and handles the note-quota block) be the write-gate. Verify live that the custom-invite deeplink opens the invite dialog and sends on such a profile.

Generated with Claude Opus 4.8

The has_invite_anchor pre-gate in connect_with_person returned
connect_unavailable for follow-primary / creator-mode profiles whose
Connect control lives in the More menu as a button, not a
/preload/custom-invite anchor. has_invite_anchor stayed False even after
opening the menu, so the custom-invite deeplink (which opens the invite
dialog regardless of button placement) was never tried.

Remove the pre-gate and rely on _submit_invite_dialog as the write-gate:
it returns submitted=False without sending when no dialog opens, and
surfaces the Premium note-quota block. Verified live against two
UK creator-mode profiles: deeplink opened the invite dialog and the
request sent (profile flipped to Pending).

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

Labels

None yet

Projects

None yet

1 participant