Skip to content

appstate: add delete for me#702

Open
marcos-travasso wants to merge 1 commit intotulir:mainfrom
marcos-travasso:feat-delete-for-me
Open

appstate: add delete for me#702
marcos-travasso wants to merge 1 commit intotulir:mainfrom
marcos-travasso:feat-delete-for-me

Conversation

@marcos-travasso
Copy link
Copy Markdown

No description provided.

Comment thread appstate/encode.go
}
}

func newDeleteForMeMutation(targetJID, senderJID string, messageInfo types.MessageInfo, fromMe string, deleteMedia bool) MutationInfo {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No need to change JID to string and fromMe should be bool

Copy link
Copy Markdown

@senpai295 senpai295 left a comment

Choose a reason for hiding this comment

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

I think this makes more sense.

Comment thread appstate/encode.go
}

// BuildDeleteForMe builds an app state patch for deleting a message for me.
func BuildDeleteForMe(messageInfo types.MessageInfo, deleteMedia bool) PatchInfo {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

func BuildDeleteForMe(messageInfo types.MessageInfo, deleteMedia bool) PatchInfo {
	
	targetJID, senderJID := messageInfo.Chat, messageInfo.Sender
	if messageInfo.Chat.User == messageInfo.Sender.User {
		senderJID = types.EmptyJID 
	}
	return PatchInfo{
		Type: WAPatchRegularHigh,
		Mutations: []MutationInfo{
			newDeleteForMeMutation(targetJID, senderJID, messageInfo, messageInfo.IsFromMe, deleteMedia),
		},
	}
}`

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