Color moderator actions on user stream

This commit is contained in:
Robin Ward 2013-07-18 17:24:51 -04:00
parent 257ddf5fc9
commit 7a6f1b5aff
5 changed files with 26 additions and 15 deletions

View File

@ -20,16 +20,18 @@ Discourse.UserActivityRoute = Discourse.Route.extend({
var composerController = this.controllerFor('composer'); var composerController = this.controllerFor('composer');
controller.set('model', user); controller.set('model', user);
Discourse.Draft.get('new_private_message').then(function(data) { if (Discourse.User.current()) {
if (data.draft) { Discourse.Draft.get('new_private_message').then(function(data) {
composerController.open({ if (data.draft) {
draft: data.draft, composerController.open({
draftKey: 'new_private_message', draft: data.draft,
ignoreIfChanged: true, draftKey: 'new_private_message',
draftSequence: data.draft_sequence ignoreIfChanged: true,
}); draftSequence: data.draft_sequence
} });
}); }
});
}
} }
}); });

View File

@ -1,6 +1,6 @@
<div id='user-stream'> <div id='user-stream'>
{{#each view.stream.content}} {{#each view.stream.content}}
<div {{bindAttr class=":item hidden deleted"}}> <div {{bindAttr class=":item hidden deleted moderator_action"}}>
<div class='clearfix info'> <div class='clearfix info'>
<a href="{{unbound userUrl}}" class='avatar-link'><div class='avatar-wrapper'>{{avatar this imageSize="large" extraClasses="actor" ignoreTitle="true"}}</div></a> <a href="{{unbound userUrl}}" class='avatar-link'><div class='avatar-wrapper'>{{avatar this imageSize="large" extraClasses="actor" ignoreTitle="true"}}</div></a>
<span class='time'>{{date path="created_at" leaveAgo="true"}}</span> <span class='time'>{{date path="created_at" leaveAgo="true"}}</span>

View File

@ -251,6 +251,9 @@
word-wrap: break-word; word-wrap: break-word;
color: lighten($black, 30%); color: lighten($black, 30%);
} }
.item.moderator-action {
background-color: #eef0ff;
}
.item.deleted { .item.deleted {
opacity: 0.8; opacity: 0.8;
background-color: #ffcece; background-color: #ffcece;

View File

@ -94,7 +94,8 @@ SELECT
u.email acting_email, u.username acting_username, u.name acting_name, u.id acting_user_id, u.email acting_email, u.username acting_username, u.name acting_name, u.id acting_user_id,
coalesce(p.cooked, p2.cooked) cooked, coalesce(p.cooked, p2.cooked) cooked,
CASE WHEN coalesce(p.deleted_at, p2.deleted_at, t.deleted_at) IS NULL THEN false ELSE true END deleted, CASE WHEN coalesce(p.deleted_at, p2.deleted_at, t.deleted_at) IS NULL THEN false ELSE true END deleted,
p.hidden p.hidden,
p.post_type
FROM user_actions as a FROM user_actions as a
JOIN topics t on t.id = a.target_topic_id JOIN topics t on t.id = a.target_topic_id
LEFT JOIN posts p on p.id = a.target_post_id LEFT JOIN posts p on p.id = a.target_post_id
@ -141,8 +142,8 @@ SELECT
pu.email acting_email, pu.username acting_username, pu.name acting_name, pu.id acting_user_id, pu.email acting_email, pu.username acting_username, pu.name acting_name, pu.id acting_user_id,
p.cooked, p.cooked,
CASE WHEN coalesce(p.deleted_at, t.deleted_at) IS NULL THEN false ELSE true END deleted, CASE WHEN coalesce(p.deleted_at, t.deleted_at) IS NULL THEN false ELSE true END deleted,
p.hidden p.hidden,
p.post_type
FROM topics t FROM topics t
JOIN posts p ON p.topic_id = t.id and p.post_number = t.highest_post_number JOIN posts p ON p.topic_id = t.id and p.post_number = t.highest_post_number
JOIN users pu ON pu.id = p.user_id JOIN users pu ON pu.id = p.user_id

View File

@ -20,7 +20,8 @@ class UserActionSerializer < ApplicationSerializer
:acting_user_id, :acting_user_id,
:title, :title,
:deleted, :deleted,
:hidden :hidden,
:moderator_action
def excerpt def excerpt
@ -39,4 +40,8 @@ class UserActionSerializer < ApplicationSerializer
Slug.for(object.title) Slug.for(object.title)
end end
def moderator_action
object.post_type == Post.types[:moderator_action]
end
end end