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: Fix client-side message rendering issue when sending attachements through the library #1905

Merged
merged 1 commit into from
Jan 15, 2023

Conversation

PurpShell
Copy link
Collaborator

@PurpShell PurpShell commented Jan 6, 2023

PR Details

This PR aims to fix the issues with rendering an attachement sent through WWebJS in the GUI after the reload/restart of the client.

image

Description

It seems the issue was that the mediaData prop was not getting properly serialized and added to the message object, which has been reflected & changed in MD. Now in MD, (in the code) the prop is also serialized and appended to the msg object in WhatsApp Web code. I have tested all types of attachments and this seems to work properly

Motivation and Context

This fix will make the UI more enjoyable and appropriate. The issue was in how the message type "chat" was not affected after the concatenation of the attachment options, and so on reload the body (the thumbnail) was eventually just rendered as text rather than an image. This change was needed to make the library a better experience overall to people who use the GUI in co-ordinance with the library. This also fixes other issues like the instability of message type after sending a message with attachments.

How Has This Been Tested

Fully tested on a session with normal WhatsApp on Android. Please try this pull request and help us assure it is fully functioning, it should be though as it now mimics 1:1 how it is sent in WA.

Types of changes

  • Dependency change
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation accordingly (index.d.ts).

@Donaldiil
Copy link

Donaldiil commented Jan 10, 2023

I still have this issue after adding the line in Injected.js

After restarting the client, the message still has the type "chat" and the body is a base64 thumbnail.

I am in headless mode google chrome, If I take a screenshot with client.pupPage.screenshot, I can see the image message showing as base64 text in the web.whatsapp.com chat room.

Are there other changes to the source code other that the one line in the Injected.js?

Thanks a lot!
Appreciate your contribution

@zulfio
Copy link
Contributor

zulfio commented Jan 12, 2023

it's work

image

@bhavya32
Copy link

Works for me :)

@pedroslopez pedroslopez merged commit 7dd8688 into main Jan 15, 2023
@pedroslopez pedroslopez deleted the fix-media-render branch January 15, 2023 18:32
pedroslopez added a commit that referenced this pull request Jan 15, 2023
…achements through the library (#1905)"

This reverts commit 7dd8688.
pedroslopez added a commit that referenced this pull request Jan 15, 2023
…achements through the library (#1905)" (#1932)

This reverts commit 7dd8688.
@pedroslopez
Copy link
Owner

@PurpShell FYI: I had to revert this in #1932 because it broke sending stickers.

@liranrevivo
Copy link

@pedroslopez can you please investigate for a way to re-add this without making breaking changes?
This fix was very critical for me..

cheveguerra pushed a commit to cheveguerra/whatsapp-web.js that referenced this pull request Jan 15, 2023
cheveguerra pushed a commit to cheveguerra/whatsapp-web.js that referenced this pull request Jan 15, 2023
cheveguerra pushed a commit to cheveguerra/whatsapp-web.js that referenced this pull request Jan 15, 2023
cheveguerra pushed a commit to cheveguerra/whatsapp-web.js that referenced this pull request Jan 15, 2023
cheveguerra pushed a commit to cheveguerra/whatsapp-web.js that referenced this pull request Jan 15, 2023
cheveguerra pushed a commit to cheveguerra/whatsapp-web.js that referenced this pull request Jan 15, 2023
@folk-connect
Copy link

@PurpShell Can you fix it without breaking stickers and create a new PR. This is an important fix for me

@PurpShell PurpShell mentioned this pull request Feb 7, 2023
@PurpShell
Copy link
Collaborator Author

.

PurpShell added a commit that referenced this pull request Feb 19, 2023
* fix: compatibility with LegacyPhoneFeatures in latest WhatsApp Web version (#1930)

* fix removed features on latest wweb version

* errors

* fix: Fix client-side message rendering issue when sending attachements through the library (#1905)

* Update supported WhatsApp Web version to v2.2301.6 (#1869)

Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>

* fix method downloadMedia when not found msg (#1852)

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>

* Adding missing CALL in events enum (#1899)

* chore: mark version v1.19.0

* Revert "fix: Fix client-side message rendering issue when sending attachements through the library (#1905)" (#1932)

This reverts commit 7dd8688.

* chore: mark version v1.19.1

* update docs for 1.19.1

* fix group methods (#1934)

* fix: create group

* fix set group subject, description, properties; exit group

* fix participant methods

* fix return type

* fix invite methods

* chore: mark version v1.19.2

* Fix: message.getInfo (#1953)

window.Store.MessageInfo.sendQueryMsgInfo now needs msg.id instead of msg

* 1.20.0-alpha.0

* chore: mark version v1.19.3

* try to fix queryWidExists (#1987)

* fix getNumberId

* Fixing the queryWidExists function (#1989)

* Update Injected.js

fix function queryWidExists

* Update Injected.js

support WA old version 2.2305.7

---------

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>

* merge fix

* Fix mute chat (#1982)

* fix function set mute chat

* chat mute new object

* Update supported WhatsApp Web version to v2.2306.7 (#1954)

Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>

* chore: mark version v1.19.4

---------

Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: pedroslopez <pedroslopez@users.noreply.github.com>
Co-authored-by: tofers <acerkot@mail.ru>
Co-authored-by: Azeem Haider <axeemhaider@gmail.com>
Co-authored-by: Michal Serlui <70711723+shirser121@users.noreply.github.com>
Co-authored-by: WWebJS Bot <hello@wwebjs.dev>
dlimars pushed a commit to somosversotech/whatsapp-web.js that referenced this pull request Feb 22, 2023
dlimars pushed a commit to somosversotech/whatsapp-web.js that referenced this pull request Feb 22, 2023
Belfio pushed a commit to Belfio/whatsapp-web.js that referenced this pull request Jan 9, 2024
Belfio pushed a commit to Belfio/whatsapp-web.js that referenced this pull request Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants