Topic List Previews

(lois) #1016

@Holly2 :hugs: here’s what we were looking for

(Bart) #1017

I can confirm this issue on our installation, and it seems to boil down to TLP. It’s causing some issues with image galleries for us, as well as some potential lost content in the future. Would be great to have a fix so we can rebake these posts :slight_smile:

(Angus McLeod) #1018

@bartv Ok thanks, I’ll take a close look this Sunday. In the meantime, if you could try and isolate:

  • when images are lost (i.e. how long it takes)
  • if there are any distinguishing characteristics of the topics from which images are lost
  • whether its affected by any site settings

@keith1 same questions for you.

(Bart) #1019

In my case it isn’t leading directly to missing images - they just don’t get downloaded by Discourse. The reproducible scenario is the following:

  • Site setting ‘download remote images to local’ is enabled.
  • User pastes a link to external image (on or anywhere else)
  • Image displays fine, but doesn’t process to ‘click-enlarge’
  • Image isn’t downloaded into Discourse, and image URL remains the original external link instead of discourse link.

My concern about future missing images is that the external image may at some point be removed and the post will break.

That’s a bit broad :slight_smile: Can you help me zoom in on any specific area?

(Chris Beach) #1021

Recently ran a poll to see if members of my forum preferred round or square topic list thumbnails.

Here’s how the topic list looks with round thumbnails (and a subtle shadow, sorry Flat Design fans :wink:):

Turns out round thumbnails is a hit!

    .topic-thumbnail {
        float: right;
        margin-left: 10px;
    .topic-thumbnail .thumbnail {
        opacity: 0.7;
        margin-top: -10px; margin-bottom: -10px;
        border-radius: 50%;
        box-shadow: 0 2px 6px rgba(0,0,0,0.2);


Or, if you are like us who can’t decide between a square or a circle, we end up with something in between: :slight_smile:


(Angus McLeod) #1023

This may not be an issue with this plugin. The logic in Discourse that handles the downloading and converting of images once they are posted should not be affected by this plugin.

If possible, try testing this behaviour with TLP disabled and see if it makes a difference. Also check your /logs for relevant entries

@ChrisBeach @ckshen Interesting! Thanks for sharing guys.

(Chris Beach) #1024

I’ve noticed that the TLP plugin is displaying thumbnails on the topic list that are hot linked to their original source. I’ve always had the “download remote images” site setting enabled.

(Angus McLeod) #1025

There are a number of interconnected questions here, so it’s important to make a few distinctions.

There are a number of steps involved in processing a post on the server. This is the main list:

@post.link_post_uploads(fragments: @doc)

This plugin hooks into update_post_image, which in core Discourse is relatively unimportant. In core Discourse it just updates the db columns posts.image_url and topics.image_url, which aren’t used much in Discourse. The plugin still retains that core functionality, but adds a fair bit more, namely it generates it’s own thumbnails to be used as topic list thumbnails.

The Discourse functionality that downloads remote images and creates optimized images for the post itself is in other methods. The relevant one here is pull_hotlinked_images. This method is unconnected to the TLP plugin. It also has a number of exceptions which could be relevant to @bartv’s issue, namely

# is the job enabled?
return unless SiteSetting.download_remote_images_to_local?
# have we enough disk space?
return if disable_if_low_on_disk_space
# don't download remote images for posts that are more than n days old
return unless @post.created_at > ( - SiteSetting.download_remote_images_max_days_old)
# we only want to run the job whenever it's changed by a user
return if @post.last_editor_id && @post.last_editor_id <= 0
# make sure no other job is scheduled
Jobs.cancel_scheduled_job(:pull_hotlinked_images, post_id:
# schedule the job
delay = SiteSetting.editing_grace_period + 1
Jobs.enqueue_in(delay.seconds.to_i, :pull_hotlinked_images, post_id:, bypass_bump: bypass_bump)

The job itself, pull_hotlinked_images, has its own conditionals and exceptions that could be the cause of an image not being downloaded: discourse/pull_hotlinked_images.rb at master · discourse/discourse · GitHub

There are various ways in which @bartv’s site is set up, or the way images are being posted, that could be the cause of images not being downloaded. To attribute the cause to this plugin, we’d need to test the issue in isolation.