revork structures for hub
This commit is contained in:
@@ -241,7 +241,7 @@ func HandleUserNewConnection(response http.ResponseWriter, request *http.Request
|
||||
}
|
||||
requestor.Mu.RUnlock()
|
||||
|
||||
connection := types.CreateConn()
|
||||
connection := types.NewConn()
|
||||
connection.CreatedAt = time.Now()
|
||||
connection.RequestorId = requestor.Id
|
||||
connection.RecipientId = recipient.Id
|
||||
|
||||
@@ -84,12 +84,12 @@ func HandleGetUserAvatar(response http.ResponseWriter, request *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if target.Avatar == "" {
|
||||
if target.AvatarUrl == "" {
|
||||
http.Error(response, "no avatar", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
url, _, err := minio.GetDownloadUrlAndMetadata(ctx, target.Avatar)
|
||||
url, _, err := minio.GetDownloadUrlAndMetadata(ctx, target.AvatarUrl)
|
||||
if err != nil {
|
||||
http.Error(response, "internal server error", http.StatusInternalServerError)
|
||||
return
|
||||
@@ -122,12 +122,12 @@ func HandleGetUserProfileBg(response http.ResponseWriter, request *http.Request)
|
||||
return
|
||||
}
|
||||
|
||||
if target.ProfileBg == "" {
|
||||
if target.ProfileBgUrl == "" {
|
||||
http.Error(response, "no profile background", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
url, _, err := minio.GetDownloadUrlAndMetadata(ctx, target.ProfileBg)
|
||||
url, _, err := minio.GetDownloadUrlAndMetadata(ctx, target.ProfileBgUrl)
|
||||
if err != nil {
|
||||
http.Error(response, "internal server error", http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
@@ -62,11 +62,11 @@ func HandleHubCreate(response http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
hub.ChannelGroups[rootGrp.Id] = rootGrp
|
||||
|
||||
rootRole := &types.HubGlobalRole{
|
||||
Id: 0,
|
||||
Name: "root",
|
||||
Color: types.Rgba{255, 0, 0, 255},
|
||||
RolePermission: ^permission.Global(0),
|
||||
rootRole := &types.HubRole{
|
||||
Id: 0,
|
||||
Name: "root",
|
||||
Color: types.Rgba{255, 0, 0, 255},
|
||||
Permissions: ^permission.Global(0),
|
||||
}
|
||||
hub.GlobalRoles[rootRole.Id] = rootRole
|
||||
|
||||
|
||||
@@ -222,8 +222,8 @@ func HandleUserModAvatar(response http.ResponseWriter, request *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if user.Avatar != "" {
|
||||
err = minio.Delete(ctx, user.Avatar)
|
||||
if user.AvatarUrl != "" {
|
||||
err = minio.Delete(ctx, user.AvatarUrl)
|
||||
if err != nil {
|
||||
http.Error(response, "internal server error", http.StatusInternalServerError)
|
||||
return
|
||||
@@ -243,7 +243,7 @@ func HandleUserModAvatar(response http.ResponseWriter, request *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
user.Avatar = key
|
||||
user.AvatarUrl = key
|
||||
err = postgresql.UserUpdateProfile(ctx, user, types.UserProfileUpdateList{Avatar: true})
|
||||
if err != nil {
|
||||
http.Error(response, "internal server error", http.StatusInternalServerError)
|
||||
@@ -285,8 +285,8 @@ func HandleUserModProfileBg(response http.ResponseWriter, request *http.Request)
|
||||
return
|
||||
}
|
||||
|
||||
if user.ProfileBg != "" {
|
||||
err = minio.Delete(ctx, user.ProfileBg)
|
||||
if user.ProfileBgUrl != "" {
|
||||
err = minio.Delete(ctx, user.ProfileBgUrl)
|
||||
if err != nil {
|
||||
http.Error(response, "internal server error", http.StatusInternalServerError)
|
||||
return
|
||||
@@ -306,7 +306,7 @@ func HandleUserModProfileBg(response http.ResponseWriter, request *http.Request)
|
||||
return
|
||||
}
|
||||
|
||||
user.ProfileBg = key
|
||||
user.ProfileBgUrl = key
|
||||
err = postgresql.UserUpdateProfile(ctx, user, types.UserProfileUpdateList{ProfileBg: true})
|
||||
if err != nil {
|
||||
http.Error(response, "internal server error", http.StatusInternalServerError)
|
||||
|
||||
Reference in New Issue
Block a user