fix(connect): send to follow-primary profiles via custom-invite deeplink#514
Draft
maree217 wants to merge 1 commit into
Draft
fix(connect): send to follow-primary profiles via custom-invite deeplink#514maree217 wants to merge 1 commit into
maree217 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #454.
Problem
connect_with_personreturnsconnect_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_stateclassifies thesefollow_only; the connect path opens the More menu and re-reads signals, but the menu's Connect is a button, not the invite anchor, sohas_invite_anchorstaysFalseand 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_anchorpre-gate and rely on_submit_invite_dialogas the write-gate. It already:submitted=Falsewithout sending when no invite dialog opens (_dialog_is_open) — so genuinely unconnectable profiles still returnconnect_unavailable, no accidental sends;custom_note_limit_reached).+11 / −29. Thefollow_onlyMore-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_onlywithhas_invite_anchor=False(→connect_unavailableonmain):https://www.linkedin.com/preload/custom-invite/?vanityName=<user>opened the "Add a note to your invitation?" dialog — the exact dialog_submit_invite_dialogdrives.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_opencheck. Per the repo's Scraping Rules, classification stays on URL patterns + attribute presence.Synthetic prompt
Generated with Claude Opus 4.8