diff --git a/common/topic.go b/common/topic.go index 0727921e..2b677e0d 100644 --- a/common/topic.go +++ b/common/topic.go @@ -216,7 +216,7 @@ func init() { getReplies2: acc.SimpleLeftJoin("replies AS r", "users AS u", "r.rid, r.content, r.createdBy, r.createdAt, r.lastEdit, r.lastEditBy, u.avatar, u.name, u.group, u.level, r.likeCount, r.attachCount, r.actionType", "r.createdBy=u.uid", "r.tid=?", "r.rid ASC", "?,?"), getReplies3: acc.Select("replies").Columns("rid, content, createdBy, createdAt, lastEdit, lastEditBy, likeCount, attachCount, actionType").Where("tid=?").Orderby("rid ASC").Limit("?,?").Prepare(), addReplies: acc.Update(t).Set("postCount=postCount+?, lastReplyBy=?, lastReplyAt=UTC_TIMESTAMP()").Where("tid=?").Prepare(), - updateLastReply: acc.Update(t).Set("lastReplyID=?").Where("lastReplyID > ? AND tid=?").Prepare(), + updateLastReply: acc.Update(t).Set("lastReplyID=?").Where("lastReplyID < ? AND tid=?").Prepare(), lock: acc.Update(t).Set("is_closed=1").Where("tid=?").Prepare(), unlock: acc.Update(t).Set("is_closed=0").Where("tid=?").Prepare(), moveTo: acc.Update(t).Set("parentID=?").Where("tid=?").Prepare(), @@ -766,6 +766,13 @@ func (t *TopicUser) Replies(offset int /*pFrag int, */, user *User) (rlist []*Re } else { parseSettings = user.ParseSettings } + /*if user.ParseSettings == nil { + parseSettings = DefaultParseSettings.CopyPtr() + parseSettings.NoEmbed = Config.NoEmbed || !postGroup.Perms.AutoEmbed + parseSettings.NoLink = !postGroup.Perms.AutoLink + } else { + parseSettings = user.ParseSettings + }*/ var eh bool r.ContentHtml, eh = ParseMessage2(r.Content, t.ParentID, "forums", parseSettings, user) diff --git a/misc_test.go b/misc_test.go index 4d59e828..3d241f7a 100644 --- a/misc_test.go +++ b/misc_test.go @@ -1170,6 +1170,7 @@ func testReplyStore(t *testing.T, newID, newPostCount int, ip string) { topic, err = c.Topics.Get(1) expectNilErr(t, err) exf(topic.PostCount == newPostCount+1, "TID #1's post count should be %d, not %d", newPostCount+1, topic.PostCount) + exf(topic.LastReplyID == rid, "TID #1's LastReplyID should be %d not %d", rid, topic.LastReplyID) err = topic.CreateActionReply("destroy", ip, 1) expectNilErr(t, err)