Repository: bookwyrm-social/bookwyrm

Issue:
Add a Reviews and Comment tab users profile
**Is your feature request related to a problem? Please describe.**
It would be nice to have a user-related feed of reviews and comments made by them.
Right now there's no way to filter out comments/reviews from "wants to read"/"finished reading" making it a bit more difficult to create a discussion/engage with a user.
Adding a "Reviews and Comment" tab in a user profile would help engagement and discussions between users.

**Additional context**
I've added a simple image to show a bit better what I mean with this feature request.
![immagine](https://user-images.githubusercontent.com/1659050/192251346-30fab5cf-b0b2-488f-92e9-afa8ebee4cbf.png)




Discussion:
This makes a lot of sense and seems like a natural feature for a social book network.

Resolving patch:
diff --git a/bookwyrm/urls.py b/bookwyrm/urls.py
--- a/bookwyrm/urls.py
+++ b/bookwyrm/urls.py
@@ -410,6 +410,11 @@
         name="user-relationships",
     ),
     re_path(r"^hide-suggestions/?$", views.hide_suggestions, name="hide-suggestions"),
+    re_path(
+        rf"{USER_PATH}/reviews-comments",
+        views.UserReviewsComments.as_view(),
+        name="user-reviews-comments",
+    ),
     # groups
     re_path(rf"{USER_PATH}/groups/?$", views.UserGroups.as_view(), name="user-groups"),
     re_path(
diff --git a/bookwyrm/views/__init__.py b/bookwyrm/views/__init__.py
--- a/bookwyrm/views/__init__.py
+++ b/bookwyrm/views/__init__.py
@@ -137,7 +137,13 @@
 from .status import CreateStatus, EditStatus, DeleteStatus, update_progress
 from .status import edit_readthrough
 from .updates import get_notification_count, get_unread_status_string
-from .user import User, hide_suggestions, user_redirect, toggle_guided_tour
+from .user import (
+    User,
+    UserReviewsComments,
+    hide_suggestions,
+    user_redirect,
+    toggle_guided_tour,
+)
 from .relationships import Relationships
 from .wellknown import *
 from .annual_summary import (
diff --git a/bookwyrm/views/user.py b/bookwyrm/views/user.py
--- a/bookwyrm/views/user.py
+++ b/bookwyrm/views/user.py
@@ -1,6 +1,7 @@
 """ The user profile """
 from django.contrib.auth.decorators import login_required
 from django.core.paginator import Paginator
+from django.db.models import Q
 from django.http import Http404
 from django.shortcuts import redirect
 from django.template.response import TemplateResponse
@@ -100,6 +101,49 @@ def get(self, request, username):
         return TemplateResponse(request, "user/user.html", data)
 
 
+class UserReviewsComments(View):
+    """user's activity filtered by reviews and comments"""
+
+    def get(self, request, username):
+        """user's activity filtered by reviews and comments"""
+        user = get_user_from_username(request.user, username)
+        is_self = request.user.id == user.id
+
+        activities = (
+            models.Status.privacy_filter(
+                request.user,
+            )
+            .filter(
+                Q(review__isnull=False) | Q(comment__isnull=False),
+                user=user,
+            )
+            .exclude(
+                privacy="direct",
+            )
+            .select_related(
+                "user",
+                "reply_parent",
+                "review__book",
+                "comment__book",
+                "quotation__book",
+            )
+            .prefetch_related(
+                "mention_books",
+                "mention_users",
+                "attachments",
+            )
+        )
+
+        paginated = Paginator(activities, PAGE_LENGTH)
+
+        data = {
+            "user": user,
+            "is_self": is_self,
+            "activities": paginated.get_page(request.GET.get("page", 1)),
+        }
+        return TemplateResponse(request, "user/reviews_comments.html", data)
+
+
 @require_POST
 @login_required
 def hide_suggestions(request):


Test patch:
diff --git a/bookwyrm/tests/views/test_user.py b/bookwyrm/tests/views/test_user.py
--- a/bookwyrm/tests/views/test_user.py
+++ b/bookwyrm/tests/views/test_user.py
@@ -233,3 +233,19 @@ def test_user_redirect(self):
         result = views.user_redirect(request, "mouse")
 
         self.assertEqual(result.status_code, 302)
+
+    def test_reviews_comments_page(self):
+        """there are so many views, this just makes sure it LOADS"""
+        view = views.UserReviewsComments.as_view()
+        request = self.factory.get("")
+        request.user = self.local_user
+        result = view(request, "mouse")
+        self.assertIsInstance(result, TemplateResponse)
+        validate_html(result.render())
+        self.assertEqual(result.status_code, 200)
+
+        request.user = self.anonymous_user
+        result = view(request, "mouse")
+        self.assertIsInstance(result, TemplateResponse)
+        validate_html(result.render())
+        self.assertEqual(result.status_code, 200)