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

Discussion in 'Closed Reports' started by abdfahim, Feb 9, 2017.

  1. abdfahim

    abdfahim Customer

    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:
    Copy Source
    <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>
     
  2. Russ

    Russ Designer

    If you place that code in the default style after the last line </li> does it reproduce the error then as well?
     
  3. abdfahim

    abdfahim Customer

    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.
     
  4. Russ

    Russ Designer

    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. abdfahim

    abdfahim Customer

    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. abdfahim

    abdfahim Customer

    Some more relevant update:

    If I put a normal DIV inside ad_message_after
    Code:
    Copy Source
    <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).
     
  7. Russ

    Russ Designer

    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.
     
    abdfahim likes this.
  8. abdfahim

    abdfahim Customer

    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.
     
  9. abdfahim

    abdfahim Customer

    Hi,

    Is there any solution for this case?

    Thanks,
     
  10. Russ

    Russ Designer

  11. Russ

    Russ Designer

    Can you try this conditional:

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

    abdfahim Customer

    Perfect ! Though I have no idea what that means :p.
     

Let's work together on your next project

Contact us today to talk about how we can help you