mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-28 05:41:34 +00:00
Update create.rs
This commit is contained in:
parent
b2a480f55c
commit
1f30b38ca2
1 changed files with 1 additions and 20 deletions
|
@ -8,7 +8,6 @@ use lemmy_api_common::{
|
|||
utils::{
|
||||
check_community_user_action,
|
||||
check_post_deleted_or_removed,
|
||||
generate_local_apub_endpoint,
|
||||
get_url_blocklist,
|
||||
is_mod_or_admin,
|
||||
local_site_to_slur_regex,
|
||||
|
@ -126,25 +125,7 @@ pub async fn create_comment(
|
|||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntCreateComment)?;
|
||||
|
||||
// Necessary to update the ap_id
|
||||
let inserted_comment_id = inserted_comment.id;
|
||||
let protocol_and_hostname = context.settings().get_protocol_and_hostname();
|
||||
|
||||
let apub_id = generate_local_apub_endpoint(
|
||||
EndpointType::Comment,
|
||||
&inserted_comment_id.to_string(),
|
||||
&protocol_and_hostname,
|
||||
)?;
|
||||
let updated_comment = Comment::update(
|
||||
&mut context.pool(),
|
||||
inserted_comment_id,
|
||||
&CommentUpdateForm {
|
||||
ap_id: Some(apub_id),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await
|
||||
.with_lemmy_type(LemmyErrorType::CouldntCreateComment)?;
|
||||
|
||||
// Scan the comment for user mentions, add those rows
|
||||
let mentions = scrape_text_for_mentions(&content);
|
||||
|
@ -170,7 +151,7 @@ pub async fn create_comment(
|
|||
.with_lemmy_type(LemmyErrorType::CouldntLikeComment)?;
|
||||
|
||||
ActivityChannel::submit_activity(
|
||||
SendActivityData::CreateComment(updated_comment.clone()),
|
||||
SendActivityData::CreateComment(inserted_comment.clone()),
|
||||
&context,
|
||||
)
|
||||
.await?;
|
||||
|
|
Loading…
Reference in a new issue