Skip to content

Conversation

@cleitonme
Copy link
Contributor

tulir/whatsmeow#1048 (comment)

Include complete message to avoid hidden tagging errors in groups; I keep it optional for compatibility with the previous version.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @cleitonme, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug related to quoted messages, particularly in scenarios involving iPhones, by enhancing the system's ability to handle full waE2E.Message objects as quoted content. The primary goal is to prevent hidden tagging errors in group messages by providing a more complete context for quoted replies, while also ensuring that existing functionalities remain compatible.

Highlights

  • Enhanced Quoted Message Handling: Introduced a new QuotedMessage field to various message sending structs (e.g., documentStruct, audioStruct, imageStruct, stickerStruct, videoStruct, contactStruct, textStruct) to allow for a complete waE2E.Message object to be used when quoting messages.
  • Improved Context Information for Quoted Messages: Updated the message sending logic across multiple handler functions (SendDocument, SendAudio, SendImage, SendSticker, SendVideo, SendContact, SendMessage) to prioritize the newly provided QuotedMessage for ContextInfo. This ensures that a richer message context can be included, addressing potential issues like hidden tagging errors in group chats.
  • Backward Compatibility Maintained: The changes are implemented to be optional, falling back to the previous logic (e.g., using an empty message or QuotedText) if a QuotedMessage is not explicitly provided. This ensures compatibility with existing implementations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new optional QuotedMessage field to several message sending endpoints. This allows providing a complete message object for quoting, which fixes an issue with hidden tagging in groups on iPhones, while maintaining backward compatibility.

The implementation is correct and consistent across all affected handlers. My review focuses on improving maintainability by reducing code duplication. I've suggested refactoring the repeated logic for handling quoted messages into helper functions. This will make the codebase cleaner and easier to manage in the future. Overall, this is a good addition to fix the reported bug.

Comment on lines 909 to 927
if t.ContextInfo.StanzaID != nil {
msg.DocumentMessage.ContextInfo = &waE2E.ContextInfo{
StanzaID: proto.String(*t.ContextInfo.StanzaID),
Participant: proto.String(*t.ContextInfo.Participant),
QuotedMessage: &waE2E.Message{Conversation: proto.String("")},
var qm *waE2E.Message

// If QuotedMessage was provided, use it.
if t.QuotedMessage != nil {
qm = t.QuotedMessage
} else {
// Otherwise, it uses the old logic (empty message).
qm = &waE2E.Message{Conversation: proto.String("")}
}

if msg.DocumentMessage.ContextInfo == nil {
msg.DocumentMessage.ContextInfo = &waE2E.ContextInfo{
StanzaID: proto.String(*t.ContextInfo.StanzaID),
Participant: proto.String(*t.ContextInfo.Participant),
QuotedMessage: qm,
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's significant code duplication across several Send... handlers for building the ContextInfo with a quoted message. This logic is repeated in SendAudio, SendImage, SendSticker, SendVideo, SendContact, and SendLocation.

To improve maintainability and reduce redundancy, you could extract this logic into a helper function. For example, you could create a function that takes a pointer to the message's ContextInfo field and sets it accordingly.

Here's an example of what such a helper function could look like:

func (s *server) setQuotedContextInfo(
	contextInfo **waE2E.ContextInfo,
	reqContextInfo waE2E.ContextInfo,
	quotedMessage *waE2E.Message,
) {
	if reqContextInfo.StanzaID == nil {
		return
	}

	// Don't overwrite if it's already set (e.g., by another part of the handler)
	if *contextInfo != nil {
		return
	}

	qm := quotedMessage
	if qm == nil {
		qm = &waE2E.Message{Conversation: proto.String("")}
	}

	*contextInfo = &waE2E.ContextInfo{
		StanzaID:      proto.String(*reqContextInfo.StanzaID),
		Participant:   proto.String(*reqContextInfo.Participant),
		QuotedMessage: qm,
	}
}

You could then call it from SendDocument like this:

s.setQuotedContextInfo(&msg.DocumentMessage.ContextInfo, t.ContextInfo, t.QuotedMessage)

And similarly for the other 6 handlers, just changing &msg.DocumentMessage.ContextInfo to &msg.AudioMessage.ContextInfo, etc. This would make the code much cleaner and easier to maintain.

Comment on lines +2257 to 2272
var qm *waE2E.Message

// If QuotedMessage was provided, use it.
if t.QuotedMessage != nil {
qm = t.QuotedMessage
} else {
qm.Conversation = proto.String("")
// Otherwise, use the old logic with QuotedText.
qm = &waE2E.Message{}
if t.QuotedText != "" {
qm.ExtendedTextMessage = &waE2E.ExtendedTextMessage{
Text: proto.String(t.QuotedText),
}
} else {
qm.Conversation = proto.String("")
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This logic for determining qm can be simplified by removing the var declaration and the outer if/else structure. This makes the code more concise and easier to read.

qm := t.QuotedMessage
			if qm == nil {
				// Otherwise, use the old logic with QuotedText.
				qm = &waE2E.Message{}
				if t.QuotedText != "" {
					qm.ExtendedTextMessage = &waE2E.ExtendedTextMessage{
						Text: proto.String(t.QuotedText),
					}
				} else {
					qm.Conversation = proto.String("")
				}
			}

julianotarga added a commit to julianotarga/wuzapi that referenced this pull request Jan 12, 2026
…one)

- Adicionar campo QuotedMessage opcional em todos os handlers de envio
- Usar QuotedMessage se fornecido, senão fallback para mensagem vazia
- Baseado no PR asternic#254 do asternic/wuzapi
- Corrige problema de citações invisíveis em grupos (especialmente iPhones)
@asternic asternic merged commit 467ac18 into asternic:main Jan 21, 2026
1 check passed
maxHSG pushed a commit to maxHSG/wuzapi that referenced this pull request Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants