From 6b816f445d808500965bbe69d34afa3d31a1b8fc Mon Sep 17 00:00:00 2001 From: Arpit Jalan <arpit@techapj.com> Date: Mon, 11 May 2015 22:21:16 +0530 Subject: [PATCH] UX: show lock icon in user stream if topic is closed/archived --- .../javascripts/discourse/templates/user/stream.hbs | 1 + app/models/user_action.rb | 1 + app/serializers/user_action_serializer.rb | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/app/assets/javascripts/discourse/templates/user/stream.hbs b/app/assets/javascripts/discourse/templates/user/stream.hbs index ed66367d5..8955e5cdc 100644 --- a/app/assets/javascripts/discourse/templates/user/stream.hbs +++ b/app/assets/javascripts/discourse/templates/user/stream.hbs @@ -3,6 +3,7 @@ <div class='clearfix info'> <a href="{{unbound item.userUrl}}" data-user-card="{{unbound item.username}}" class='avatar-link'><div class='avatar-wrapper'>{{avatar item imageSize="large" extraClasses="actor" ignoreTitle="true"}}</div></a> <span class='time'>{{format-date item.created_at}}</span> + {{topic-status topic=item disableActions=true}} <span class="title"> <a href="{{unbound item.postUrl}}">{{unbound item.title}}</a> </span> diff --git a/app/models/user_action.rb b/app/models/user_action.rb index 0e979991c..0d4c661d1 100644 --- a/app/models/user_action.rb +++ b/app/models/user_action.rb @@ -142,6 +142,7 @@ SQL SELECT a.id, t.title, a.action_type, a.created_at, t.id topic_id, + t.closed AS topic_closed, t.archived AS topic_archived, a.user_id AS target_user_id, au.name AS target_name, au.username AS target_username, coalesce(p.post_number, 1) post_number, p.id as post_id, p.reply_to_post_number, diff --git a/app/serializers/user_action_serializer.rb b/app/serializers/user_action_serializer.rb index 503aabe62..ccf02e031 100644 --- a/app/serializers/user_action_serializer.rb +++ b/app/serializers/user_action_serializer.rb @@ -26,6 +26,8 @@ class UserActionSerializer < ApplicationSerializer :edit_reason, :category_id, :uploaded_avatar_id, + :closed, + :archived, :acting_uploaded_avatar_id def excerpt @@ -77,4 +79,12 @@ class UserActionSerializer < ApplicationSerializer object.action_type == UserAction::EDIT end + def closed + object.topic_closed + end + + def archived + object.topic_archived + end + end