This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse
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
..
app FIX: Consistently show history modal when clicking edit notifications (#13912) 2021-08-03 19:06:23 +03:00
config FIX: ember-cli proxy subfolder fix (#12996) 2021-05-10 10:02:33 -07:00
lib FIX: allows authentication data to be present in bootstrap (#13885) 2021-07-29 15:01:11 +02:00
public/assets/scripts DEV: Allow plugin tests to run in Ember CLI qunit 2021-06-24 10:13:35 -04:00
tests FIX: Consistently show history modal when clicking edit notifications (#13912) 2021-08-03 19:06:23 +03:00
.ember-cli REFACTOR: Sync up master with changes for Ember-CLI (#11671) 2021-01-12 10:13:21 -05:00
ember-cli-build.js DEV: Allow plugin tests to run in Ember CLI qunit 2021-06-24 10:13:35 -04:00
package.json FEATURE: Uppy image uploader with UppyUploadMixin (#13656) 2021-07-13 12:22:00 +10:00
testem.js FIX: Use the no-sandbox flag when running Ember CLI tests. (#12951) 2021-05-05 14:02:26 -03:00