Fix Tab.new! visible:false and add v84 newsletters migration - #421
Merged
Conversation
get_attr/2 used || operator which converts false to nil (false || nil = nil). This caused visible: false tabs to always resolve to the default true, making all tabs appear in the admin sidebar regardless of their visibility. Fix get_attr/2 to use Map.has_key? instead of || for key lookup. Fix visible field assignment to use is_nil check instead of || true. Fix divider/1 with the same pattern for visible field. Add gen.migration task to dialyzer ignore for Mix unknown_function warnings.
Idempotently renames phoenix_kit_mailing_* tables to phoenix_kit_newsletters_* for databases that ran the old V79 which created mailing_* table names. Uses IF EXISTS guards so it is safe to run multiple times. Update current_version to 84 in postgres.ex. Add z-10 to auth page wrapper for proper stacking above footer.
Contributor
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
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.
Summary
Tab.new!wherevisible: falsewas always overridden totruemailing_*tables tonewsletters_*mix phoenix_kit.gen.migrationtask to generate proper versioned upgradesz-10to auth page wrapper for correct stacking orderChanges
Bug Fix: Tab.new! ignores visible: false
get_attr/2used||operator:false || nil = nil, causingvisible: falseto silently becometrue. This made all admin sidebar tabs appear regardless of theirvisiblesetting.get_attr/2to useMap.has_key?instead of||visiblefield assignment to useis_nilcheckdivider/1with the same patternphoenix_kit.gen.migrationto.dialyzer_ignore.exsMigration V84: Rename mailing tables to newsletters
Databases that ran V79 before it was updated have
phoenix_kit_mailing_*tables instead ofphoenix_kit_newsletters_*. V84 idempotently renames them usingIF EXISTSguards.Fix mix phoenix_kit.gen.migration task
The generator now scans existing migrations to detect the current installed version and generates a proper
PhoenixKit.Migrations.up(version: N)upgrade migration instead of creating initial tables.Test Plan
Tab.new!(visible: false)now correctly returnsvisible: false