Not a Bug Editing first post of a page makes it disappear

#1
I don't know why I feel I have seen this somewhere, but couldn't find it in this section. Hence I am reporting it.

This issue does not happen in default style, it happens only with EDGE.

When I have a Google Ad Unit in the "ad_message_after" template, editing the first post of a page (any page of a thread) makes it (the first post) disappear. A loading sign appears continuously at the top-right corner, as if it is trying to load something but fails to do so. Also it results the following error in the console.

upload_2017-2-10_11-5-46.png

ad_message_after:
Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0">
<li class="message">
    <div>
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="XXXXXXXXXXXXXXXXX"
         data-ad-slot="XXXXXXXXXXXXXXXXX"
         data-ad-format="auto"></ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>
</li>
</xen:if>
 

Russ

Pixel Exit Staff
#2
If you place that code in the default style after the last line </li> does it reproduce the error then as well?
 
#3
If you place that code in the default style after the last line </li> does it reproduce the error then as well?
Sorry, I didn't get it properly. Can you please elaborate what should I test?

The default style does not produce the error at its current state. I also have the similar code at ad_thread_view_below_messages (so the Ad appears between the last post and quick reply block) without any issue.
 

Russ

Pixel Exit Staff
#4
Essentially can you take that exact code you posted, and try it on the default style. Paste it inside the message template after the very last line. See if that replicates it.
 
#5
Oh sorry, silly me. The same error also happens in default style after pasting the same code in message template (I don't know what I was thinking before to check in default style without pasting the code!!!).

Just for your information, below is what happens when I edit first post.

Before Edit:
  • First <LI> is the message,
  • 2nd <LI> is the one that contains Google Adsense.
upload_2017-2-11_19-21-22.png


After Edit:
  • 1st <LI> is hidden message - display:hidden
  • 2nd <LI>: don't know what, empty - display:hidden
  • 3rd <LI>: Google Adsense.
upload_2017-2-11_19-20-26.png
 
#6
Some more relevant update:

If I put a normal DIV inside ad_message_after
Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0">
<li class="message">Test</li>
</xen:if>
, then editing first post duplicates the Test block above (but don't hide the first page).
 

Russ

Pixel Exit Staff
#7
Alright... so to be honest I'm not exactly sure why it would be doing it. If you use just basic text it doesn't reproduce it, when I'm back Monday I can post on the official XF forums for some help. Essentially the question would be how to add the message after that <li> in message template without it duplicating.

Technically it's a visual glitch, it goes away upon refresh but still annoying.
 
#8
Technically it's a visual glitch, it goes away upon refresh but still annoying.
Yup right, it is a visual glitch. But it can make user confused. I am not concern about editing first post (as I have editing disabled for members) but same thing happens (from my memory, I've to recheck again though) when a new post makes a new page.
 

Russ

Pixel Exit Staff
#11
Can you try this conditional:

Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0 AND {$firstPost}">
See if that works for you.
 

Pre-Sale Questions

If you have any questions or concerns you want to ask before you make a purchase don't hesitate to use one of our multiple support channels for your convenience.