feat(cosmetics): оформление «для друзей» в друзьях и личных беседах
- API: список друзей отдаёт вычисленное оформление «для друзей» одним запросом на весь список (AGENT.md 7.2) - клиент: рамка, иконка, цвет и эффект ника в списке друзей, в ленте личных бесед — из профиля собеседника - тесты: Go на список друзей, Vitest на отрисовку в друзьях
This commit is contained in:
@@ -404,6 +404,27 @@ func (s *Store) EffectiveCosmeticsForGuild(ctx context.Context, guildID uint64)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// EffectiveCosmeticsForUsers вычисляет оформление «для друзей» для пачки
|
||||
// пользователей: так список друзей и DM получают его одним запросом.
|
||||
func (s *Store) EffectiveCosmeticsForUsers(ctx context.Context, userIDs []uint64) (map[uint64]EffectiveCosmetics, error) {
|
||||
result := make(map[uint64]EffectiveCosmetics, len(userIDs))
|
||||
if len(userIDs) == 0 {
|
||||
return result, nil
|
||||
}
|
||||
styles, err := s.listUserStylesFor(ctx, userIDs, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
grants, err := s.CosmeticGrantsForUsers(ctx, userIDs, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, userID := range userIDs {
|
||||
result[userID] = resolveCosmetics(nil, nil, nil, styles.global[userID], grants[userID])
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// EffectiveCosmeticsForUser вычисляет оформление пользователя в контексте
|
||||
// «для друзей» (DM, список друзей, глобальные места).
|
||||
func (s *Store) EffectiveCosmeticsForUser(ctx context.Context, userID uint64) (EffectiveCosmetics, error) {
|
||||
|
||||
Reference in New Issue
Block a user