Repository navigation
feat: let streamers notify their followers when they go live - #687
Closed
ashkesarmaa wants to merge 2 commits into
Closed
ashkesarmaa wants to merge 2 commits into
ashkesarmaa wants to merge 2 commits into
Conversation
The go-live modal now has a "Notify followers" switch (on by default) and a slider for the stream length instead of the hours dropdown. With the switch on, every follower gets an "is live" notification that links to the streamer's profile. Followers who muted the streamer are skipped, and the notifications disappear when the stream ends. The settings toggles now share one Switch component.
Going live can notify every follower, so going live and ending the stream over and over could spam them. Each user can now go live or end a stream 10 times an hour.
Member
|
hey man, thank you so much for the effort on this one 🤌🏻 i don't want to do this for now.. maybe in the future thank you though |
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.
Problem
When someone goes live, their followers have no way to find out unless they happen to visit the profile or see the live marker on the avatar. The go-live modal also asks for the stream length with a plain 1–12 hours dropdown.
Change
NotificationBuilder::relevant()already hides it.liverate limit of 10 an hour, so going live over and over can't spam followers.Implementation
NotificationType::WentLiveand aCreateLiveNotificationsaction, called fromUpdateUserLivewhennotifyis true. It reads follower ids straight fromfollowsin chunks and inserts one notification per follower with the keywent_live:{user}, so a repeated call never duplicates one.DeleteUserLive(used by both the End stream action andEndLiveStreams) deletes the user's went-live notifications in the same transaction.UpdateUserLiveRequestaccepts an optionalnotifyboolean. Leaving it out means no notifications.components/ui/switch.tsx, which the go-live modal uses too.commit === nullinstead of a list of types.Data
Tests
CreateLiveNotificationsTest: notifies every follower, is idempotent, skips followers who muted the streamer.UserLiveControllerTest: notifies only when asked, rejects a non-booleannotify.EndLiveStreamsTest: removes the notifications of streams that ran out and keeps those of running streams.NotificationBuilderTest: keeps live notifications while the stream runs, hides them once it runs out, deletes them with the actor, hides them from muters.NotificationInboxTest: the inbox shows a live notification.RateLimitTest: the newlivelimit.