v4: a dump or playlist going public notifies its followers — a private dump notified no one when posted, and nothing told its followers when it was made public: the poster's followers never learnt of it, nor did the followers of the public playlists holding it. Likewise, the dumps added to a playlist while it was private were never notified to its followers. updateDump and replaceFileDump now call notifyIfWentPublic, which notifies the poster's followers (user_dump_posted) and, through the new notifyPlaylistFollowersNowPublic, the followers of each public playlist holding the dump (playlist_dump_added). updatePlaylist calls the same function when a playlist goes public, for each public dump in it, from the bottom up. A follower hears of a dump once both it and the playlist are public; the source keys stop a dump made private and public again from notifying twice. 256 backend tests pass, and deno check, deno fmt and doc:lint are clean.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,7 @@ import {
|
||||
import {
|
||||
notifyMentions,
|
||||
notifyPlaylistFollowersNewDump,
|
||||
notifyPlaylistFollowersNowPublic,
|
||||
} from "./notification-service.ts";
|
||||
import { changeSlug, newSlug, resolveSlug } from "./slug-service.ts";
|
||||
import { linkAttachments } from "./attachment-service.ts";
|
||||
@@ -207,8 +208,9 @@ export function listPlaylistsByUser(
|
||||
* moderator is exempt from its rate limit; a new title leaves the slug as it
|
||||
* is. `canModerate` lets someone other than the owner edit it. If the
|
||||
* playlist is public, it notifies, in the owner's name, the users the
|
||||
* description mentions. It links the description's attachments and
|
||||
* broadcasts `playlist_updated`.
|
||||
* description mentions. When it goes public, its followers are notified of
|
||||
* its public dumps they weren't yet told of. It links the description's
|
||||
* attachments and broadcasts `playlist_updated`.
|
||||
*
|
||||
* @throws {APIException} 404 when there is no such playlist, 403 when the user
|
||||
* is neither its owner nor a moderator, 400 when the slug isn't valid, 409
|
||||
@@ -270,6 +272,10 @@ export function updatePlaylist(
|
||||
linkAttachments(newDescription, "playlist", playlist.id);
|
||||
}
|
||||
broadcastPlaylistUpdated(updated, playlist.isPublic);
|
||||
// Its followers weren't told of the dumps added while it was private.
|
||||
if (!playlist.isPublic && newIsPublic) {
|
||||
notifyPlaylistFollowersNowPublic({ playlistId: playlist.id });
|
||||
}
|
||||
return updated;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user