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');
controller.set('model', user);
Discourse.Draft.get('new_private_message').then(function(data) {
if (data.draft) {
composerController.open({
draft: data.draft,
draftKey: 'new_private_message',
ignoreIfChanged: true,
draftSequence: data.draft_sequence
});
}
});
if (Discourse.User.current()) {
Discourse.Draft.get('new_private_message').then(function(data) {
if (data.draft) {
composerController.open({
draft: data.draft,
draftKey: 'new_private_message',
ignoreIfChanged: true,
draftSequence: data.draft_sequence
});
}
});
}
}
});

View File

@ -1,6 +1,6 @@
<div id='user-stream'>
{{#each view.stream.content}}
<div {{bindAttr class=":item hidden deleted"}}>
<div {{bindAttr class=":item hidden deleted moderator_action"}}>
<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>
<span class='time'>{{date path="created_at" leaveAgo="true"}}</span>

View File

@ -251,6 +251,9 @@
word-wrap: break-word;
color: lighten($black, 30%);
}
.item.moderator-action {
background-color: #eef0ff;
}
.item.deleted {
opacity: 0.8;
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,
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,
p.hidden
p.hidden,
p.post_type
FROM user_actions as a
JOIN topics t on t.id = a.target_topic_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,
p.cooked,
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
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

View File

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