discourse/app
Osama Sayegh e67670c1e4
FIX: Consistently show history modal when clicking edit notifications (#13912)
Currently when a user clicks on an edit notification, we use `appEvents` to
notify the topics controller that it should open up the history modal for the
edited post and the appEvents callback opens up the history modal in the next
Ember runloop (by scheduling an `afterRender` callback).

There are 2 problems with this implementation:

1) the callbacks are fired/executed too early and if the post has never been
loaded from the server (i.e. not in cache), we will not get a modal history
because the method that shows the modal `return`s if it can't find the post:

016efeadf6/app/assets/javascripts/discourse/app/controllers/topic.js (L145-L152)

2) when clicking an edit notification from a non-topic page, you're redirected
to the topic page that contains the edited post and you'll see the history
modal briefly and it'll be closed immediately. The reason for this is because
we attempt to show the history modal before the route transition finishes
completely, and we have cleanup code in `initializers/page-tracking.js` that's
called after every transition and it does several things one of which is
closing any open modals.

The fix in this commit defers showing the history modal until posts are loaded
(whether fresh or cached). It works by storing some bits of information (topic
id, post number, revision number) whenever the user clicks on an edit
notification, and when the user is redirected to the topic (or scrolled to the
edited post if they're already in the topic), the post stream model checks if
we have stored information of an edit notification and requests the history
modal to be shown by the topics controller.
2021-08-03 19:06:23 +03:00
..
assets FIX: Consistently show history modal when clicking edit notifications (#13912) 2021-08-03 19:06:23 +03:00
controllers FEATURE: New and Unread messages for user personal messages. (#13603) 2021-08-02 12:41:41 +08:00
helpers FIX: Assets for the theme tests page are not compressed (#13736) 2021-07-14 22:52:35 +03:00
jobs Revert "DEV: Move private message topic tracking state publish into sidekiq." 2021-07-30 11:36:01 +08:00
mailers UX: suspend forever time period messages (#13776) 2021-07-20 14:42:08 +04:00
models FEATURE: Add post edits count to user activity (#13495) 2021-08-02 10:15:53 -04:00
serializers FEATURE: Add post edits count to user activity (#13495) 2021-08-02 10:15:53 -04:00
services DEV: don't merge email address if target user is not human. (#13915) 2021-08-03 10:04:35 +05:30
views FIX: use correct URL in schema markup for post images. (#13847) 2021-07-26 21:39:51 +05:30