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

Search page for community #970

Merged
merged 1 commit into from
Oct 10, 2024
Merged

Search page for community #970

merged 1 commit into from
Oct 10, 2024

Conversation

nighca
Copy link
Collaborator

@nighca nighca commented Oct 10, 2024

close #942

  • Search page for community
  • Update route for search page, from /projects to /search
  • Adjust details for ProjectItem

Copy link

qiniu-prow bot commented Oct 10, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@qiniu-ci
Copy link

This PR has been deployed to the preview environment. You can explore it using the preview URL.

Warning

Please note that deployments in the preview environment are temporary and will be automatically cleaned up after a certain period. Make sure to explore it before it is removed. For any questions, contact the Go+ Builder team.

@@ -101,12 +101,16 @@ export function deleteProject(owner: string, name: string) {

export type ListProjectParams = PaginationParams & {
isPublic?: IsPublic
/** Name of project owner, `*` indicates projects of all users */
owner?: string
Copy link
Member

Choose a reason for hiding this comment

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

不设置 owner(也就是不根据 owner 过滤项目),应该就是指包含所有用户的(公开)项目?是不是没必要再用 * 表示所有

Copy link
Collaborator Author

@nighca nighca Oct 10, 2024

Choose a reason for hiding this comment

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

目前不指定 owner(默认)是 list 当前用户的项目

调整成不指定 owner 表示“所有用户”也是可以的,只是那样的话 list 当前用户的项目会比较麻烦,接口调用方需要总是先去读到当前用户 name 才能组装出请求参数

Copy link
Member

Choose a reason for hiding this comment

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

目前不指定 owner(默认)是 list 当前用户的项目

按照目前后端实现,不指定 owner 的意思应该是 list 所有用户的公开项目:

// Ensure non-owners can only see public projects.
if user, ok := UserFromContext(ctx); !ok || params.Owner == nil || user.Name != *params.Owner {
public := model.Public
params.IsPublic = &public
}
var wheres []model.FilterCondition
if params.Owner != nil {
wheres = append(wheres, model.FilterCondition{Column: "owner", Operation: "=", Value: *params.Owner})
}
if params.IsPublic != nil {
wheres = append(wheres, model.FilterCondition{Column: "is_public", Operation: "=", Value: *params.IsPublic})
}

好像一直是这样实现的

Copy link
Collaborator Author

@nighca nighca Oct 10, 2024

Choose a reason for hiding this comment

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

🤣 owner 的值在 cmd/spx-backend/get_projects_list.yap 这里被转换过

Copy link
Member

Choose a reason for hiding this comment

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

😂好吧我忘了这里还会做处理,那我来改一下 api spec

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK

@nighca nighca merged commit 9d123a2 into goplus:dev Oct 10, 2024
4 checks passed
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.

Community Search Page
3 participants