aboutsummaryrefslogtreecommitdiff
path: root/CacheDatabase.go
diff options
context:
space:
mode:
authorFChannel <=>2021-01-26 13:39:08 -0800
committerFChannel <=>2021-01-26 13:39:08 -0800
commit36e9b49ac109b542e080ce967eb782b885d9b7d3 (patch)
treeff38e8afbf5bb57cbcb74af687351d1bbd6ae5c3 /CacheDatabase.go
parenta589c58ed85eece34a8e3938219bd0264238b2a8 (diff)
tombstone cache posts
Diffstat (limited to 'CacheDatabase.go')
-rw-r--r--CacheDatabase.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/CacheDatabase.go b/CacheDatabase.go
index fe55e84..cbb7cd1 100644
--- a/CacheDatabase.go
+++ b/CacheDatabase.go
@@ -562,6 +562,34 @@ func DeleteObjectFromCache(db *sql.DB, id string) {
CheckError(err, "could not delete cache replies activitystream")
}
+func TombstoneObjectFromCache(db *sql.DB, id string) {
+
+ datetime := time.Now().Format(time.RFC3339)
+
+ query := `update cacheactivitystream set type='Tombstone', name='', content='', attributedto='deleted', updated=$1, deleted=$2 where id=$3`
+
+ _, err := db.Exec(query, datetime, datetime, id)
+
+ CheckError(err, "error with tombstone cache object")
+
+ query = `update cacheactivitystream set type='Tombstone', mediatype='image/png', href=$1, name='', content='', attributedto='deleted', updated=$2, deleted=$3 where id in (select attachment from cacheactivitystream where id=$4)`
+
+ _, err = db.Exec(query, "/public/removed.png", datetime, datetime, id)
+
+ CheckError(err, "error with tombstone attachment cache object")
+
+ query = `update cacheactivitystream set type='Tombstone', mediatype='image/png', href=$1, name='', content='', attributedto='deleted', updated=$2, deleted=$3 where id in (select preview from cacheactivitystream where id=$4)`
+
+ _, err = db.Exec(query, "/public/removed.png", datetime, datetime, id)
+
+ CheckError(err, "error with tombstone preview cache object")
+
+ query = `delete from replies where id=$1`
+ _, err = db.Exec(query, id)
+
+ CheckError(err, "could not delete cache replies activitystream")
+}
+
func GetObjectPostsTotalCache(db *sql.DB, actor Actor) int{
count := 0