Sorting topics by newest to oldest doesn't change data-index

  • So, I'm testing having new posts first, which doesn't work as expected. It assigns the posts in order as if they were the other way around, so the newest post is data-index:1 every time. This makes it impossible to link to a topic, as each new post would be tid/2. It also means that, when you click from a category "last replied 7 hours ago" for example, it takes you to the highest data-indexed post, which is the first post in the topic, at the bottom, when what you actually wanted was the most recent (so in most cases you go to completely the wrong post).

    I think that the data-index should work the same way as it does with oldest to newest, newest posts getting the higher ID, but they just display backwards. So first post in that topic is 1, but is displayed at the bottom.

    Or is it supposed to do that and it doesn't work? 🙂

  • NodeBB Admin

    Yeah this is a known problem, the current data-index assignment only works for oldest to newest.

  • Good stuff, least you're aware of it. 👍

  • NodeBB Admin

    Did plenty of work on this on the 0.5.1 branch here, here and here.

    Ended up refactoring and fixing notifications as well, since they were pointing to wrong posts if sorting was changed. One last thing to fix is the index in the url since changing the data-index causes it to go from highest to lowest 😆

  • @baris Is that last point what's causing this?!--

    Edit: And this: Which stops new posts displaying. 😞


    Both issues have turned up after a git pull. 🙂

  • NodeBB Admin

    Are you on master? The changes I made are on the 0.5.1 branch so they shouldn't effect you unless you switched to that branch. Try downgrading templates.js to 0.0.10 or 0.0.8 and see if it helps.

  • Yeah did a pull on master. Will try downgrading templates.

  • 0.0.8 solved it. Thanks.

Suggested Topics

| | |

© 2014 – 2022 NodeBB, Inc. — Made in Canada.