Skip to content

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

Merged
merged 3 commits into from
Nov 29, 2023
Merged

Conversation

sy-records
Copy link
Member

close #656

@sy-records sy-records force-pushed the fix/permalink branch 2 times, most recently from aa3363c to 07cb4ee Compare November 27, 2023 09:23
@fenbox fenbox requested a review from LinkinStars November 28, 2023 08:27
Comment on lines 207 to 211
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
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all xorm tags?

Copy link
Member

@LinkinStars LinkinStars Nov 28, 2023

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
Copy link
Member

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.

Comment on lines 594 to 600
var ID = data.ID
if handler.GetEnableShortID(ctx) {
ID = uid.EnShortID(data.ID)
}

info := schema.QuestionInfo{}
info.ID = data.ID
info.ID = ID
Copy link
Member

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)
	}

@LinkinStars LinkinStars added this to the v1.2.1 milestone Nov 29, 2023
@LinkinStars LinkinStars merged commit 7aa16f2 into apache:main Nov 29, 2023
@sy-records sy-records deleted the fix/permalink branch November 29, 2023 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

There are a few places where the URL format does not match the permalink format in the SEO settings.
3 participants