FEATURE: add the pencil glyph when the post was edited after the first flag

This commit is contained in:
Régis Hanol 2014-08-18 18:56:39 +02:00
parent d273374f1a
commit 9f72971d26
5 changed files with 19 additions and 3 deletions

View File

@ -46,6 +46,14 @@ Discourse.FlaggedPost = Discourse.Post.extend({
return "<i class='fa " + icon + "' title='" + title + "'></i>";
},
wasEdited: function () {
if (this.blank("last_revised_at")) { return false; }
var lastRevisedAt = Date.parse(this.get("last_revised_at"));
return _.some(this.get("post_actions"), function (postAction) {
return Date.parse(postAction.created_at) < lastRevisedAt;
});
}.property("last_revised_at", "post_actions.@each.created_at"),
conversations: function () {
var self = this;
var conversations = [];
@ -142,7 +150,7 @@ Discourse.FlaggedPost.reopenClass({
return Discourse.ajax('/admin/flags/' + filter + '.json?offset=' + offset).then(function (data) {
// users
var userLookup = {};
_.each(data.users,function (user) {
_.each(data.users, function (user) {
userLookup[user.id] = Discourse.AdminUser.create(user);
});
@ -153,7 +161,7 @@ Discourse.FlaggedPost.reopenClass({
});
// posts
_.each(data.posts,function (post) {
_.each(data.posts, function (post) {
var f = Discourse.FlaggedPost.create(post);
f.userLookup = userLookup;
f.topicLookup = topicLookup;

View File

@ -29,6 +29,7 @@
{{#if flaggedPost.postAuthorFlagged}}
{{#if flaggedPost.user}}
{{#link-to 'adminUser' flaggedPost.user}}{{avatar flaggedPost.user imageSize="small"}}{{/link-to}}
{{#if flaggedPost.wasEdited}}<i class="fa fa-pencil" title="{{i18n admin.flags.was_edited}}"></i>{{/if}}
{{/if}}
{{/if}}
</td>

View File

@ -504,6 +504,7 @@ section.details {
.user {
width: 20px;
padding: 8px 0 0 0;
text-align: center;
}
.excerpt {
max-width: 700px;

View File

@ -1512,6 +1512,7 @@ en:
no_results: "There are no flags."
topic_flagged: "This <strong>topic</strong> has been flagged."
visit_topic: "Visit the topic to take action"
was_edited: "Post was edited after the first flag"
summary:
action_type_3:

View File

@ -25,7 +25,12 @@ module FlagQuery
p.topic_id,
p.post_number,
p.hidden,
p.deleted_at
p.deleted_at,
(SELECT pr.created_at
FROM post_revisions pr
WHERE pr.post_id = p.id AND pr.user_id = p.user_id
ORDER BY created_at DESC
LIMIT 1) AS last_revised_at
FROM posts p
WHERE p.id in (:post_ids)").map_exec(OpenStruct, post_ids: post_ids)