Keep the playback playlist in step with the chat and the profile - #3380
Open
FrayxRulez wants to merge 1 commit into
Open
Keep the playback playlist in step with the chat and the profile#3380FrayxRulez wants to merge 1 commit into
FrayxRulez wants to merge 1 commit into
Conversation
FrayxRulez
force-pushed
the
playback-rework
branch
from
August 27, 2026 14:54
d09471c to
ffd2c40
Compare
FrayxRulez
force-pushed
the
playback-reconcile
branch
from
August 27, 2026 14:54
3b08a55 to
f2b71db
Compare
FrayxRulez
force-pushed
the
playback-reconcile
branch
from
August 31, 2026 14:24
f2b71db to
769a985
Compare
FrayxRulez
force-pushed
the
playback-reconcile
branch
from
August 31, 2026 14:32
769a985 to
ef067b5
Compare
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.
Second of three. #3379 is merged, so this is on
develop; #3381 sits on top.An open playlist was a snapshot of the moment playback started. Audio arriving in the chat never
appeared in it, and a message deleted while playing carried on to the end of the track.
Chat playlists
PlaybackServicesubscribes to the playing session's aggregator — the per-session one, not thestatic instance the album cover file tokens go through — for
UpdateNewMessage,UpdateDeleteMessagesandUpdateMessageContent, and drops the subscription with theplaylist.
A new message is only added once the newest end has been reached. Before that there are
messages between the playlist and the new one, and
Extending the cursor over them would moveit past the gap and lose them for good.
CanAddNewestis what gates it, and note it depends onthe playlist rather than on the direction: the newest message is the start of an audio playlist
and the end of a voice note one.
Acceptsdeliberately only compares topics when the playlist has one. A null topic means thewhole chat, and comparing anyway would reject everything, since in a forum every message carries
a topic and
AreTheSame(null, x)is false.UpdateMessageContentreplaces the item rather than patching it, because everything an itemexposes — file, duration, title, cover — is read off the content when it is built. A content the
playlist does not play, which is what a voice note becomes when it expires, takes the item out
instead, and if it was playing that stops it, for the same reason a deletion does. When the
replaced item is the playing one,
_currentItemis assigned directly rather than through theproperty: the setter resets position and raises
SourceChanged, and the player keeps streamingthe file it already opened — only what is displayed for it can have changed.
UpdateMessageSendSucceededis deliberately not handled. A message added while it is still beingsent keeps the id it was added with, and that id is only ever compared against a later deletion
of the same message.
Deleting the playing message skips to the next one. That is a privacy matter, not tidiness —
whoever sent it took it back, so it should stop.
FromCacheand non-permanent deletions areignored, following
GalleryWindow.Profile audio
There is no server update for it, and the only changes are local ones made from
PlaybackPopup,so the popup reports them through
ProfileAudioAdded/ProfileAudioRemoved— following theprecedent already set by
MoveTofor drag-reorder. Removing an audio from your own profile isnot somebody taking a message back, so one playing when it leaves the list plays on.
Both adjust the source cursor by one, because profile paging is positional: inserting at the
front shifts everything after it down, and without moving the cursor the next page repeats or
skips an item.
Incidental
PlaybackPreviousStatenow carries the source, so a music playlist interrupted by a voice notecan still grow once it comes back. Without it the restore left
_sourcenull and paging wasdead for the rest of the session.
AudioWithOwner.Valuekeeps theAudioit copied its fields from, andPlaybackItem.Trackexposes it, so an item can be moved into a profile playlist.
Trackrather thanAudiobecause
PlaybackItemProfileAudio.Audioalready exists and is anAudioWithOwner.ProfileAudioAdded/ProfileAudioRemovedrather than after thetd_api requests they follow, which would have shadowed
AddProfileAudio/RemoveProfileAudioat the call site.
Testing
Builds clean. Not exercised at runtime.
🤖 Generated with Claude Code