Skip to content
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

Fix incorrect url of searching repo by language in user profile page when user have .profile repository #26425

Closed

Conversation

yp05327
Copy link
Contributor

@yp05327 yp05327 commented Aug 10, 2023

Caused by overview tabs (custom profile page). If user have .profile repo, then overview tab will become the default tab instead of repository tab.
And $.Link does not have query info, so we will search in overview tab by default but not in repository tab which is not expected, so we just need to add ?tab=xxx in the query.

Before:
image
If user doesn't have .profile repo, it works well. But if user has, it will redirect to the wrong page:
image

After:
image

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 10, 2023
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 10, 2023
@yp05327
Copy link
Contributor Author

yp05327 commented Aug 10, 2023

emmm, in org home page we will get this url:
image

@CaiCandong
Copy link
Member

Before:
before
After:
After

@@ -40,7 +40,7 @@
</div>
<div class="flex-item-trailing">
{{if .PrimaryLanguage}}
<a class="muted" href="{{$.Link}}?q={{$.Keyword}}&sort={{$.SortType}}&language={{.PrimaryLanguage.Language}}">
<a class="muted" href="{{$.Link}}?{{if $.PageIsUserProfile}}tab={{$.TabName}}&{{end}}q={{$.Keyword}}&sort={{$.SortType}}&language={{.PrimaryLanguage.Language}}">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<a class="muted" href="{{$.Link}}?{{if $.PageIsUserProfile}}tab={{$.TabName}}&{{end}}q={{$.Keyword}}&sort={{$.SortType}}&language={{.PrimaryLanguage.Language}}">
<a class="muted" href="{{$.Link}}?tab={{$.TabName}}&q={{$.Keyword}}&sort={{$.SortType}}&language={{.PrimaryLanguage.Language}}">

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it is not user profile page, we will always have a strange tab param in the url.

Copy link
Member

@CaiCandong CaiCandong Aug 10, 2023

Choose a reason for hiding this comment

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

This bug is similar to #26374,Without a user profile page, it's not surprising that tab=repositories when you visit repositories.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is right.
e.g. We have no repositories tab in the following page.
yourdomain/notifications/watching
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ops, this page can not filter repo by language. We need to fix this in another PR.

Copy link
Contributor Author

@yp05327 yp05327 Aug 15, 2023

Choose a reason for hiding this comment

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

how can we access /notifications/subscriptions from web?
I found this page in the source code, but have no idea about how to access it from web.

Edited:
I got it.
image

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Aug 13, 2023

-> Make profile page work with repositories list #26475

One line change:

if profileReadme != nil && !(ctx.Req.Form.Has("q") || ctx.Req.Form.Has("sort") || ctx.Req.Form.Has("language")) {

Oops, not ideal either. close that.

@lunny lunny added the type/bug label Aug 15, 2023
@lunny lunny added this to the 1.21.0 milestone Aug 15, 2023
@lunny lunny added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Aug 15, 2023
@puni9869
Copy link
Member

I this we should backport this.

@lunny lunny modified the milestones: 1.21.0, 1.22.0 Sep 21, 2023
@github-actions github-actions bot added the modifies/templates This PR modifies the template files label Nov 10, 2023
@yp05327
Copy link
Contributor Author

yp05327 commented Dec 8, 2023

This has been fixed by #28320.

ps: don't know why nobody review this one 😕

@yp05327 yp05327 closed this Dec 8, 2023
@GiteaBot GiteaBot removed this from the 1.22.0 milestone Dec 8, 2023
@delvh
Copy link
Member

delvh commented Dec 8, 2023

Oops

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Mar 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/templates This PR modifies the template files size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants