Improved activity page

This commit is contained in:
2021-11-23 15:47:25 +09:00
parent 1cf4e6a1ae
commit 0f5f18db0c
12 changed files with 113 additions and 32 deletions

View File

@ -7,6 +7,7 @@ import (
"strings"
"github.com/aerogo/aero"
"github.com/aerogo/aero/event"
"github.com/aerogo/api"
"github.com/aerogo/markdown"
"github.com/animenotifier/notify.moe/arn/autocorrect"
@ -182,6 +183,12 @@ func (post *Post) Create(ctx aero.Context) error {
activity := NewActivityCreate("Post", post.ID, user.ID)
activity.Save()
// Broadcast event to all users so they can reload the activity page if needed
for receiver := range StreamUsers() {
activityEvent := event.New("post activity", receiver.IsFollowing(user.ID))
receiver.BroadcastEvent(activityEvent)
}
return nil
}