diff --git a/common/parser.go b/common/parser.go index 27d9177d..11b61d74 100644 --- a/common/parser.go +++ b/common/parser.go @@ -394,13 +394,13 @@ func peekMatch(cur int, phrase string, runes []rune) bool { } // ! Not concurrency safe -func AddHashLinkType(prefix string, handler func(*strings.Builder, string, *int)) { +func AddHashLinkType(prefix string, h func(*strings.Builder, string, *int)) { // There can only be one hash link type starting with a specific character at the moment hashType := hashLinkTypes[prefix[0]] if hashType != "" { return } - hashLinkMap[prefix] = handler + hashLinkMap[prefix] = h hashLinkTypes[prefix[0]] = prefix } diff --git a/common/reply_store.go b/common/reply_store.go index 96299a67..1879a6bf 100644 --- a/common/reply_store.go +++ b/common/reply_store.go @@ -43,7 +43,7 @@ func NewSQLReplyStore(acc *qgen.Accumulator, cache ReplyCache) (*SQLReplyStore, return &SQLReplyStore{ cache: cache, get: acc.Select(re).Columns("tid, content, createdBy, createdAt, lastEdit, lastEditBy, ip, likeCount, attachCount, actionType").Where("rid=?").Prepare(), - getAll: acc.Select(re).Columns("rid,tid, content, createdBy, createdAt, lastEdit, lastEditBy, ip, likeCount, attachCount, actionType").Prepare(), + getAll: acc.Select(re).Columns("rid,tid,content,createdBy,createdAt,lastEdit,lastEditBy,ip,likeCount,attachCount,actionType").Prepare(), exists: acc.Exists(re, "rid").Prepare(), create: acc.Insert(re).Columns("tid, content, parsed_content, createdAt, lastUpdated, ip, words, createdBy").Fields("?,?,?,UTC_TIMESTAMP(),UTC_TIMESTAMP(),?,?,?").Prepare(), count: acc.Count(re).Prepare(), diff --git a/mssql.go b/mssql.go index 2df58dde..6ba315f0 100644 --- a/mssql.go +++ b/mssql.go @@ -3,7 +3,7 @@ /* * * Gosora MSSQL Interface -* Copyright Azareal 2016 - 2019 +* Copyright Azareal 2016 - 2020 * */ package main @@ -78,6 +78,12 @@ func initMSSQL() (err error) { return err } + log.Print("Preparing getActivityFeedByWatcher statement.") + stmts.getActivityFeedByWatcherStmt, err = db.Prepare("SELECT activity_stream_matches.asid, activity_stream.actor, activity_stream.targetUser, activity_stream.event, activity_stream.elementType, activity_stream.elementID, activity_stream.createdAt FROM [activity_stream_matches] INNER JOIN [activity_stream] ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE [watcher] = ? ORDER BY activity_stream.asid DESC OFFSET 0 ROWS FETCH NEXT ? ROWS ONLY") + if err != nil { + return err + } + log.Print("Preparing getActivityCountByWatcher statement.") stmts.getActivityCountByWatcherStmt, err = db.Prepare("SELECT count(*) FROM [activity_stream_matches] INNER JOIN [activity_stream] ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE [watcher] = ?") if err != nil { diff --git a/mysql.go b/mysql.go index e1a7277a..a352666d 100644 --- a/mysql.go +++ b/mysql.go @@ -53,12 +53,24 @@ func initMySQL() (err error) { } // TODO: Is there a less noisy way of doing this for tests? - log.Print("Preparing getActivityFeedByWatcher statement.") + /*log.Print("Preparing getActivityFeedByWatcher statement.") stmts.getActivityFeedByWatcher, err = db.Prepare("SELECT activity_stream_matches.asid, activity_stream.actor, activity_stream.targetUser, activity_stream.event, activity_stream.elementType, activity_stream.elementID, activity_stream.createdAt FROM `activity_stream_matches` INNER JOIN `activity_stream` ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE `watcher` = ? ORDER BY activity_stream.asid DESC LIMIT 16") + if err != nil { + return errors.WithStack(err) + }*/ + + log.Print("Preparing getActivityFeedByWatcher statement.") + stmts.getActivityFeedByWatcher, err = db.Prepare("SELECT activity_stream_matches.asid, activity_stream.actor, activity_stream.targetUser, activity_stream.event, activity_stream.elementType, activity_stream.elementID, activity_stream.createdAt FROM `activity_stream_matches` INNER JOIN `activity_stream` ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE `watcher` = ? ORDER BY activity_stream.asid DESC LIMIT ?") if err != nil { return errors.WithStack(err) } + /*log.Print("Preparing getActivityFeedByWatcherAfter statement.") + stmts.getActivityFeedByWatcherAfter, err = db.Prepare("SELECT activity_stream_matches.asid, activity_stream.actor, activity_stream.targetUser, activity_stream.event, activity_stream.elementType, activity_stream.elementID, activity_stream.createdAt FROM `activity_stream_matches` INNER JOIN `activity_stream` ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE `watcher` = ? AND createdAt => ? ORDER BY activity_stream.asid DESC LIMIT ?") + if err != nil { + return errors.WithStack(err) + }*/ + log.Print("Preparing getActivityCountByWatcher statement.") stmts.getActivityCountByWatcher, err = db.Prepare("SELECT count(*) FROM `activity_stream_matches` INNER JOIN `activity_stream` ON activity_stream_matches.asid = activity_stream.asid AND activity_stream_matches.watcher != activity_stream.actor WHERE `watcher` = ?") if err != nil { diff --git a/pgsql.go b/pgsql.go index ab9542c8..f365a772 100644 --- a/pgsql.go +++ b/pgsql.go @@ -1,6 +1,6 @@ // +build pgsql -/* Copyright Azareal 2016 - 2019 */ +/* Copyright Azareal 2016 - 2020 */ /* Super experimental and incomplete. DON'T USE IT YET! */ package main diff --git a/public/global.js b/public/global.js index e95973ec..e06e1104 100644 --- a/public/global.js +++ b/public/global.js @@ -124,13 +124,13 @@ function updateAlertList(menuAlerts) { } function setAlertError(menuAlerts,msg) { - let alertListNode = menuAlerts.getElementsByClassName("alertList")[0]; - alertListNode.innerHTML = "