diff --git a/app/assets/javascripts/discourse/components/stream-item.js.es6 b/app/assets/javascripts/discourse/components/stream-item.js.es6 index 26d1e6f8e5a..72b494821ce 100644 --- a/app/assets/javascripts/discourse/components/stream-item.js.es6 +++ b/app/assets/javascripts/discourse/components/stream-item.js.es6 @@ -1,8 +1,20 @@ import { propertyEqual } from 'discourse/lib/computed'; import { actionDescription } from "discourse/components/small-action"; +import { ajax } from 'discourse/lib/ajax'; export default Ember.Component.extend({ classNameBindings: [":item", "item.hidden", "item.deleted:deleted", "moderatorAction"], moderatorAction: propertyEqual("item.post_type", "site.post_types.moderator_action"), actionDescription: actionDescription("item.action_code", "item.created_at", "item.username"), + + actions: { + expandItem() { + const item = this.get('item'); + + return ajax(`/posts/${item.get('post_id')}/cooked.json`).then(result => { + item.set('truncated', false); + item.set('excerpt', result.cooked); + }); + } + } }); diff --git a/app/assets/javascripts/discourse/templates/components/stream-item.hbs b/app/assets/javascripts/discourse/templates/components/stream-item.hbs index bb321a9ef35..71c2bb9e333 100644 --- a/app/assets/javascripts/discourse/templates/components/stream-item.hbs +++ b/app/assets/javascripts/discourse/templates/components/stream-item.hbs @@ -1,11 +1,17 @@
{{avatar item imageSize="large" extraClasses="actor" ignoreTitle="true"}}
{{format-date item.created_at}} + {{#if item.truncated}} + + {{fa-icon "chevron-down"}} + + {{/if}} {{topic-status topic=item disableActions=true}} {{{item.title}}}
{{category-link item.category}}
+ {{#if item.deleted_by}} {{fa-icon "trash-o"}} diff --git a/app/assets/stylesheets/common/base/user.scss b/app/assets/stylesheets/common/base/user.scss index 365fc9a3c83..31d2402e789 100644 --- a/app/assets/stylesheets/common/base/user.scss +++ b/app/assets/stylesheets/common/base/user.scss @@ -12,6 +12,12 @@ .avatar-link { margin-right: 3px; } + +} +.user-stream .item .expand-item { + float: right; + margin-right: 0.5em; + color: $primary; } .user-main { diff --git a/app/assets/stylesheets/desktop/user.scss b/app/assets/stylesheets/desktop/user.scss index f22c226d5ce..db7302369ea 100644 --- a/app/assets/stylesheets/desktop/user.scss +++ b/app/assets/stylesheets/desktop/user.scss @@ -1,5 +1,4 @@ // styles that apply to the user page - .groups { .group-link { color: $tertiary; diff --git a/app/serializers/admin_user_action_serializer.rb b/app/serializers/admin_user_action_serializer.rb index 606e4fed324..6d776de23dc 100644 --- a/app/serializers/admin_user_action_serializer.rb +++ b/app/serializers/admin_user_action_serializer.rb @@ -4,6 +4,7 @@ class AdminUserActionSerializer < ApplicationSerializer :id, :created_at, :post_number, + :post_id, :name, :username, :avatar_template, @@ -11,6 +12,7 @@ class AdminUserActionSerializer < ApplicationSerializer :slug, :title, :category_id, + :truncated, :excerpt, :hidden, :moderator_action, @@ -21,6 +23,18 @@ class AdminUserActionSerializer < ApplicationSerializer :action_type ) + def truncated + true + end + + def post_id + object.id + end + + def include_truncated? + object.excerpt != object.cooked + end + def deleted deleted_at.present? end diff --git a/app/serializers/user_action_serializer.rb b/app/serializers/user_action_serializer.rb index 01de8083d67..2db30ca9077 100644 --- a/app/serializers/user_action_serializer.rb +++ b/app/serializers/user_action_serializer.rb @@ -44,7 +44,7 @@ class UserActionSerializer < ApplicationSerializer end def include_truncated? - excerpt != cooked + cooked.length > 300 end def avatar_template