LP-5613 #2
@ -91,6 +91,7 @@ type RevokeOwnershipRequest struct {
|
||||
type TypeWithBadgeCount struct {
|
||||
*badgesmodel.BadgeTypeDefinition
|
||||
BadgeCount int `json:"badge_count"`
|
||||
CreatedByUsername string `json:"created_by_username"`
|
||||
AllowlistCanCreate string `json:"allowlist_can_create"`
|
||||
AllowlistCanGrant string `json:"allowlist_can_grant"`
|
||||
}
|
||||
@ -204,9 +205,14 @@ func (p *Plugin) getTypes(w http.ResponseWriter, r *http.Request, userID string)
|
||||
|
||||
result := make([]TypeWithBadgeCount, len(types))
|
||||
for i, t := range types {
|
||||
createdByUsername := t.CreatedBy
|
||||
if creator, appErr := p.mm.User.Get(t.CreatedBy); appErr == nil {
|
||||
createdByUsername = creator.Username
|
||||
}
|
||||
result[i] = TypeWithBadgeCount{
|
||||
BadgeTypeDefinition: t,
|
||||
BadgeCount: badgeCountByType[t.ID],
|
||||
CreatedByUsername: createdByUsername,
|
||||
AllowlistCanCreate: p.resolveUserIDList(t.CanCreate.AllowList),
|
||||
AllowlistCanGrant: p.resolveUserIDList(t.CanGrant.AllowList),
|
||||
}
|
||||
|
||||
@ -43,6 +43,12 @@ const AllTypesRow: React.FC<Props> = ({badgeType, onEdit, onDelete, onClick}: Pr
|
||||
)}
|
||||
</div>
|
||||
<div className='AllTypesRow__meta'>
|
||||
<FormattedMessage
|
||||
id='badges.label.created_by'
|
||||
defaultMessage='Создал: {username}'
|
||||
values={{username: badgeType.created_by_username || badgeType.created_by}}
|
||||
/>
|
||||
{' · '}
|
||||
<FormattedMessage
|
||||
id='badges.types.badge_count'
|
||||
defaultMessage='{count, plural, one {# достижение} few {# достижения} many {# достижений} other {# достижений}}'
|
||||
|
||||
@ -43,6 +43,7 @@ export type BadgeTypeDefinition = {
|
||||
name: string;
|
||||
frame: string;
|
||||
created_by: string;
|
||||
created_by_username: string;
|
||||
can_grant: PermissionScheme;
|
||||
can_create: PermissionScheme;
|
||||
badge_count: number;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user