diff options
author | FChannel <> | 2021-07-15 13:49:29 -0700 |
---|---|---|
committer | FChannel <> | 2021-07-15 13:49:29 -0700 |
commit | 22ee823b6e9200317337941c2ad41ca9df9dd855 (patch) | |
tree | 8ff9518bb529ff476bf4d667ea3f72b4cba970a2 /database.go | |
parent | 26f59904f0f1d7a908969ad0f5846448b0e7451b (diff) |
added auto follow for boards
Diffstat (limited to 'database.go')
-rw-r--r-- | database.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/database.go b/database.go index 0e53142..1b2ec3d 100644 --- a/database.go +++ b/database.go @@ -1649,3 +1649,29 @@ func DeleteRegexBlacklistDB(db *sql.DB, id int) { CheckError(err, "error with delete from postblacklist") } + +func GetActorAutoSubscribeDB(db *sql.DB, id string) bool{ + query := `select autosubscribe from actor where id=$1` + + rows, err:= db.Query(query, id) + + CheckError(err, "error with getting actor auto subscribe status from db") + + var subscribed bool + defer rows.Close() + rows.Next() + rows.Scan(&subscribed) + + + return subscribed +} + +func SetActorAutoSubscribeDB(db *sql.DB, id string) { + current := GetActorAutoSubscribeDB(db, id) + + query := `update actor set autosubscribe=$1 where id=$2` + + _, err := db.Exec(query, !current, id) + + CheckError(err, "error with set actor auto subscribe status from db") +} |