FIX: Small actions should show descriptions on the user stream

This commit is contained in:
Robin Ward
2015-07-31 14:22:28 -04:00
parent d71301e406
commit cf91bca0cd
12 changed files with 110 additions and 74 deletions

View File

@@ -154,6 +154,7 @@ SQL
CASE WHEN coalesce(p.deleted_at, p2.deleted_at, t.deleted_at) IS NULL THEN false ELSE true END deleted,
p.hidden,
p.post_type,
p.action_code,
p.edit_reason,
t.category_id
FROM user_actions as a

View File

@@ -29,11 +29,11 @@ class UserActionObserver < ActiveRecord::Observer
return unless action && post && user && post.id
row = {
action_type: action,
user_id: user.id,
acting_user_id: acting_user_id || post.user_id,
target_topic_id: post.topic_id,
target_post_id: post.id
action_type: action,
user_id: user.id,
acting_user_id: acting_user_id || post.user_id,
target_topic_id: post.topic_id,
target_post_id: post.id
}
if post.deleted_at.nil?
@@ -48,12 +48,12 @@ class UserActionObserver < ActiveRecord::Observer
return if model.is_first_post?
row = {
action_type: UserAction::REPLY,
user_id: model.user_id,
acting_user_id: model.user_id,
target_post_id: model.id,
target_topic_id: model.topic_id,
created_at: model.created_at
action_type: UserAction::REPLY,
user_id: model.user_id,
acting_user_id: model.user_id,
target_post_id: model.id,
target_topic_id: model.topic_id,
created_at: model.created_at
}
rows = [row]
@@ -79,12 +79,12 @@ class UserActionObserver < ActiveRecord::Observer
def log_topic(model)
row = {
action_type: model.archetype == Archetype.private_message ? UserAction::NEW_PRIVATE_MESSAGE : UserAction::NEW_TOPIC,
user_id: model.user_id,
acting_user_id: model.user_id,
target_topic_id: model.id,
target_post_id: -1,
created_at: model.created_at
action_type: model.archetype == Archetype.private_message ? UserAction::NEW_PRIVATE_MESSAGE : UserAction::NEW_TOPIC,
user_id: model.user_id,
acting_user_id: model.user_id,
target_topic_id: model.id,
target_post_id: -1,
created_at: model.created_at
}
rows = [row]