mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 18:42:45 +08:00
FIX: Disable the previous revision button if it is the last revision (#22784)
We introduced a tiny bug #22522. When viewing the last revision of a post, we need to disable the ⏪ button. This fixes the issue.
This commit is contained in:
parent
ad9ad55870
commit
1ab1116cda
|
@ -45,6 +45,7 @@ export default class History extends Component {
|
|||
get loadPreviousDisabled() {
|
||||
return (
|
||||
this.loading ||
|
||||
!this.postRevision.previous_revision ||
|
||||
(!this.postRevision.previous_revision &&
|
||||
this.postRevision.current_revision <=
|
||||
this.postRevision.previous_revision)
|
||||
|
|
|
@ -47,7 +47,11 @@ acceptance("History Modal - authorized", function (needs) {
|
|||
});
|
||||
|
||||
server.get("/posts/419/revisions/1.json", () => {
|
||||
return helper.response({ ...revisionResponse, current_revision: 1 });
|
||||
return helper.response({
|
||||
...revisionResponse,
|
||||
current_revision: 1,
|
||||
previous_revision: null,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -69,6 +73,15 @@ acceptance("History Modal - authorized", function (needs) {
|
|||
"hides the edit post button when not on the latest revision"
|
||||
);
|
||||
});
|
||||
|
||||
test("previous revision button", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("article[data-post-id='419'] .edits button");
|
||||
|
||||
await click(".history-modal .previous-revision");
|
||||
|
||||
assert.dom(".history-modal .previous-revision").isDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
acceptance("History Modal - anonymous", function (needs) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user