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/components/reviewable-flagged-post.js.es6
2019-05-03 16:36:37 -04:00

34 lines
1.0 KiB
JavaScript

import computed from "ember-addons/ember-computed-decorators";
import { longDate } from "discourse/lib/formatter";
import { historyHeat } from "discourse/widgets/post-edits-indicator";
import showModal from "discourse/lib/show-modal";
export default Ember.Component.extend({
hasEdits: Ember.computed.gt("reviewable.post_version", 1),
@computed("reviewable.post_updated_at")
historyClass(updatedAt) {
return historyHeat(this.siteSettings, new Date(updatedAt));
},
@computed("reviewable.post_updated_at")
editedDate(updatedAt) {
return longDate(updatedAt);
},
actions: {
showEditHistory() {
let postId = this.get("reviewable.post_id");
this.store.find("post", postId).then(post => {
let historyController = showModal("history", {
model: post,
modalClass: "history-modal"
});
historyController.refresh(postId, "latest");
historyController.set("post", post);
historyController.set("topicController", null);
});
}
}
});