YalePrivacyLab / mastodon-timeline-widget

Displays Mastodon.social timeline for @privacylab to embed in other websites
https://privacylab.yale.edu/social
GNU Affero General Public License v3.0
7 stars 1 forks source link

Re-toots not rendered correctly? #2

Open rschmunk opened 1 month ago

rschmunk commented 1 month ago

I deployed this widget to a website recently, and just discovered that a re-toot post (i.e., a boost) does not render in the widget correctly. The widget does seem to notice the re-toot exits, but it does not show any of its text, or any of its graphic if there are such. A click on the timestamp in the corner of the layout does not lead to the instance server but instead shows what looks like JSON metadata for the re-toot.

Edit: The JSON exposed by clicking the timestamp is on the host instance.

rschmunk commented 1 month ago

I've spent some time on this and have a partial fix in my copy of the code. The problem is that when the JS code cycles through the array of toots/posts to include in the widget, the appendStatus method simply appends the content text of a post status to the output. For a boost/re-toot, the status.content will be the empty string and the code then needs to check whether the status.reblog field has been set. If so, the value of reblog is the status that should be displayed.

What took me extra work on this was that I wanted the widget to make it evident that there is a boost in play, and the boosted post status is shown indented. (A bit like how one of the Mastodon apps on my phone displays boosts.) It works, but my code is currently a bit messy, and I made a couple non-optimal tweaks to the CSS file. I also need to take a second and third look at how any images in a boost are shown.