diff --git a/files/routes/posts.py b/files/routes/posts.py index 9c3c85a1f5..5fad7bf53c 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -870,6 +870,7 @@ def save_post(pid, v): if not save: new_save=SaveRelationship(user_id=v.id, post_id=p.id) g.db.add(new_save) + cache.delete_memoized(userpagelisting) return {"message": "Post saved!"} @@ -887,6 +888,7 @@ def unsave_post(pid, v): if save: g.db.delete(save) + cache.delete_memoized(userpagelisting) return {"message": "Post unsaved!"} diff --git a/files/routes/users.py b/files/routes/users.py index 23c541f2c6..ace84d43a5 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -508,6 +508,7 @@ def subscribe(v, post_id): if not existing: new_sub = Subscription(user_id=v.id, post_id=post_id) g.db.add(new_sub) + cache.delete_memoized(userpagelisting) return {"message": "Subscribed to post successfully!"} @app.post("/unsubscribe/") @@ -520,6 +521,7 @@ def unsubscribe(v, post_id): existing = g.db.query(Subscription).filter_by(user_id=v.id, post_id=post_id).one_or_none() if existing: g.db.delete(existing) + cache.delete_memoized(userpagelisting) return {"message": "Unsubscribed from post successfully!"} @app.post("/@/message") diff --git a/files/templates/post.html b/files/templates/post.html index 9b2d3cc93f..2a245b1c24 100644 --- a/files/templates/post.html +++ b/files/templates/post.html @@ -297,6 +297,7 @@ {% if sort=="new" %}{% endif %} {% if sort=="old" %}{% endif %} {% if sort=="controversial" %}{% endif %} + {% if sort=="saves" %}{% endif %} {{sort | capitalize}} diff --git a/files/templates/search.html b/files/templates/search.html index 7a502109d2..dd2314e67c 100644 --- a/files/templates/search.html +++ b/files/templates/search.html @@ -137,7 +137,7 @@ {% if sort != "controversial" %}Controversial{% endif %} {% if sort != "comments" and "/posts" in request.path %}Comments{% endif %} {% if sort != "subscriptions" and "/posts" in request.path %}Subscriptions{% endif %} - {% if sort != "saves" and "/posts" in request.path %}Saves{% endif %} + {% if sort != "saves" %}Saves{% endif %} diff --git a/files/templates/userpage/header.html b/files/templates/userpage/header.html index a97de0a497..058f32e4e8 100644 --- a/files/templates/userpage/header.html +++ b/files/templates/userpage/header.html @@ -67,6 +67,8 @@ {% if sort != "new" %}New{% endif %} {% if sort != "old" %}Old{% endif %} {% if sort != "controversial" %}Controversial{% endif %} + {% if sort != "subscriptions" and "/posts" in request.path %}Subscriptions{% endif %} + {% if sort != "saves" %}Saves{% endif %}