Channel cards have no edit option #137
Labels
No labels
bug
devops
duplicate
enhancement
good first issue
layout
next major release
next minor release
question
research
testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lvl0/fedi-feed-router#137
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Channel cards on
/channelsoffer an active/inactive toggle and account attach/detach, but no way to edit the channel itself. Language and description cannot be changed after creation — the only recourse is deleting the channel and recreating it, which makes managing channels painful.app/Livewire/Channels.phpcurrently exposestoggle(), the create-modal methods, and the account-management methods (openAccountModal(),attachAccount(),detachAccount()). No edit path for the channel's own attributes exists.Expected
Each channel card has an edit action that opens a modal prefilled with the channel's current values, allowing them to be updated and saved.
Implementation reference
app/Livewire/Routes.phpalready implements this pattern —openEditModal()/closeEditModal()/updateRoute()with dedicatedediting*properties. Follow the same shape here.Open question — scope of what is editable
Resolved: the safer default was taken. The community/instance pairing is immutable.
display_name,language_id,descriptionname,channel_id,platform_instance_idThat triplet is the channel's remote identity.
platform_channelscarriesunique(['platform_instance_id', 'name']),nameandchannel_idcome from the remote community viaCommunityDirectory, and re-pointing a channel would change where every route already attached to it publishes. Leaving it immutable also avoids needing the instance-selection and community-refresh flow inside the edit modal.The modal shows the community and instance read-only with a note explaining why.
This matches the precedent set by #136 "Feed cards have no edit option", where provider and language were left immutable because they derive the unique
feeds.url. One deliberate asymmetry: language is editable here. OnPlatformChannelit is a plain nullable FK that derives nothing; onFeedit feeds the URL derivation.Acceptance criteria
Delivered in
0163fa5.What shipped
x-form-modalprefilled with display name, language and descriptionChannels::openEditModal()/closeEditModal()/updateChannel()witheditingChannelId/editDisplayName/editLanguageId/editDescription, following theRoutes.phpshapenull; the language select offers "No language" and clearing it is supportedScope
Resolved in the ticket body above. The immutability is enforced in code rather than only in the UI:
updateChannel()builds an explicit three-key array instead of reusingCreateChannelAction, so a replayed Livewire request cannot reachname,channel_idorplatform_instance_id.ChannelsTest::test_update_channel_leaves_the_community_pairing_untouchedsnapshots that triplet before and after an edit.Pre-existing bugs found and fixed
PlatformChannel's docblock was wrong in three ways, all verified against2024_01_01_000003_create_platforms.php:display_name(NOT NULL) — missing from the docblock entirelydescription(nullable) — missing entirelylanguage_id— declaredint, but the column is->nullable()A
phpstan-baseline.neonentry was suppressing anassertNull()inCreateChannelActionTestthat only failed because of the wronglanguage_idtype. Correcting the docblock made the entry stale, so it was removed.This is the second occurrence of that pattern — #136 fixed the identical defect on
Feed::$description. Two of two models touched carried it, so it is likely systemic. Every remaining entry inphpstan-baseline.neonthat names a model property is worth treating as a bug report about that property.Also noted, not fixed:
platform_channels.display_nameis NOT NULL, so thedisplay_name ?? namefallbacks inchannels.blade.php(card header and account-modal title) are dead code. Pre-existing and out of scope here.Verification
12 new feature tests: edit action present, prefill (including a null description prefilling blank), successful update across all three fields, blank-to-null coercion, required and max-length validation on display name, unknown-language rejection, clearing the language, discard on close, no-op without an open modal, and community-pairing immutability.
1165 tests / 2865 assertions green, Pint clean (338 files), PHPStan clean.
code-reviewerreturned no critical issues and no recommendations. Confirmed working in a browser.