fix: quote counts in the counts line; remove dead editor scripts and files (v2.14.2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
88aea09e04
commit
d354dc9733
18 files changed
+106
-60
No files matched your search
@@ -112,7 +112,8 @@ def get_webmentions_for_note(note_id: int) -> Dict[str, List[Dict[str, Any]]]:
|
||||
|
||||
def response_counts(note_ids: List[int]) -> Dict[int, Dict[str, int]]:
|
||||
"""
|
||||
Likes, reposts and replies per note, for lists of notes (v2.13.4).
|
||||
Likes, reposts, replies and quotes per note, for lists of notes
|
||||
(v2.13.4; quotes v2.14.2).
|
||||
|
||||
Shown responses (valid and approved) plus the counts silos give without
|
||||
names (Threads; people who opted out of backfeed) on synced crossposts.
|
||||
@@ -126,21 +127,22 @@ def response_counts(note_ids: List[int]) -> Dict[int, Dict[str, int]]:
|
||||
|
||||
def add(note_id, key, n):
|
||||
if n:
|
||||
counts.setdefault(note_id, {'likes': 0, 'reposts': 0, 'replies': 0})[key] += n
|
||||
counts.setdefault(note_id, {'likes': 0, 'reposts': 0, 'replies': 0, 'quotes': 0})[key] += n
|
||||
|
||||
for row in db.execute(
|
||||
f"""
|
||||
SELECT target_note_id, mention_type, COUNT(*) FROM webmentions
|
||||
WHERE target_note_id IN ({marks}) AND validation_status = 'valid'
|
||||
AND moderation_status = 'approved' AND mention_type IN ('like', 'repost', 'reply')
|
||||
AND moderation_status = 'approved' AND mention_type IN ('like', 'repost', 'reply', 'quote')
|
||||
GROUP BY target_note_id, mention_type
|
||||
""",
|
||||
note_ids,
|
||||
):
|
||||
add(row[0], {'like': 'likes', 'repost': 'reposts', 'reply': 'replies'}[row[1]], row[2])
|
||||
add(row[0], {'like': 'likes', 'repost': 'reposts', 'reply': 'replies', 'quote': 'quotes'}[row[1]], row[2])
|
||||
for row in db.execute(
|
||||
f"""
|
||||
SELECT note_id, SUM(COALESCE(likes_count, 0)), SUM(COALESCE(reposts_count, 0))
|
||||
SELECT note_id, SUM(COALESCE(likes_count, 0)), SUM(COALESCE(reposts_count, 0)),
|
||||
SUM(COALESCE(quotes_count, 0))
|
||||
FROM syndications WHERE note_id IN ({marks}) AND state = 'synced'
|
||||
GROUP BY note_id
|
||||
""",
|
||||
@@ -148,6 +150,7 @@ def response_counts(note_ids: List[int]) -> Dict[int, Dict[str, int]]:
|
||||
):
|
||||
add(row[0], 'likes', row[1])
|
||||
add(row[0], 'reposts', row[2])
|
||||
add(row[0], 'quotes', row[3])
|
||||
return counts
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user