fix: Client.createGroup + GroupChat.addParticipants (#3670)
* Adjustment addParticipants * createGroup fully refactored, fixed bugs, added creation options and updated docs * fix: eslint fix * refactor: GroupChat.addParticipants fully refactored * fix: eslint fix --------- Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
This commit is contained in:
parent
81fb154a9f
commit
81fd090e36
1 changed files with 58 additions and 49 deletions
|
|
@ -871,8 +871,8 @@ exports.LoadUtils = () => {
|
|||
return dataUrl;
|
||||
|
||||
return Object.assign(media, {
|
||||
mimetype: options.mimeType,
|
||||
data: dataUrl.replace(`data:${options.mimeType};base64,`, '')
|
||||
mimetype: options.mimetype,
|
||||
data: dataUrl.replace(`data:${options.mimetype};base64,`, '')
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -941,30 +941,14 @@ exports.LoadUtils = () => {
|
|||
return undefined;
|
||||
};
|
||||
|
||||
window.WWebJS.getAddParticipantsRpcResult = async (groupMetadata, groupWid, participantWid) => {
|
||||
const participantLidArgs = groupMetadata?.isLidAddressingMode
|
||||
? {
|
||||
phoneNumber: participantWid,
|
||||
lid: window.Store.LidUtils.getCurrentLid(participantWid)
|
||||
}
|
||||
: { phoneNumber: participantWid };
|
||||
|
||||
window.WWebJS.getAddParticipantsRpcResult = async (groupWid, participantWid) => {
|
||||
const iqTo = window.Store.WidToJid.widToGroupJid(groupWid);
|
||||
|
||||
const participantArgs =
|
||||
participantLidArgs.lid
|
||||
? [{
|
||||
participantJid: window.Store.WidToJid.widToUserJid(participantLidArgs.lid),
|
||||
phoneNumberMixinArgs: {
|
||||
anyPhoneNumber: window.Store.WidToJid.widToUserJid(participantLidArgs.phoneNumber)
|
||||
}
|
||||
}]
|
||||
: [{
|
||||
participantJid: window.Store.WidToJid.widToUserJid(participantLidArgs.phoneNumber)
|
||||
}];
|
||||
const participantArgs = [{
|
||||
participantJid: window.Store.WidToJid.widToUserJid(participantWid)
|
||||
}];
|
||||
|
||||
let rpcResult, resultArgs;
|
||||
const isOldImpl = window.compareWwebVersions(window.Debug.VERSION, '<=', '2.2335.9');
|
||||
const data = {
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
|
|
@ -974,12 +958,10 @@ exports.LoadUtils = () => {
|
|||
|
||||
try {
|
||||
rpcResult = await window.Store.GroupParticipants.sendAddParticipantsRPC({ participantArgs, iqTo });
|
||||
resultArgs = isOldImpl
|
||||
? rpcResult.value.addParticipant[0].addParticipantsParticipantMixins
|
||||
: rpcResult.value.addParticipant[0]
|
||||
.addParticipantsParticipantAddedOrNonRegisteredWaUserParticipantErrorLidResponseMixinGroup
|
||||
.value
|
||||
.addParticipantsParticipantMixins;
|
||||
resultArgs = rpcResult.value.addParticipant[0]
|
||||
.addParticipantsParticipantAddedOrNonRegisteredWaUserParticipantErrorLidResponseMixinGroup
|
||||
.value
|
||||
.addParticipantsParticipantMixins;
|
||||
} catch (err) {
|
||||
data.code = 400;
|
||||
return data;
|
||||
|
|
|
|||
Loading…
Reference in a new issue