-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Manage User Badges in the UI #31262
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
base: main
Are you sure you want to change the base?
Manage User Badges in the UI #31262
Conversation
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.
Thanks for the PR! The CI has a few linting reports that came up that I've reported in line :)
Thank you so much! |
Co-authored-by: Diogo Vicente <diogo.m.s.vicente@tecnico.ulisboa.pt>
Co-authored-by: Diogo Vicente <diogo.m.s.vicente@tecnico.ulisboa.pt>
@HenriquerPimentel looks like some different CI steps are failing, also related to linting (some public go functions require comments to document their purpose, eg As a sidenote: force pushing erases some review history as GitHub sees some files as new (even if they remain the same). If you could reduce your force pushes, it'd be helpful to me as a reviewer so I can keep track of what I've seen already |
@lunny updated this PR per your feedback including adding some pagination |
@lunny any additional feedback? |
// GetBadgeUsersOptions contains options for getting users with a specific badge | ||
type GetBadgeUsersOptions struct { | ||
db.ListOptions | ||
Badge *Badge |
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.
It's not clear to use a slug here. Why not directly use a BadgeSlug string
here?
<label for="slug">{{ctx.Locale.Tr "admin.badges.slug"}}</label> | ||
<input autofocus required id="slug" name="slug" value="{{.slug}}"> | ||
</div> | ||
<div class="field {{if .Err_Description}}error{{end}}"> |
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.
Should a name and description be necessary?
</div> | ||
</div> | ||
<div class="flex-item-trailing"> | ||
<button class="ui red tiny button inline delete-button" data-url="{{$.Link}}/delete" data-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.
if err := user_model.RemoveUserBadge(ctx, user, &user_model.Badge{Slug: ctx.PathParam(":badge_slug")}); err == nil { | ||
ctx.Flash.Success(ctx.Tr("admin.badges.user_remove_success")) | ||
} else { | ||
ctx.Flash.Error("DeleteBadgeUser: " + err.Error()) |
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.
ServerError
ctx.Flash.Error("DeleteBadgeUser: " + err.Error()) | ||
} | ||
|
||
ctx.JSONRedirect(fmt.Sprintf("%s/-/admin/badges/%s/users", setting.AppSubURL, ctx.PathParam(":badge_slug"))) |
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.
escape
opts := &user_model.GetBadgeUsersOptions{ | ||
ListOptions: db.ListOptions{ | ||
Page: page, | ||
PageSize: setting.UI.User.RepoPagingNum, |
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.
</h4> | ||
<div class="ui attached segment"> | ||
<form class="ui form" action="./edit" method="post"> | ||
{{template "base/disable_form_autofill"}} |
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.
No password field then do not use this trick
@@ -0,0 +1,30 @@ | |||
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin new user")}} |
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.
admin new user
?
Implemented #29798
This feature implements:
Implemented Badge Management in administration panel
9 Added new translation phrases (en-US): search.badge_kind, form.ImageURL, form.invalid_image_url_error, form.slug_been_taken, admin.badges, admin.badges.badges_manage_panel, admin.badges.details, admin.badges.new_badge, admin.badges.slug, admin.badges.description, admin.badges.image_url, admin.badges.slug.must_fill, admin.badges.new_success, admin.badges.update_success, admin.badges.deletion_success, admin.badges.edit_badge, admin.badges.update_badge, admin.badges.delete_badge, admin.badges.delete_badge_desc
Implemented User Badge Management Interface