forked from WhiskeySockets/Baileys
-
Notifications
You must be signed in to change notification settings - Fork 22
release: develop → master 2026-06-06 (#503 + #506 + #507) #508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
eebb6d2
fix(newsletter): parse metadata and fetch-messages responses (#2620 p…
rsalcara f335c1f
fix(contacts): resolve LID↔PN for profile-picture contacts.update (po…
rsalcara 3f409e7
feat(phase9): add status.db (14th file) — Status feed + channel-cross…
rsalcara 4fdc6d9
Merge origin/master into release/develop-to-master-2026-06-06
rsalcara 3d03204
fix(newsletter): cover node.{image,preview} as parseNewsletterMetadat…
rsalcara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import { areJidsSameUser, isLidUser, isPnUser, jidNormalizedUser } from '../WABinary' | ||
|
|
||
| export type ContactPictureIdentityContext = { | ||
| getPNForLID: (lid: string) => Promise<string | null> | ||
| getLIDForPN: (pn: string) => Promise<string | null> | ||
| meId: string | undefined | ||
| meLid: string | undefined | ||
| } | ||
|
|
||
| /** | ||
| * Resolve the best-effort contact identity for a profile-picture notification. | ||
| * `from` must be the already-normalized individual JID (never a group jid). | ||
| * | ||
| * Returns the fields to merge into a `contacts.update` entry. When `from` is a LID we | ||
| * attempt to resolve the PN (and vice-versa) so consumers can correlate the change with a | ||
| * cached contact regardless of which addressing form they store. For non-saved contacts WA | ||
| * omits the canonical identity, so resolution may fail — in that case we still return the | ||
| * raw LID so the event is never empty. | ||
| */ | ||
| export async function resolveContactPictureIdentity( | ||
| from: string, | ||
| ctx: ContactPictureIdentityContext | ||
| ): Promise<{ id: string; lid?: string; phoneNumber?: string }> { | ||
| const result: { id: string; lid?: string; phoneNumber?: string } = { id: from } | ||
|
|
||
| if (isLidUser(from)) { | ||
| result.lid = from | ||
| const resolvedPn = await ctx.getPNForLID(from).catch(() => null) | ||
| const normalizedPn = jidNormalizedUser(resolvedPn || undefined) | ||
| // guard: discard a resolution that points at our own PN unless `from` is our own LID | ||
| const isBogusSelf = | ||
| !!normalizedPn && | ||
| !!ctx.meId && | ||
| areJidsSameUser(normalizedPn, ctx.meId) && | ||
| !(ctx.meLid && areJidsSameUser(from, ctx.meLid)) | ||
| if (normalizedPn && !isBogusSelf) { | ||
|
rsalcara marked this conversation as resolved.
|
||
| result.id = normalizedPn | ||
| result.phoneNumber = normalizedPn | ||
| } | ||
| } else if (isPnUser(from)) { | ||
| result.phoneNumber = from | ||
| const resolvedLid = await ctx.getLIDForPN(from).catch(() => null) | ||
| if (resolvedLid && isLidUser(resolvedLid)) { | ||
| result.lid = jidNormalizedUser(resolvedLid) | ||
| } | ||
| } | ||
|
|
||
| return result | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.