add user join hub
This commit is contained in:
+16
-16
@@ -221,26 +221,24 @@ func (p *CachedUserPermissions) ClearCanMessage() { *p &^= CachedUserCanMessage
|
||||
func (p CachedUserPermissions) CanMessage() bool { return p&CachedUserCanMessage != 0 }
|
||||
|
||||
type Hub struct {
|
||||
Mu sync.RWMutex `json:"-"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Roles [256]*HubRole `json:"-"`
|
||||
Users map[uuid.UUID]*HubUser `json:"-"`
|
||||
Groups [256]*HubGroup `json:"-"`
|
||||
Channels map[uuid.UUID]*HubChannel `json:"-"`
|
||||
Name string `json:"name"`
|
||||
IconUrl string `json:"iconUrl"`
|
||||
BgUrl string `json:"backgroundUrl"`
|
||||
JoinRole *HubRole `json:"joinRole"`
|
||||
Id uuid.UUID `json:"id"`
|
||||
Creator uuid.UUID `json:"creator"`
|
||||
Color Rgba `json:"color"`
|
||||
UserColorAllowed bool `json:"userColorAllowed"`
|
||||
Mu sync.RWMutex `json:"-"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
Roles [256]*HubRole `json:"-"`
|
||||
Users map[uuid.UUID]*HubUser `json:"-"`
|
||||
Groups [256]*HubGroup `json:"-"`
|
||||
Name string `json:"name"`
|
||||
IconUrl string `json:"iconUrl"`
|
||||
BgUrl string `json:"backgroundUrl"`
|
||||
JoinRole *HubRole `json:"joinRole"`
|
||||
Id uuid.UUID `json:"id"`
|
||||
Creator uuid.UUID `json:"creator"`
|
||||
Color Rgba `json:"color"`
|
||||
UserColorAllowed bool `json:"userColorAllowed"`
|
||||
}
|
||||
|
||||
func NewHub() *Hub {
|
||||
return &Hub{
|
||||
Users: make(map[uuid.UUID]*HubUser),
|
||||
Channels: make(map[uuid.UUID]*HubChannel),
|
||||
Users: make(map[uuid.UUID]*HubUser),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,12 +280,14 @@ type HubGroup struct {
|
||||
Color Rgba `json:"color"`
|
||||
RolesCanView HubBoundRoles `json:"rolesCanView"`
|
||||
UsersCachedPermissions map[uuid.UUID]CachedUserPermissions `json:"-"`
|
||||
Channels map[uuid.UUID]*HubChannel `json:"channels"`
|
||||
Id uint8 `json:"id"` // Id 0 for unused
|
||||
}
|
||||
|
||||
func NewHubGroup() *HubGroup {
|
||||
return &HubGroup{
|
||||
UsersCachedPermissions: make(map[uuid.UUID]CachedUserPermissions),
|
||||
Channels: make(map[uuid.UUID]*HubChannel),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user