diff options
| author | Bobby <[email protected]> | 2023-01-23 03:22:50 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2023-01-23 03:22:50 -0500 |
| commit | cdb3c96cdf2e4dda308d4de43e7cdec73cb1be7c (patch) | |
| tree | e5f458f67ea8210b8dbd78fe86eb73cffd2a9d06 | |
| parent | cf8ff752df348c1b67843360bdad87b223668f22 (diff) | |
| download | thatcomputerscientist-cdb3c96cdf2e4dda308d4de43e7cdec73cb1be7c.tar.xz thatcomputerscientist-cdb3c96cdf2e4dda308d4de43e7cdec73cb1be7c.zip | |
allow access to user to their activity on private profile
| -rw-r--r-- | blog/views.py | 2 | ||||
| -rw-r--r-- | static/css/main.css | 4 | ||||
| -rw-r--r-- | templates/blog/activity.html | 10 |
3 files changed, 12 insertions, 4 deletions
diff --git a/blog/views.py b/blog/views.py index 0aa79b65..690eea66 100644 --- a/blog/views.py +++ b/blog/views.py @@ -250,7 +250,7 @@ def articles(request): def user_activity(request, username): user = User.objects.get(username=username) user_profile = UserProfile.objects.get(user=user) - if user_profile.is_public: + if user_profile.is_public or user == request.user: recent_comments = Comment.objects.filter(user=user).order_by('-created_at')[:5] else: recent_comments = [] diff --git a/static/css/main.css b/static/css/main.css index 9fc865a8..cd543f37 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -168,6 +168,10 @@ kbd { color: #00ff00; } +.info { + color: #65c6c6; +} + .ac { margin-right: 5px; height: 12px; diff --git a/templates/blog/activity.html b/templates/blog/activity.html index 595dd920..6d70af3b 100644 --- a/templates/blog/activity.html +++ b/templates/blog/activity.html @@ -28,10 +28,14 @@ </div> <div style="clear: both;" id="activity"> - {% if activity_user_profile.is_public %} + {% if activity_user_profile.is_public or request.user.username == activity_user.username %} - {% if activity_recent_comments %} - <h2>Recent Comments</h2> + + {% if activity_recent_comments %} + <h2>Recent Comments</h2> + {% if not activity_user_profile.is_public and request.user.username == activity_user.username %} + <p class="info">Your profile is not public. Only you can see this information. If you want to change this, go to your <a href="{% url 'blog:account' %}?tab=details">account settings</a>.</p> + {% endif %} <ul> {% for comment in activity_recent_comments %} <li style="background: #1c1c1c;padding: 20px 10px 10px 10px;margin-bottom: 10px;border-radius: 8px;" |
