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

[FEATURE] show caption of a message even if the media is deleted #111

Closed
code-consensus opened this issue Sep 3, 2024 · 7 comments
Closed
Assignees
Labels
all platforms Issue related to all platforms enhancement New feature or request

Comments

@code-consensus
Copy link

  • WhatsApp version: any
  • OS: Android
  • Platform: any
  • Branch and version: 0.10.0

Describe the bug
Messages that have media and a caption, but where the media has been deleted, are not shown at all in the output file. The only thing shown is "The media is missing"

Solution:
Add a section to detect a message caption to the whatsapp.html template, specifically right after line 139 and line 223, within the section with the {% if msg.meta == true or msg.media == false and msg.data is none %}

Specifically something like:
{% if msg.caption is not none %}
<div class="INSERT w3 formatting">
{{ msg.caption | urlize(none, true, '_blank') }}
</div>
{% endif %}

@KnugiHK KnugiHK self-assigned this Sep 7, 2024
@KnugiHK KnugiHK added the enhancement New feature or request label Sep 7, 2024
@KnugiHK KnugiHK changed the title [BUG] show caption of a message even if the media is deleted [FEATURE] show caption of a message even if the media is deleted Sep 9, 2024
@KnugiHK KnugiHK added the all platforms Issue related to all platforms label Sep 9, 2024
@KnugiHK
Copy link
Owner

KnugiHK commented Sep 14, 2024

Implemented in 87b1fcc.

I noticed there are class names in your example:

{% if msg.caption is not none %}
    <div class="INSERT w3 formatting">
             {{ msg.caption | urlize(none, true, '_blank') }}
    </div>
{% endif %}

Are there any specific reasons or things your want to achieve?

@code-consensus
Copy link
Author

I noticed there are class names in your example:

I put that simply as a placeholder (class="INSERT w3 formatting"), because I don't really know CSS! I just tried w3-container, and seems to work fine!

@KnugiHK KnugiHK added the pending for release Feature or bug fix to be released label Sep 15, 2024
@code-consensus
Copy link
Author

@KnugiHK I actually noticed your change may also benefit the other area where the message caption is used in the HTML template. In line 169 and line 258:

{% if msg.caption is not none %}
<br>
{{ msg.caption | urlize(none, true, '_blank') }}
{% endif %}

Instead of <br>, wrapping that in the <div class="w3-container"> works a lot better actually.

With the <br>, it looked like this for me, for example:
msg_caption_nodiv_file

With your <div class="w3-container">:
msg_caption_div_file

KnugiHK added a commit that referenced this issue Sep 16, 2024
@KnugiHK
Copy link
Owner

KnugiHK commented Sep 16, 2024

I actually noticed your change may also benefit the other area where the message caption is used in the HTML template. In line 169 and line 258:

{% if msg.caption is not none %}
<br>
{{ msg.caption | urlize(none, true, '_blank') }}
{% endif %}

Instead of <br>, wrapping that in the <div class="w3-container"> works a lot better actually.

I changed it but I haven't have time to test it, although I believe there should be no error. Could you please do so? Thanks!

@code-consensus
Copy link
Author

I changed it but I haven't have time to test it, although I believe there should be no error. Could you please do so? Thanks!

I tested these changes, and it seems to work for me just fine!

@KnugiHK
Copy link
Owner

KnugiHK commented Sep 17, 2024

I changed it but I haven't have time to test it, although I believe there should be no error. Could you please do so? Thanks!

I tested these changes, and it seems to work for me just fine!

Thanks! I will leave this open until next release.

@KnugiHK KnugiHK removed the pending for release Feature or bug fix to be released label Oct 24, 2024
@KnugiHK
Copy link
Owner

KnugiHK commented Oct 24, 2024

Released in 0.10.5.

@KnugiHK KnugiHK closed this as completed Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
all platforms Issue related to all platforms enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants