fix(backend): use correct ID in patch member endpoint

This commit is contained in:
Sam 2023-03-27 05:00:16 +02:00
parent 80ac218376
commit 83e38bb320
No known key found for this signature in database
GPG key ID: B4EF20DDE721CAA1

View file

@ -184,7 +184,7 @@ func (s *Server) patchMember(w http.ResponseWriter, r *http.Request) error {
return err
}
hash, err := s.DB.WriteMemberAvatar(ctx, id, webp, jpg)
hash, err := s.DB.WriteMemberAvatar(ctx, m.ID, webp, jpg)
if err != nil {
log.Errorf("uploading member avatar: %v", err)
return err
@ -193,7 +193,7 @@ func (s *Server) patchMember(w http.ResponseWriter, r *http.Request) error {
// delete current avatar if member has one
if m.Avatar != nil {
err = s.DB.DeleteMemberAvatar(ctx, claims.UserID, *m.Avatar)
err = s.DB.DeleteMemberAvatar(ctx, m.ID, *m.Avatar)
if err != nil {
log.Errorf("deleting existing avatar: %v", err)
}