mirror of
https://github.com/mattermost/focalboard.git
synced 2025-02-13 19:42:12 +02:00
* refactor: updated dependency for focalboard server * chore: more dependency fixes * refactor: removed the unless code * refactor: added ctx for login and removed unnessary code * refactor: bump up go version * refactor: removed the commented code * chore: upgraded golinter version * fix: linter issue * refactor: removed feature flg fix golinter * refactor: removed feature flag from code * revert: statistic and it's function * refactor: removed ProductLimit related code * refactor: removed isWithinViewsLimit implementation * refactor: moved function GetUsedCardsCount to statistics.go from cloud.go * refactor: removed insight code board * refactor: removed limit dialog * refactor: updated dependencies for linux * chore: golinter fix * chore: updated helper test function to use newLogger * fix: go test * refactor: db ping attempts from config * revert: feature in action * revert: feature flag in action * revert: boardsEditor setting --------- Co-authored-by: Rajat Dabade <rajat@Rajats-MacBook-Pro.local>
53 lines
1.4 KiB
Go
53 lines
1.4 KiB
Go
package app
|
|
|
|
import (
|
|
"github.com/mattermost/focalboard/server/model"
|
|
"github.com/mattermost/focalboard/server/utils"
|
|
|
|
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
|
)
|
|
|
|
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 != nil {
|
|
return nil, err
|
|
}
|
|
if err := a.store.DeleteSubscription(blockID, subscriberID); err != nil {
|
|
return nil, err
|
|
}
|
|
sub.DeleteAt = utils.GetMillis()
|
|
a.notifySubscriptionChanged(sub)
|
|
|
|
return sub, nil
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
board, err := a.getBoardForBlock(subscription.BlockID)
|
|
if err != nil {
|
|
a.logger.Error("Error notifying subscription change",
|
|
mlog.String("subscriber_id", subscription.SubscriberID),
|
|
mlog.String("block_id", subscription.BlockID),
|
|
mlog.Err(err),
|
|
)
|
|
}
|
|
a.wsAdapter.BroadcastSubscriptionChange(board.TeamID, subscription)
|
|
}
|