FIX: local post onebox was always pointing to 1st post

This commit is contained in:
Régis Hanol 2018-02-26 16:05:35 +01:00
parent ac701696b3
commit 3be0294465
3 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
<aside class='quote' data-post="1" data-topic="{{topic_id}}"> <aside class='quote' data-post="{{post_number}}" data-topic="{{topic_id}}">
<div class='title'> <div class='title'>
<div class='quote-controls'></div> <div class='quote-controls'></div>
{{{avatar}}} {{{avatar}}}

View File

@ -202,6 +202,7 @@ module Oneboxer
else else
args = { args = {
topic_id: topic.id, topic_id: topic.id,
post_number: post.post_number,
avatar: PrettyText.avatar_img(post.user.avatar_template, "tiny"), avatar: PrettyText.avatar_img(post.user.avatar_template, "tiny"),
original_url: url, original_url: url,
title: PrettyText.unescape_emoji(CGI::escapeHTML(topic.title)), title: PrettyText.unescape_emoji(CGI::escapeHTML(topic.title)),

View File

@ -54,6 +54,7 @@ describe Oneboxer do
onebox = preview(public_reply.url, user, public_category) onebox = preview(public_reply.url, user, public_category)
expect(onebox).to include(public_reply.excerpt) expect(onebox).to include(public_reply.excerpt)
expect(onebox).to include(%{data-post="2"})
expect(onebox).to include(PrettyText.avatar_img(replier.avatar_template, "tiny")) expect(onebox).to include(PrettyText.avatar_img(replier.avatar_template, "tiny"))
onebox = preview(public_reply.url, user, public_category, public_topic) onebox = preview(public_reply.url, user, public_category, public_topic)