From 3a7664d404bca40cb3234924fa969c0ae133d085 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sat, 16 Jul 2022 09:49:54 -0700 Subject: fixed replies to post not showing up when following other boards added content length changes to alter database --- activitypub/object.go | 10 +++++----- databaseschema.psql | 5 ++++- views/partials/bottom.html | 2 +- views/partials/footer.html | 2 +- views/partials/top.html | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/activitypub/object.go b/activitypub/object.go index f01d97d..5b78689 100644 --- a/activitypub/object.go +++ b/activitypub/object.go @@ -1277,7 +1277,7 @@ func (obj ObjectBase) WriteReply() error { } if update { - if err := e.WriteUpdate(); err != nil { + if err := e.WriteUpdate(obj.Published); err != nil { return util.MakeError(err, "WriteReply") } } @@ -1321,21 +1321,21 @@ func (obj ObjectBase) WriteCache() (ObjectBase, error) { if obj.Replies.OrderedItems != nil { for _, e := range obj.Replies.OrderedItems { - e._WriteCache() + e.WriteCache() } } return obj, nil } -func (obj ObjectBase) WriteUpdate() error { +func (obj ObjectBase) WriteUpdate(updated time.Time) error { query := `update activitystream set updated=$1 where id=$2` - if _, err := config.DB.Exec(query, time.Now().UTC().Format(time.RFC3339), obj.Id); err != nil { + if _, err := config.DB.Exec(query, updated, obj.Id); err != nil { return util.MakeError(err, "WriteUpdate") } query = `update cacheactivitystream set updated=$1 where id=$2` - _, err := config.DB.Exec(query, time.Now().UTC().Format(time.RFC3339), obj.Id) + _, err := config.DB.Exec(query, updated, obj.Id) return util.MakeError(err, "WriteUpdate") } diff --git a/databaseschema.psql b/databaseschema.psql index d4b2616..c56457e 100644 --- a/databaseschema.psql +++ b/databaseschema.psql @@ -254,4 +254,7 @@ activity_id varchar(100) CREATE TABLE IF NOT EXISTS locked( actor_id varchar(100), activity_id varchar(100) -); \ No newline at end of file +); + +ALTER TABLE activitystream ALTER COLUMN content TYPE varchar(4500); +ALTER TABLE cacheactivitystream ALTER COLUMN content TYPE varchar(4500); \ No newline at end of file diff --git a/views/partials/bottom.html b/views/partials/bottom.html index 35e8c4a..c48821b 100644 --- a/views/partials/bottom.html +++ b/views/partials/bottom.html @@ -6,7 +6,7 @@