aboutsummaryrefslogtreecommitdiff
path: root/CacheDatabase.go
diff options
context:
space:
mode:
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