mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FEATURE: add the pencil glyph when the post was edited after the first flag
This commit is contained in:
parent
d273374f1a
commit
9f72971d26
5 changed files with 19 additions and 3 deletions
|
@ -46,6 +46,14 @@ Discourse.FlaggedPost = Discourse.Post.extend({
|
||||||
return "<i class='fa " + icon + "' title='" + title + "'></i>";
|
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 () {
|
conversations: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
var conversations = [];
|
var conversations = [];
|
||||||
|
@ -142,7 +150,7 @@ Discourse.FlaggedPost.reopenClass({
|
||||||
return Discourse.ajax('/admin/flags/' + filter + '.json?offset=' + offset).then(function (data) {
|
return Discourse.ajax('/admin/flags/' + filter + '.json?offset=' + offset).then(function (data) {
|
||||||
// users
|
// users
|
||||||
var userLookup = {};
|
var userLookup = {};
|
||||||
_.each(data.users,function (user) {
|
_.each(data.users, function (user) {
|
||||||
userLookup[user.id] = Discourse.AdminUser.create(user);
|
userLookup[user.id] = Discourse.AdminUser.create(user);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -153,7 +161,7 @@ Discourse.FlaggedPost.reopenClass({
|
||||||
});
|
});
|
||||||
|
|
||||||
// posts
|
// posts
|
||||||
_.each(data.posts,function (post) {
|
_.each(data.posts, function (post) {
|
||||||
var f = Discourse.FlaggedPost.create(post);
|
var f = Discourse.FlaggedPost.create(post);
|
||||||
f.userLookup = userLookup;
|
f.userLookup = userLookup;
|
||||||
f.topicLookup = topicLookup;
|
f.topicLookup = topicLookup;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
{{#if flaggedPost.postAuthorFlagged}}
|
{{#if flaggedPost.postAuthorFlagged}}
|
||||||
{{#if flaggedPost.user}}
|
{{#if flaggedPost.user}}
|
||||||
{{#link-to 'adminUser' flaggedPost.user}}{{avatar flaggedPost.user imageSize="small"}}{{/link-to}}
|
{{#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}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -504,6 +504,7 @@ section.details {
|
||||||
.user {
|
.user {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
padding: 8px 0 0 0;
|
padding: 8px 0 0 0;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
.excerpt {
|
.excerpt {
|
||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
|
|
|
@ -1512,6 +1512,7 @@ en:
|
||||||
no_results: "There are no flags."
|
no_results: "There are no flags."
|
||||||
topic_flagged: "This <strong>topic</strong> has been flagged."
|
topic_flagged: "This <strong>topic</strong> has been flagged."
|
||||||
visit_topic: "Visit the topic to take action"
|
visit_topic: "Visit the topic to take action"
|
||||||
|
was_edited: "Post was edited after the first flag"
|
||||||
|
|
||||||
summary:
|
summary:
|
||||||
action_type_3:
|
action_type_3:
|
||||||
|
|
|
@ -25,7 +25,12 @@ module FlagQuery
|
||||||
p.topic_id,
|
p.topic_id,
|
||||||
p.post_number,
|
p.post_number,
|
||||||
p.hidden,
|
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
|
FROM posts p
|
||||||
WHERE p.id in (:post_ids)").map_exec(OpenStruct, post_ids: post_ids)
|
WHERE p.id in (:post_ids)").map_exec(OpenStruct, post_ids: post_ids)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue