DEV: Add loading spinner to history modal (#22666)

https://github.com/discourse/discourse/assets/50783505/b5f510a8-719c-461c-a02f-a8b3a8573466
This commit is contained in:
Isaac Janzen 2023-07-18 12:30:27 -05:00 committed by GitHub
parent d258bda2fe
commit 6ba8259918
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 29 deletions

View File

@ -4,33 +4,35 @@
class="history-modal" class="history-modal"
> >
<:body> <:body>
<Modal::History::Revision <ConditionalLoadingSpinner @condition={{this.loading}}>
@model={{this.postRevision}} <Modal::History::Revision
@mobileView={{this.site.mobileView}} @model={{this.postRevision}}
@wikiDisabled={{this.wikiDisabled}} @mobileView={{this.site.mobileView}}
@previousCategory={{this.previousCategory}} @wikiDisabled={{this.wikiDisabled}}
@currentCategory={{this.currentCategory}} @previousCategory={{this.previousCategory}}
@displayInline={{this.displayInline}} @currentCategory={{this.currentCategory}}
@displaySideBySide={{this.displaySideBySide}} @displayInline={{this.displayInline}}
@displaySideBySideMarkdown={{this.displaySideBySideMarkdown}} @displaySideBySide={{this.displaySideBySide}}
@viewMode={{this.viewMode}} @displaySideBySideMarkdown={{this.displaySideBySideMarkdown}}
/> @viewMode={{this.viewMode}}
<Modal::History::Revisions />
@model={{this.postRevision}} <Modal::History::Revisions
@hiddenClasses={{this.hiddenClasses}} @model={{this.postRevision}}
@mobileView={{this.site.mobileView}} @hiddenClasses={{this.hiddenClasses}}
@userChanges={{this.user_changes}} @mobileView={{this.site.mobileView}}
@wikiDisabled={{this.wikiDisabled}} @userChanges={{this.user_changes}}
@postTypeDisabled={{this.postTypeDisabled}} @wikiDisabled={{this.wikiDisabled}}
@previousCategory={{this.previousCategory}} @postTypeDisabled={{this.postTypeDisabled}}
@currentCategory={{this.currentCategory}} @previousCategory={{this.previousCategory}}
@previousTagChanges={{this.previousTagChanges}} @currentCategory={{this.currentCategory}}
@currentTagChanges={{this.currentTagChanges}} @previousTagChanges={{this.previousTagChanges}}
@bodyDiffHTML={{this.bodyDiffHTML}} @currentTagChanges={{this.currentTagChanges}}
@bodyDiff={{this.bodyDiff}} @bodyDiffHTML={{this.bodyDiffHTML}}
@calculateBodyDiff={{this.calculateBodyDiff}} @bodyDiff={{this.bodyDiff}}
@titleDiff={{this.titleDiff}} @calculateBodyDiff={{this.calculateBodyDiff}}
/> @titleDiff={{this.titleDiff}}
/>
</ConditionalLoadingSpinner>
</:body> </:body>
<:footer> <:footer>
{{#if @model.editPost}} {{#if @model.editPost}}

View File

@ -168,8 +168,8 @@ export default class History extends Component {
refresh(postId, postVersion) { refresh(postId, postVersion) {
this.loading = true; this.loading = true;
Post.loadRevision(postId, postVersion).then((result) => { Post.loadRevision(postId, postVersion).then((result) => {
this.loading = false;
this.postRevision = result; this.postRevision = result;
this.loading = false;
}); });
} }

View File

@ -68,6 +68,7 @@
<LinksRedirect <LinksRedirect
@class="row body-diff" @class="row body-diff"
{{did-insert @calculateBodyDiff @bodyDiffHTML}}
{{did-update @calculateBodyDiff @bodyDiffHTML}} {{did-update @calculateBodyDiff @bodyDiffHTML}}
> >
{{html-safe @bodyDiff}} {{html-safe @bodyDiff}}

View File

@ -42,7 +42,6 @@ acceptance("Edit Notification Click", function (needs) {
await visit("/"); await visit("/");
await click(".header-dropdown-toggle.current-user"); await click(".header-dropdown-toggle.current-user");
await click(".notification.edited a"); await click(".notification.edited a");
const [v1, v2] = queryAll(".history-modal .revision-content"); const [v1, v2] = queryAll(".history-modal .revision-content");
assert.strictEqual( assert.strictEqual(