From 2738d11f60164ce7144a138c68143bcaf13a69f0 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Fri, 21 Jun 2019 20:47:32 +0530 Subject: [PATCH] UX: show like icon on archived posts (#7775) --- .../javascripts/discourse/widgets/post-menu.js.es6 | 10 ++++++++-- app/assets/stylesheets/desktop/topic-post.scss | 5 +++-- app/assets/stylesheets/mobile/topic-post.scss | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/widgets/post-menu.js.es6 b/app/assets/javascripts/discourse/widgets/post-menu.js.es6 index 06fe905a472..e3d8c6ba3c5 100644 --- a/app/assets/javascripts/discourse/widgets/post-menu.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post-menu.js.es6 @@ -61,9 +61,15 @@ function likeCount(attrs) { ? "post.has_likes_title_only_you" : "post.has_likes_title_you" : "post.has_likes_title"; - const icon = attrs.yours ? "d-liked" : ""; + let icon = attrs.yours ? "d-liked" : ""; + let addContainer = attrs.yours; const additionalClass = attrs.yours ? "my-likes" : "regular-likes"; + if (!attrs.showLike) { + icon = attrs.yours ? "d-liked" : "d-unliked"; + addContainer = true; + } + return { action: "toggleWhoLiked", title, @@ -71,7 +77,7 @@ function likeCount(attrs) { contents: count, icon, iconRight: true, - addContainer: attrs.yours, + addContainer, titleOptions: { count: attrs.liked ? count - 1 : count } }; } diff --git a/app/assets/stylesheets/desktop/topic-post.scss b/app/assets/stylesheets/desktop/topic-post.scss index 80e5a264726..eabd9cd5ec0 100644 --- a/app/assets/stylesheets/desktop/topic-post.scss +++ b/app/assets/stylesheets/desktop/topic-post.scss @@ -65,8 +65,9 @@ nav.post-controls { } margin-left: 0; margin-right: 0; - &.my-likes { - // Like count on my posts + &.my-likes, + &.regular-likes { + // Like count on posts .d-icon { color: $primary-low-mid; padding-left: 0.45em; diff --git a/app/assets/stylesheets/mobile/topic-post.scss b/app/assets/stylesheets/mobile/topic-post.scss index 27f9c7db10c..e87327b25ea 100644 --- a/app/assets/stylesheets/mobile/topic-post.scss +++ b/app/assets/stylesheets/mobile/topic-post.scss @@ -47,7 +47,8 @@ span.badge-posts { + .create-flag { padding: s(2 2 2 1); } - &.my-likes { + &.my-likes, + &.regular-likes { display: flex; max-width: unset; padding: s(2);