Handle no avatar, add delete avatar support

This commit is contained in:
blankhex committed 2026-10-22 23:08:23 +03:00
1 parent 35bff424f1
commit 3864a4c1cc
9 files changed
+110 -11

No files matched your search

+11
View File
@@ -163,6 +163,17 @@ func (s *Service) Avatar(ctx context.Context, user *User) ([]byte, error) {
return s.r.Avatar(ctx, user.Id)
}
// DeleteAvatar removes a user's avatar. It is a no-op when no avatar is stored,
// so the operation is idempotent.
func (s *Service) DeleteAvatar(ctx context.Context, user *User) error {
return s.r.DeleteAvatar(ctx, user.Id)
}
// HasAvatar reports whether the user currently has an avatar stored.
func (s *Service) HasAvatar(ctx context.Context, user *User) (bool, error) {
return s.r.HasAvatar(ctx, user.Id)
}
func (s *Service) ActivateUser(ctx context.Context, user *User) (*User, error) {
tx, err := s.r.Db.BeginTx(ctx, nil)
if err != nil {