fix group announce and restrict always false (#971)

* fix group announce and restrict always false

* refactor: make group setting change params in line with WA

Co-authored-by: Adhiraj Singh <adhirajsingh1001@gmail.com>
This commit is contained in:
LightningNeko
2021-12-06 00:23:12 -03:00
committed by GitHub
parent cccd9305a2
commit 7e414a940b

View File

@@ -206,12 +206,12 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
emitParticipantsUpdate('add')
break
case WAMessageStubType.GROUP_CHANGE_ANNOUNCE:
const announce = message.messageStubParameters[0] === 'on'
emitGroupUpdate({ announce })
const announceValue = message.messageStubParameters[0]
emitGroupUpdate({ announce: announceValue === 'true' || announceValue === 'on' })
break
case WAMessageStubType.GROUP_CHANGE_RESTRICT:
const restrict = message.messageStubParameters[0] === 'on'
emitGroupUpdate({ restrict })
const restrictValue = message.messageStubParameters[0]
emitGroupUpdate({ restrict: restrictValue === 'true' || restrictValue === 'on' })
break
case WAMessageStubType.GROUP_CHANGE_SUBJECT:
chatUpdate.name = message.messageStubParameters[0]
@@ -321,12 +321,12 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
case 'announcement':
case 'not_announcement':
result.messageStubType = WAMessageStubType.GROUP_CHANGE_ANNOUNCE
result.messageStubParameters = [ (child.tag === 'announcement').toString() ]
result.messageStubParameters = [ (child.tag === 'announcement') ? 'on' : 'off' ]
break
case 'locked':
case 'unlocked':
result.messageStubType = WAMessageStubType.GROUP_CHANGE_RESTRICT
result.messageStubParameters = [ (child.tag === 'locked').toString() ]
result.messageStubParameters = [ (child.tag === 'locked') ? 'on' : 'off' ]
break
}