Skip to content

Conversation

aliyss
Copy link
Collaborator

@aliyss aliyss commented Apr 18, 2020

chat.pin()
chat.unpin()

client.pinChat(chatId)
...

Copy link
Owner

@pedroslopez pedroslopez left a comment

Choose a reason for hiding this comment

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

Pinning/unpinning seems to work, but the return value isn't as expected (docstrings indicate it returns a boolean with the pin state). While testing I found pinning/unpinning returns a number that seems like it may be a timestamp, and I even got undefined at one point. Can you verify this?

@aliyss aliyss requested a review from pedroslopez April 21, 2020 03:10
- Now return Booleans.
Copy link
Owner

@pedroslopez pedroslopez left a comment

Choose a reason for hiding this comment

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

The return still doesn't seem to be working right. When I first pin a chat I get false, and unpinning gives me true, which would seem backwards.

Calling pin() or unpin() more than once should also be limited or simply ignored. Doing this more than once seems to bug it out and it can get to a state where trying to unpin gives the message "Couldn't unpin chat", and just stays stuck until a restart of whatsapp web. Furthermore, doing this reverts the return values, causing pin() to return true and unpin() to return false.

@aliyss
Copy link
Collaborator Author

aliyss commented Apr 21, 2020

Ok. Will add a check later. So the state is checked before it tries to pin/unpin.

@stale
Copy link

stale bot commented May 21, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 21, 2020
@stale stale bot removed the stale label May 24, 2020
@pedroslopez
Copy link
Owner

@aliyss have you been able to take a look at this? Still seems like the pin state isn't too reliable

@aliyss
Copy link
Collaborator Author

aliyss commented May 24, 2020

@pedroslopez I didn't get to it. Very Sorry. Currently a lot to do.

I'll try to look into it tomorrow. Also thanks for the mute/unmute

aliyss and others added 3 commits May 24, 2020 14:39
- Added Check for already pinned / unpinned.
- Added Check for already max amount pinned.
- returns true / false based on checks instead of WhatsApp, since Whatsapp needs time to update the value.
@aliyss aliyss requested a review from pedroslopez May 25, 2020 13:25
@stale
Copy link

stale bot commented Jul 18, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 18, 2020
@pedroslopez
Copy link
Owner

@aliyss I think it's ok to assume it's 3 as long as we clearly indicate what that number means (e.g const MAX_PIN_COUNT = 3 or something similar)

However, we still need to get the current number of pinned chats and compare it to prevent the issue.

@aliyss aliyss requested a review from pedroslopez September 2, 2020 20:10
Copy link
Owner

@pedroslopez pedroslopez left a comment

Choose a reason for hiding this comment

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

Just a couple details with await usage

aliyss and others added 5 commits September 2, 2020 22:42
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
@aliyss
Copy link
Collaborator Author

aliyss commented Sep 2, 2020

Fixed and tested. Still works.

@aliyss aliyss requested a review from pedroslopez September 2, 2020 20:49
@stale
Copy link

stale bot commented Oct 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 2, 2020
@stale stale bot closed this Oct 10, 2020
@aliyss
Copy link
Collaborator Author

aliyss commented Oct 10, 2020

@pedroslopez
Keeping it open... Until officially closed? All requested changes have been made.

@pedroslopez pedroslopez reopened this Oct 11, 2020
@stale stale bot removed the stale label Oct 11, 2020
@pedroslopez pedroslopez added this to the v1.10.0 milestone Oct 11, 2020
@pedroslopez pedroslopez merged commit aedf41b into pedroslopez:master Oct 11, 2020
@aliyss aliyss deleted the pin-xoxo-unpin branch October 15, 2020 23:59
Belfio pushed a commit to Belfio/whatsapp-web.js that referenced this pull request Jan 9, 2024
* Added Pinning
- chat.pin() to pin
- chat.unpin() to unpin

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
Filarh pushed a commit to Filarh/whatsapp-web.js that referenced this pull request Jun 13, 2025
* Added Pinning
- chat.pin() to pin
- chat.unpin() to unpin

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
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