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/post.rs | |
parent | cb7059f832749836f865e2fcb90b089d949b8487 (diff) |
Adding post and comment ap_id columns.
Diffstat (limited to 'server/src/api/post.rs')
-rw-r--r-- | server/src/api/post.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/server/src/api/post.rs b/server/src/api/post.rs index 651d5769..cfb71941 100644 --- a/server/src/api/post.rs +++ b/server/src/api/post.rs @@ -131,6 +131,8 @@ impl Perform<PostResponse> for Oper<CreatePost> { embed_description: iframely_description, embed_html: iframely_html, thumbnail_url: pictshare_thumbnail, + ap_id: "changeme".into(), + local: true, }; let inserted_post = match Post::create(&conn, &post_form) { @@ -146,6 +148,11 @@ impl Perform<PostResponse> for Oper<CreatePost> { } }; + match Post::update_ap_id(&conn, inserted_post.id) { + Ok(post) => post, + Err(_e) => return Err(APIError::err("couldnt_create_post").into()), + }; + // They like their own post by default let like_form = PostLikeForm { post_id: inserted_post.id, @@ -371,6 +378,8 @@ impl Perform<PostResponse> for Oper<EditPost> { let (iframely_title, iframely_description, iframely_html, pictshare_thumbnail) = fetch_iframely_and_pictshare_data(data.url.to_owned()); + let read_post = Post::read(&conn, data.edit_id)?; + let post_form = PostForm { name: data.name.to_owned(), url: data.url.to_owned(), @@ -387,6 +396,8 @@ impl Perform<PostResponse> for Oper<EditPost> { embed_description: iframely_description, embed_html: iframely_html, thumbnail_url: pictshare_thumbnail, + ap_id: read_post.ap_id, + local: read_post.local, }; let _updated_post = match Post::update(&conn, data.edit_id, &post_form) { |