Skip to content

Commit 039b6be

Browse files
ddevdanclaude
andcommitted
[NRT-903] Address review: drop unused arg, trim volatile pointers
- `_show_upsell` no longer takes `user_details`; the copy comes from the claim endpoint, not from `GET /users/me`. - Drop the Django-repo file/line pointers from the taxonomy comments; name the `source` and `surface` properties instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 6cacca5 commit 039b6be

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

ankihub/gui/flashcard_selector_dialog.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ def _get_non_embed_url(self) -> str:
7070
UPSELL_SOURCE_GENERIC = "generic_upsell"
7171

7272
# Third value in the web's `surface` taxonomy, alongside `web_app` (browser) and
73-
# `anki_webview` (webview hosted in Anki), which are set in _analytics_state.html:17.
74-
# Note that Smart Search's webview is also served inside the add-on and reports
75-
# `anki_webview`, so this value means specifically the add-on's native Qt layer.
76-
# Both surfaces open the same plans page with no marker of their own, so this property
77-
# is the only thing preventing double-counting.
73+
# `anki_webview` (webview hosted in Anki). Smart Search's webview is also served inside
74+
# the add-on and reports `anki_webview`, so this value means specifically the add-on's
75+
# native Qt layer. Both surfaces open the same plans page with no marker of their own,
76+
# so this property is the only thing preventing double-counting.
7877
UPSELL_SURFACE = "anki_addon"
7978

8079

@@ -95,8 +94,8 @@ def send_event() -> None:
9594
distinct_id=user_id,
9695
event_name=event_name,
9796
properties={
98-
# Key and values mirror the web upsell's taxonomy so the two channels can
99-
# be reconciled later (ModalUpsellContent.html:40,47 emits `source`).
97+
# `source` and `surface` mirror the web upsell's taxonomy so the two
98+
# channels can be reconciled later.
10099
"source": source,
101100
"surface": UPSELL_SURFACE,
102101
"user": user_id,
@@ -142,7 +141,7 @@ def on_button_clicked(button_index: int) -> None:
142141
_track_upsell_event("upgrade_cta_viewed", source)
143142

144143

145-
def _show_upsell(user_details: dict, parent=aqt.mw) -> None:
144+
def _show_upsell(parent=aqt.mw) -> None:
146145
"""Claim the one-shot trial-ended message, then show the upsell with the matching copy.
147146
148147
The claim is what marks the message as shown, so it is sent here - at display time - and
@@ -179,5 +178,5 @@ def on_access_granted(_: dict) -> None:
179178
check_user_feature_access(
180179
feature_key="has_flashcard_selector_access",
181180
on_access_granted=on_access_granted,
182-
on_access_denied=lambda user_details: _show_upsell(user_details, parent),
181+
on_access_denied=lambda _: _show_upsell(parent),
183182
)

0 commit comments

Comments
 (0)