Skip to content

fix: gate flashcards shortcuts and tags when the feature is disabled - #13401

Merged
tiensonqin merged 7 commits into
masterfrom
logseq/gate-flashcards-feature-2450
Nov 25, 2026
Merged

tiensonqin merged 7 commits into
masterfrom
logseq/gate-flashcards-feature-2450

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1272

Root cause

:feature/enable-flashcards? already hid the Flashcards Navigation item (and the "Make a flashcard" context-menu actions). It did not gate:

  • gf / tc (:go/flashcards → toggle-cards! → :modal/show-cards)
  • #Card / #Cards tag completion (get-matched-classes / blank # search)
  • Query builder and property class pickers
  • Practice button on #Cards blocks
  • batch-make-cards!

:inactive on shortcuts is evaluated once at load time, so the handlers have to check the live flag.

Fix

  • toggle-cards! and :modal/show-cards no-op when Flashcards is off (an already-open dialog can still be closed)
  • Hide #Card / #Cards at UI class/tag pickers via state/classes-for-tag-completion, using the requested repo's enable-flashcards?: editor # completion, query builder tags, and the property class picker
  • Property class-select keeps already-selected Card/Cards so existing tag restrictions can still be deselected
  • Keep db-async/<get-all-classes as an unfiltered worker passthrough so plugin get-all-tags and other graphs still see existing Card/Cards tags; worker nil is preserved
  • Hide the #Cards Practice button and skip batch-make-cards! when off
  • Subscribe the left sidebar to config so the Navigation Flashcards item actually disappears when the toggle changes

Enabling the feature again restores shortcuts, tags, and the modal.

Review follow-up

Moved the class filter out of shared <get-all-classes so a disabled Flashcards feature cannot:

  • drop Card/Cards from plugin tag listings
  • apply the current graph's flag to another graph's class fetch
  • rewrite a missing worker result (nil) into []

UI pickers apply the repo-aware filter. class-select retains already-selected flashcard classes so they remain removable.

Tests

Focused unit and e2e, all green. Sync tests skipped. clj-kondo lint is clean after renaming a shadowed keep local.

  • Unit: toggle-cards! off vs on; classes-for-tag-completion uses the repo flag and keeps selected Card; <get-all-classes stays complete and preserves nil; get-matched-classes hides/shows Card/Cards
  • E2E: flashcards-feature-flag-gates-shortcuts-and-tags-test plus existing flashcards-plus-and-switching-test

Pre-fix evidence

With Flashcards disabled, gf still opened the modal and #card still offered Card/Cards:

Settings Features with Flashcards disabled
gf still opens flashcards modal after disable
#card still offers Card and Cards after disable

Post-fix evidence

Same flow after the fix: nav hides, shortcuts do not open, #card does not offer Card/Cards; re-enabling restores both.

gf does not open flashcards after disable
#card no longer offers Card or Cards after disable
gf opens flashcards again after re-enable
#card offers Card and Cards after re-enable

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

@tiensonqin
tiensonqin marked this pull request as ready for review September 24, 2026 06:23
devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 1 new potential issue.

⚠️ 1 issue in files not directly in the diff

⚠️ Flashcard tags remain in tag pickers

With Flashcards off, <get-all-classes still supplies Card and Cards to the query builder and property class picker. Both pickers offer disabled flashcard tags for selection.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

@tiensonqin tiensonqin self-assigned this Sep 24, 2026
@tiensonqin
tiensonqin force-pushed the logseq/gate-flashcards-feature-2450 branch from e1efddd to 6a0d526 Compare September 24, 2026 17:37
cursoragent and others added 7 commits November 25, 2026 16:21
Disable gf/tc, #Card/#Cards tag completion, and related card UI
when Settings → Features → Flashcards is off.

Co-authored-by: Tienson Qin <[email protected]>
The previous edit closed `when` too early and broke compilation.

Co-authored-by: Tienson Qin <[email protected]>
Keep the shared class fetch complete so plugins and other graphs see
Card/Cards, and hide those tags only in editor autocomplete using the
requested repo's feature flag.

Co-authored-by: Tienson Qin <[email protected]>
Filter Card/Cards in the query builder and property class pickers when
Flashcards is off, without changing the shared class fetch.

Co-authored-by: Tienson Qin <[email protected]>
When Flashcards is off, class-select still lists already chosen Card or
Cards so those property restrictions can be deselected.

Co-authored-by: Tienson Qin <[email protected]>
Rename the local keep set in classes-for-tag-completion so clj-kondo
does not warn on a shadowed core var.

Co-authored-by: Tienson Qin <[email protected]>
@megayu
megayu force-pushed the logseq/gate-flashcards-feature-2450 branch from 6a0d526 to 50cfed2 Compare November 25, 2026 08:47
@tiensonqin
tiensonqin merged commit 468792a into master Nov 25, 2026
15 checks passed
@tiensonqin
tiensonqin deleted the logseq/gate-flashcards-feature-2450 branch November 25, 2026 09:21
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.

Disabling Flashcards in Settings does not disable Flashcard shortcuts or tags

3 participants