mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
add summary text field to Pages and Notes
This commit is contained in:
parent
39ddb0af3e
commit
71d66905bd
4 changed files with 7 additions and 3 deletions
|
@ -14,7 +14,7 @@ from app.activitypub.util import public_key, users_total, active_half_year, acti
|
|||
lemmy_site_data, instance_weight, is_activitypub_request, downvote_post_reply, downvote_post, upvote_post_reply, \
|
||||
upvote_post, activity_already_ingested, make_image_sizes, delete_post_or_comment, community_members
|
||||
from app.utils import gibberish, get_setting, is_image_url, allowlist_html, html_to_markdown, render_template, \
|
||||
domain_from_url, markdown_to_html, community_membership, ap_datetime
|
||||
domain_from_url, markdown_to_html, community_membership, ap_datetime, markdown_to_text
|
||||
import werkzeug.exceptions
|
||||
|
||||
INBOX = []
|
||||
|
@ -1016,6 +1016,7 @@ def comment_ap(comment_id):
|
|||
reply.author.followers_url()
|
||||
],
|
||||
'content': reply.body_html,
|
||||
'summary': markdown_to_text(reply.body),
|
||||
'mediaType': 'text/html',
|
||||
'published': ap_datetime(reply.created_at),
|
||||
'distinguished': False,
|
||||
|
|
|
@ -21,7 +21,7 @@ from PIL import Image, ImageOps
|
|||
from io import BytesIO
|
||||
|
||||
from app.utils import get_request, allowlist_html, html_to_markdown, get_setting, ap_datetime, markdown_to_html, \
|
||||
is_image_url, domain_from_url, gibberish, ensure_directory_exists
|
||||
is_image_url, domain_from_url, gibberish, ensure_directory_exists, markdown_to_text
|
||||
|
||||
|
||||
def public_key():
|
||||
|
@ -121,6 +121,7 @@ def post_to_activity(post: Post, community: Community):
|
|||
"name": post.title,
|
||||
"cc": [],
|
||||
"content": post.body_html,
|
||||
"summary": markdown_to_text(post.body),
|
||||
"mediaType": "text/html",
|
||||
"source": {
|
||||
"content": post.body,
|
||||
|
|
|
@ -610,7 +610,7 @@ def post_reply_report(post_id: int, comment_id: int):
|
|||
form = ReportPostForm()
|
||||
if form.validate_on_submit():
|
||||
report = Report(reasons=form.reasons_to_string(form.reasons.data), description=form.description.data,
|
||||
type=1, reporter_id=current_user.id, suspect_post_id=post.id, suspect_community_id=post.community.id,
|
||||
type=2, reporter_id=current_user.id, suspect_post_id=post.id, suspect_community_id=post.community.id,
|
||||
suspect_user_id=post_reply.author.id, suspect_post_reply_id=post_reply.id)
|
||||
db.session.add(report)
|
||||
|
||||
|
|
|
@ -191,6 +191,8 @@ def markdown_to_html(markdown_text) -> str:
|
|||
|
||||
|
||||
def markdown_to_text(markdown_text) -> str:
|
||||
if not markdown_text or markdown_text == '':
|
||||
return ''
|
||||
return markdown_text.replace("# ", '')
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue