forked from forks/microblog.pub
Make the liked collection private
This commit is contained in:
parent
ed6e52d77d
commit
4887bd2eb4
3 changed files with 10 additions and 12 deletions
19
app.py
19
app.py
|
@ -34,6 +34,7 @@ import blueprints.tasks
|
||||||
import blueprints.well_known
|
import blueprints.well_known
|
||||||
import config
|
import config
|
||||||
from blueprints.api import _api_required
|
from blueprints.api import _api_required
|
||||||
|
from blueprints.api import api_required
|
||||||
from blueprints.tasks import TaskError
|
from blueprints.tasks import TaskError
|
||||||
from config import DB
|
from config import DB
|
||||||
from config import ID
|
from config import ID
|
||||||
|
@ -112,14 +113,12 @@ def inject_config():
|
||||||
"meta.deleted": False,
|
"meta.deleted": False,
|
||||||
"meta.poll_answer": False,
|
"meta.poll_answer": False,
|
||||||
}
|
}
|
||||||
liked_count = DB.activities.count(
|
liked_q = {
|
||||||
{
|
**in_outbox,
|
||||||
"box": Box.OUTBOX.value,
|
"meta.deleted": False,
|
||||||
"meta.deleted": False,
|
"meta.undo": False,
|
||||||
"meta.undo": False,
|
"type": ActivityType.LIKE.value,
|
||||||
"type": ActivityType.LIKE.value,
|
}
|
||||||
}
|
|
||||||
)
|
|
||||||
followers_q = {
|
followers_q = {
|
||||||
"box": Box.INBOX.value,
|
"box": Box.INBOX.value,
|
||||||
"type": ActivityType.FOLLOW.value,
|
"type": ActivityType.FOLLOW.value,
|
||||||
|
@ -141,7 +140,7 @@ def inject_config():
|
||||||
followers_count=DB.activities.count(followers_q),
|
followers_count=DB.activities.count(followers_q),
|
||||||
following_count=DB.activities.count(following_q) if logged_in else 0,
|
following_count=DB.activities.count(following_q) if logged_in else 0,
|
||||||
notes_count=notes_count,
|
notes_count=notes_count,
|
||||||
liked_count=liked_count,
|
liked_count=DB.activities.count(liked_q) if logged_in else 0,
|
||||||
with_replies_count=DB.activities.count(all_q) if logged_in else 0,
|
with_replies_count=DB.activities.count(all_q) if logged_in else 0,
|
||||||
unread_notifications_count=DB.activities.count(unread_notifications_q)
|
unread_notifications_count=DB.activities.count(unread_notifications_q)
|
||||||
if logged_in
|
if logged_in
|
||||||
|
@ -853,6 +852,7 @@ def featured():
|
||||||
|
|
||||||
|
|
||||||
@app.route("/liked")
|
@app.route("/liked")
|
||||||
|
@api_required
|
||||||
def liked():
|
def liked():
|
||||||
if not is_api_request():
|
if not is_api_request():
|
||||||
q = {
|
q = {
|
||||||
|
@ -868,7 +868,6 @@ def liked():
|
||||||
"liked.html", liked=liked, older_than=older_than, newer_than=newer_than
|
"liked.html", liked=liked, older_than=older_than, newer_than=newer_than
|
||||||
)
|
)
|
||||||
|
|
||||||
_log_sig()
|
|
||||||
q = {"meta.deleted": False, "meta.undo": False, "type": ActivityType.LIKE.value}
|
q = {"meta.deleted": False, "meta.undo": False, "type": ActivityType.LIKE.value}
|
||||||
return jsonify(
|
return jsonify(
|
||||||
**activitypub.build_ordered_collection(
|
**activitypub.build_ordered_collection(
|
||||||
|
|
|
@ -126,7 +126,6 @@ ME = {
|
||||||
"following": ID + "/following",
|
"following": ID + "/following",
|
||||||
"followers": ID + "/followers",
|
"followers": ID + "/followers",
|
||||||
"featured": ID + "/featured",
|
"featured": ID + "/featured",
|
||||||
"liked": ID + "/liked",
|
|
||||||
"inbox": ID + "/inbox",
|
"inbox": ID + "/inbox",
|
||||||
"outbox": ID + "/outbox",
|
"outbox": ID + "/outbox",
|
||||||
"preferredUsername": USERNAME,
|
"preferredUsername": USERNAME,
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/" {% if request.path == "/" %}class="selected"{% endif %}>Notes <small class="badge">{{ notes_count }}</small></a></li>
|
<li><a href="/" {% if request.path == "/" %}class="selected"{% endif %}>Notes <small class="badge">{{ notes_count }}</small></a></li>
|
||||||
{% if session.logged_in %}<li><a href="/all" {% if request.path == url_for("all") %}class="selected"{% endif %}>All <small class="badge">{{ with_replies_count }}</small></a></li>
|
{% if session.logged_in %}<li><a href="/all" {% if request.path == url_for("all") %}class="selected"{% endif %}>All <small class="badge">{{ with_replies_count }}</small></a></li>
|
||||||
{% endif %}
|
|
||||||
<li><a href="/liked" {% if request.path == "/liked" %}class="selected"{% endif %}>Liked <small class="badge">{{ liked_count }}</small></a></li>
|
<li><a href="/liked" {% if request.path == "/liked" %}class="selected"{% endif %}>Liked <small class="badge">{{ liked_count }}</small></a></li>
|
||||||
|
{% endif %}
|
||||||
<li><a href="/followers"{% if request.path == "/followers" %} class="selected" {% endif %}>Followers <small class="badge">{{ followers_count }}</small></a></li>
|
<li><a href="/followers"{% if request.path == "/followers" %} class="selected" {% endif %}>Followers <small class="badge">{{ followers_count }}</small></a></li>
|
||||||
{% if not config.HIDE_FOLLOWING or session.logged_in %}<li id="menu-item-following"><a href="/following"{% if request.path == "/following" %} class="selected" {% endif %}>Following <small class="badge">{{ following_count }}</small></a></li>{% endif %}
|
{% if not config.HIDE_FOLLOWING or session.logged_in %}<li id="menu-item-following"><a href="/following"{% if request.path == "/following" %} class="selected" {% endif %}>Following <small class="badge">{{ following_count }}</small></a></li>{% endif %}
|
||||||
<!-- <li><a href="/about"{% if request.path == "/about" %} class="selected" {% endif %}>/about</a></li>
|
<!-- <li><a href="/about"{% if request.path == "/about" %} class="selected" {% endif %}>/about</a></li>
|
||||||
|
|
Loading…
Reference in a new issue