Beispiel #1
0
// Subscribe the given UID to the notification list.
func subscribe(u config.User) bool {
	if isSubscribed(u) {
		log.Debugf("[Posts] %[1]s attempted to subscribe to the notification list, but was already subscribed", u.Name)
		return false
	}
	log.Debugf("[Posts] %[1]s successfully subscribed to the notifcation list", u.Name)
	u.SetSetting(subSetting, "true")
	config.ASave()
	return true
}
Beispiel #2
0
// Unsubscribe the given UID from the notification list.
func unsubscribe(u config.User) bool {
	if !isSubscribed(u) {
		log.Debugf("[Posts] %[1]s attempted to unsubscribe from the notification list, but was not subscribed", u.Name)
		return false
	}
	log.Debugf("[Posts] %[1]s successfully unsubscribed from the notifcation list", u.Name)
	u.RemoveSetting(subSetting)
	config.ASave()
	return true
}
Beispiel #3
0
func isSubscribed(u config.User) bool {
	return u.HasSetting(subSetting)
}