-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: permalink error on some pages #660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
aa3363c
to
07cb4ee
Compare
internal/schema/question_schema.go
Outdated
Title string `json:"title" xorm:"title"` // title | ||
UrlTitle string `json:"url_title" xorm:"url_title"` // title | ||
ViewCount int `json:"view_count" xorm:"view_count"` // view count | ||
AnswerCount int `json:"answer_count" xorm:"answer_count"` // answer count | ||
CollectionCount int `json:"collection_count" xorm:"collection_count"` // collection count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The xorm tag
here must have been misused by someone else, please help me remove it. And remove the final comments, which are redundant. Thanks a lot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all xorm tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all xorm tags?
Yes. In this struct.
@@ -591,8 +591,13 @@ func (qs *QuestionCommon) ShowListFormat(ctx context.Context, data *entity.Quest | |||
} | |||
|
|||
func (qs *QuestionCommon) ShowFormat(ctx context.Context, data *entity.Question) *schema.QuestionInfo { | |||
ID := data.ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using id
for variable name would be better.
var ID = data.ID | ||
if handler.GetEnableShortID(ctx) { | ||
ID = uid.EnShortID(data.ID) | ||
} | ||
|
||
info := schema.QuestionInfo{} | ||
info.ID = data.ID | ||
info.ID = ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't that be better?
info := schema.QuestionInfo{}
info.ID = data.ID
if handler.GetEnableShortID(ctx) {
info.ID = uid.EnShortID(data.ID)
}
69363cd
to
bf2d316
Compare
close #656