mirror of
https://github.com/thomiceli/opengist.git
synced 2026-08-07 07:14:49 +00:00
Move users avatar directory (#760)
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ type User struct {
|
||||
CreatedAt int64
|
||||
Email string
|
||||
MD5Hash string // for gravatar, if no Email is specified, the value is random
|
||||
AvatarURL string // an absolute URL (from an OAuth provider) or a bare filename for a manually uploaded avatar stored under {home}/avatars
|
||||
AvatarURL string // an absolute URL (from an OAuth provider) or a bare filename for a manually uploaded avatar stored under {home}/avatars/users
|
||||
GithubID string
|
||||
GitlabID string
|
||||
GiteaID string
|
||||
@@ -101,7 +101,7 @@ func (user *User) BeforeDelete(tx *gorm.DB) error {
|
||||
|
||||
// Delete uploaded avatar, if any
|
||||
if user.HasUploadedAvatar() {
|
||||
_ = os.Remove(filepath.Join(config.GetHomeDir(), "avatars", filepath.Base(user.AvatarURL)))
|
||||
_ = os.Remove(filepath.Join(config.GetHomeDir(), "avatars", "users", filepath.Base(user.AvatarURL)))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -23,7 +23,7 @@ var allowedAvatarTypes = map[string]string{
|
||||
}
|
||||
|
||||
func AvatarsDir() string {
|
||||
return filepath.Join(config.GetHomeDir(), "avatars")
|
||||
return filepath.Join(config.GetHomeDir(), "avatars", "users")
|
||||
}
|
||||
|
||||
func AvatarProcess(ctx *context.Context) error {
|
||||
|
||||
Reference in New Issue
Block a user