post mark and mention the mastodon acc
This commit is contained in:
parent
73a358c959
commit
bd3066287f
2 changed files with 9 additions and 4 deletions
|
@ -233,7 +233,12 @@ class Mark:
|
|||
self.rating_grade = rating_grade
|
||||
# publish a new or updated ActivityPub post
|
||||
post_as_new = shelf_type != last_shelf_type or visibility != last_visibility
|
||||
post = Takahe.post_mark(self, post_as_new) # this will update linked post
|
||||
append = (
|
||||
f" \n@{self.owner.user.mastodon_acct}"
|
||||
if visibility > 0 and share_to_mastodon
|
||||
else ""
|
||||
)
|
||||
post = Takahe.post_mark(self, post_as_new, append)
|
||||
# async boost to mastodon
|
||||
if post and share_to_mastodon:
|
||||
if settings.FORCE_CLASSIC_REPOST:
|
||||
|
|
|
@ -551,7 +551,7 @@ class Takahe:
|
|||
return post
|
||||
|
||||
@staticmethod
|
||||
def post_mark(mark, share_as_new_post: bool) -> Post | None:
|
||||
def post_mark(mark, share_as_new_post: bool, append_content="") -> Post | None:
|
||||
from catalog.common import ItemCategory
|
||||
|
||||
user = mark.owner.user
|
||||
|
@ -569,7 +569,7 @@ class Takahe:
|
|||
pre_conetent = (
|
||||
f'{mark.action_label}<a href="{item_link}">《{mark.item.display_title}》</a>'
|
||||
)
|
||||
content = f"{stars}\n{mark.comment_text or ''}{tags}"
|
||||
content = f"{stars} \n{mark.comment_text or ''}{tags}"
|
||||
data = {
|
||||
"object": {
|
||||
"tag": [mark.item.ap_object_ref],
|
||||
|
@ -593,7 +593,7 @@ class Takahe:
|
|||
post = Takahe.post(
|
||||
mark.owner.pk,
|
||||
pre_conetent,
|
||||
content,
|
||||
content + append_content,
|
||||
v,
|
||||
data,
|
||||
existing_post.pk if existing_post else None,
|
||||
|
|
Loading…
Add table
Reference in a new issue