From 95d3f9ebe1a9e0791d4adce2cd7d1cae7eb9f528 Mon Sep 17 00:00:00 2001 From: Azareal Date: Fri, 3 Apr 2020 06:25:55 +1000 Subject: [PATCH] try to reduce noise in tests save bytes --- common/reply.go | 4 ++-- common/topic_list.go | 2 +- extend/plugin_markdown.go | 2 +- plugin_test.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/reply.go b/common/reply.go index 5055049d..da7a2cd4 100644 --- a/common/reply.go +++ b/common/reply.go @@ -79,7 +79,7 @@ func init() { re := "replies" replyStmts = ReplyStmts{ isLiked: acc.Select("likes").Columns("targetItem").Where("sentBy=? and targetItem=? and targetType='replies'").Prepare(), - createLike: acc.Insert("likes").Columns("weight, targetItem, targetType, sentBy").Fields("?,?,?,?").Prepare(), + createLike: acc.Insert("likes").Columns("weight,targetItem,targetType,sentBy").Fields("?,?,?,?").Prepare(), edit: acc.Update(re).Set("content=?,parsed_content=?").Where("rid=? AND poll=0").Prepare(), setPoll: acc.Update(re).Set("poll=?").Where("rid=? AND poll=0").Prepare(), delete: acc.Delete(re).Where("rid=?").Prepare(), @@ -90,7 +90,7 @@ func init() { deleteActivitySubs: acc.Delete("activity_subscriptions").Where("targetID=? AND targetType='post'").Prepare(), // TODO: Optimise this to avoid firing an update if it's not the last reply in a topic. We will need to set lastReplyID properly in other places and in the patcher first so we can use it here. - updateTopicReplies: acc.RawPrepare("UPDATE topics t INNER JOIN replies r ON t.tid = r.tid SET t.lastReplyBy = r.createdBy, t.lastReplyAt = r.createdAt, t.lastReplyID = r.rid WHERE t.tid = ?"), + updateTopicReplies: acc.RawPrepare("UPDATE topics t INNER JOIN replies r ON t.tid=r.tid SET t.lastReplyBy=r.createdBy, t.lastReplyAt=r.createdAt, t.lastReplyID=r.rid WHERE t.tid=?"), updateTopicReplies2: acc.Update("topics").Set("lastReplyAt=createdAt,lastReplyBy=createdBy,lastReplyID=0").Where("postCount=1 AND tid=?").Prepare(), getAidsOfReply: acc.Select("attachments").Columns("attachID").Where("originID=? AND originTable='replies'").Prepare(), diff --git a/common/topic_list.go b/common/topic_list.go index c66b9f67..ce0f12ad 100644 --- a/common/topic_list.go +++ b/common/topic_list.go @@ -66,7 +66,7 @@ func NewDefaultTopicList(acc *qgen.Accumulator) (*DefaultTopicList, error) { forums: make(map[int]*ForumTopicListHolder), qcounts: make(map[int]*sql.Stmt), qcounts2: make(map[int]*sql.Stmt), - getTopicsByForum: acc.Select("topics").Columns("tid, title, content, createdBy, is_closed, sticky, createdAt, lastReplyAt, lastReplyBy, lastReplyID, views, postCount, likeCount").Where("parentID=?").Orderby("sticky DESC,lastReplyAt DESC,createdBy DESC").Limit("?,?").Prepare(), + getTopicsByForum: acc.Select("topics").Columns("tid,title,content,createdBy,is_closed,sticky,createdAt,lastReplyAt,lastReplyBy,lastReplyID,views,postCount,likeCount").Where("parentID=?").Orderby("sticky DESC,lastReplyAt DESC,createdBy DESC").Limit("?,?").Prepare(), //getTidsByForum: acc.Select("topics").Columns("tid").Where("parentID=?").Orderby("sticky DESC,lastReplyAt DESC,createdBy DESC").Limit("?,?").Prepare(), } if err := acc.FirstError(); err != nil { diff --git a/extend/plugin_markdown.go b/extend/plugin_markdown.go index 8008dbc7..a605f328 100644 --- a/extend/plugin_markdown.go +++ b/extend/plugin_markdown.go @@ -73,7 +73,7 @@ func _markdownParse(msg string, n int) string { var outbytes []byte var lastElement int breaking := false - c.DebugLogf("Initial Message: %+v\n", strings.Replace(msg, "\r", "\\r", -1)) + //c.DebugLogf("Initial Message: %+v\n", strings.Replace(msg, "\r", "\\r", -1)) for index := 0; index < len(msg); index++ { simpleMatch := func(char byte, o []byte, c []byte) { diff --git a/plugin_test.go b/plugin_test.go index c10ad1d8..f3928963 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -21,7 +21,7 @@ type MEPairList struct { Items []MEPair } -func (l *MEPairList) Add(msg string, expects string) { +func (l *MEPairList) Add(msg, expects string) { l.Items = append(l.Items, MEPair{msg, expects}) }