forked from MirrorHub/mautrix-whatsapp
Apply more group metadata before creating room
This commit is contained in:
parent
a1192bd0a4
commit
6184eeb28a
1 changed files with 19 additions and 15 deletions
34
portal.go
34
portal.go
|
@ -1542,16 +1542,32 @@ func (portal *Portal) CreateMatrixRoom(user *User, groupInfo *types.GroupInfo, i
|
|||
portal.Topic = groupInfo.Topic
|
||||
portal.IsParent = groupInfo.IsParent
|
||||
portal.ParentGroup = groupInfo.LinkedParentJID
|
||||
if groupInfo.IsEphemeral {
|
||||
portal.ExpirationTime = groupInfo.DisappearingTimer
|
||||
}
|
||||
}
|
||||
portal.UpdateAvatar(user, types.EmptyJID, false)
|
||||
}
|
||||
|
||||
powerLevels := portal.GetBasePowerLevels()
|
||||
|
||||
if groupInfo != nil {
|
||||
if groupInfo.IsAnnounce {
|
||||
powerLevels.EventsDefault = 50
|
||||
}
|
||||
if groupInfo.IsLocked {
|
||||
powerLevels.EnsureEventLevel(event.StateRoomName, 50)
|
||||
powerLevels.EnsureEventLevel(event.StateRoomAvatar, 50)
|
||||
powerLevels.EnsureEventLevel(event.StateTopic, 50)
|
||||
}
|
||||
}
|
||||
|
||||
bridgeInfoStateKey, bridgeInfo := portal.getBridgeInfo()
|
||||
|
||||
initialState := []*event.Event{{
|
||||
Type: event.StatePowerLevels,
|
||||
Content: event.Content{
|
||||
Parsed: portal.GetBasePowerLevels(),
|
||||
Parsed: powerLevels,
|
||||
},
|
||||
}, {
|
||||
Type: event.StateBridge,
|
||||
|
@ -1662,20 +1678,8 @@ func (portal *Portal) CreateMatrixRoom(user *User, groupInfo *types.GroupInfo, i
|
|||
|
||||
go portal.addToPersonalSpace(user)
|
||||
|
||||
if groupInfo != nil {
|
||||
if groupInfo.IsEphemeral {
|
||||
portal.ExpirationTime = groupInfo.DisappearingTimer
|
||||
portal.Update(nil)
|
||||
}
|
||||
if !autoJoinInvites {
|
||||
portal.SyncParticipants(user, groupInfo)
|
||||
}
|
||||
if groupInfo.IsAnnounce {
|
||||
portal.RestrictMessageSending(groupInfo.IsAnnounce)
|
||||
}
|
||||
if groupInfo.IsLocked {
|
||||
portal.RestrictMetadataChanges(groupInfo.IsLocked)
|
||||
}
|
||||
if groupInfo != nil && !autoJoinInvites {
|
||||
portal.SyncParticipants(user, groupInfo)
|
||||
}
|
||||
//if broadcastMetadata != nil {
|
||||
// portal.SyncBroadcastRecipients(user, broadcastMetadata)
|
||||
|
|
Loading…
Reference in a new issue