Jump to content

No-JS fallback for time in quote header (Also affects API)


TSP

Recommended Posts

I discovered something while investigating an issue. 

When a post with a quote is submitted to the database it stores it like this: 
 

<blockquote class="ipsQuote" data-gramm="false" data-ipsquote="" data-ipsquote-contentapp="forums" data-ipsquote-contentclass="forums_Topic" data-ipsquote-contentcommentid="25160025" data-ipsquote-contentid="1840499" data-ipsquote-contenttype="forums" data-ipsquote-timestamp="1573983633" data-ipsquote-userid="58981" data-ipsquote-username="TSP">
        <div class="ipsQuote_citation">
                TSP skrev (Akkurat nå):
        </div>

        <div class="ipsQuote_contents ipsClearfix" data-gramm="false">
                <p>
                        Kult!
                </p>
        </div>
</blockquote>

<p>
        Du er kul!
</p>`

 

Note what's within ipsQuote_citation. ("Akkurat nå" == "Just now")

You store the relative time as it was in the users browser when they generated the quote. The string is for the same reason also stored according to their current language settings. 

On display in the community you fix this all up with Javascript by using the data-attributes. 

However, I would argue you should replace it on storage with a non-relative time, and also use the default language of the community for it.

Changing this could provide a better experience for people with javascript disabled and developers utilizing the REST API.

Link to comment
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...