package app
import (
"github.com/mattermost/focalboard/server/model"
"github.com/mattermost/focalboard/server/utils"
)
func (a *App) CreateSubscription(sub *model.Subscription) (*model.Subscription, error) {
sub, err := a.store.CreateSubscription(sub)
if err != nil {
return nil, err
}
a.notifySubscriptionChanged(sub)
return sub, nil
func (a *App) DeleteSubscription(blockID string, subscriberID string) (*model.Subscription, error) {
sub, err := a.store.GetSubscription(blockID, subscriberID)
if err := a.store.DeleteSubscription(blockID, subscriberID); err != nil {
sub.DeleteAt = utils.GetMillis()
func (a *App) GetSubscriptions(subscriberID string) ([]*model.Subscription, error) {
return a.store.GetSubscriptions(subscriberID)
func (a *App) notifySubscriptionChanged(subscription *model.Subscription) {
if a.notifications == nil {
return
a.notifications.BroadcastSubscriptionChange(subscription)