MCPcopy Create free account
hub / github.com/gogs/gogs / DeleteCustomAvatar

Method DeleteCustomAvatar

internal/database/users.go:350–360  ·  view source on GitHub ↗

DeleteCustomAvatar deletes the current user custom avatar and falls back to use look up avatar by email.

(ctx context.Context, userID int64)

Source from the content-addressed store, hash-verified

348// DeleteCustomAvatar deletes the current user custom avatar and falls back to
349// use look up avatar by email.
350func (s *UsersStore) DeleteCustomAvatar(ctx context.Context, userID int64) error {
351 _ = os.Remove(userutil.CustomAvatarPath(userID))
352 return s.db.WithContext(ctx).
353 Model(&User{}).
354 Where("id = ?", userID).
355 Updates(map[string]any{
356 "use_custom_avatar": false,
357 "updated_unix": s.db.NowFunc().Unix(),
358 }).
359 Error
360}
361
362type ErrUserOwnRepos struct {
363 args errutil.Args

Callers 4

usersDeleteCustomAvatarFunction · 0.80
UpdateAvatarSettingFunction · 0.80
SettingsDeleteAvatarFunction · 0.80
SettingsDeleteAvatarFunction · 0.80

Calls 3

CustomAvatarPathFunction · 0.92
RemoveMethod · 0.80
WhereMethod · 0.80

Tested by 1

usersDeleteCustomAvatarFunction · 0.64