[ARCHIVE] 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 imgur.com 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 > (Date.today - 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: @post.id)
# schedule the job
delay = SiteSetting.editing_grace_period + 1
Jobs.enqueue_in(delay.seconds.to_i, :pull_hotlinked_images, post_id: @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.


Any news? I understand if it’s not a priority and you’re busy. I would just like to know how complicated it seems to you.

(Damar Wicaksono) #1027

There are so many developments going on over the years on this plugin, and I’m a bit lost going through them.
I was just wondering whether it is possible to show the preview thumbnails for all topics in a given category?
That is, is there somehow an all list to select in the Show topic preview thumbnails in selected lists and not just latest, new, etc.? Did I miss something?

(Angus McLeod) #1028

Adding topic list preview functionality is definitely possible, but it will be a bit of work. The search results are not a “topic list” like the other lists. They don’t use the same components and have different plugin outlets.

Yes. Just add all list types to Show topic preview thumbnails in selected lists in this category.

(Damar Wicaksono) #1029

Of course! Thanks! It seems to work.

(Paul) #1030

I’m quite impressed this thread has got to 1000 comments. Has there been any interest in making this plugin part of core?

(Paul) #1032

Is it possible to sort the topic by most liked whilst using top list previews?

I’m considering using the Like button as a voting/ranking system

(Angus McLeod) #1033

Not really.

TLP modifies topic lists, based on the name of the list filter, i.e. latest, top etc. The various TLP settings contain lists of existing topic list filters you can add the TLP feature to, ie

To sort by likes, you’d be introducing a new filter, i.e.

We haven’t yet added support for adding custom filters to the TLP settings, but it’s a worthy subject of new feature work in the next month or so. @merefield and I will discuss.

(jjaarrvviiss) #1034

@merefield has the bug with the infinite scroll been solved yet? I’d be happy to help however can, testing or troubleshooting! Thanks.


Hey jjaarrvviiss,

Yes, that’s resolved and it’s working great now.

I’ve just submitted what I hope to be some near final changes, but @angus will need to review them as it’s his component I’m invading with my code! That said we’ve been talking all along so hopefully it will be a checking off exercise now.

Very glad for you to test it out, but I recommend waiting until Angus has had a review so you will get to check out close to final code. I’ll be very keen to get feedback :slight_smile:

Sometimes Angus gets a chance to look at things during the week, but it’s never a quick job to gate-keep large PRs so the weekend might be a more likely release time and even then I don’t know his weekend plans :sweat_smile:

(jjaarrvviiss) #1036

Hooray!! Very good news!

Ok, we’ll wait but very excited to try it out, this is exactly the thing we’ve been looking for to help the front page of our discourse installation be more engaging and visually interesting!

Glad to test and provide feedback on Github too, as we start to use it.

Congrats on finalizing your PR!


If you are really keen to try it out (but suggest you do not do so on a Prod instance) you can always pull the branch from here but suggest holding on a little while.