diff options
author | Dessalines <tyhou13@gmx.com> | 2020-04-03 20:04:57 -0400 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-04-03 20:04:57 -0400 |
commit | 85ea1046f060694bec545c7897c5da9ecda412ef (patch) | |
tree | 9937c4b672fbc5e7013e5b5d729106d168aec00b /server/src/api/comment.rs | |
parent | cb7059f832749836f865e2fcb90b089d949b8487 (diff) |
Adding post and comment ap_id columns.
Diffstat (limited to 'server/src/api/comment.rs')
-rw-r--r-- | server/src/api/comment.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/src/api/comment.rs b/server/src/api/comment.rs index 8373a338..1528f509 100644 --- a/server/src/api/comment.rs +++ b/server/src/api/comment.rs @@ -99,6 +99,8 @@ impl Perform<CommentResponse> for Oper<CreateComment> { deleted: None, read: None, updated: None, + ap_id: "changeme".into(), + local: true, }; let inserted_comment = match Comment::create(&conn, &comment_form) { @@ -106,6 +108,11 @@ impl Perform<CommentResponse> for Oper<CreateComment> { Err(_e) => return Err(APIError::err("couldnt_create_comment").into()), }; + match Comment::update_ap_id(&conn, inserted_comment.id) { + Ok(comment) => comment, + Err(_e) => return Err(APIError::err("couldnt_create_comment").into()), + }; + let mut recipient_ids = Vec::new(); // Scan the comment for user mentions, add those rows @@ -272,6 +279,8 @@ impl Perform<CommentResponse> for Oper<EditComment> { let content_slurs_removed = remove_slurs(&data.content.to_owned()); + let read_comment = Comment::read(&conn, data.edit_id)?; + let comment_form = CommentForm { content: content_slurs_removed, parent_id: data.parent_id, @@ -285,6 +294,8 @@ impl Perform<CommentResponse> for Oper<EditComment> { } else { Some(naive_now()) }, + ap_id: read_comment.ap_id, + local: read_comment.local, }; let _updated_comment = match Comment::update(&conn, data.edit_id, &comment_form) { |