mirror of
https://github.com/discourse/discourse.git
synced 2026-07-29 15:54:48 -05:00
Move deleted at into actions history, where it should be.
This commit is contained in:
@@ -25,6 +25,7 @@ Discourse.Post = Discourse.Model.extend({
|
||||
// Posts can show up as deleted if the topic is deleted
|
||||
deletedViaTopic: Em.computed.and('firstPost', 'topic.deleted_at'),
|
||||
deleted: Em.computed.or('deleted_at', 'deletedViaTopic'),
|
||||
notDeleted: Em.computed.not('deleted'),
|
||||
|
||||
postDeletedBy: function() {
|
||||
if (this.get('firstPost')) { return this.get('topic.deleted_by'); }
|
||||
|
||||
@@ -53,14 +53,7 @@
|
||||
{{view Discourse.PostMenuView postBinding="this" postViewBinding="view"}}
|
||||
</div>
|
||||
{{view Discourse.RepliesView contentBinding="replies" postViewBinding="view"}}
|
||||
{{view Discourse.ActionsHistoryView contentBinding="actionsHistory"}}
|
||||
|
||||
{{#if deleted}}
|
||||
<div class='post-actions'>
|
||||
{{i18n post.deleted_by}} {{avatar postDeletedBy imageSize="tiny"}} {{unboundAge postDeletedAt}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{view Discourse.ActionsHistoryView postBinding="this"}}
|
||||
{{view Discourse.TopicSummaryView postBinding="this"}}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -10,13 +10,19 @@
|
||||
Discourse.ActionsHistoryView = Discourse.View.extend({
|
||||
tagName: 'section',
|
||||
classNameBindings: [':post-actions', 'hidden'],
|
||||
hidden: Em.computed.empty('content'),
|
||||
shouldRerender: Discourse.View.renderIfChanged('content.@each', 'content.users.length'),
|
||||
content: Em.computed.alias('post.actionsHistory'),
|
||||
noContent: Em.computed.empty('content'),
|
||||
hidden: Em.computed.and('noContent', 'post.notDeleted'),
|
||||
shouldRerender: Discourse.View.renderIfChanged('content.@each', 'content.users.length', 'post.deleted'),
|
||||
|
||||
// This was creating way too many bound ifs and subviews in the handlebars version.
|
||||
render: function(buffer) {
|
||||
if (!this.present('content')) return;
|
||||
|
||||
var renderAvatar = function() {
|
||||
|
||||
}
|
||||
|
||||
if (this.present('content')) {
|
||||
this.get('content').forEach(function(c) {
|
||||
buffer.push("<div class='post-action'>");
|
||||
|
||||
@@ -55,6 +61,16 @@ Discourse.ActionsHistoryView = Discourse.View.extend({
|
||||
|
||||
buffer.push("</div>");
|
||||
});
|
||||
}
|
||||
|
||||
var post = this.get('post');
|
||||
if (post.get('deleted')) {
|
||||
buffer.push("<div class='post-action'>" +
|
||||
I18n.t("post.deleted_by") + " " +
|
||||
Discourse.Utilities.tinyAvatar(post.get('postDeletedBy.username')) +
|
||||
Discourse.Formatter.autoUpdatingRelativeAge(new Date(post.get('postDeletedAt'))) +
|
||||
"</div>");
|
||||
}
|
||||
},
|
||||
|
||||
actionTypeById: function(actionTypeId) {
|
||||
@@ -77,12 +93,12 @@ Discourse.ActionsHistoryView = Discourse.View.extend({
|
||||
}
|
||||
|
||||
if (actionTypeId = $target.data('act')) {
|
||||
this.content.findProperty('id', actionTypeId).act();
|
||||
this.get('content').findProperty('id', actionTypeId).act();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (actionTypeId = $target.data('undo')) {
|
||||
this.content.findProperty('id', actionTypeId).undo();
|
||||
this.get('content').findProperty('id', actionTypeId).undo();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user