feat: add enable/disable link preview privacy (#1675)
This commit is contained in:
@@ -852,6 +852,18 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
return appPatch(patch)
|
return appPatch(patch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/Disable link preview privacy, not related to baileys link preview generation
|
||||||
|
*/
|
||||||
|
const updateDisableLinkPreviewsPrivacy = (isPreviewsDisabled: boolean) => {
|
||||||
|
return chatModify(
|
||||||
|
{
|
||||||
|
disableLinkPreviews: { isPreviewsDisabled }
|
||||||
|
},
|
||||||
|
''
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Star or Unstar a message
|
* Star or Unstar a message
|
||||||
*/
|
*/
|
||||||
@@ -1144,6 +1156,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
updateProfileStatus,
|
updateProfileStatus,
|
||||||
updateProfileName,
|
updateProfileName,
|
||||||
updateBlockStatus,
|
updateBlockStatus,
|
||||||
|
updateDisableLinkPreviewsPrivacy,
|
||||||
updateCallPrivacy,
|
updateCallPrivacy,
|
||||||
updateMessagesPrivacy,
|
updateMessagesPrivacy,
|
||||||
updateLastSeenPrivacy,
|
updateLastSeenPrivacy,
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ export type ChatModification =
|
|||||||
}
|
}
|
||||||
| { delete: true; lastMessages: LastMessageList }
|
| { delete: true; lastMessages: LastMessageList }
|
||||||
| { contact: proto.SyncActionValue.IContactAction | null }
|
| { contact: proto.SyncActionValue.IContactAction | null }
|
||||||
|
| { disableLinkPreviews: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction }
|
||||||
// Label
|
// Label
|
||||||
| { addLabel: LabelActionBody }
|
| { addLabel: LabelActionBody }
|
||||||
// Label assosiation
|
// Label assosiation
|
||||||
|
|||||||
@@ -619,6 +619,16 @@ export const chatModificationToAppPatch = (mod: ChatModification, jid: string) =
|
|||||||
apiVersion: 2,
|
apiVersion: 2,
|
||||||
operation: mod.contact ? OP.SET : OP.REMOVE
|
operation: mod.contact ? OP.SET : OP.REMOVE
|
||||||
}
|
}
|
||||||
|
} else if ('disableLinkPreviews' in mod) {
|
||||||
|
patch = {
|
||||||
|
syncAction: {
|
||||||
|
privacySettingDisableLinkPreviewsAction: mod.disableLinkPreviews || {}
|
||||||
|
},
|
||||||
|
index: ['setting_disableLinkPreviews'],
|
||||||
|
type: 'regular',
|
||||||
|
apiVersion: 8,
|
||||||
|
operation: OP.SET
|
||||||
|
}
|
||||||
} else if ('star' in mod) {
|
} else if ('star' in mod) {
|
||||||
const key = mod.star.messages[0]!
|
const key = mod.star.messages[0]!
|
||||||
patch = {
|
patch = {
|
||||||
|
|||||||
Reference in New Issue
Block a user