parent_id: data.parent_id.to_owned(),
post_id: data.post_id,
creator_id: local_user_view.person.id,
- removed: None,
- deleted: None,
- read: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
// Create the comment
icon,
banner,
creator_id: local_user_view.person.id,
- removed: None,
- deleted: None,
nsfw: data.nsfw,
- updated: None,
actor_id: Some(community_actor_id.to_owned()),
- local: true,
private_key: Some(keypair.private_key),
public_key: Some(keypair.public_key),
- last_refreshed_at: None,
- published: None,
followers_url: Some(generate_followers_url(&community_actor_id)?),
inbox_url: Some(generate_inbox_url(&community_actor_id)?),
shared_inbox_url: Some(Some(generate_shared_inbox_url(&community_actor_id)?)),
+ ..CommunityForm::default()
};
let inserted_community = match blocking(context.pool(), move |conn| {
let community_form = CommunityForm {
name: read_community.name,
title: data.title.to_owned(),
+ creator_id: read_community.creator_id,
description: data.description.to_owned(),
icon,
banner,
- creator_id: read_community.creator_id,
- removed: Some(read_community.removed),
- deleted: Some(read_community.deleted),
nsfw: data.nsfw,
updated: Some(naive_now()),
- actor_id: Some(read_community.actor_id),
- local: read_community.local,
- private_key: read_community.private_key,
- public_key: read_community.public_key,
- last_refreshed_at: None,
- published: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let community_id = data.community_id;
let new_person = PersonForm {
name: "Gerry9812".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let local_user_form = LocalUserForm {
person_id: inserted_person.id,
- email: None,
password_encrypted: "123456".to_string(),
- admin: None,
- show_nsfw: None,
- theme: None,
- default_sort_type: None,
- default_listing_type: None,
- lang: None,
- show_avatars: None,
- send_notifications_to_email: None,
+ ..LocalUserForm::default()
};
let inserted_local_user = LocalUser::create(&conn, &local_user_form).unwrap();
// Register the new person
let person_form = PersonForm {
name: data.username.to_owned(),
- avatar: None,
- banner: None,
- preferred_username: None,
- published: None,
- updated: None,
- banned: None,
- deleted: None,
actor_id: Some(actor_id.clone()),
- bio: None,
- local: Some(true),
private_key: Some(Some(actor_keypair.private_key)),
public_key: Some(Some(actor_keypair.public_key)),
- last_refreshed_at: None,
inbox_url: Some(generate_inbox_url(&actor_id)?),
shared_inbox_url: Some(Some(generate_shared_inbox_url(&actor_id)?)),
- matrix_user_id: None,
+ ..PersonForm::default()
};
// insert the person
name: default_community_name.to_string(),
title: "The Default Community".to_string(),
description: Some("The Default Community".to_string()),
- nsfw: false,
creator_id: inserted_person.id,
- removed: None,
- deleted: None,
- updated: None,
actor_id: Some(actor_id.to_owned()),
- local: true,
private_key: Some(main_community_keypair.private_key),
public_key: Some(main_community_keypair.public_key),
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
followers_url: Some(generate_followers_url(&actor_id)?),
inbox_url: Some(generate_inbox_url(&actor_id)?),
shared_inbox_url: Some(Some(generate_shared_inbox_url(&actor_id)?)),
+ ..CommunityForm::default()
};
blocking(context.pool(), move |conn| {
Community::create(conn, &community_form)
content: content_slurs_removed.to_owned(),
creator_id: local_user_view.person.id,
recipient_id: data.recipient_id,
- deleted: None,
- read: None,
- updated: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PrivateMessageForm::default()
};
let inserted_private_message = match blocking(context.pool(), move |conn| {
body: data.body.to_owned(),
community_id: data.community_id,
creator_id: local_user_view.person.id,
- removed: None,
- deleted: None,
nsfw: data.nsfw,
- locked: None,
- stickied: None,
- updated: None,
embed_title: iframely_title,
embed_description: iframely_description,
embed_html: iframely_html,
thumbnail_url: pictrs_thumbnail.map(|u| u.into()),
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post =
fetch_iframely_and_pictrs_data(context.client(), data_url).await;
let post_form = PostForm {
+ creator_id: orig_post.creator_id.to_owned(),
+ community_id: orig_post.community_id,
name: data.name.trim().to_owned(),
url: data_url.map(|u| u.to_owned().into()),
body: data.body.to_owned(),
nsfw: data.nsfw,
- creator_id: orig_post.creator_id.to_owned(),
- community_id: orig_post.community_id,
- removed: Some(orig_post.removed),
- deleted: Some(orig_post.deleted),
- locked: Some(orig_post.locked),
- stickied: Some(orig_post.stickied),
updated: Some(naive_now()),
embed_title: iframely_title,
embed_description: iframely_description,
embed_html: iframely_html,
thumbnail_url: pictrs_thumbnail.map(|u| u.into()),
- ap_id: Some(orig_post.ap_id),
- local: orig_post.local,
- published: None,
+ ..PostForm::default()
};
let post_id = data.post_id;
pub description: Option<String>,
pub icon: Option<String>,
pub banner: Option<String>,
- pub nsfw: bool,
+ pub nsfw: Option<bool>,
pub auth: String,
}
pub description: Option<String>,
pub icon: Option<String>,
pub banner: Option<String>,
- pub nsfw: bool,
+ pub nsfw: Option<bool>,
pub auth: String,
}
updated: note.updated().map(|u| u.to_owned().naive_local()),
deleted: None,
ap_id: Some(check_object_domain(note, expected_domain)?),
- local: false,
+ local: Some(false),
})
}
}
published: group.inner.published().map(|u| u.to_owned().naive_local()),
updated: group.inner.updated().map(|u| u.to_owned().naive_local()),
deleted: None,
- nsfw: group.ext_one.sensitive.unwrap_or(false),
+ nsfw: Some(group.ext_one.sensitive.unwrap_or(false)),
actor_id: Some(check_object_domain(group, expected_domain)?),
- local: false,
+ local: Some(false),
private_key: None,
public_key: Some(group.ext_two.to_owned().public_key.public_key_pem),
last_refreshed_at: Some(naive_now()),
embed_html: iframely_html,
thumbnail_url: pictrs_thumbnail.map(|u| u.into()),
ap_id: Some(check_object_domain(page, expected_domain)?),
- local: false,
+ local: Some(false),
})
}
}
deleted: None,
read: None,
ap_id: Some(check_object_domain(note, expected_domain)?),
- local: false,
+ local: Some(false),
})
}
}
let new_person = PersonForm {
name: "thommy_comment_agg".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let another_person = PersonForm {
name: "jerry_comment_agg".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
name: "TIL_comment_agg".into(),
creator_id: inserted_person.id,
title: "nada".to_owned(),
- description: None,
- nsfw: false,
- removed: None,
- deleted: None,
- updated: None,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
- url: None,
- body: None,
creator_id: inserted_person.id,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- nsfw: false,
- updated: None,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
- parent_id: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_comment = Comment::create(&conn, &comment_form).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
parent_id: Some(inserted_comment.id),
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let _inserted_child_comment = Comment::create(&conn, &child_comment_form).unwrap();
let new_person = PersonForm {
name: "thommy_community_agg".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let another_person = PersonForm {
name: "jerry_community_agg".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
name: "TIL_community_agg".into(),
creator_id: inserted_person.id,
title: "nada".to_owned(),
- description: None,
- nsfw: false,
- removed: None,
- deleted: None,
- updated: None,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
name: "TIL_community_agg_2".into(),
creator_id: inserted_person.id,
title: "nada".to_owned(),
- description: None,
- nsfw: false,
- removed: None,
- deleted: None,
- updated: None,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let another_inserted_community = Community::create(&conn, &another_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
- url: None,
- body: None,
creator_id: inserted_person.id,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- nsfw: false,
- updated: None,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
- parent_id: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_comment = Comment::create(&conn, &comment_form).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
parent_id: Some(inserted_comment.id),
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let _inserted_child_comment = Comment::create(&conn, &child_comment_form).unwrap();
let new_person = PersonForm {
name: "thommy_user_agg".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let another_person = PersonForm {
name: "jerry_user_agg".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
name: "TIL_site_agg".into(),
creator_id: inserted_person.id,
title: "nada".to_owned(),
- description: None,
- nsfw: false,
- removed: None,
- deleted: None,
- updated: None,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
- url: None,
- body: None,
creator_id: inserted_person.id,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- nsfw: false,
- updated: None,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
- parent_id: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_comment = Comment::create(&conn, &comment_form).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
parent_id: Some(inserted_comment.id),
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_child_comment = Comment::create(&conn, &child_comment_form).unwrap();
let new_person = PersonForm {
name: "thommy_community_agg".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let another_person = PersonForm {
name: "jerry_community_agg".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let another_inserted_person = Person::create(&conn, &another_person).unwrap();
name: "TIL_community_agg".into(),
creator_id: inserted_person.id,
title: "nada".to_owned(),
- description: None,
- nsfw: false,
- removed: None,
- deleted: None,
- updated: None,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
- url: None,
- body: None,
creator_id: inserted_person.id,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- nsfw: false,
- updated: None,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
- parent_id: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_comment = Comment::create(&conn, &comment_form).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
parent_id: Some(inserted_comment.id),
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let _inserted_child_comment = Comment::create(&conn, &child_comment_form).unwrap();
let new_person = PersonForm {
name: "thommy_site_agg".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
name: "TIL_site_agg".into(),
creator_id: inserted_person.id,
title: "nada".to_owned(),
- description: None,
- nsfw: false,
- removed: None,
- deleted: None,
- updated: None,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
- url: None,
- body: None,
creator_id: inserted_person.id,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- nsfw: false,
- updated: None,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
// Insert two of those posts
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
- parent_id: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
// Insert two of those comments
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
parent_id: Some(inserted_comment.id),
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let _inserted_child_comment = Comment::create(&conn, &child_comment_form).unwrap();
let activity_form = ActivityForm {
ap_id,
data: serde_json::to_value(&data)?,
- local,
+ local: Some(local),
sensitive,
updated: None,
};
let creator_form = PersonForm {
name: "activity_creator_pm".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_creator = Person::create(&conn, &creator_form).unwrap();
let activity_form = ActivityForm {
ap_id: ap_id.clone(),
data: test_json.to_owned(),
- local: true,
+ local: Some(true),
sensitive: false,
updated: None,
};
let new_person = PersonForm {
name: "terry".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let new_community = CommunityForm {
name: "test community".to_string(),
title: "nada".to_owned(),
- description: None,
creator_id: inserted_person.id,
- removed: None,
- deleted: None,
- updated: None,
- nsfw: false,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- banner: None,
- icon: None,
- inbox_url: None,
- shared_inbox_url: None,
- followers_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
creator_id: inserted_person.id,
- url: None,
- body: None,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- updated: None,
- nsfw: false,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
- parent_id: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_comment = Comment::create(&conn, &comment_form).unwrap();
creator_id: inserted_person.id,
post_id: inserted_post.id,
parent_id: Some(inserted_comment.id),
- removed: None,
- deleted: None,
- read: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_child_comment = Comment::create(&conn, &child_comment_form).unwrap();
let new_person = PersonForm {
name: "bobbee".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
name: "TIL".into(),
creator_id: inserted_person.id,
title: "nada".to_owned(),
- description: None,
- nsfw: false,
- removed: None,
- deleted: None,
- updated: None,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_mod = PersonForm {
name: "the mod".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_mod = Person::create(&conn, &new_mod).unwrap();
let new_person = PersonForm {
name: "jim2".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let new_community = CommunityForm {
name: "mod_community".to_string(),
title: "nada".to_owned(),
- description: None,
creator_id: inserted_person.id,
- removed: None,
- deleted: None,
- updated: None,
- nsfw: false,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post thweep".into(),
- url: None,
- body: None,
creator_id: inserted_person.id,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- updated: None,
- nsfw: false,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
- parent_id: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_comment = Comment::create(&conn, &comment_form).unwrap();
let new_person = PersonForm {
name: "thommy prw".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let new_local_user = LocalUserForm {
person_id: inserted_person.id,
password_encrypted: "pass".to_string(),
- email: None,
- admin: None,
- show_nsfw: None,
- theme: None,
- default_sort_type: None,
- default_listing_type: None,
- lang: None,
- show_avatars: None,
- send_notifications_to_email: None,
+ ..LocalUserForm::default()
};
let inserted_local_user = LocalUser::create(&conn, &new_local_user).unwrap();
let new_person = PersonForm {
name: "holly".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let new_person = PersonForm {
name: "terrylake".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let recipient_form = PersonForm {
name: "terrylakes recipient".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_recipient = Person::create(&conn, &recipient_form).unwrap();
let new_community = CommunityForm {
name: "test community lake".to_string(),
title: "nada".to_owned(),
- description: None,
creator_id: inserted_person.id,
- removed: None,
- deleted: None,
- updated: None,
- nsfw: false,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
creator_id: inserted_person.id,
- url: None,
- body: None,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- updated: None,
- nsfw: false,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
content: "A test comment".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- removed: None,
- deleted: None,
- read: None,
- parent_id: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_comment = Comment::create(&conn, &comment_form).unwrap();
let new_person = PersonForm {
name: "jim".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let new_community = CommunityForm {
name: "test community_3".to_string(),
title: "nada".to_owned(),
- description: None,
creator_id: inserted_person.id,
- removed: None,
- deleted: None,
- updated: None,
- nsfw: false,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post".into(),
- url: None,
- body: None,
creator_id: inserted_person.id,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- nsfw: false,
- updated: None,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
let creator_form = PersonForm {
name: "creator_pm".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_creator = Person::create(&conn, &creator_form).unwrap();
let recipient_form = PersonForm {
name: "recipient_pm".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_recipient = Person::create(&conn, &recipient_form).unwrap();
content: "A test private message".into(),
creator_id: inserted_creator.id,
recipient_id: inserted_recipient.id,
- deleted: None,
- read: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..PrivateMessageForm::default()
};
let inserted_private_message = PrivateMessage::create(&conn, &private_message_form).unwrap();
pub mod schema;
pub mod source;
-#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, DieselNewType)]
+#[derive(
+ Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize, DieselNewType,
+)]
pub struct PostId(pub i32);
impl fmt::Display for PostId {
}
}
-#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, DieselNewType)]
+#[derive(
+ Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize, DieselNewType,
+)]
pub struct PersonId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, DieselNewType)]
}
}
-#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, DieselNewType)]
+#[derive(
+ Debug, Copy, Clone, Hash, Eq, PartialEq, Default, Serialize, Deserialize, DieselNewType,
+)]
pub struct CommunityId(pub i32);
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Serialize, Deserialize, DieselNewType)]
#[table_name = "activity"]
pub struct ActivityForm {
pub data: Value,
- pub local: bool,
+ pub local: Option<bool>,
pub updated: Option<chrono::NaiveDateTime>,
pub ap_id: DbUrl,
pub sensitive: bool,
pub local: bool,
}
-#[derive(Insertable, AsChangeset, Clone)]
+#[derive(Insertable, AsChangeset, Clone, Default)]
#[table_name = "comment"]
pub struct CommentForm {
pub creator_id: PersonId,
pub updated: Option<chrono::NaiveDateTime>,
pub deleted: Option<bool>,
pub ap_id: Option<DbUrl>,
- pub local: bool,
+ pub local: Option<bool>,
}
#[derive(Identifiable, Queryable, Associations, PartialEq, Debug, Clone)]
pub banner: Option<DbUrl>,
}
-#[derive(Insertable, AsChangeset, Debug)]
+#[derive(Insertable, AsChangeset, Debug, Default)]
#[table_name = "community"]
pub struct CommunityForm {
pub name: String,
pub published: Option<chrono::NaiveDateTime>,
pub updated: Option<chrono::NaiveDateTime>,
pub deleted: Option<bool>,
- pub nsfw: bool,
+ pub nsfw: Option<bool>,
pub actor_id: Option<DbUrl>,
- pub local: bool,
+ pub local: Option<bool>,
pub private_key: Option<String>,
pub public_key: Option<String>,
pub last_refreshed_at: Option<chrono::NaiveDateTime>,
}
// TODO redo these, check table defaults
-#[derive(Insertable, AsChangeset, Clone)]
+#[derive(Insertable, AsChangeset, Clone, Default)]
#[table_name = "local_user"]
pub struct LocalUserForm {
pub person_id: PersonId,
pub matrix_user_id: Option<String>,
}
-#[derive(Insertable, AsChangeset, Clone)]
+#[derive(Insertable, AsChangeset, Clone, Default)]
#[table_name = "person"]
pub struct PersonForm {
pub name: String,
pub local: bool,
}
-#[derive(Insertable, AsChangeset)]
+#[derive(Insertable, AsChangeset, Default)]
#[table_name = "post"]
pub struct PostForm {
pub name: String,
pub embed_html: Option<String>,
pub thumbnail_url: Option<DbUrl>,
pub ap_id: Option<DbUrl>,
- pub local: bool,
+ pub local: Option<bool>,
}
#[derive(Identifiable, Queryable, Associations, PartialEq, Debug)]
pub local: bool,
}
-#[derive(Insertable, AsChangeset)]
+#[derive(Insertable, AsChangeset, Default)]
#[table_name = "private_message"]
pub struct PrivateMessageForm {
pub creator_id: PersonId,
pub published: Option<chrono::NaiveDateTime>,
pub updated: Option<chrono::NaiveDateTime>,
pub ap_id: Option<DbUrl>,
- pub local: bool,
+ pub local: Option<bool>,
}
let new_person = PersonForm {
name: "timmy".into(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let new_community = CommunityForm {
name: "test community 5".to_string(),
title: "nada".to_owned(),
- description: None,
creator_id: inserted_person.id,
- removed: None,
- deleted: None,
- updated: None,
- nsfw: false,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: "A test post 2".into(),
creator_id: inserted_person.id,
- url: None,
- body: None,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- updated: None,
- nsfw: false,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
content: "A test comment 32".into(),
creator_id: inserted_person.id,
post_id: inserted_post.id,
- parent_id: None,
- removed: None,
- deleted: None,
- read: None,
- published: None,
- updated: None,
- ap_id: None,
- local: true,
+ ..CommentForm::default()
};
let inserted_comment = Comment::create(&conn, &comment_form).unwrap();
let new_person = PersonForm {
name: person_name.to_owned(),
- preferred_username: None,
- avatar: None,
- banner: None,
- banned: None,
- deleted: None,
- published: None,
- updated: None,
- actor_id: None,
- bio: None,
- local: None,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
let inserted_person = Person::create(&conn, &new_person).unwrap();
let new_community = CommunityForm {
name: community_name.to_owned(),
title: "nada".to_owned(),
- description: None,
creator_id: inserted_person.id,
- removed: None,
- deleted: None,
- updated: None,
- nsfw: false,
- actor_id: None,
- local: true,
- private_key: None,
- public_key: None,
- last_refreshed_at: None,
- published: None,
- icon: None,
- banner: None,
- followers_url: None,
- inbox_url: None,
- shared_inbox_url: None,
+ ..CommunityForm::default()
};
let inserted_community = Community::create(&conn, &new_community).unwrap();
let new_post = PostForm {
name: post_name.to_owned(),
- url: None,
- body: None,
creator_id: inserted_person.id,
community_id: inserted_community.id,
- removed: None,
- deleted: None,
- locked: None,
- stickied: None,
- updated: None,
- nsfw: false,
- embed_title: None,
- embed_description: None,
- embed_html: None,
- thumbnail_url: None,
- ap_id: None,
- local: true,
- published: None,
+ ..PostForm::default()
};
let inserted_post = Post::create(&conn, &new_post).unwrap();
let form = PersonForm {
name: cperson.name.to_owned(),
- avatar: None,
- banner: None,
- preferred_username: None,
- published: None,
- updated: None,
- banned: None,
- deleted: None,
actor_id: Some(generate_apub_endpoint(EndpointType::Person, &cperson.name)?),
- bio: None,
- local: None,
private_key: Some(Some(keypair.private_key)),
public_key: Some(Some(keypair.public_key)),
last_refreshed_at: Some(naive_now()),
- inbox_url: None,
- shared_inbox_url: None,
- matrix_user_id: None,
+ ..PersonForm::default()
};
Person::update(&conn, cperson.id, &form)?;
creator_id: ccommunity.creator_id,
removed: None,
deleted: None,
- nsfw: ccommunity.nsfw,
+ nsfw: None,
updated: None,
actor_id: Some(community_actor_id.to_owned()),
- local: ccommunity.local,
+ local: Some(ccommunity.local),
private_key: Some(keypair.private_key),
public_key: Some(keypair.public_key),
last_refreshed_at: Some(naive_now()),