Embed blacklist selector behavior

(probus) #1

When embedding discourse comments in static pages the blacklist/whitelist css functionality is broken.

The blacklist only seems to work initially if the discussion topic is created during the first user visit to the static page. If you wait for the topic to be created from the rss feed the blacklist/whitelist doesn’t have any effect. Even if you get the correct content in the opening post by visiting the static page first, after an hour the opening post updates itself and reverts to a state like it would have been with empty blacklist/whitelist.

It seems when the system checks for updates to the static page the whitelist/blacklist gets bypassed.

Steps to reproduce:

  1. Embed Discourse comments in your blog
  2. Write “p” in settings>embed blacklist selector
  3. Write a blog post and don’t visit the page
  4. Wait a few minutes for the comment topic to get created from rss feed
  5. The opening post has full contents of (every p element in) the page and blacklist doesn’t have any effect


  1. Embed Discourse comments in your blog
  2. Write “p” in settings>embed blacklist selector
  3. Write a blog post and visit the page
  4. Notice a comment topic with mostly empty first post being created immediately like it should
  5. Wait an hour
  6. Watch the topic opening post update itself with again all the content from the static page

edit. updated with more information

CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8
(Jeff Atwood) #2

This is @sam’s feature and is highly specific to embedding and the Show Full Post button, at least, I think that is what you are referring to.

(probus) #3

I haven’t tested if the Show Full Post button/setting has any effect. After quick testing, it doesn’t seem to.

Basically I’m saying the whitelist/blacklist is bust. You don’t have any way to influence what gets picked up on the opening post of the comment topic. It will always revert to default behaviour. It’s impossible to have, as an example, empty first post with no blog content in it.

After playing around with the Show Full Post button enabled, it seems like the fist paragraph that is initially shown is from the unfiltered contents and after you click it, it shows the white/blacklisted version. Weird.

(Kane York) #4

Ah! So you just need to get a smarter excerpt.

(probus) #5

I don’t understand.

Perhaps it would help if someone explained what the whitelist/blacklist is supposed to do. Right now, it doesn’t seem to do anything useful and the experience is at best inconsistent.

(Sam Saffron) #6

Its supposed to hint at the GitHub - cantino/ruby-readability: Port of arc90's readability project to Ruby to tell it what to select or not to select.


(probus) #7

Well, I assume that it’s supposed to hint that every time ruby-readability is used. Since it only has effect on very limited cases and otherwise the ruby-readability seems to be working on default settings, the implementation seems buggy.

Just to be clear:

  1. I’d expect it to have some effect when embed truncate is not used (i.e. no button).
  2. I’d expect the effect to be the same before and after the Show Full Post button is clicked
  3. I’d expect the opening post not to change if there has been no edits to the blog post

Right now, none of these conditions are true.

(Sam Saffron) #8

The options are always passed, I am very confused here. Embedding always goes to the main site. I have no idea about the embed truncate thing

You are going to have to help fix this up if you want to use it, we have very very few spots using this feature and for those spots it works adequately.

(probus) #9

Me too, since clearly they are not always passed. Unfortunately I don’t understand the code well enough to see where the problem is. I only tried the truncate after @codinghorror suggested it has something to do with this.

You can try this on your own blog if you want. Set “.post” in the blacklist and see what happens. When you write a new blog post the created comment topic opening post will temporarily be empty until the Sidekiq job PollFeed runs and updates the full contents there without passing on the blacklist.

(probus) #10

I’m trying one more time, since we are nearing release.

Is there a way to have anything else than the full content of the blog post in the opening post? Empty post would be fine. If not, please tell me how I can help you to fix it.

Is there any way to include excerpts of blogs as topics instead of full posts?
(probus) #11

I’ve found a workaround.

If you disable rss feed polling, the whitelist/blacklist seems to work correctly. The post content also doesn’t revert back after a while.

The downsides are, that the opening post contents won’t update any more automatically and the comment topic gets created only when the first user loads the blog post. So when you create a new blog post you have to visit the url to create the comment topic and if you then change the blog contents the content of the opening post doesn’t update automatically anymore.