Twitter Native Embed

There was Reddit, taken by the same approach. Discussion are truly on risk (nobody listen untils it’s late like almost always).

We got Discourse, for sure :slight_smile:

1 Like

This is a feature. To prevent the iframe from being requested multiple times while editing, I didn’t allow the component to be enabled in compose.

6 Likes

With this installed, I notice that when going to a thread, it first takes you to ‘last post’, then the Twitter embed function populates, and it drags you back a few posts, every time.

Is there a fix for this?

2 Likes

We are still having an issue… nothing is embedding yet it appears everything is set up… any ideas?

1 Like

This theme component doesnt’t use the twitter api, you won’t be limited in that aspect

1 Like

Twitter’s onebox has been subject to changes as per this commit: FIX: Use Twitter API v2 for oneboxes and restore OpenGraph fallback (… · discourse/discourse@24c9053 · GitHub

I tried this theme component on my test instance, and it doesn’t show media:

Is this related?

1 Like

This theme component will only work if onebox doesn’t work

1 Like

Alright :+1:.

I tested, and if oneboxes don’t work well (like, not showing media), then you must add twitter.com in blocked onebox domains in order for the component to work. :slight_smile:

From:

To:

I didn’t use the theme component widely and didn’t encounter the issue, but my guess is that Discourse doesn’t know how tall will be a Twitter iframe before the content is loaded. When the iframe loads, it pushes the content arround it, creating this behavior.

Can you capture a video of it?

2 Likes

The one box has started working again for tweets, overriding this component. Did anyone spot this today?

I ran a rebuild app approx 10 hours ago, current version 3.1.0.beta5 (09feb03056)

So this might have something to do with the sudden reversion.

I actually prefer how this component works for tweets. Is there a way to exclude tweets form being oneboxed now?

What I see in settings is allowed onebox iframes however I can not list all teh possible src I want jsut to exclude twitter, is there a way to disable one or a handful of src this way? If not how about it?

Or else something must have changed over at Twitter again and it is all coincidental.

Has anyone else noticed this? @Lhc_fl

1 Like

@jancernik fixed it up following the recent API changes at Twitter :raised_hands:

Yeah that’s exactly right. That’s the reason we don’t use the “official” Twitter embed in Discourse core - it causes topics to jump around as the iframes load.

4 Likes

Doh I should have read the last few posts! :melting_face:

3 Likes

Yes the jumping is very notable in topics but tbh I prefer the native twitter styling and the capturing of the parent tweet in a reply.

This saves posting two twitter links, yes it get’s clipped sometimes, but the component author is not going to get any heat from me, I’m thankful for the alternative solution any improvements are a bonus.

3 Likes

It’s exactly like this that I thought it was this again, it has popped up in various builds iirc Discourse jumps back 20 posts in post history when navigating to new topic

1 Like

Is there any way to minimize the jump? It’s really noticeable and annoying if there are multiple twitter links in the loaded page. I looked at the plugin code and took a quick glance at the API it’s using, would estimating the height of the content and using that to set a height on the blockquote element be helpful in reducing the jump, or is this all pretty much at the mercy of the twitter javascript that’s called async? I am not familiar with the discourse API so I don’t know the order things are rendered, etc, and don’t have time to pull that thread right now to determine if there’s any reasonable way to do this.

1 Like

This solution wasn’t enough for me so I’ll add a little something

We need to add something (really, anything random will do) in the twitter consumer key and twitter consumer secret

You probably still had your old api in place

Then the theme component will work again

2 Likes

I think I didn’t, but Twitter keeps changing the behavior of their software (even the result we get with a curl) very often. I wouldn’t be surprised if you had a different experience recently because of this.

2 Likes

For recap, are you using the theme component with consumer keys enabled and twitter.com in blocked oneboxed domains?

From what I remember, Twitter was in onebox blocked domains, and I didn’t use any Twitter credentials in my admin.
I didn’t try the component again since.

In the latest 3.6.0.beta6 update this has reverted to Onebox for twitter embeds again, and this is despite twitter.com being in the blocked_onebox_domains in settings.

The onebox domain blocks were enough in beta5 so whatever the latest update did this additional advice above worked to get the component rending tweets again.