mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-11-15 03:04:28 +00:00
Make the liked collection private
This commit is contained in:
parent
ed6e52d77d
commit
4887bd2eb4
3 changed files with 10 additions and 12 deletions
11
app.py
11
app.py
|
@ -34,6 +34,7 @@ import blueprints.tasks
|
|||
import blueprints.well_known
|
||||
import config
|
||||
from blueprints.api import _api_required
|
||||
from blueprints.api import api_required
|
||||
from blueprints.tasks import TaskError
|
||||
from config import DB
|
||||
from config import ID
|
||||
|
@ -112,14 +113,12 @@ def inject_config():
|
|||
"meta.deleted": False,
|
||||
"meta.poll_answer": False,
|
||||
}
|
||||
liked_count = DB.activities.count(
|
||||
{
|
||||
"box": Box.OUTBOX.value,
|
||||
liked_q = {
|
||||
**in_outbox,
|
||||
"meta.deleted": False,
|
||||
"meta.undo": False,
|
||||
"type": ActivityType.LIKE.value,
|
||||
}
|
||||
)
|
||||
followers_q = {
|
||||
"box": Box.INBOX.value,
|
||||
"type": ActivityType.FOLLOW.value,
|
||||
|
@ -141,7 +140,7 @@ def inject_config():
|
|||
followers_count=DB.activities.count(followers_q),
|
||||
following_count=DB.activities.count(following_q) if logged_in else 0,
|
||||
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,
|
||||
unread_notifications_count=DB.activities.count(unread_notifications_q)
|
||||
if logged_in
|
||||
|
@ -853,6 +852,7 @@ def featured():
|
|||
|
||||
|
||||
@app.route("/liked")
|
||||
@api_required
|
||||
def liked():
|
||||
if not is_api_request():
|
||||
q = {
|
||||
|
@ -868,7 +868,6 @@ def liked():
|
|||
"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}
|
||||
return jsonify(
|
||||
**activitypub.build_ordered_collection(
|
||||
|
|
|
@ -126,7 +126,6 @@ ME = {
|
|||
"following": ID + "/following",
|
||||
"followers": ID + "/followers",
|
||||
"featured": ID + "/featured",
|
||||
"liked": ID + "/liked",
|
||||
"inbox": ID + "/inbox",
|
||||
"outbox": ID + "/outbox",
|
||||
"preferredUsername": USERNAME,
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
<ul>
|
||||
<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>
|
||||
{% endif %}
|
||||
<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>
|
||||
{% 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>
|
||||
|
|
Loading…
Reference in a new issue