Files
owncast/core/webhooks/fediverseEngagement_test.go
T
80850b15d0 feat: Adds a webhook for when a user follows the stream (#4362)
* feat: Adds a webhook for when a user follow the stream

Frontend:
Adds a checkbox which renders only when social features are enabled.

Backend:
- Defines a new type for the event
- Implements the webhook including unit testing
- Fires the webhook inside the ApproveFollower handler

* Removes unnecessary Type fiels from Events struct

* refactor: renames SendUserFollowedEvent func to FediverseEngagementFollow and fixes linting errors

* fix: fixes unit test to reflect removed Type field from FediverseEngagementFollowEvent

* feat: fires webhook also when manual approvals are not required

* chore: slight cleanup

---------

Co-authored-by: Gabe Kangas <gabek@real-ity.com>
2025-11-21 13:47:50 -08:00

29 lines
611 B
Go

package webhooks
import (
"testing"
"time"
"github.com/owncast/owncast/activitypub/events"
"github.com/owncast/owncast/models"
)
func TestSendFediverseEngagementEventFollow(t *testing.T) {
checkPayload(t, models.FediverseEngagementFollow, func() {
sendFediverseEngagementEventFollow(events.FediverseEngagementFollowEvent{
Event: events.Event{
Timestamp: time.Unix(72, 6).UTC(),
ID: "id",
},
Name: "be",
Username: "be@witch.me",
})
}, `{
"id": "id",
"image": "",
"name": "be",
"timestamp": "1970-01-01T00:01:12.000000006Z",
"username": "be@witch.me"
}`)
}