mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
413bd33613
commit
8b6dc582fa
28
inbox.py
28
inbox.py
|
@ -90,7 +90,7 @@ from utils import updateAnnounceCollection
|
|||
from utils import undoAnnounceCollectionEntry
|
||||
from utils import dangerousMarkup
|
||||
from utils import isDM
|
||||
from utils import isReply
|
||||
from utils import is_reply
|
||||
from utils import has_actor
|
||||
from httpsig import messageContentDigest
|
||||
from posts import editedPostFilename
|
||||
|
@ -3079,13 +3079,13 @@ def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
|
|||
The file can then be used by other systems to create a notification
|
||||
xmpp, matrix, email, etc
|
||||
"""
|
||||
isReplyToMutedPost = False
|
||||
is_replyToMutedPost = False
|
||||
if postIsDM:
|
||||
return isReplyToMutedPost
|
||||
if not isReply(post_json_object, actor):
|
||||
return isReplyToMutedPost
|
||||
return is_replyToMutedPost
|
||||
if not is_reply(post_json_object, actor):
|
||||
return is_replyToMutedPost
|
||||
if nickname == 'inbox':
|
||||
return isReplyToMutedPost
|
||||
return is_replyToMutedPost
|
||||
# replies index will be updated
|
||||
updateIndexList.append('tlreplies')
|
||||
|
||||
|
@ -3094,12 +3094,12 @@ def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
|
|||
conversationId = post_json_object['object']['conversation']
|
||||
|
||||
if not post_json_object['object'].get('inReplyTo'):
|
||||
return isReplyToMutedPost
|
||||
return is_replyToMutedPost
|
||||
inReplyTo = post_json_object['object']['inReplyTo']
|
||||
if not inReplyTo:
|
||||
return isReplyToMutedPost
|
||||
return is_replyToMutedPost
|
||||
if not isinstance(inReplyTo, str):
|
||||
return isReplyToMutedPost
|
||||
return is_replyToMutedPost
|
||||
if not isMuted(base_dir, nickname, domain, inReplyTo, conversationId):
|
||||
# check if the reply is within the allowed time period
|
||||
# after publication
|
||||
|
@ -3117,8 +3117,8 @@ def _createReplyNotificationFile(base_dir: str, nickname: str, domain: str,
|
|||
' hours')
|
||||
return False
|
||||
else:
|
||||
isReplyToMutedPost = True
|
||||
return isReplyToMutedPost
|
||||
is_replyToMutedPost = True
|
||||
return is_replyToMutedPost
|
||||
|
||||
|
||||
def _lowFrequencyPostNotification(base_dir: str, http_prefix: str,
|
||||
|
@ -3474,7 +3474,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
max_like_count,
|
||||
cw_lists, lists_enabled)
|
||||
|
||||
isReplyToMutedPost = False
|
||||
is_replyToMutedPost = False
|
||||
|
||||
if not isGroup:
|
||||
# create a DM notification file if needed
|
||||
|
@ -3498,7 +3498,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||
|
||||
# create a reply notification file if needed
|
||||
isReplyToMutedPost = \
|
||||
is_replyToMutedPost = \
|
||||
_createReplyNotificationFile(base_dir, nickname, domain,
|
||||
handle, debug, postIsDM,
|
||||
post_json_object, actor,
|
||||
|
@ -3533,7 +3533,7 @@ def _inboxAfterInitial(recentPostsCache: {}, max_recent_posts: int,
|
|||
|
||||
# If this is a reply to a muted post then also mute it.
|
||||
# This enables you to ignore a threat that's getting boring
|
||||
if isReplyToMutedPost:
|
||||
if is_replyToMutedPost:
|
||||
print('MUTE REPLY: ' + destinationFilename)
|
||||
destinationFilenameMuted = destinationFilename + '.muted'
|
||||
try:
|
||||
|
|
|
@ -13,7 +13,7 @@ import random
|
|||
import urllib.parse
|
||||
from utils import removeIdEnding
|
||||
from utils import isDM
|
||||
from utils import isReply
|
||||
from utils import is_reply
|
||||
from utils import camelCaseSplit
|
||||
from utils import getDomainFromActor
|
||||
from utils import getNicknameFromActor
|
||||
|
@ -455,7 +455,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
|||
|
||||
isDirect = isDM(post_json_object)
|
||||
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||
replyToYou = isReply(post_json_object, actor)
|
||||
replyToYou = is_reply(post_json_object, actor)
|
||||
|
||||
published = ''
|
||||
if post_json_object['object'].get('published'):
|
||||
|
|
20
utils.py
20
utils.py
|
@ -1506,8 +1506,8 @@ def removeModerationPostFromIndex(base_dir: str, postUrl: str,
|
|||
' from moderation index')
|
||||
|
||||
|
||||
def _isReplyToBlogPost(base_dir: str, nickname: str, domain: str,
|
||||
post_json_object: str):
|
||||
def _is_reply_to_blog_post(base_dir: str, nickname: str, domain: str,
|
||||
post_json_object: str):
|
||||
"""Is the given post a reply to a blog post?
|
||||
"""
|
||||
if not has_object_dict(post_json_object):
|
||||
|
@ -1516,13 +1516,13 @@ def _isReplyToBlogPost(base_dir: str, nickname: str, domain: str,
|
|||
return False
|
||||
if not isinstance(post_json_object['object']['inReplyTo'], str):
|
||||
return False
|
||||
blogsIndexFilename = \
|
||||
blogs_index_filename = \
|
||||
acct_dir(base_dir, nickname, domain) + '/tlblogs.index'
|
||||
if not os.path.isfile(blogsIndexFilename):
|
||||
if not os.path.isfile(blogs_index_filename):
|
||||
return False
|
||||
postId = removeIdEnding(post_json_object['object']['inReplyTo'])
|
||||
postId = postId.replace('/', '#')
|
||||
if postId in open(blogsIndexFilename).read():
|
||||
post_id = removeIdEnding(post_json_object['object']['inReplyTo'])
|
||||
post_id = post_id.replace('/', '#')
|
||||
if post_id in open(blogs_index_filename).read():
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -1736,8 +1736,8 @@ def deletePost(base_dir: str, http_prefix: str,
|
|||
return
|
||||
|
||||
# don't remove replies to blog posts
|
||||
if _isReplyToBlogPost(base_dir, nickname, domain,
|
||||
post_json_object):
|
||||
if _is_reply_to_blog_post(base_dir, nickname, domain,
|
||||
post_json_object):
|
||||
return
|
||||
|
||||
# remove from recent posts cache in memory
|
||||
|
@ -2613,7 +2613,7 @@ def isDM(post_json_object: {}) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
def isReply(post_json_object: {}, actor: str) -> bool:
|
||||
def is_reply(post_json_object: {}, actor: str) -> bool:
|
||||
"""Returns true if the given post is a reply to the given actor
|
||||
"""
|
||||
if post_json_object['type'] != 'Create':
|
||||
|
|
Loading…
Reference in New Issue