Skip to content

Can not get real-time alias when we modified contact alias in WeChat App by contact.alias(). #1964

@su-chang

Description

@su-chang

Important:Please file the issue follow the template, or we won't help you to solve the problem.

0. Report Issue Guide

  1. Please run the following command and check whether the problem has been fixed:
rm -rf package-lock.json
rm -rf node_modules
npm install
  1. Please search in FAQ List first, and make sure your problem has not been solved before.

  2. Please search in the issue first, and make sure your problem had not been reported before

1. Versions

  • What is your wechaty version?
    Answer:0.39.26

  • Which puppet are you using for wechaty? (padchat/puppeteer/padpro/...)
    Answer:donut

  • What is your wechaty-puppet-XXX(padchat/puppeteer/) version?
    Answer:0.3.19

  • What is your node version? (run node --version)
    Answer:10.16.0

  • What os are you using
    Answer:MacOS

2. Describe the bug

Give a clear and concise description of what the bug is.

Now we can get alias from payload, but if the payload is not the real-time, it will make the alias not real-time.

Due to wechaty-puppet-donut can not post real-time data when something modified, so maybe we should do some change for method alias() in Contact.

BTW, the method contactAlias(contactId) in wechaty-puppet has never been used due to we get alias from payload rather than this method.

3. To Reproduce

This part is very important: if you can not provide any reproduce steps, then the problem will be very hard to be recognized.

Steps to reproduce the behavior:

  1. run hosite for donut
  2. modified contact alias in WeChat App
  3. get contact alias in wechaty

4. Expected behavior

Give a clear and concise description of what you expected to happen.

if (typeof newAlias === 'undefined') {
  return this.payload.alias || null
}

change it to:

if (typeof newAlias === 'undefined') {
  return this.puppet.contactAlias(this.id)
}

Reasons

  1. it is not a breaking change for existed puppet neither
  2. could sync contact in base level
  3. make the puppet method contactAlias(contactId) make sense

I have test it in my local env, everything work as expected so far.

5. Actual behavior

If applicable, add screenshots to help explain your problem. But do not paste log screenshots here.
Can not get the real-time contact alias.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions