Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 735f617

Browse files
author
zhangxh
committed
修复bug : 登陆可见主题,附言内容未登录也可以看到
1 parent d452c77 commit 735f617

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/http/controller/topic.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,13 @@ func (TopicController) Detail(ctx echo.Context) error {
155155
"activeTopics": "active",
156156
"topic": topic,
157157
"replies": replies,
158+
"appends": []*model.TopicAppend{},
158159
}
159160

160161
me, ok := ctx.Get("user").(*model.Me)
162+
if topic["permission"] == 0 || (topic["permission"] == 1 && ok) {
163+
data["appends"] = logic.DefaultTopic.FindAppend(ctx, tid)
164+
}
161165
if ok {
162166
tid := topic["tid"].(int)
163167
data["likeflag"] = logic.DefaultLike.HadLike(ctx, me.Uid, tid, model.TypeTopic)
@@ -177,8 +181,6 @@ func (TopicController) Detail(ctx echo.Context) error {
177181
logic.Views.Incr(Request(ctx), model.TypeTopic, tid)
178182
}
179183

180-
data["appends"] = logic.DefaultTopic.FindAppend(ctx, tid)
181-
182184
return render(ctx, "topics/detail.html,common/comment.html", data)
183185
}
184186

0 commit comments

Comments
 (0)