78c5c62eee
Add the users_groups_promotions table. Optimise ConvoViewPage. Shortened some things. Convo CSS fixes. Make sure the user cache is flushed properly after the post stats change. You will need to run the patcher / updater for this commit.
31 lines
778 B
Go
31 lines
778 B
Go
package common
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
qgen "github.com/Azareal/Gosora/query_gen"
|
|
)
|
|
|
|
var Subscriptions SubscriptionStore
|
|
|
|
// ? Should we have a subscription store for each zone? topic, forum, etc?
|
|
type SubscriptionStore interface {
|
|
Add(uid int, elementID int, elementType string) error
|
|
}
|
|
|
|
type DefaultSubscriptionStore struct {
|
|
add *sql.Stmt
|
|
}
|
|
|
|
func NewDefaultSubscriptionStore() (*DefaultSubscriptionStore, error) {
|
|
acc := qgen.NewAcc()
|
|
return &DefaultSubscriptionStore{
|
|
add: acc.Insert("activity_subscriptions").Columns("user, targetID, targetType, level").Fields("?,?,?,2").Prepare(),
|
|
}, acc.FirstError()
|
|
}
|
|
|
|
func (s *DefaultSubscriptionStore) Add(uid int, elementID int, elementType string) error {
|
|
_, err := s.add.Exec(uid, elementID, elementType)
|
|
return err
|
|
}
|