aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2021-07-07 13:48:22 -0700
committerFChannel <>2021-07-07 13:48:22 -0700
commit3d6891c9403bbc3c7d268c17b5e514bb38eb2881 (patch)
treeb6cfb3282d149618b7c33d053ba13d3bd99cc998
parent188c137e8ffee7fce6cb5e363b5ea5a3095318ef (diff)
fixed caching order
-rw-r--r--cacheDatabase.go28
-rw-r--r--static/faq.html2
2 files changed, 23 insertions, 7 deletions
diff --git a/cacheDatabase.go b/cacheDatabase.go
index 22a4a79..7ab3b9e 100644
--- a/cacheDatabase.go
+++ b/cacheDatabase.go
@@ -79,11 +79,15 @@ func WriteActivitytoCache(db *sql.DB, obj ObjectBase) {
if id != "" {
return
- }
+ }
+
+ if obj.Updated == "" {
+ obj.Updated = obj.Published
+ }
query = `insert into cacheactivitystream (id, type, name, content, published, updated, attributedto, actor, tripcode, sensitive) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)`
- _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, obj.Published, obj.Published, obj.AttributedTo, obj.Actor, obj.TripCode, obj.Sensitive)
+ _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, obj.Published, obj.Updated, obj.AttributedTo, obj.Actor, obj.TripCode, obj.Sensitive)
if e != nil{
fmt.Println("error inserting new activity cache")
@@ -110,11 +114,15 @@ func WriteActivitytoCacheWithAttachment(db *sql.DB, obj ObjectBase, attachment O
if id != "" {
return
- }
+ }
+
+ if obj.Updated == "" {
+ obj.Updated = obj.Published
+ }
query = `insert into cacheactivitystream (id, type, name, content, attachment, preview, published, updated, attributedto, actor, tripcode, sensitive) values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)`
- _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, attachment.Id, preview.Id, obj.Published, obj.Published, obj.AttributedTo, obj.Actor, obj.TripCode, obj.Sensitive)
+ _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Content, attachment.Id, preview.Id, obj.Published, obj.Updated, obj.AttributedTo, obj.Actor, obj.TripCode, obj.Sensitive)
if e != nil{
fmt.Println("error inserting new activity with attachment cache")
@@ -138,10 +146,14 @@ func WriteAttachmentToCache(db *sql.DB, obj ObjectBase) {
if id != "" {
return
}
+
+ if obj.Updated == "" {
+ obj.Updated = obj.Published
+ }
query = `insert into cacheactivitystream (id, type, name, href, published, updated, attributedTo, mediatype, size) values ($1, $2, $3, $4, $5, $6, $7, $8, $9)`
- _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Href, obj.Published, obj.Published, obj.AttributedTo, obj.MediaType, obj.Size)
+ _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Href, obj.Published, obj.Updated, obj.AttributedTo, obj.MediaType, obj.Size)
if e != nil{
fmt.Println("error inserting new attachment cache")
@@ -164,11 +176,15 @@ func WritePreviewToCache(db *sql.DB, obj NestedObjectBase) {
if id != "" {
return
+ }
+
+ if obj.Updated == "" {
+ obj.Updated = obj.Published
}
query = `insert into cacheactivitystream (id, type, name, href, published, updated, attributedTo, mediatype, size) values ($1, $2, $3, $4, $5, $6, $7, $8, $9)`
- _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Href, obj.Published, obj.Published, obj.AttributedTo, obj.MediaType, obj.Size)
+ _, e := db.Exec(query, obj.Id ,obj.Type, obj.Name, obj.Href, obj.Published, obj.Updated, obj.AttributedTo, obj.MediaType, obj.Size)
if e != nil{
fmt.Println("error inserting new preview cache")
diff --git a/static/faq.html b/static/faq.html
index 35c07f0..7405982 100644
--- a/static/faq.html
+++ b/static/faq.html
@@ -56,7 +56,7 @@
<p>Soon&trade;.</p>
<h4 id="version">What version is this FChannel instance?</h4>
- <p>v0.0.7-dev</p>
+ <p>v0.0.8-dev</p>
</div>
<div style="width: 500px; margin:0 auto; margin-top: 50px; text-align: center;">
<a href="/">[Home]</a><a href="/static/rules.html">[Rules]</a><a href="/static/faq.html">[FAQ]</a>