From ad7d4d777b571b6a172fba91c071d72548d79b75 Mon Sep 17 00:00:00 2001
From: flaburgan <flaburgan@geexxx.fr>
Date: Mon, 20 Mar 2017 21:07:57 +0100
Subject: [PATCH] Add links to liked and commented pages within My activity

closes #5502
---
 Changelog.md                                  |  1 +
 .../javascripts/app/views/stream_view.js      |  6 ++++++
 app/assets/stylesheets/navbar_left.scss       | 16 ++++++++++++----
 app/views/streams/main_stream.html.haml       | 12 +++++++++---
 config/locales/diaspora/en.yml                |  6 ++++++
 features/desktop/activity_stream.feature      | 19 +++++++++++++++++++
 6 files changed, 53 insertions(+), 7 deletions(-)

diff --git a/Changelog.md b/Changelog.md
index 800f90c216..ea35401f6e 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -9,6 +9,7 @@
 * Don't hide posts when blocking someone from the profile [#7379](https://github.com/diaspora/diaspora/pull/7379)
 
 ## Features
+* Add links to liked and commented pages [#5502](https://github.com/diaspora/diaspora/pull/5502)
 
 # 0.6.4.0
 
diff --git a/app/assets/javascripts/app/views/stream_view.js b/app/assets/javascripts/app/views/stream_view.js
index 45e2091ff7..687822595a 100644
--- a/app/assets/javascripts/app/views/stream_view.js
+++ b/app/assets/javascripts/app/views/stream_view.js
@@ -28,6 +28,12 @@ app.views.Stream = app.views.InfScroll.extend({
     var streamSelection = $("#stream_selection");
     streamSelection.find("[data-stream]").removeClass("selected");
     streamSelection.find("[data-stream='" + activeStream + "']").addClass("selected");
+
+    var activityContainer = streamSelection.find(".my-activity");
+    activityContainer.removeClass("activity-stream-selected");
+    if (activeStream === "activity" || activeStream === "liked" || activeStream === "commented") {
+      activityContainer.addClass("activity-stream-selected");
+    }
   },
 
   initInvitationModal : function() {
diff --git a/app/assets/stylesheets/navbar_left.scss b/app/assets/stylesheets/navbar_left.scss
index 56134c3bf2..498b4fde57 100644
--- a/app/assets/stylesheets/navbar_left.scss
+++ b/app/assets/stylesheets/navbar_left.scss
@@ -30,16 +30,14 @@
     }
   }
 
-  .all-aspects .hoverable.selected,
-  .followed-tags-sidebar .hoverable.selected,
+  .nested-list .hoverable.selected,
   .selected > .hoverable {
     color: $white;
     background: $gray;
     border-color: $gray;
   }
 
-  .all-aspects ul,
-  .followed-tags-sidebar ul {
+  .nested-list ul {
     background: $left-navbar-drawer-background;
     li { padding: 0; }
     .entypo-check { visibility: hidden; }
@@ -59,6 +57,16 @@
     .hoverable:hover > .action { visibility: visible; }
   }
 
+  .my-activity {
+    ul {
+      display: none;
+    }
+
+    &.activity-stream-selected ul {
+      display: block;
+    }
+  }
+
   #tags_list {
     #new_tag_following {
       padding: 10px 20px 10px 30px;
diff --git a/app/views/streams/main_stream.html.haml b/app/views/streams/main_stream.html.haml
index 8fe84aefec..da6c31f759 100644
--- a/app/views/streams/main_stream.html.haml
+++ b/app/views/streams/main_stream.html.haml
@@ -27,13 +27,19 @@
         %ul#stream_selection
           %li{data: {stream: "stream"}}
             = link_to t("streams.multi.title"), stream_path, rel: "backbone", class: "hoverable"
-          %li{data: {stream: "activity"}}
+          %li.nested-list.my-activity{data: {stream: "activity"}}
             = link_to t("streams.activity.title"), activity_stream_path, rel: "backbone", class: "hoverable"
+            %ul
+              %li{data: {stream: "liked"}}
+                = link_to t("streams.liked.title"), liked_stream_path, rel: "backbone", class: "hoverable selectable"
+              %li{data: {stream: "commented"}}
+                = link_to t("streams.commented.title"), commented_stream_path,
+                  rel: "backbone", class: "hoverable selectable"
           %li{data: {stream: "mentions"}}
             = link_to t("streams.mentions.title"), mentioned_stream_path, rel: "backbone", class: "hoverable"
-          %li.all-aspects
+          %li.nested-list.all-aspects
             = render "aspects/aspect_listings", stream: @stream
-          %li.followed-tags-sidebar
+          %li.nested-list
             = render "tags/followed_tags_listings"
           %li{data: {stream: "public"}}
             = link_to t("streams.public.title"), public_stream_path, rel: "backbone", class: "hoverable"
diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml
index 065f7336c0..e6bc470010 100644
--- a/config/locales/diaspora/en.yml
+++ b/config/locales/diaspora/en.yml
@@ -1150,6 +1150,12 @@ en:
 
     activity:
       title: "My activity"
+
+    liked:
+      title: "Liked posts"
+
+    commented:
+      title: "Commented posts"
   users:
     edit:
       edit_account: "Edit account"
diff --git a/features/desktop/activity_stream.feature b/features/desktop/activity_stream.feature
index 7fb9e52774..f6a9d37462 100644
--- a/features/desktop/activity_stream.feature
+++ b/features/desktop/activity_stream.feature
@@ -15,12 +15,22 @@ Feature: The activity stream
     Then I should see "Look at this dog"
     And I should see "is that a poodle?"
 
+    When I go to the commented stream page
+    Then I should see "Look at this dog"
+    And I should see "is that a poodle?"
+
+    When I go to the liked stream page
+    Then I should not see "Look at this dog"
+
     When I am on "alice@alice.alice"'s page
     And I confirm the alert after I click to delete the first comment
 
     And I go to the activity stream page
     Then I should not see "Look at this dog"
 
+    When I go to the commented stream page
+    Then I should not see "Look at this dog"
+
   Scenario: unliking a post
     When I sign in as "bob@bob.bob"
     And I am on "alice@alice.alice"'s page
@@ -30,7 +40,16 @@ Feature: The activity stream
     And I go to the activity stream page
     Then I should see "Look at this dog"
 
+    When I go to the commented stream page
+    Then I should not see "Look at this dog"
+
+    When I go to the liked stream page
+    Then I should see "Look at this dog"
+
     When I am on "alice@alice.alice"'s page
     And I unlike the post "Look at this dog" in the stream
     And I go to the activity stream page
     Then I should not see "Look at this dog"
+
+    When I go to the liked stream page
+    Then I should not see "Look at this dog"
-- 
GitLab