Skip to content
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

Fix the "Someone" nickname problem (whatsapp) #1931

Merged
merged 6 commits into from
Dec 14, 2022
Merged

Conversation

ilmaisin
Copy link
Contributor

@ilmaisin ilmaisin commented Nov 29, 2022

Fix #1876 and code cleanup

@ilmaisin ilmaisin changed the title Apply patch to work around the "Someone" nickname problem Apply patch to work around the "Someone" nickname problem (whatsapp) Nov 29, 2022
@ilmaisin
Copy link
Contributor Author

If i move

if AltName != "" {
	return AltName
}

to the place of

if sender.PushName != "" {
	return sender.PushName
}

the patch stops working.

if sender, exists := b.contacts[senderJid]; exists {
if sender.FullName != "" {
return sender.FullName
func (b *Bwhatsapp) getSenderName(info types.MessageInfo) string {
Copy link

Choose a reason for hiding this comment

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

Method Bwhatsapp.getSenderName has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.

@ilmaisin
Copy link
Contributor Author

ilmaisin commented Dec 2, 2022

I have noticed that the getSenderName function does that FullName => PushName => FirstName query, but getSenderNotify just uses the PushName. Why?

@ilmaisin ilmaisin changed the title Apply patch to work around the "Someone" nickname problem (whatsapp) Fix the "Someone" nickname problem (whatsapp) Dec 2, 2022
@ilmaisin ilmaisin marked this pull request as ready for review December 3, 2022 20:56
@ilmaisin ilmaisin marked this pull request as draft December 6, 2022 22:25
@ilmaisin ilmaisin marked this pull request as ready for review December 6, 2022 22:35
@codeclimate
Copy link

codeclimate bot commented Dec 6, 2022

Code Climate has analyzed commit 2200a9c and detected 0 issues on this pull request.

View more on Code Climate.

@42wim 42wim added this to the 1.26.0 milestone Dec 14, 2022
@42wim 42wim merged commit 4cf313c into 42wim:master Dec 14, 2022
@42wim
Copy link
Owner

42wim commented Dec 14, 2022

Thanks!

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.

"Someone" instead of real nick when messaging from WhatsApp via web or desktop app (to Nextcloud Talk)
2 participants