mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-03 00:31:25 -08:00
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
786a24432b
4 changed files with 16 additions and 5 deletions
|
@ -582,7 +582,7 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
||||||
if can_create_post_reply(user, community):
|
if can_create_post_reply(user, community):
|
||||||
try:
|
try:
|
||||||
post = create_post_reply(activity_log, community, in_reply_to, request_json, user)
|
post = create_post_reply(activity_log, community, in_reply_to, request_json, user)
|
||||||
if post and community.is_local():
|
if post:
|
||||||
announce_activity_to_followers(community, user, request_json)
|
announce_activity_to_followers(community, user, request_json)
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
activity_log.exception_message = 'TypeError. See log file.'
|
activity_log.exception_message = 'TypeError. See log file.'
|
||||||
|
@ -984,8 +984,7 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
|
||||||
if reply:
|
if reply:
|
||||||
if can_edit(request_json['actor'], reply):
|
if can_edit(request_json['actor'], reply):
|
||||||
update_post_reply_from_activity(reply, request_json)
|
update_post_reply_from_activity(reply, request_json)
|
||||||
if reply.community.is_local():
|
announce_activity_to_followers(reply.community, reply.author, request_json)
|
||||||
announce_activity_to_followers(reply.community, reply.author, request_json)
|
|
||||||
activity_log.result = 'success'
|
activity_log.result = 'success'
|
||||||
else:
|
else:
|
||||||
activity_log.exception_message = 'Edit attempt denied'
|
activity_log.exception_message = 'Edit attempt denied'
|
||||||
|
@ -1191,6 +1190,10 @@ def process_delete_request(request_json, activitypublog_id, ip_address):
|
||||||
|
|
||||||
|
|
||||||
def announce_activity_to_followers(community, creator, activity):
|
def announce_activity_to_followers(community, creator, activity):
|
||||||
|
# avoid announcing activity sent to local users unless it is also in a local community
|
||||||
|
if not community.is_local():
|
||||||
|
return
|
||||||
|
|
||||||
# remove context from what will be inner object
|
# remove context from what will be inner object
|
||||||
del activity["@context"]
|
del activity["@context"]
|
||||||
|
|
||||||
|
|
|
@ -1426,4 +1426,8 @@ h1 .warning_badge {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post_body, .comment_body {
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
/*# sourceMappingURL=structure.css.map */
|
/*# sourceMappingURL=structure.css.map */
|
||||||
|
|
|
@ -1104,4 +1104,8 @@ h1 .warning_badge {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post_body, .comment_body {
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
|
@ -188,7 +188,7 @@ def allowlist_html(html: str) -> str:
|
||||||
soup = BeautifulSoup(html, 'html.parser')
|
soup = BeautifulSoup(html, 'html.parser')
|
||||||
|
|
||||||
# Find all plain text links, convert to <a> tags
|
# Find all plain text links, convert to <a> tags
|
||||||
re_url = re.compile(r'(http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)')
|
re_url = re.compile(r'(http[s]?://[!-~]+)') # http(s):// followed by chars in ASCII range 33 to 126
|
||||||
for tag in soup.find_all(text=True):
|
for tag in soup.find_all(text=True):
|
||||||
tags = []
|
tags = []
|
||||||
url = False
|
url = False
|
||||||
|
|
Loading…
Add table
Reference in a new issue