Core: [sticky] New post injected above unread sticky

Created on 17 Feb 2019  路  12Comments  路  Source: flarum/core

Bug Report

  1. create a post with admin
  2. sticky the post
  3. login with a normal user account

The unread sticky post is on top, don't open it!

  1. Create a post as user than publish it

The user post will be over the sticky post. This seems to happen because maybe new post are added by Javascript that are not requiring the updated list with API.

Expected Behavior
Also on new user post the sticky post should stay on top not take second, third, etc, ... line... the sticky post is unread so should stay on top. This happen only if the page is refreshed.

Screenshots

00

The following screen has been provided by Matteo (other tester)

01

Environment

  • Flarum version: 0.1.0-beta.8.1
  • Website URL: https://community.peopleinside.it/
  • Webserver: [e.g. apache, nginx] Apache
  • Hosting environment: [e.g. shared, vps] VPS
  • PHP version: 7.3
  • Browser: [e.g. chrome 67, safari 11] Firefox
`Loaded extensions: Core, date, libxml, pcre, dom, fileinfo, filter, hash, json, SPL, bz2, posix, Reflection, session, SimpleXML, standard, xml, xmlreader, xmlwriter, bcmath, openssl, calendar, ctype, curl, dba, mbstring, ftp, gd, gettext, gmp, iconv, imap, intl, ldap, exif, zlib, pcntl, PDO, pdo_sqlite, shmop, soap, sockets, sqlite3, sysvsem, sysvshm, tidy, tokenizer, wddx, xmlrpc, xsl, zip, Phar, mysqlnd, mysqli, pdo_mysql, ionCube Loader, Zend OPcache
+------------------------------+-----------------+--------+
| Flarum Extensions | | |
+------------------------------+-----------------+--------+
| ID | Version | Commit |
+------------------------------+-----------------+--------+
| flarum-approval | v0.1.0-beta.8 | |
| flarum-bbcode | v0.1.0-beta.8 | |
| flarum-emoji | v0.1.0-beta.8 | |
| flarum-flags | v0.1.0-beta.8.1 | |
| flarum-likes | v0.1.0-beta.8.1 | |
| flarum-lock | v0.1.0-beta.8 | |
| flarum-mentions | v0.1.0-beta.8.1 | |
| flarum-sticky | v0.1.0-beta.8 | |
| flarum-subscriptions | v0.1.0-beta.8 | |
| flarum-suspend | v0.1.0-beta.8 | |
| flarum-tags | v0.1.0-beta.8.2 | |
| flarum-lang-english | v0.1.0-beta.8 | |
| flarum-statistics | v0.1.0-beta.8 | |
| flarum-akismet | v0.1.0-beta.8 | |
| nearata-lang-italian | v0.1.0-beta.8.2 | |
| flarum-auth-facebook | v0.1.0-beta.8 | |
| flagrow-terms | 0.3.1 | |
| fof-links | 0.1.1 | |
| flarum-auth-github | v0.1.0-beta.8 | |
| fof-user-bio | 0.1.1 | |
| flarum-pusher | v0.1.0-beta.8.1 | |
| reflar-twofactor | 0.1.0-beta.4.2 | |
| flarum-auth-twitter | v0.1.0-beta.8 | |
| flagrow-upload | 0.7.0 | |
| flarum-markdown | v0.1.0-beta.8 | |
| fof-default-user-preferences | 0.1.0 | |
+------------------------------+-----------------+--------+
Base URL: https://community.peopleinside.it
Debug mode: off`

Possible Solution
Maybe use request discussion updated list using API.

Additional Context
Add any other context about the problem here.

Thanks to Matteo that helped me to figure out this issue in my try to do super sticky

Good first issue typbug

Most helpful comment

The pusher extension needs some love anyway :P

All 12 comments

The pusher extension needs some love anyway :P

@PeopleInside Can you reproduce this issue when the Pusher extension is disabled?

Hi @franzliedke . I disabled pusher extension than cleared cache.
Logged in as normal user and created a post. The post is again up to the sticky post so

yes, i am able to reproduce with pusher disabled.

But if you refresh the page, the order resets back to normal right? It's just an issue immediately after the new discussion is created?

Correct

So the fix would basically be forcing a refresh of the discussion list (by clearing the discussion list cache) after you create a new discussion, instead of prepending the new one onto the top.

I just noticed the same behaviour on https://meta.discourse.org/ when a new post appears (similar to our pusher integration). It appears above the sticky discussion as well. After refreshing the page, the post is back at the intended place below the pinned post. Looks like they didn't bother sorting the list on the client side or refreshing the full list either :upside_down_face:

Just tested this, looks like when I use my admin to create a new post after I created a sticky post it also goes up top, even after a refresh

image

@tom-it that's the intended behaviour, sticky discussions with no unread posts aren't kept at the top

@tom-it that's the intended behaviour, sticky discussions with no unread posts aren't kept at the top

ah ok, roger that thanks :-)

then i'll take care of this one today

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ardacebi picture ardacebi  路  4Comments

clrh picture clrh  路  4Comments

luceos picture luceos  路  4Comments

jordanjay29 picture jordanjay29  路  3Comments

tobyzerner picture tobyzerner  路  4Comments