]> Untitled Git - lemmy.git/commitdiff
~80% done
authorDessalines <tyhou13@gmx.com>
Wed, 10 Mar 2021 22:33:55 +0000 (17:33 -0500)
committerDessalines <tyhou13@gmx.com>
Wed, 10 Mar 2021 22:33:55 +0000 (17:33 -0500)
101 files changed:
1  2 
crates/api/src/comment.rs
crates/api/src/community.rs
crates/api/src/lib.rs
crates/api/src/post.rs
crates/api/src/routes.rs
crates/api/src/site.rs
crates/api/src/user.rs
crates/api/src/websocket.rs
crates/api_structs/src/community.rs
crates/api_structs/src/lib.rs
crates/api_structs/src/person.rs
crates/api_structs/src/site.rs
crates/apub/src/activities/receive/comment.rs
crates/apub/src/activities/receive/comment_undo.rs
crates/apub/src/activities/receive/mod.rs
crates/apub/src/activities/receive/post.rs
crates/apub/src/activities/receive/post_undo.rs
crates/apub/src/activities/receive/private_message.rs
crates/apub/src/activities/send/comment.rs
crates/apub/src/activities/send/community.rs
crates/apub/src/activities/send/mod.rs
crates/apub/src/activities/send/person.rs
crates/apub/src/activities/send/post.rs
crates/apub/src/activities/send/private_message.rs
crates/apub/src/activity_queue.rs
crates/apub/src/extensions/signatures.rs
crates/apub/src/fetcher/community.rs
crates/apub/src/fetcher/mod.rs
crates/apub/src/fetcher/person.rs
crates/apub/src/fetcher/search.rs
crates/apub/src/http/mod.rs
crates/apub/src/http/person.rs
crates/apub/src/inbox/community_inbox.rs
crates/apub/src/inbox/mod.rs
crates/apub/src/inbox/person_inbox.rs
crates/apub/src/inbox/receive_for_community.rs
crates/apub/src/inbox/shared_inbox.rs
crates/apub/src/lib.rs
crates/apub/src/objects/comment.rs
crates/apub/src/objects/community.rs
crates/apub/src/objects/mod.rs
crates/apub/src/objects/person.rs
crates/apub/src/objects/post.rs
crates/apub/src/objects/private_message.rs
crates/apub/src/routes.rs
crates/db_queries/src/aggregates/comment_aggregates.rs
crates/db_queries/src/aggregates/community_aggregates.rs
crates/db_queries/src/aggregates/person_aggregates.rs
crates/db_queries/src/aggregates/post_aggregates.rs
crates/db_queries/src/aggregates/site_aggregates.rs
crates/db_queries/src/source/activity.rs
crates/db_queries/src/source/comment.rs
crates/db_queries/src/source/community.rs
crates/db_queries/src/source/local_user.rs
crates/db_queries/src/source/moderator.rs
crates/db_queries/src/source/password_reset_request.rs
crates/db_queries/src/source/person.rs
crates/db_queries/src/source/person_mention.rs
crates/db_queries/src/source/post.rs
crates/db_queries/src/source/private_message.rs
crates/db_queries/src/source/user.rs
crates/db_schema/src/schema.rs
crates/db_schema/src/source/comment.rs
crates/db_schema/src/source/community.rs
crates/db_schema/src/source/local_user.rs
crates/db_schema/src/source/password_reset_request.rs
crates/db_schema/src/source/person.rs
crates/db_schema/src/source/post.rs
crates/db_views/src/comment_report_view.rs
crates/db_views/src/comment_view.rs
crates/db_views/src/lib.rs
crates/db_views/src/local_user_view.rs
crates/db_views/src/post_report_view.rs
crates/db_views/src/post_view.rs
crates/db_views/src/private_message_view.rs
crates/db_views/src/site_view.rs
crates/db_views_actor/src/community_follower_view.rs
crates/db_views_actor/src/community_moderator_view.rs
crates/db_views_actor/src/community_person_ban_view.rs
crates/db_views_actor/src/community_user_ban_view.rs
crates/db_views_actor/src/community_view.rs
crates/db_views_actor/src/lib.rs
crates/db_views_actor/src/person_mention_view.rs
crates/db_views_actor/src/person_view.rs
crates/db_views_actor/src/user_view.rs
crates/db_views_moderator/src/mod_add_community_view.rs
crates/db_views_moderator/src/mod_add_view.rs
crates/db_views_moderator/src/mod_ban_from_community_view.rs
crates/db_views_moderator/src/mod_ban_view.rs
crates/db_views_moderator/src/mod_lock_post_view.rs
crates/db_views_moderator/src/mod_remove_comment_view.rs
crates/db_views_moderator/src/mod_remove_community_view.rs
crates/db_views_moderator/src/mod_remove_post_view.rs
crates/db_views_moderator/src/mod_sticky_post_view.rs
crates/routes/src/feeds.rs
crates/routes/src/webfinger.rs
crates/websocket/src/lib.rs
migrations/2021-03-09-171136_split_user_table_2/down.sql
migrations/2021-03-09-171136_split_user_table_2/up.sql
restore_db.sh
src/code_migrations.rs

index bd4f33f5e5bda986d75f5d1f78d494d32beea484,cb8b2d515a96aac06230b864db7b501635d0d727..711e8e725f4f5bbc38200665b2725b465ed1f084
@@@ -3,8 -3,8 +3,8 @@@ use crate::
    check_downvotes_enabled,
    collect_moderated_communities,
    get_post,
--  get_user_from_jwt,
--  get_user_from_jwt_opt,
++  get_local_user_view_from_jwt,
++  get_local_user_view_from_jwt_opt,
    is_mod_or_admin,
    Perform,
  };
@@@ -48,7 -48,7 +48,7 @@@ impl Perform for CreateComment 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CommentResponse, LemmyError> {
      let data: &CreateComment = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let content_slurs_removed = remove_slurs(&data.content.to_owned());
  
@@@ -56,7 -56,7 +56,7 @@@
      let post_id = data.post_id;
      let post = get_post(post_id, context.pool()).await?;
  
--    check_community_ban(user.id, post.community_id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, post.community_id, context.pool()).await?;
  
      // Check if post is locked, no new comments
      if post.locked {
@@@ -80,7 -80,7 +80,7 @@@
        content: content_slurs_removed,
        parent_id: data.parent_id.to_owned(),
        post_id: data.post_id,
--      creator_id: user.id,
++      creator_id: local_user_view.person.id,
        removed: None,
        deleted: None,
        read: None,
          Err(_e) => return Err(ApiError::err("couldnt_create_comment").into()),
        };
  
--    updated_comment.send_create(&user, context).await?;
++    updated_comment.send_create(&local_user_view.person, context).await?;
  
      // Scan the comment for user mentions, add those rows
      let post_id = post.id;
      let recipient_ids = send_local_notifs(
        mentions,
        updated_comment.clone(),
--      &user,
++      local_user_view.person.clone(),
        post,
        context.pool(),
        true,
      let like_form = CommentLikeForm {
        comment_id: inserted_comment.id,
        post_id,
-       person_id: user.id,
 -      user_id: user.id,
++      person_id: local_user_view.person.id,
        score: 1,
      };
  
        return Err(ApiError::err("couldnt_like_comment").into());
      }
  
--    updated_comment.send_like(&user, context).await?;
++    updated_comment.send_like(&local_user_view.person, context).await?;
  
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let mut comment_view = blocking(context.pool(), move |conn| {
--      CommentView::read(&conn, inserted_comment.id, Some(user_id))
++      CommentView::read(&conn, inserted_comment.id, Some(person_id))
      })
      .await??;
  
      // If its a comment to yourself, mark it as read
      let comment_id = comment_view.comment.id;
--    if user.id == comment_view.get_recipient_id() {
++    if local_user_view.person.id == comment_view.get_recipient_id() {
        match blocking(context.pool(), move |conn| {
          Comment::update_read(conn, comment_id, true)
        })
@@@ -193,7 -193,7 +193,7 @@@ impl Perform for EditComment 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CommentResponse, LemmyError> {
      let data: &EditComment = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let comment_id = data.comment_id;
      let orig_comment = blocking(context.pool(), move |conn| {
      })
      .await??;
  
--    check_community_ban(user.id, orig_comment.community.id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_comment.community.id, context.pool()).await?;
  
      // Verify that only the creator can edit
--    if user.id != orig_comment.creator.id {
++    if local_user_view.person.id != orig_comment.creator.id {
        return Err(ApiError::err("no_comment_edit_allowed").into());
      }
  
      };
  
      // Send the apub update
--    updated_comment.send_update(&user, context).await?;
++    updated_comment.send_update(&local_user_view.person, context).await?;
  
      // Do the mentions / recipients
      let updated_comment_content = updated_comment.content.to_owned();
      let recipient_ids = send_local_notifs(
        mentions,
        updated_comment,
--      &user,
++      local_user_view.person.clone(),
        orig_comment.post,
        context.pool(),
        false,
      .await?;
  
      let comment_id = data.comment_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let comment_view = blocking(context.pool(), move |conn| {
--      CommentView::read(conn, comment_id, Some(user_id))
++      CommentView::read(conn, comment_id, Some(person_id))
      })
      .await??;
  
@@@ -269,7 -269,7 +269,7 @@@ impl Perform for DeleteComment 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CommentResponse, LemmyError> {
      let data: &DeleteComment = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let comment_id = data.comment_id;
      let orig_comment = blocking(context.pool(), move |conn| {
      })
      .await??;
  
--    check_community_ban(user.id, orig_comment.community.id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_comment.community.id, context.pool()).await?;
  
      // Verify that only the creator can delete
--    if user.id != orig_comment.creator.id {
++    if local_user_view.person.id != orig_comment.creator.id {
        return Err(ApiError::err("no_comment_edit_allowed").into());
      }
  
  
      // Send the apub message
      if deleted {
--      updated_comment.send_delete(&user, context).await?;
++      updated_comment.send_delete(&local_user_view.person, context).await?;
      } else {
--      updated_comment.send_undo_delete(&user, context).await?;
++      updated_comment.send_undo_delete(&local_user_view.person, context).await?;
      }
  
      // Refetch it
      let comment_id = data.comment_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let comment_view = blocking(context.pool(), move |conn| {
--      CommentView::read(conn, comment_id, Some(user_id))
++      CommentView::read(conn, comment_id, Some(person_id))
      })
      .await??;
  
      let recipient_ids = send_local_notifs(
        mentions,
        updated_comment,
--      &user,
++      local_user_view.person.clone(),
        comment_view_2.post,
        context.pool(),
        false,
@@@ -349,7 -349,7 +349,7 @@@ impl Perform for RemoveComment 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CommentResponse, LemmyError> {
      let data: &RemoveComment = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let comment_id = data.comment_id;
      let orig_comment = blocking(context.pool(), move |conn| {
      })
      .await??;
  
--    check_community_ban(user.id, orig_comment.community.id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_comment.community.id, context.pool()).await?;
  
      // Verify that only a mod or admin can remove
--    is_mod_or_admin(context.pool(), user.id, orig_comment.community.id).await?;
++    is_mod_or_admin(context.pool(), local_user_view.person.id, orig_comment.community.id).await?;
  
      // Do the remove
      let removed = data.removed;
  
      // Mod tables
      let form = ModRemoveCommentForm {
-       mod_person_id: user.id,
 -      mod_user_id: user.id,
++      mod_person_id: local_user_view.person.id,
        comment_id: data.comment_id,
        removed: Some(removed),
        reason: data.reason.to_owned(),
  
      // Send the apub message
      if removed {
--      updated_comment.send_remove(&user, context).await?;
++      updated_comment.send_remove(&local_user_view.person, context).await?;
      } else {
--      updated_comment.send_undo_remove(&user, context).await?;
++      updated_comment.send_undo_remove(&local_user_view.person, context).await?;
      }
  
      // Refetch it
      let comment_id = data.comment_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let comment_view = blocking(context.pool(), move |conn| {
--      CommentView::read(conn, comment_id, Some(user_id))
++      CommentView::read(conn, comment_id, Some(person_id))
      })
      .await??;
  
      let recipient_ids = send_local_notifs(
        mentions,
        updated_comment,
--      &user,
++      local_user_view.person.clone(),
        comment_view_2.post,
        context.pool(),
        false,
@@@ -440,7 -440,7 +440,7 @@@ impl Perform for MarkCommentAsRead 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<CommentResponse, LemmyError> {
      let data: &MarkCommentAsRead = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let comment_id = data.comment_id;
      let orig_comment = blocking(context.pool(), move |conn| {
      })
      .await??;
  
--    check_community_ban(user.id, orig_comment.community.id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_comment.community.id, context.pool()).await?;
  
      // Verify that only the recipient can mark as read
--    if user.id != orig_comment.get_recipient_id() {
++    if local_user_view.person.id != orig_comment.get_recipient_id() {
        return Err(ApiError::err("no_comment_edit_allowed").into());
      }
  
  
      // Refetch it
      let comment_id = data.comment_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let comment_view = blocking(context.pool(), move |conn| {
--      CommentView::read(conn, comment_id, Some(user_id))
++      CommentView::read(conn, comment_id, Some(person_id))
      })
      .await??;
  
@@@ -494,11 -494,11 +494,11 @@@ impl Perform for SaveComment 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<CommentResponse, LemmyError> {
      let data: &SaveComment = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let comment_saved_form = CommentSavedForm {
        comment_id: data.comment_id,
-       person_id: user.id,
 -      user_id: user.id,
++      person_id: local_user_view.person.id,
      };
  
      if data.save {
      }
  
      let comment_id = data.comment_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let comment_view = blocking(context.pool(), move |conn| {
--      CommentView::read(conn, comment_id, Some(user_id))
++      CommentView::read(conn, comment_id, Some(person_id))
      })
      .await??;
  
@@@ -538,7 -538,7 +538,7 @@@ impl Perform for CreateCommentLike 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CommentResponse, LemmyError> {
      let data: &CreateCommentLike = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let mut recipient_ids = Vec::new();
  
      })
      .await??;
  
--    check_community_ban(user.id, orig_comment.community.id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_comment.community.id, context.pool()).await?;
  
      // Add parent user to recipients
      recipient_ids.push(orig_comment.get_recipient_id());
      let like_form = CommentLikeForm {
        comment_id: data.comment_id,
        post_id: orig_comment.post.id,
-       person_id: user.id,
 -      user_id: user.id,
++      person_id: local_user_view.person.id,
        score: data.score,
      };
  
      // Remove any likes first
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      blocking(context.pool(), move |conn| {
--      CommentLike::remove(conn, user_id, comment_id)
++      CommentLike::remove(conn, person_id, comment_id)
      })
      .await??;
  
        }
  
        if like_form.score == 1 {
--        comment.send_like(&user, context).await?;
++        comment.send_like(&local_user_view.person, context).await?;
        } else if like_form.score == -1 {
--        comment.send_dislike(&user, context).await?;
++        comment.send_dislike(&local_user_view.person, context).await?;
        }
      } else {
--      comment.send_undo_like(&user, context).await?;
++      comment.send_undo_like(&local_user_view.person, context).await?;
      }
  
      // Have to refetch the comment to get the current state
      let comment_id = data.comment_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let liked_comment = blocking(context.pool(), move |conn| {
--      CommentView::read(conn, comment_id, Some(user_id))
++      CommentView::read(conn, comment_id, Some(person_id))
      })
      .await??;
  
@@@ -623,8 -623,8 +623,8 @@@ impl Perform for GetComments 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetCommentsResponse, LemmyError> {
      let data: &GetComments = &self;
--    let user = get_user_from_jwt_opt(&data.auth, context.pool()).await?;
--    let user_id = user.map(|u| u.id);
++    let local_user_view = get_local_user_view_from_jwt_opt(&data.auth, context.pool()).await?;
++    let person_id = local_user_view.map(|u| u.person.id);
  
      let type_ = ListingType::from_str(&data.type_)?;
      let sort = SortType::from_str(&data.sort)?;
          .sort(&sort)
          .community_id(community_id)
          .community_name(community_name)
--        .my_user_id(user_id)
++        .my_person_id(person_id)
          .page(page)
          .limit(limit)
          .list()
@@@ -665,7 -665,7 +665,7 @@@ impl Perform for CreateCommentReport 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CreateCommentReportResponse, LemmyError> {
      let data: &CreateCommentReport = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // check size of report and check for whitespace
      let reason = data.reason.trim();
        return Err(ApiError::err("report_too_long").into());
      }
  
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let comment_id = data.comment_id;
      let comment_view = blocking(context.pool(), move |conn| {
        CommentView::read(&conn, comment_id, None)
      })
      .await??;
  
--    check_community_ban(user_id, comment_view.community.id, context.pool()).await?;
++    check_community_ban(person_id, comment_view.community.id, context.pool()).await?;
  
      let report_form = CommentReportForm {
--      creator_id: user_id,
++      creator_id: person_id,
        comment_id,
        original_comment_text: comment_view.comment.content,
        reason: data.reason.to_owned(),
      context.chat_server().do_send(SendUserRoomMessage {
        op: UserOperation::CreateCommentReport,
        response: res.clone(),
--      recipient_id: user.id,
++      recipient_id: local_user_view.person.id,
        websocket_id,
      });
  
@@@ -732,7 -732,7 +732,7 @@@ impl Perform for ResolveCommentReport 
      websocket_id: Option<ConnectionId>,
    ) -> Result<ResolveCommentReportResponse, LemmyError> {
      let data: &ResolveCommentReport = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let report_id = data.report_id;
      let report = blocking(context.pool(), move |conn| {
      })
      .await??;
  
--    let user_id = user.id;
--    is_mod_or_admin(context.pool(), user_id, report.community.id).await?;
++    let person_id = local_user_view.person.id;
++    is_mod_or_admin(context.pool(), person_id, report.community.id).await?;
  
      let resolved = data.resolved;
      let resolve_fun = move |conn: &'_ _| {
        if resolved {
--        CommentReport::resolve(conn, report_id, user_id)
++        CommentReport::resolve(conn, report_id, person_id)
        } else {
--        CommentReport::unresolve(conn, report_id, user_id)
++        CommentReport::unresolve(conn, report_id, person_id)
        }
      };
  
@@@ -785,12 -785,12 +785,12 @@@ impl Perform for ListCommentReports 
      websocket_id: Option<ConnectionId>,
    ) -> Result<ListCommentReportsResponse, LemmyError> {
      let data: &ListCommentReports = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let community_id = data.community;
      let community_ids =
--      collect_moderated_communities(user_id, community_id, context.pool()).await?;
++      collect_moderated_communities(person_id, community_id, context.pool()).await?;
  
      let page = data.page;
      let limit = data.limit;
      context.chat_server().do_send(SendUserRoomMessage {
        op: UserOperation::ListCommentReports,
        response: res.clone(),
--      recipient_id: user.id,
++      recipient_id: local_user_view.person.id,
        websocket_id,
      });
  
index 40dc345ec336ad47ac1b13d3abfd2b56bbc65308,cee5d3710d643edc368e1c558942c04218ff0824..6949a4a9994418c7eb01126b8234a4b0f7f8fe19
@@@ -1,8 -1,7 +1,7 @@@
  use crate::{
    check_community_ban,
-   check_optional_url,
--  get_user_from_jwt,
--  get_user_from_jwt_opt,
++  get_local_user_view_from_jwt,
++  get_local_user_view_from_jwt_opt,
    is_admin,
    is_mod_or_admin,
    Perform,
@@@ -41,9 -41,8 +41,8 @@@ use lemmy_db_views_actor::
    community_follower_view::CommunityFollowerView,
    community_moderator_view::CommunityModeratorView,
    community_view::{CommunityQueryBuilder, CommunityView},
--  user_view::UserViewSafe,
++  person_view::PersonViewSafe,
  };
- use lemmy_structs::{blocking, community::*};
  use lemmy_utils::{
    apub::generate_actor_keypair,
    location_info,
@@@ -69,8 -68,8 +68,8 @@@ impl Perform for GetCommunity 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetCommunityResponse, LemmyError> {
      let data: &GetCommunity = &self;
--    let user = get_user_from_jwt_opt(&data.auth, context.pool()).await?;
--    let user_id = user.map(|u| u.id);
++    let local_user_view = get_local_user_view_from_jwt_opt(&data.auth, context.pool()).await?;
++    let person_id = local_user_view.map(|u| u.person.id);
  
      let community_id = match data.id {
        Some(id) => id,
@@@ -89,7 -88,7 +88,7 @@@
      };
  
      let community_view = match blocking(context.pool(), move |conn| {
--      CommunityView::read(conn, community_id, user_id)
++      CommunityView::read(conn, community_id, person_id)
      })
      .await?
      {
@@@ -133,7 -132,7 +132,7 @@@ impl Perform for CreateCommunity 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<CommunityResponse, LemmyError> {
      let data: &CreateCommunity = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      check_slurs(&data.name)?;
      check_slurs(&data.title)?;
        description: data.description.to_owned(),
        icon,
        banner,
--      creator_id: user.id,
++      creator_id: local_user_view.person.id,
        removed: None,
        deleted: None,
        nsfw: data.nsfw,
      // The community creator becomes a moderator
      let community_moderator_form = CommunityModeratorForm {
        community_id: inserted_community.id,
-       person_id: user.id,
 -      user_id: user.id,
++      person_id: local_user_view.person.id,
      };
  
      let join = move |conn: &'_ _| CommunityModerator::join(conn, &community_moderator_form);
      // Follow your own community
      let community_follower_form = CommunityFollowerForm {
        community_id: inserted_community.id,
-       person_id: user.id,
 -      user_id: user.id,
++      person_id: local_user_view.person.id,
        pending: false,
      };
  
        return Err(ApiError::err("community_follower_already_exists").into());
      }
  
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let community_view = blocking(context.pool(), move |conn| {
--      CommunityView::read(conn, inserted_community.id, Some(user_id))
++      CommunityView::read(conn, inserted_community.id, Some(person_id))
      })
      .await??;
  
@@@ -238,7 -234,7 +234,7 @@@ impl Perform for EditCommunity 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CommunityResponse, LemmyError> {
      let data: &EditCommunity = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      check_slurs(&data.title)?;
      check_slurs_opt(&data.description)?;
          .map(|v| v.into_iter().map(|m| m.moderator.id).collect())
      })
      .await??;
--    if !mods.contains(&user.id) {
++    if !mods.contains(&local_user_view.person.id) {
        return Err(ApiError::err("not_a_moderator").into());
      }
  
      // process for communities and users
  
      let community_id = data.community_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let community_view = blocking(context.pool(), move |conn| {
--      CommunityView::read(conn, community_id, Some(user_id))
++      CommunityView::read(conn, community_id, Some(person_id))
      })
      .await??;
  
@@@ -326,7 -319,7 +319,7 @@@ impl Perform for DeleteCommunity 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CommunityResponse, LemmyError> {
      let data: &DeleteCommunity = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Verify its the creator (only a creator can delete the community)
      let community_id = data.community_id;
        Community::read(conn, community_id)
      })
      .await??;
--    if read_community.creator_id != user.id {
++    if read_community.creator_id != local_user_view.person.id {
        return Err(ApiError::err("no_community_edit_allowed").into());
      }
  
      }
  
      let community_id = data.community_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let community_view = blocking(context.pool(), move |conn| {
--      CommunityView::read(conn, community_id, Some(user_id))
++      CommunityView::read(conn, community_id, Some(person_id))
      })
      .await??;
  
@@@ -382,10 -375,10 +375,10 @@@ impl Perform for RemoveCommunity 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CommunityResponse, LemmyError> {
      let data: &RemoveCommunity = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Verify its an admin (only an admin can remove a community)
--    is_admin(context.pool(), user.id).await?;
++    is_admin(&local_user_view)?;
  
      // Do the remove
      let community_id = data.community_id;
        None => None,
      };
      let form = ModRemoveCommunityForm {
-       mod_person_id: user.id,
 -      mod_user_id: user.id,
++      mod_person_id: local_user_view.person.id,
        community_id: data.community_id,
        removed: Some(removed),
        reason: data.reason.to_owned(),
      }
  
      let community_id = data.community_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let community_view = blocking(context.pool(), move |conn| {
--      CommunityView::read(conn, community_id, Some(user_id))
++      CommunityView::read(conn, community_id, Some(person_id))
      })
      .await??;
  
@@@ -448,15 -441,15 +441,16 @@@ impl Perform for ListCommunities 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<ListCommunitiesResponse, LemmyError> {
      let data: &ListCommunities = &self;
--    let user = get_user_from_jwt_opt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt_opt(&data.auth, context.pool()).await?;
  
--    let user_id = match &user {
--      Some(user) => Some(user.id),
++    let person_id = match &local_user_view {
++      Some(uv) => Some(uv.person.id),
        None => None,
      };
  
--    let show_nsfw = match &user {
--      Some(user) => user.show_nsfw,
++    // Don't show NSFW by default
++    let show_nsfw = match &local_user_view {
++      Some(uv) => uv.local_user.show_nsfw,
        None => false,
      };
  
          .listing_type(&type_)
          .sort(&sort)
          .show_nsfw(show_nsfw)
--        .my_user_id(user_id)
++        .my_person_id(person_id)
          .page(page)
          .limit(limit)
          .list()
@@@ -492,7 -485,7 +486,7 @@@ impl Perform for FollowCommunity 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<CommunityResponse, LemmyError> {
      let data: &FollowCommunity = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let community_id = data.community_id;
      let community = blocking(context.pool(), move |conn| {
      .await??;
      let community_follower_form = CommunityFollowerForm {
        community_id: data.community_id,
-       person_id: user.id,
 -      user_id: user.id,
++      person_id: local_user_view.person.id,
        pending: false,
      };
  
      if community.local {
        if data.follow {
--        check_community_ban(user.id, community_id, context.pool()).await?;
++        check_community_ban(local_user_view.person.id, community_id, context.pool()).await?;
  
          let follow = move |conn: &'_ _| CommunityFollower::follow(conn, &community_follower_form);
          if blocking(context.pool(), follow).await?.is_err() {
      } else if data.follow {
        // Dont actually add to the community followers here, because you need
        // to wait for the accept
--      user.send_follow(&community.actor_id(), context).await?;
++      local_user_view.person.send_follow(&community.actor_id(), context).await?;
      } else {
--      user.send_unfollow(&community.actor_id(), context).await?;
++      local_user_view.person.send_unfollow(&community.actor_id(), context).await?;
        let unfollow = move |conn: &'_ _| CommunityFollower::unfollow(conn, &community_follower_form);
        if blocking(context.pool(), unfollow).await?.is_err() {
          return Err(ApiError::err("community_follower_already_exists").into());
      }
  
      let community_id = data.community_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let mut community_view = blocking(context.pool(), move |conn| {
--      CommunityView::read(conn, community_id, Some(user_id))
++      CommunityView::read(conn, community_id, Some(person_id))
      })
      .await??;
  
@@@ -560,11 -553,11 +554,11 @@@ impl Perform for GetFollowedCommunitie
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetFollowedCommunitiesResponse, LemmyError> {
      let data: &GetFollowedCommunities = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let communities = match blocking(context.pool(), move |conn| {
--      CommunityFollowerView::for_user(conn, user_id)
++      CommunityFollowerView::for_person(conn, person_id)
      })
      .await?
      {
@@@ -587,17 -580,17 +581,17 @@@ impl Perform for BanFromCommunity 
      websocket_id: Option<ConnectionId>,
    ) -> Result<BanFromCommunityResponse, LemmyError> {
      let data: &BanFromCommunity = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let community_id = data.community_id;
--    let banned_user_id = data.user_id;
++    let banned_person_id = data.person_id;
  
      // Verify that only mods or admins can ban
--    is_mod_or_admin(context.pool(), user.id, community_id).await?;
++    is_mod_or_admin(context.pool(), local_user_view.person.id, community_id).await?;
  
 -    let community_user_ban_form = CommunityUserBanForm {
 +    let community_user_ban_form = CommunityPersonBanForm {
        community_id: data.community_id,
-       person_id: data.user_id,
 -      user_id: data.user_id,
++      person_id: data.person_id,
      };
  
      if data.ban {
        // Also unsubscribe them from the community, if they are subscribed
        let community_follower_form = CommunityFollowerForm {
          community_id: data.community_id,
-         person_id: banned_user_id,
 -        user_id: banned_user_id,
++        person_id: banned_person_id,
          pending: false,
        };
        blocking(context.pool(), move |conn: &'_ _| {
      if data.remove_data {
        // Posts
        blocking(context.pool(), move |conn: &'_ _| {
--        Post::update_removed_for_creator(conn, banned_user_id, Some(community_id), true)
++        Post::update_removed_for_creator(conn, banned_person_id, Some(community_id), true)
        })
        .await??;
  
        // TODO Diesel doesn't allow updates with joins, so this has to be a loop
        let comments = blocking(context.pool(), move |conn| {
          CommentQueryBuilder::create(conn)
--          .creator_id(banned_user_id)
++          .creator_id(banned_person_id)
            .community_id(community_id)
            .limit(std::i64::MAX)
            .list()
      };
  
      let form = ModBanFromCommunityForm {
-       mod_person_id: user.id,
-       other_person_id: data.user_id,
 -      mod_user_id: user.id,
 -      other_user_id: data.user_id,
++      mod_person_id: local_user_view.person.id,
++      other_person_id: data.person_id,
        community_id: data.community_id,
        reason: data.reason.to_owned(),
        banned: Some(data.ban),
      })
      .await??;
  
--    let user_id = data.user_id;
--    let user_view = blocking(context.pool(), move |conn| {
--      UserViewSafe::read(conn, user_id)
++    let person_id = data.person_id;
++    let person_view = blocking(context.pool(), move |conn| {
++      PersonViewSafe::read(conn, person_id)
      })
      .await??;
  
      let res = BanFromCommunityResponse {
--      user_view,
++      person_view,
        banned: data.ban,
      };
  
@@@ -704,17 -697,17 +698,17 @@@ impl Perform for AddModToCommunity 
      websocket_id: Option<ConnectionId>,
    ) -> Result<AddModToCommunityResponse, LemmyError> {
      let data: &AddModToCommunity = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let community_moderator_form = CommunityModeratorForm {
        community_id: data.community_id,
-       person_id: data.user_id,
 -      user_id: data.user_id,
++      person_id: data.person_id,
      };
  
      let community_id = data.community_id;
  
      // Verify that only mods or admins can add mod
--    is_mod_or_admin(context.pool(), user.id, community_id).await?;
++    is_mod_or_admin(context.pool(), local_user_view.person.id, community_id).await?;
  
      if data.added {
        let join = move |conn: &'_ _| CommunityModerator::join(conn, &community_moderator_form);
  
      // Mod tables
      let form = ModAddCommunityForm {
-       mod_person_id: user.id,
-       other_person_id: data.user_id,
 -      mod_user_id: user.id,
 -      other_user_id: data.user_id,
++      mod_person_id: local_user_view.person.id,
++      other_person_id: data.person_id,
        community_id: data.community_id,
        removed: Some(!data.added),
      };
@@@ -769,7 -762,7 +763,7 @@@ impl Perform for TransferCommunity 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetCommunityResponse, LemmyError> {
      let data: &TransferCommunity = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let community_id = data.community_id;
      let read_community = blocking(context.pool(), move |conn| {
      })
      .await??;
  
--    let mut admins = blocking(context.pool(), move |conn| UserViewSafe::admins(conn)).await??;
++    let mut admins = blocking(context.pool(), move |conn| PersonViewSafe::admins(conn)).await??;
  
      // Making sure the creator, if an admin, is at the top
      let creator_index = admins
        .iter()
--      .position(|r| r.user.id == site_creator_id)
++      .position(|r| r.person.id == site_creator_id)
        .context(location_info!())?;
--    let creator_user = admins.remove(creator_index);
--    admins.insert(0, creator_user);
++    let creator_person = admins.remove(creator_index);
++    admins.insert(0, creator_person);
  
      // Make sure user is the creator, or an admin
--    if user.id != read_community.creator_id
--      && !admins.iter().map(|a| a.user.id).any(|x| x == user.id)
++    if local_user_view.person.id != read_community.creator_id
++      && !admins.iter().map(|a| a.person.id).any(|x| x == local_user_view.person.id)
      {
        return Err(ApiError::err("not_an_admin").into());
      }
  
      let community_id = data.community_id;
--    let new_creator = data.user_id;
++    let new_creator = data.person_id;
      let update = move |conn: &'_ _| Community::update_creator(conn, community_id, new_creator);
      if blocking(context.pool(), update).await?.is_err() {
        return Err(ApiError::err("couldnt_update_community").into());
      .await??;
      let creator_index = community_mods
        .iter()
--      .position(|r| r.moderator.id == data.user_id)
++      .position(|r| r.moderator.id == data.person_id)
        .context(location_info!())?;
--    let creator_user = community_mods.remove(creator_index);
--    community_mods.insert(0, creator_user);
++    let creator_person = community_mods.remove(creator_index);
++    community_mods.insert(0, creator_person);
  
      let community_id = data.community_id;
      blocking(context.pool(), move |conn| {
  
      // Mod tables
      let form = ModAddCommunityForm {
-       mod_person_id: user.id,
-       other_person_id: data.user_id,
 -      mod_user_id: user.id,
 -      other_user_id: data.user_id,
++      mod_person_id: local_user_view.person.id,
++      other_person_id: data.person_id,
        community_id: data.community_id,
        removed: Some(false),
      };
      .await??;
  
      let community_id = data.community_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let community_view = match blocking(context.pool(), move |conn| {
--      CommunityView::read(conn, community_id, Some(user_id))
++      CommunityView::read(conn, community_id, Some(person_id))
      })
      .await?
      {
@@@ -886,7 -879,7 +880,7 @@@ fn send_community_websocket
    websocket_id: Option<ConnectionId>,
    op: UserOperation,
  ) {
--  // Strip out the user id and subscribed when sending to others
++  // Strip out the person id and subscribed when sending to others
    let mut res_sent = res.clone();
    res_sent.community_view.subscribed = false;
  
index ab0bc8ac1f9801dc9c75ba8ee2de039870851898,d87375ca7512db5995d7f727db862a9533b9680a..3fe3bc7ab1b07084c4955e3195b4eb79253dfe33
@@@ -1,9 -1,18 +1,19 @@@
  use actix_web::{web, web::Data};
 -  user::*,
+ use lemmy_api_structs::{
+   blocking,
+   comment::*,
+   community::*,
+   post::*,
+   site::*,
++  person::*,
+   websocket::*,
+ };
  use lemmy_db_queries::{
    source::{
      community::{CommunityModerator_, Community_},
      site::Site_,
--    user::UserSafeSettings_,
++    local_user::LocalUserSettings_,
++    local_user::LocalUser_,
    },
    Crud,
    DbPool,
@@@ -12,14 -21,19 +22,22 @@@ use lemmy_db_schema::source::
    community::{Community, CommunityModerator},
    post::Post,
    site::Site,
--  user::{UserSafeSettings, User_},
++  person::{Person, PersonSafe},
++  local_user::LocalUserSettings,
++  local_user::LocalUser,
  };
  use lemmy_db_views_actor::{
--  community_user_ban_view::CommunityUserBanView,
++  community_person_ban_view::CommunityPersonBanView,
    community_view::CommunityView,
  };
- use lemmy_structs::{blocking, comment::*, community::*, post::*, site::*, user::*, websocket::*};
- use lemmy_utils::{claims::Claims, settings::Settings, ApiError, ConnectionId, LemmyError};
++use lemmy_db_views::local_user_view::{LocalUserView, LocalUserSettingsView};
+ use lemmy_utils::{
+   claims::Claims,
+   settings::structs::Settings,
+   ApiError,
+   ConnectionId,
+   LemmyError,
+ };
  use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperation};
  use serde::Deserialize;
  use std::process::Command;
@@@ -46,11 -60,11 +64,11 @@@ pub trait Perform 
  
  pub(crate) async fn is_mod_or_admin(
    pool: &DbPool,
--  user_id: i32,
++  person_id: i32,
    community_id: i32,
  ) -> Result<(), LemmyError> {
    let is_mod_or_admin = blocking(pool, move |conn| {
--    CommunityView::is_mod_or_admin(conn, user_id, community_id)
++    CommunityView::is_mod_or_admin(conn, person_id, community_id)
    })
    .await?;
    if !is_mod_or_admin {
    }
    Ok(())
  }
--pub async fn is_admin(pool: &DbPool, user_id: i32) -> Result<(), LemmyError> {
--  let user = blocking(pool, move |conn| User_::read(conn, user_id)).await??;
--  if !user.admin {
++
++// TODO this probably isn't necessary anymore
++// pub async fn is_admin(pool: &DbPool, person_id: i32) -> Result<(), LemmyError> {
++//   let user = blocking(pool, move |conn| LocalUser::read(conn, person_id)).await??;
++//   if !user.admin {
++//     return Err(ApiError::err("not_an_admin").into());
++//   }
++//   Ok(())
++// }
++
++pub fn is_admin(local_user_view: &LocalUserView) -> Result<(), LemmyError> {
++  if !local_user_view.local_user.admin {
      return Err(ApiError::err("not_an_admin").into());
    }
    Ok(())
@@@ -73,63 -87,63 +100,60 @@@ pub(crate) async fn get_post(post_id: i
    }
  }
  
--pub(crate) async fn get_user_from_jwt(jwt: &str, pool: &DbPool) -> Result<User_, LemmyError> {
++pub(crate) async fn get_local_user_view_from_jwt(jwt: &str, pool: &DbPool) -> Result<LocalUserView, LemmyError> {
    let claims = match Claims::decode(&jwt) {
      Ok(claims) => claims.claims,
      Err(_e) => return Err(ApiError::err("not_logged_in").into()),
    };
--  let user_id = claims.id;
--  let user = blocking(pool, move |conn| User_::read(conn, user_id)).await??;
++  let person_id = claims.id;
++  let local_user_view = blocking(pool, move |conn| LocalUserView::read(conn, person_id)).await??;
    // Check for a site ban
--  if user.banned {
++  if local_user_view.person.banned {
      return Err(ApiError::err("site_ban").into());
    }
--  Ok(user)
++  Ok(local_user_view)
  }
  
--pub(crate) async fn get_user_from_jwt_opt(
++pub(crate) async fn get_local_user_view_from_jwt_opt(
    jwt: &Option<String>,
    pool: &DbPool,
--) -> Result<Option<User_>, LemmyError> {
++) -> Result<Option<LocalUserView>, LemmyError> {
    match jwt {
--    Some(jwt) => Ok(Some(get_user_from_jwt(jwt, pool).await?)),
++    Some(jwt) => Ok(Some(get_local_user_view_from_jwt(jwt, pool).await?)),
      None => Ok(None),
    }
  }
  
--pub(crate) async fn get_user_safe_settings_from_jwt(
--  jwt: &str,
--  pool: &DbPool,
--) -> Result<UserSafeSettings, LemmyError> {
++pub(crate) async fn get_local_user_settings_view_from_jwt(jwt: &str, pool: &DbPool) -> Result<LocalUserSettingsView, LemmyError> {
    let claims = match Claims::decode(&jwt) {
      Ok(claims) => claims.claims,
      Err(_e) => return Err(ApiError::err("not_logged_in").into()),
    };
--  let user_id = claims.id;
--  let user = blocking(pool, move |conn| UserSafeSettings::read(conn, user_id)).await??;
++  let person_id = claims.id;
++  let local_user_view = blocking(pool, move |conn| LocalUserSettingsView::read(conn, person_id)).await??;
    // Check for a site ban
--  if user.banned {
++  if local_user_view.person.banned {
      return Err(ApiError::err("site_ban").into());
    }
--  Ok(user)
++  Ok(local_user_view)
  }
  
--pub(crate) async fn get_user_safe_settings_from_jwt_opt(
++pub(crate) async fn get_local_user_settings_view_from_jwt_opt(
    jwt: &Option<String>,
    pool: &DbPool,
--) -> Result<Option<UserSafeSettings>, LemmyError> {
++) -> Result<Option<LocalUserSettingsView>, LemmyError> {
    match jwt {
--    Some(jwt) => Ok(Some(get_user_safe_settings_from_jwt(jwt, pool).await?)),
++    Some(jwt) => Ok(Some(get_local_user_settings_view_from_jwt(jwt, pool).await?)),
      None => Ok(None),
    }
  }
  
  pub(crate) async fn check_community_ban(
--  user_id: i32,
++  person_id: i32,
    community_id: i32,
    pool: &DbPool,
  ) -> Result<(), LemmyError> {
--  let is_banned = move |conn: &'_ _| CommunityUserBanView::get(conn, user_id, community_id).is_ok();
++  let is_banned = move |conn: &'_ _| CommunityPersonBanView::get(conn, person_id, community_id).is_ok();
    if blocking(pool, is_banned).await? {
      Err(ApiError::err("community_ban").into())
    } else {
@@@ -226,17 -236,17 +246,17 @@@ pub async fn match_websocket_operation
      UserOperation::Login => do_websocket_operation::<Login>(context, id, op, data).await,
      UserOperation::Register => do_websocket_operation::<Register>(context, id, op, data).await,
      UserOperation::GetCaptcha => do_websocket_operation::<GetCaptcha>(context, id, op, data).await,
--    UserOperation::GetUserDetails => {
--      do_websocket_operation::<GetUserDetails>(context, id, op, data).await
++    UserOperation::GetPersonDetails => {
++      do_websocket_operation::<GetPersonDetails>(context, id, op, data).await
      }
      UserOperation::GetReplies => do_websocket_operation::<GetReplies>(context, id, op, data).await,
      UserOperation::AddAdmin => do_websocket_operation::<AddAdmin>(context, id, op, data).await,
--    UserOperation::BanUser => do_websocket_operation::<BanUser>(context, id, op, data).await,
--    UserOperation::GetUserMentions => {
--      do_websocket_operation::<GetUserMentions>(context, id, op, data).await
++    UserOperation::BanPerson => do_websocket_operation::<BanPerson>(context, id, op, data).await,
++    UserOperation::GetPersonMentions => {
++      do_websocket_operation::<GetPersonMentions>(context, id, op, data).await
      }
--    UserOperation::MarkUserMentionAsRead => {
--      do_websocket_operation::<MarkUserMentionAsRead>(context, id, op, data).await
++    UserOperation::MarkPersonMentionAsRead => {
++      do_websocket_operation::<MarkPersonMentionAsRead>(context, id, op, data).await
      }
      UserOperation::MarkAllAsRead => {
        do_websocket_operation::<MarkAllAsRead>(context, id, op, data).await
index 33983a4e1cc72bd84923618450ecf87b65214fea,202ea30b33c56acd16d151a71c0e62dafcb8a972..92226171583fe77d31f3b94f4715339e3fc82566
@@@ -1,10 -1,9 +1,9 @@@
  use crate::{
    check_community_ban,
    check_downvotes_enabled,
-   check_optional_url,
    collect_moderated_communities,
--  get_user_from_jwt,
--  get_user_from_jwt_opt,
++  get_local_user_view_from_jwt,
++  get_local_user_view_from_jwt_opt,
    is_mod_or_admin,
    Perform,
  };
@@@ -61,7 -60,7 +60,7 @@@ impl Perform for CreatePost 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PostResponse, LemmyError> {
      let data: &CreatePost = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      check_slurs(&data.name)?;
      check_slurs_opt(&data.body)?;
        return Err(ApiError::err("invalid_post_title").into());
      }
  
--    check_community_ban(user.id, data.community_id, context.pool()).await?;
-     check_optional_url(&Some(data.url.to_owned()))?;
++    check_community_ban(local_user_view.person.id, data.community_id, context.pool()).await?;
  
      // Fetch Iframely and pictrs cached image
+     let data_url = data.url.as_ref();
      let (iframely_title, iframely_description, iframely_html, pictrs_thumbnail) =
-       fetch_iframely_and_pictrs_data(context.client(), data.url.to_owned()).await;
+       fetch_iframely_and_pictrs_data(context.client(), data_url).await;
  
      let post_form = PostForm {
        name: data.name.trim().to_owned(),
-       url: data.url.to_owned(),
+       url: data_url.map(|u| u.to_owned().into()),
        body: data.body.to_owned(),
        community_id: data.community_id,
--      creator_id: user.id,
++      creator_id: local_user_view.person.id,
        removed: None,
        deleted: None,
        nsfw: data.nsfw,
        Err(_e) => return Err(ApiError::err("couldnt_create_post").into()),
      };
  
--    updated_post.send_create(&user, context).await?;
++    updated_post.send_create(&local_user_view.person, context).await?;
  
      // They like their own post by default
      let like_form = PostLikeForm {
        post_id: inserted_post.id,
-       person_id: user.id,
 -      user_id: user.id,
++      person_id: local_user_view.person.id,
        score: 1,
      };
  
        return Err(ApiError::err("couldnt_like_post").into());
      }
  
--    updated_post.send_like(&user, context).await?;
++    updated_post.send_like(&local_user_view.person, context).await?;
  
      // Refetch the view
      let inserted_post_id = inserted_post.id;
      let post_view = match blocking(context.pool(), move |conn| {
--      PostView::read(conn, inserted_post_id, Some(user.id))
++      PostView::read(conn, inserted_post_id, Some(local_user_view.person.id))
      })
      .await?
      {
@@@ -173,12 -171,12 +171,12 @@@ impl Perform for GetPost 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetPostResponse, LemmyError> {
      let data: &GetPost = &self;
--    let user = get_user_from_jwt_opt(&data.auth, context.pool()).await?;
--    let user_id = user.map(|u| u.id);
++    let local_user_view = get_local_user_view_from_jwt_opt(&data.auth, context.pool()).await?;
++    let person_id = local_user_view.map(|u| u.person.id);
  
      let id = data.id;
      let post_view = match blocking(context.pool(), move |conn| {
--      PostView::read(conn, id, user_id)
++      PostView::read(conn, id, person_id)
      })
      .await?
      {
      let id = data.id;
      let comments = blocking(context.pool(), move |conn| {
        CommentQueryBuilder::create(conn)
--        .my_user_id(user_id)
++        .my_person_id(person_id)
          .post_id(id)
          .limit(9999)
          .list()
  
      // Necessary for the sidebar
      let community_view = match blocking(context.pool(), move |conn| {
--      CommunityView::read(conn, community_id, user_id)
++      CommunityView::read(conn, community_id, person_id)
      })
      .await?
      {
@@@ -239,15 -237,15 +237,15 @@@ impl Perform for GetPosts 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetPostsResponse, LemmyError> {
      let data: &GetPosts = &self;
--    let user = get_user_from_jwt_opt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt_opt(&data.auth, context.pool()).await?;
  
--    let user_id = match &user {
--      Some(user) => Some(user.id),
++    let person_id = match &local_user_view {
++      Some(uv) => Some(uv.person.id),
        None => None,
      };
  
--    let show_nsfw = match &user {
--      Some(user) => user.show_nsfw,
++    let show_nsfw = match &local_user_view {
++      Some(uv) => uv.local_user.show_nsfw,
        None => false,
      };
  
          .show_nsfw(show_nsfw)
          .community_id(community_id)
          .community_name(community_name)
--        .my_user_id(user_id)
++        .my_person_id(person_id)
          .page(page)
          .limit(limit)
          .list()
@@@ -290,7 -288,7 +288,7 @@@ impl Perform for CreatePostLike 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PostResponse, LemmyError> {
      let data: &CreatePostLike = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Don't do a downvote if site has downvotes disabled
      check_downvotes_enabled(data.score, context.pool()).await?;
      let post_id = data.post_id;
      let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
--    check_community_ban(user.id, post.community_id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, post.community_id, context.pool()).await?;
  
      let like_form = PostLikeForm {
        post_id: data.post_id,
-       person_id: user.id,
 -      user_id: user.id,
++      person_id: local_user_view.person.id,
        score: data.score,
      };
  
      // Remove any likes first
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      blocking(context.pool(), move |conn| {
--      PostLike::remove(conn, user_id, post_id)
++      PostLike::remove(conn, person_id, post_id)
      })
      .await??;
  
        }
  
        if like_form.score == 1 {
--        post.send_like(&user, context).await?;
++        post.send_like(&local_user_view.person, context).await?;
        } else if like_form.score == -1 {
--        post.send_dislike(&user, context).await?;
++        post.send_dislike(&local_user_view.person, context).await?;
        }
      } else {
--      post.send_undo_like(&user, context).await?;
++      post.send_undo_like(&local_user_view.person, context).await?;
      }
  
      let post_id = data.post_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let post_view = match blocking(context.pool(), move |conn| {
--      PostView::read(conn, post_id, Some(user_id))
++      PostView::read(conn, post_id, Some(person_id))
      })
      .await?
      {
@@@ -365,7 -363,7 +363,7 @@@ impl Perform for EditPost 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PostResponse, LemmyError> {
      let data: &EditPost = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      check_slurs(&data.name)?;
      check_slurs_opt(&data.body)?;
      let post_id = data.post_id;
      let orig_post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
--    check_community_ban(user.id, orig_post.community_id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_post.community_id, context.pool()).await?;
  
      // Verify that only the creator can edit
--    if !Post::is_post_creator(user.id, orig_post.creator_id) {
++    if !Post::is_post_creator(local_user_view.person.id, orig_post.creator_id) {
        return Err(ApiError::err("no_post_edit_allowed").into());
      }
  
      };
  
      // Send apub update
--    updated_post.send_update(&user, context).await?;
++    updated_post.send_update(&local_user_view.person, context).await?;
  
      let post_id = data.post_id;
      let post_view = blocking(context.pool(), move |conn| {
--      PostView::read(conn, post_id, Some(user.id))
++      PostView::read(conn, post_id, Some(local_user_view.person.id))
      })
      .await??;
  
@@@ -458,15 -457,15 +457,15 @@@ impl Perform for DeletePost 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PostResponse, LemmyError> {
      let data: &DeletePost = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let post_id = data.post_id;
      let orig_post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
--    check_community_ban(user.id, orig_post.community_id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_post.community_id, context.pool()).await?;
  
      // Verify that only the creator can delete
--    if !Post::is_post_creator(user.id, orig_post.creator_id) {
++    if !Post::is_post_creator(local_user_view.person.id, orig_post.creator_id) {
        return Err(ApiError::err("no_post_edit_allowed").into());
      }
  
  
      // apub updates
      if deleted {
--      updated_post.send_delete(&user, context).await?;
++      updated_post.send_delete(&local_user_view.person, context).await?;
      } else {
--      updated_post.send_undo_delete(&user, context).await?;
++      updated_post.send_undo_delete(&local_user_view.person, context).await?;
      }
  
      // Refetch the post
      let post_id = data.post_id;
      let post_view = blocking(context.pool(), move |conn| {
--      PostView::read(conn, post_id, Some(user.id))
++      PostView::read(conn, post_id, Some(local_user_view.person.id))
      })
      .await??;
  
@@@ -514,15 -513,15 +513,15 @@@ impl Perform for RemovePost 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PostResponse, LemmyError> {
      let data: &RemovePost = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let post_id = data.post_id;
      let orig_post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
--    check_community_ban(user.id, orig_post.community_id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_post.community_id, context.pool()).await?;
  
      // Verify that only the mods can remove
--    is_mod_or_admin(context.pool(), user.id, orig_post.community_id).await?;
++    is_mod_or_admin(context.pool(), local_user_view.person.id, orig_post.community_id).await?;
  
      // Update the post
      let post_id = data.post_id;
  
      // Mod tables
      let form = ModRemovePostForm {
-       mod_person_id: user.id,
 -      mod_user_id: user.id,
++      mod_person_id: local_user_view.person.id,
        post_id: data.post_id,
        removed: Some(removed),
        reason: data.reason.to_owned(),
  
      // apub updates
      if removed {
--      updated_post.send_remove(&user, context).await?;
++      updated_post.send_remove(&local_user_view.person, context).await?;
      } else {
--      updated_post.send_undo_remove(&user, context).await?;
++      updated_post.send_undo_remove(&local_user_view.person, context).await?;
      }
  
      // Refetch the post
      let post_id = data.post_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let post_view = blocking(context.pool(), move |conn| {
--      PostView::read(conn, post_id, Some(user_id))
++      PostView::read(conn, post_id, Some(person_id))
      })
      .await??;
  
@@@ -581,15 -580,15 +580,15 @@@ impl Perform for LockPost 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PostResponse, LemmyError> {
      let data: &LockPost = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let post_id = data.post_id;
      let orig_post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
--    check_community_ban(user.id, orig_post.community_id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_post.community_id, context.pool()).await?;
  
      // Verify that only the mods can lock
--    is_mod_or_admin(context.pool(), user.id, orig_post.community_id).await?;
++    is_mod_or_admin(context.pool(), local_user_view.person.id, orig_post.community_id).await?;
  
      // Update the post
      let post_id = data.post_id;
  
      // Mod tables
      let form = ModLockPostForm {
-       mod_person_id: user.id,
 -      mod_user_id: user.id,
++      mod_person_id: local_user_view.person.id,
        post_id: data.post_id,
        locked: Some(locked),
      };
      blocking(context.pool(), move |conn| ModLockPost::create(conn, &form)).await??;
  
      // apub updates
--    updated_post.send_update(&user, context).await?;
++    updated_post.send_update(&local_user_view.person, context).await?;
  
      // Refetch the post
      let post_id = data.post_id;
      let post_view = blocking(context.pool(), move |conn| {
--      PostView::read(conn, post_id, Some(user.id))
++      PostView::read(conn, post_id, Some(local_user_view.person.id))
      })
      .await??;
  
@@@ -639,15 -638,15 +638,15 @@@ impl Perform for StickyPost 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PostResponse, LemmyError> {
      let data: &StickyPost = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let post_id = data.post_id;
      let orig_post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
--    check_community_ban(user.id, orig_post.community_id, context.pool()).await?;
++    check_community_ban(local_user_view.person.id, orig_post.community_id, context.pool()).await?;
  
      // Verify that only the mods can sticky
--    is_mod_or_admin(context.pool(), user.id, orig_post.community_id).await?;
++    is_mod_or_admin(context.pool(), local_user_view.person.id, orig_post.community_id).await?;
  
      // Update the post
      let post_id = data.post_id;
  
      // Mod tables
      let form = ModStickyPostForm {
-       mod_person_id: user.id,
 -      mod_user_id: user.id,
++      mod_person_id: local_user_view.person.id,
        post_id: data.post_id,
        stickied: Some(stickied),
      };
  
      // Apub updates
      // TODO stickied should pry work like locked for ease of use
--    updated_post.send_update(&user, context).await?;
++    updated_post.send_update(&local_user_view.person, context).await?;
  
      // Refetch the post
      let post_id = data.post_id;
      let post_view = blocking(context.pool(), move |conn| {
--      PostView::read(conn, post_id, Some(user.id))
++      PostView::read(conn, post_id, Some(local_user_view.person.id))
      })
      .await??;
  
@@@ -701,11 -700,11 +700,11 @@@ impl Perform for SavePost 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<PostResponse, LemmyError> {
      let data: &SavePost = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let post_saved_form = PostSavedForm {
        post_id: data.post_id,
-       person_id: user.id,
 -      user_id: user.id,
++      person_id: local_user_view.person.id,
      };
  
      if data.save {
      }
  
      let post_id = data.post_id;
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let post_view = blocking(context.pool(), move |conn| {
--      PostView::read(conn, post_id, Some(user_id))
++      PostView::read(conn, post_id, Some(person_id))
      })
      .await??;
  
@@@ -742,7 -741,7 +741,7 @@@ impl Perform for CreatePostReport 
      websocket_id: Option<ConnectionId>,
    ) -> Result<CreatePostReportResponse, LemmyError> {
      let data: &CreatePostReport = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // check size of report and check for whitespace
      let reason = data.reason.trim();
        return Err(ApiError::err("report_too_long").into());
      }
  
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let post_id = data.post_id;
      let post_view = blocking(context.pool(), move |conn| {
        PostView::read(&conn, post_id, None)
      })
      .await??;
  
--    check_community_ban(user_id, post_view.community.id, context.pool()).await?;
++    check_community_ban(person_id, post_view.community.id, context.pool()).await?;
  
      let report_form = PostReportForm {
--      creator_id: user_id,
++      creator_id: person_id,
        post_id,
        original_post_name: post_view.post.name,
        original_post_url: post_view.post.url,
      context.chat_server().do_send(SendUserRoomMessage {
        op: UserOperation::CreatePostReport,
        response: res.clone(),
--      recipient_id: user.id,
++      recipient_id: local_user_view.person.id,
        websocket_id,
      });
  
@@@ -811,7 -810,7 +810,7 @@@ impl Perform for ResolvePostReport 
      websocket_id: Option<ConnectionId>,
    ) -> Result<ResolvePostReportResponse, LemmyError> {
      let data: &ResolvePostReport = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let report_id = data.report_id;
      let report = blocking(context.pool(), move |conn| {
      })
      .await??;
  
--    let user_id = user.id;
--    is_mod_or_admin(context.pool(), user_id, report.community.id).await?;
++    let person_id = local_user_view.person.id;
++    is_mod_or_admin(context.pool(), person_id, report.community.id).await?;
  
      let resolved = data.resolved;
      let resolve_fun = move |conn: &'_ _| {
        if resolved {
--        PostReport::resolve(conn, report_id, user_id)
++        PostReport::resolve(conn, report_id, person_id)
        } else {
--        PostReport::unresolve(conn, report_id, user_id)
++        PostReport::unresolve(conn, report_id, person_id)
        }
      };
  
@@@ -863,12 -862,12 +862,12 @@@ impl Perform for ListPostReports 
      websocket_id: Option<ConnectionId>,
    ) -> Result<ListPostReportsResponse, LemmyError> {
      let data: &ListPostReports = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
--    let user_id = user.id;
++    let person_id = local_user_view.person.id;
      let community_id = data.community;
      let community_ids =
--      collect_moderated_communities(user_id, community_id, context.pool()).await?;
++      collect_moderated_communities(person_id, community_id, context.pool()).await?;
  
      let page = data.page;
      let limit = data.limit;
      context.chat_server().do_send(SendUserRoomMessage {
        op: UserOperation::ListPostReports,
        response: res.clone(),
--      recipient_id: user.id,
++      recipient_id: local_user_view.person.id,
        websocket_id,
      });
  
index 7ca609f1ac40f668f81dfee3a836ddf834d1497e,a64e0bffd0621b8240be16a68e30864b4359c88f..0c70dc0d3b47f621a97b97863c30b5709d4788ed
@@@ -1,6 -1,6 +1,6 @@@
  use crate::Perform;
  use actix_web::{error::ErrorBadRequest, *};
- use lemmy_structs::{comment::*, community::*, post::*, site::*, user::*, websocket::*};
 -use lemmy_api_structs::{comment::*, community::*, post::*, site::*, user::*, websocket::*};
++use lemmy_api_structs::{comment::*, community::*, post::*, site::*, person::*, websocket::*};
  use lemmy_utils::rate_limit::RateLimit;
  use lemmy_websocket::{routes::chat_route, LemmyContext};
  use serde::Deserialize;
@@@ -137,11 -137,11 +137,11 @@@ pub fn config(cfg: &mut web::ServiceCon
        .service(
          web::scope("/user")
            .wrap(rate_limit.message())
--          .route("", web::get().to(route_get::<GetUserDetails>))
--          .route("/mention", web::get().to(route_get::<GetUserMentions>))
++          .route("", web::get().to(route_get::<GetPersonDetails>))
++          .route("/mention", web::get().to(route_get::<GetPersonMentions>))
            .route(
              "/mention/mark_as_read",
--            web::post().to(route_post::<MarkUserMentionAsRead>),
++            web::post().to(route_post::<MarkPersonMentionAsRead>),
            )
            .route("/replies", web::get().to(route_get::<GetReplies>))
            .route(
            )
            .route("/join", web::post().to(route_post::<UserJoin>))
            // Admin action. I don't like that it's in /user
--          .route("/ban", web::post().to(route_post::<BanUser>))
++          .route("/ban", web::post().to(route_post::<BanPerson>))
            // Account actions. I don't like that they're in /user maybe /accounts
            .route("/login", web::post().to(route_post::<Login>))
            .route("/get_captcha", web::get().to(route_get::<GetCaptcha>))
index 56f14dea7d16c1498183b85b65c474835eae19a8,af9d22c41afcc24bce2855dcf63c6d463a5c6843..5acd099c467a4713b7db7bc2f8d1be3fa08caa27
@@@ -1,16 -1,23 +1,22 @@@
  use crate::{
    build_federated_instances,
--  get_user_from_jwt,
--  get_user_from_jwt_opt,
--  get_user_safe_settings_from_jwt,
--  get_user_safe_settings_from_jwt_opt,
++  get_local_user_view_from_jwt,
++  get_local_user_view_from_jwt_opt,
++  get_local_user_settings_view_from_jwt_opt,
    is_admin,
    Perform,
  };
  use actix_web::web::Data;
  use anyhow::Context;
 -use lemmy_api_structs::{blocking, site::*, user::Register};
++use lemmy_api_structs::{blocking, site::*, person::Register};
  use lemmy_apub::fetcher::search::search_by_apub_id;
- use lemmy_db_queries::{diesel_option_overwrite, source::site::Site_, Crud, SearchType, SortType};
+ use lemmy_db_queries::{
+   diesel_option_overwrite_to_url,
+   source::site::Site_,
+   Crud,
+   SearchType,
+   SortType,
+ };
  use lemmy_db_schema::{
    naive_now,
    source::{
@@@ -25,7 -32,7 +31,7 @@@ use lemmy_db_views::
  };
  use lemmy_db_views_actor::{
    community_view::CommunityQueryBuilder,
--  user_view::{UserQueryBuilder, UserViewSafe},
++  person_view::{PersonQueryBuilder, PersonViewSafe},
  };
  use lemmy_db_views_moderator::{
    mod_add_community_view::ModAddCommunityView,
@@@ -68,36 -74,36 +73,36 @@@ impl Perform for GetModlog 
      let data: &GetModlog = &self;
  
      let community_id = data.community_id;
--    let mod_user_id = data.mod_user_id;
++    let mod_person_id = data.mod_person_id;
      let page = data.page;
      let limit = data.limit;
      let removed_posts = blocking(context.pool(), move |conn| {
--      ModRemovePostView::list(conn, community_id, mod_user_id, page, limit)
++      ModRemovePostView::list(conn, community_id, mod_person_id, page, limit)
      })
      .await??;
  
      let locked_posts = blocking(context.pool(), move |conn| {
--      ModLockPostView::list(conn, community_id, mod_user_id, page, limit)
++      ModLockPostView::list(conn, community_id, mod_person_id, page, limit)
      })
      .await??;
  
      let stickied_posts = blocking(context.pool(), move |conn| {
--      ModStickyPostView::list(conn, community_id, mod_user_id, page, limit)
++      ModStickyPostView::list(conn, community_id, mod_person_id, page, limit)
      })
      .await??;
  
      let removed_comments = blocking(context.pool(), move |conn| {
--      ModRemoveCommentView::list(conn, community_id, mod_user_id, page, limit)
++      ModRemoveCommentView::list(conn, community_id, mod_person_id, page, limit)
      })
      .await??;
  
      let banned_from_community = blocking(context.pool(), move |conn| {
--      ModBanFromCommunityView::list(conn, community_id, mod_user_id, page, limit)
++      ModBanFromCommunityView::list(conn, community_id, mod_person_id, page, limit)
      })
      .await??;
  
      let added_to_community = blocking(context.pool(), move |conn| {
--      ModAddCommunityView::list(conn, community_id, mod_user_id, page, limit)
++      ModAddCommunityView::list(conn, community_id, mod_person_id, page, limit)
      })
      .await??;
  
      let (removed_communities, banned, added) = if data.community_id.is_none() {
        blocking(context.pool(), move |conn| {
          Ok((
--          ModRemoveCommunityView::list(conn, mod_user_id, page, limit)?,
--          ModBanView::list(conn, mod_user_id, page, limit)?,
--          ModAddView::list(conn, mod_user_id, page, limit)?,
++          ModRemoveCommunityView::list(conn, mod_person_id, page, limit)?,
++          ModBanView::list(conn, mod_person_id, page, limit)?,
++          ModAddView::list(conn, mod_person_id, page, limit)?,
          )) as Result<_, LemmyError>
        })
        .await??
@@@ -146,20 -152,20 +151,20 @@@ impl Perform for CreateSite 
        return Err(ApiError::err("site_already_exists").into());
      };
  
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      check_slurs(&data.name)?;
      check_slurs_opt(&data.description)?;
  
      // Make sure user is an admin
--    is_admin(context.pool(), user.id).await?;
++    is_admin(&local_user_view)?;
  
      let site_form = SiteForm {
        name: data.name.to_owned(),
        description: data.description.to_owned(),
-       icon: Some(data.icon.to_owned()),
-       banner: Some(data.banner.to_owned()),
-       creator_id: user.id,
+       icon: Some(data.icon.to_owned().map(|url| url.into())),
+       banner: Some(data.banner.to_owned().map(|url| url.into())),
 -      creator_id: user.id,
++      creator_id: local_user_view.person.id,
        enable_downvotes: data.enable_downvotes,
        open_registration: data.open_registration,
        enable_nsfw: data.enable_nsfw,
@@@ -186,13 -192,13 +191,13 @@@ impl Perform for EditSite 
      websocket_id: Option<ConnectionId>,
    ) -> Result<SiteResponse, LemmyError> {
      let data: &EditSite = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      check_slurs(&data.name)?;
      check_slurs_opt(&data.description)?;
  
      // Make sure user is an admin
--    is_admin(context.pool(), user.id).await?;
++    is_admin(&local_user_view)?;
  
      let found_site = blocking(context.pool(), move |conn| Site::read_simple(conn)).await??;
  
@@@ -277,20 -283,20 +282,20 @@@ impl Perform for GetSite 
        }
      };
  
--    let mut admins = blocking(context.pool(), move |conn| UserViewSafe::admins(conn)).await??;
++    let mut admins = blocking(context.pool(), move |conn| PersonViewSafe::admins(conn)).await??;
  
      // Make sure the site creator is the top admin
      if let Some(site_view) = site_view.to_owned() {
        let site_creator_id = site_view.creator.id;
        // TODO investigate why this is sometimes coming back null
        // Maybe user_.admin isn't being set to true?
--      if let Some(creator_index) = admins.iter().position(|r| r.user.id == site_creator_id) {
--        let creator_user = admins.remove(creator_index);
--        admins.insert(0, creator_user);
++      if let Some(creator_index) = admins.iter().position(|r| r.person.id == site_creator_id) {
++        let creator_person = admins.remove(creator_index);
++        admins.insert(0, creator_person);
        }
      }
  
--    let banned = blocking(context.pool(), move |conn| UserViewSafe::banned(conn)).await??;
++    let banned = blocking(context.pool(), move |conn| PersonViewSafe::banned(conn)).await??;
  
      let online = context
        .chat_server()
        .await
        .unwrap_or(1);
  
--    let my_user = get_user_safe_settings_from_jwt_opt(&data.auth, context.pool()).await?;
++    let my_user = get_local_user_settings_view_from_jwt_opt(&data.auth, context.pool()).await?;
      let federated_instances = build_federated_instances(context.pool()).await?;
  
      Ok(GetSiteResponse {
@@@ -329,8 -335,8 +334,8 @@@ impl Perform for Search 
        Err(e) => debug!("Failed to resolve search query as activitypub ID: {}", e),
      }
  
--    let user = get_user_from_jwt_opt(&data.auth, context.pool()).await?;
--    let user_id = user.map(|u| u.id);
++    let local_user_view = get_local_user_view_from_jwt_opt(&data.auth, context.pool()).await?;
++    let person_id = local_user_view.map(|u| u.person.id);
  
      let type_ = SearchType::from_str(&data.type_)?;
  
              .show_nsfw(true)
              .community_id(community_id)
              .community_name(community_name)
--            .my_user_id(user_id)
++            .my_person_id(person_id)
              .search_term(q)
              .page(page)
              .limit(limit)
            CommentQueryBuilder::create(&conn)
              .sort(&sort)
              .search_term(q)
--            .my_user_id(user_id)
++            .my_person_id(person_id)
              .page(page)
              .limit(limit)
              .list()
            CommunityQueryBuilder::create(conn)
              .sort(&sort)
              .search_term(q)
--            .my_user_id(user_id)
++            .my_person_id(person_id)
              .page(page)
              .limit(limit)
              .list()
        }
        SearchType::Users => {
          users = blocking(context.pool(), move |conn| {
--          UserQueryBuilder::create(conn)
++          PersonQueryBuilder::create(conn)
              .sort(&sort)
              .search_term(q)
              .page(page)
              .show_nsfw(true)
              .community_id(community_id)
              .community_name(community_name)
--            .my_user_id(user_id)
++            .my_person_id(person_id)
              .search_term(q)
              .page(page)
              .limit(limit)
            CommentQueryBuilder::create(conn)
              .sort(&sort)
              .search_term(q)
--            .my_user_id(user_id)
++            .my_person_id(person_id)
              .page(page)
              .limit(limit)
              .list()
            CommunityQueryBuilder::create(conn)
              .sort(&sort)
              .search_term(q)
--            .my_user_id(user_id)
++            .my_person_id(person_id)
              .page(page)
              .limit(limit)
              .list()
          let sort = SortType::from_str(&data.sort)?;
  
          users = blocking(context.pool(), move |conn| {
--          UserQueryBuilder::create(conn)
++          PersonQueryBuilder::create(conn)
              .sort(&sort)
              .search_term(q)
              .page(page)
            PostQueryBuilder::create(conn)
              .sort(&sort)
              .show_nsfw(true)
--            .my_user_id(user_id)
++            .my_person_id(person_id)
              .community_id(community_id)
              .community_name(community_name)
              .url_search(q)
@@@ -492,18 -498,18 +497,18 @@@ impl Perform for TransferSite 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetSiteResponse, LemmyError> {
      let data: &TransferSite = &self;
--    let user = get_user_safe_settings_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
--    is_admin(context.pool(), user.id).await?;
++    is_admin(&local_user_view)?;
  
      let read_site = blocking(context.pool(), move |conn| Site::read_simple(conn)).await??;
  
      // Make sure user is the creator
--    if read_site.creator_id != user.id {
++    if read_site.creator_id != local_user_view.person.id {
        return Err(ApiError::err("not_an_admin").into());
      }
  
--    let new_creator_id = data.user_id;
++    let new_creator_id = data.person_id;
      let transfer_site = move |conn: &'_ _| Site::transfer(conn, new_creator_id);
      if blocking(context.pool(), transfer_site).await?.is_err() {
        return Err(ApiError::err("couldnt_update_site").into());
  
      // Mod tables
      let form = ModAddForm {
-       mod_person_id: user.id,
-       other_person_id: data.user_id,
 -      mod_user_id: user.id,
 -      other_user_id: data.user_id,
++      mod_person_id: local_user_view.person.id,
++      other_person_id: data.person_id,
        removed: Some(false),
      };
  
  
      let site_view = blocking(context.pool(), move |conn| SiteView::read(conn)).await??;
  
--    let mut admins = blocking(context.pool(), move |conn| UserViewSafe::admins(conn)).await??;
++    let mut admins = blocking(context.pool(), move |conn| PersonViewSafe::admins(conn)).await??;
      let creator_index = admins
        .iter()
--      .position(|r| r.user.id == site_view.creator.id)
++      .position(|r| r.person.id == site_view.creator.id)
        .context(location_info!())?;
--    let creator_user = admins.remove(creator_index);
--    admins.insert(0, creator_user);
++    let creator_person = admins.remove(creator_index);
++    admins.insert(0, creator_person);
  
--    let banned = blocking(context.pool(), move |conn| UserViewSafe::banned(conn)).await??;
++    let banned = blocking(context.pool(), move |conn| PersonViewSafe::banned(conn)).await??;
      let federated_instances = build_federated_instances(context.pool()).await?;
  
      Ok(GetSiteResponse {
        banned,
        online: 0,
        version: version::VERSION.to_string(),
--      my_user: Some(user),
++      my_user: Some(local_user_view),
        federated_instances,
      })
    }
@@@ -553,10 -559,10 +558,10 @@@ impl Perform for GetSiteConfig 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetSiteConfigResponse, LemmyError> {
      let data: &GetSiteConfig = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Only let admins read this
--    is_admin(context.pool(), user.id).await?;
++    is_admin(&local_user_view)?;
  
      let config_hjson = Settings::read_config_file()?;
  
@@@ -574,11 -580,11 +579,11 @@@ impl Perform for SaveSiteConfig 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetSiteConfigResponse, LemmyError> {
      let data: &SaveSiteConfig = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Only let admins read this
--    let user_id = user.id;
--    is_admin(context.pool(), user_id).await?;
++    let person_id = local_user_view.person.id;
++    is_admin(&local_user_view)?;
  
      // Make sure docker doesn't have :ro at the end of the volume, so its not a read-only filesystem
      let config_hjson = match Settings::save_config_file(&data.config_hjson) {
index a8f1477f88b4808a9d9ce29fd096276771180c99,93ffdfff42feb75db29b116d6f72e2beaa8a03f4..112814904824a8bcea3e25573c0e51748e34b9f6
@@@ -1,10 -1,10 +1,10 @@@
  use crate::{
    captcha_espeak_wav_base64,
-   check_optional_url,
    collect_moderated_communities,
--  get_user_from_jwt,
--  get_user_from_jwt_opt,
++  get_local_user_view_from_jwt,
++  get_local_user_view_from_jwt_opt,
    is_admin,
+   password_length_check,
    Perform,
  };
  use actix_web::web::Data;
@@@ -12,6 -12,7 +12,7 @@@ use anyhow::Context
  use bcrypt::verify;
  use captcha::{gen, Difficulty};
  use chrono::Duration;
 -use lemmy_api_structs::{blocking, send_email_to_user, user::*};
++use lemmy_api_structs::{blocking, send_email_to_user, person::*};
  use lemmy_apub::{
    generate_apub_endpoint,
    generate_followers_url,
@@@ -29,8 -31,8 +31,8 @@@ use lemmy_db_queries::
      post::Post_,
      private_message::PrivateMessage_,
      site::Site_,
--    user::User,
--    user_mention::UserMention_,
++    person::Person_,
++    person_mention::PersonMention_,
    },
    Crud,
    Followable,
    ListingType,
    SortType,
  };
--use lemmy_db_schema::{
--  naive_now,
--  source::{
--    comment::Comment,
--    community::*,
--    moderator::*,
--    password_reset_request::*,
--    post::Post,
--    private_message::*,
--    site::*,
--    user::*,
--    user_mention::*,
--  },
--};
++use lemmy_db_schema::{naive_now, source::{comment::Comment, community::*, local_user::LocalUserForm, moderator::*, password_reset_request::*, person::*, person_mention::*, post::Post, private_message::*, site::*}};
  use lemmy_db_views::{
    comment_report_view::CommentReportView,
    comment_view::CommentQueryBuilder,
    post_report_view::PostReportView,
    post_view::PostQueryBuilder,
    private_message_view::{PrivateMessageQueryBuilder, PrivateMessageView},
++  local_user_view::LocalUserView,
  };
  use lemmy_db_views_actor::{
    community_follower_view::CommunityFollowerView,
    community_moderator_view::CommunityModeratorView,
--  user_mention_view::{UserMentionQueryBuilder, UserMentionView},
--  user_view::UserViewSafe,
++  person_mention_view::{PersonMentionQueryBuilder, PersonMentionView},
++  person_view::PersonViewSafe,
  };
- use lemmy_structs::{blocking, send_email_to_user, user::*};
  use lemmy_utils::{
    apub::generate_actor_keypair,
    claims::Claims,
@@@ -104,24 -105,24 +93,24 @@@ impl Perform for Login 
  
      // Fetch that username / email
      let username_or_email = data.username_or_email.clone();
--    let user = match blocking(context.pool(), move |conn| {
--      User_::find_by_email_or_username(conn, &username_or_email)
++    let local_user_view = match blocking(context.pool(), move |conn| {
++      LocalUserView::find_by_email_or_name(conn, &username_or_email)
      })
      .await?
      {
--      Ok(user) => user,
++      Ok(uv) => uv,
        Err(_e) => return Err(ApiError::err("couldnt_find_that_username_or_email").into()),
      };
  
      // Verify the password
--    let valid: bool = verify(&data.password, &user.password_encrypted).unwrap_or(false);
++    let valid: bool = verify(&data.password, &local_user_view.local_user.password_encrypted).unwrap_or(false);
      if !valid {
        return Err(ApiError::err("password_incorrect").into());
      }
  
      // Return the jwt
      Ok(LoginResponse {
-       jwt: Claims::jwt(user.id, Settings::get().hostname)?,
 -      jwt: Claims::jwt(user.id, Settings::get().hostname())?,
++      jwt: Claims::jwt(local_user_view.person.id, Settings::get().hostname())?,
      })
    }
  }
@@@ -156,7 -154,7 +142,7 @@@ impl Perform for Register 
  
      // Check if there are admins. False if admins exist
      let no_admins = blocking(context.pool(), move |conn| {
--      UserViewSafe::admins(conn).map(|a| a.is_empty())
++      PersonViewSafe::admins(conn).map(|a| a.is_empty())
      })
      .await??;
  
  
      check_slurs(&data.username)?;
  
--    let user_keypair = generate_actor_keypair()?;
++    let actor_keypair = generate_actor_keypair()?;
      if !is_valid_username(&data.username) {
        return Err(ApiError::err("invalid_username").into());
      }
--    let user_actor_id = generate_apub_endpoint(EndpointType::User, &data.username)?;
++    let actor_id = generate_apub_endpoint(EndpointType::Person, &data.username)?;
  
--    // Register the new user
--    let user_form = UserForm {
++    // We have to create both a person, and local_user
++    
++    // Register the new person
++    let person_form = PersonForm {
        name: data.username.to_owned(),
--      email: Some(data.email.to_owned()),
--      matrix_user_id: None,
        avatar: None,
        banner: None,
--      password_encrypted: data.password.to_owned(),
        preferred_username: None,
        published: None,
        updated: None,
--      admin: no_admins,
--      banned: Some(false),
++      banned: None,
++      deleted: None,
        show_nsfw: data.show_nsfw,
        theme: "browser".into(),
        default_sort_type: SortType::Active as i16,
        lang: "browser".into(),
        show_avatars: true,
        send_notifications_to_email: false,
--      actor_id: Some(user_actor_id.clone()),
++      actor_id: Some(actor_id.clone()),
        bio: None,
        local: true,
--      private_key: Some(user_keypair.private_key),
--      public_key: Some(user_keypair.public_key),
++      private_key: Some(actor_keypair.private_key),
++      public_key: Some(actor_keypair.public_key),
        last_refreshed_at: None,
--      inbox_url: Some(generate_inbox_url(&user_actor_id)?),
--      shared_inbox_url: Some(Some(generate_shared_inbox_url(&user_actor_id)?)),
++      inbox_url: Some(generate_inbox_url(&actor_id)?),
++      shared_inbox_url: Some(Some(generate_shared_inbox_url(&actor_id)?)),
      };
  
--    // Create the user
--    let inserted_user = match blocking(context.pool(), move |conn| {
--      User_::register(conn, &user_form)
++    // insert the person
++    let inserted_person = match blocking(context.pool(), move |conn| {
++      Person::create(conn, &person_form)
      })
      .await?
      {
        Ok(user) => user,
++      Err(e) => {
++        return Err(ApiError::err("user_already_exists").into());
++      }
++    };
++
++    // Create the local user
++    let local_user_form = LocalUserForm {
++      person_id: inserted_person.id,
++      email: Some(data.email.to_owned()),
++      matrix_user_id: None,
++      password_encrypted: data.password.to_owned(),
++      admin: no_admins,
++
++    };
++
++    let inserted_local_user = match blocking(context.pool(), move |conn| {
++      LocalUser::register(conn, &local_user_form)
++    })
++    .await?
++    {
++      Ok(lu) => lu,
        Err(e) => {
          let err_type = if e.to_string()
--          == "duplicate key value violates unique constraint \"user__email_key\""
++          == "duplicate key value violates unique constraint \"local_user_email_key\""
          {
            "email_already_exists"
          } else {
            "user_already_exists"
          };
  
++        // If the local user creation errored, then delete that person
++        blocking(context.pool(), move |conn| Person::delete(&conn, inserted_person.id)).await??;
++
          return Err(ApiError::err(err_type).into());
        }
      };
++    
  
      let main_community_keypair = generate_actor_keypair()?;
  
              title: "The Default Community".to_string(),
              description: Some("The Default Community".to_string()),
              nsfw: false,
--            creator_id: inserted_user.id,
++            creator_id: inserted_person.id,
              removed: None,
              deleted: None,
              updated: None,
      // Sign them up for main community no matter what
      let community_follower_form = CommunityFollowerForm {
        community_id: main_community.id,
-       person_id: inserted_user.id,
 -      user_id: inserted_user.id,
++      person_id: inserted_person.id,
        pending: false,
      };
  
      if no_admins {
        let community_moderator_form = CommunityModeratorForm {
          community_id: main_community.id,
-         person_id: inserted_user.id,
 -        user_id: inserted_user.id,
++        person_id: inserted_person.id,
        };
  
        let join = move |conn: &'_ _| CommunityModerator::join(conn, &community_moderator_form);
  
      // Return the jwt
      Ok(LoginResponse {
-       jwt: Claims::jwt(inserted_user.id, Settings::get().hostname)?,
 -      jwt: Claims::jwt(inserted_user.id, Settings::get().hostname())?,
++      jwt: Claims::jwt(inserted_person.id, Settings::get().hostname())?,
      })
    }
  }
@@@ -364,10 -362,10 +374,10 @@@ impl Perform for SaveUserSettings 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<LoginResponse, LemmyError> {
      let data: &SaveUserSettings = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
-     let avatar = diesel_option_overwrite(&data.avatar);
-     let banner = diesel_option_overwrite(&data.banner);
+     let avatar = diesel_option_overwrite_to_url(&data.avatar)?;
+     let banner = diesel_option_overwrite_to_url(&data.banner)?;
      let email = diesel_option_overwrite(&data.email);
      let bio = diesel_option_overwrite(&data.bio);
      let preferred_username = diesel_option_overwrite(&data.preferred_username);
@@@ -490,7 -486,7 +498,7 @@@ impl Perform for GetUserDetails 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetUserDetailsResponse, LemmyError> {
      let data: &GetUserDetails = &self;
--    let user = get_user_from_jwt_opt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt_opt(&data.auth, context.pool()).await?;
  
      let show_nsfw = match &user {
        Some(user) => user.show_nsfw,
          .limit(limit);
  
        let mut comments_query = CommentQueryBuilder::create(conn)
--        .my_user_id(user_id)
++        .my_person_id(user_id)
          .sort(&sort)
          .saved_only(saved_only)
          .page(page)
        }
      };
      let moderates = blocking(context.pool(), move |conn| {
--      CommunityModeratorView::for_user(conn, user_details_id)
++      CommunityModeratorView::for_person(conn, user_details_id)
      })
      .await??;
  
@@@ -597,7 -593,7 +605,7 @@@ impl Perform for AddAdmin 
      websocket_id: Option<ConnectionId>,
    ) -> Result<AddAdminResponse, LemmyError> {
      let data: &AddAdmin = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Make sure user is an admin
      is_admin(context.pool(), user.id).await?;
@@@ -653,7 -649,7 +661,7 @@@ impl Perform for BanUser 
      websocket_id: Option<ConnectionId>,
    ) -> Result<BanUserResponse, LemmyError> {
      let data: &BanUser = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Make sure user is an admin
      is_admin(context.pool(), user.id).await?;
      };
  
      context.chat_server().do_send(SendAllMessage {
--      op: UserOperation::BanUser,
++      op: UserOperation::BanPerson,
        response: res.clone(),
        websocket_id,
      });
@@@ -733,7 -729,7 +741,7 @@@ impl Perform for GetReplies 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetRepliesResponse, LemmyError> {
      let data: &GetReplies = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let sort = SortType::from_str(&data.sort)?;
  
          .sort(&sort)
          .unread_only(unread_only)
          .recipient_id(user_id)
--        .my_user_id(user_id)
++        .my_person_id(user_id)
          .page(page)
          .limit(limit)
          .list()
@@@ -767,7 -763,7 +775,7 @@@ impl Perform for GetUserMentions 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetUserMentionsResponse, LemmyError> {
      let data: &GetUserMentions = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let sort = SortType::from_str(&data.sort)?;
  
@@@ -801,7 -797,7 +809,7 @@@ impl Perform for MarkUserMentionAsRead 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<UserMentionResponse, LemmyError> {
      let data: &MarkUserMentionAsRead = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let user_mention_id = data.user_mention_id;
      let read_user_mention = blocking(context.pool(), move |conn| {
@@@ -841,12 -837,12 +849,12 @@@ impl Perform for MarkAllAsRead 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<GetRepliesResponse, LemmyError> {
      let data: &MarkAllAsRead = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let user_id = user.id;
      let replies = blocking(context.pool(), move |conn| {
        CommentQueryBuilder::create(conn)
--        .my_user_id(user_id)
++        .my_person_id(user_id)
          .recipient_id(user_id)
          .unread_only(true)
          .page(1)
@@@ -895,7 -891,7 +903,7 @@@ impl Perform for DeleteAccount 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<LoginResponse, LemmyError> {
      let data: &DeleteAccount = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Verify the password
      let valid: bool = verify(&data.password, &user.password_encrypted).unwrap_or(false);
@@@ -1026,7 -1024,7 +1036,7 @@@ impl Perform for CreatePrivateMessage 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PrivateMessageResponse, LemmyError> {
      let data: &CreatePrivateMessage = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let content_slurs_removed = remove_slurs(&data.content.to_owned());
  
@@@ -1119,7 -1117,7 +1129,7 @@@ impl Perform for EditPrivateMessage 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PrivateMessageResponse, LemmyError> {
      let data: &EditPrivateMessage = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Checking permissions
      let private_message_id = data.private_message_id;
@@@ -1178,7 -1176,7 +1188,7 @@@ impl Perform for DeletePrivateMessage 
      websocket_id: Option<ConnectionId>,
    ) -> Result<PrivateMessageResponse, LemmyError> {
      let data: &DeletePrivateMessage = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Checking permissions
      let private_message_id = data.private_message_id;
@@@ -1243,7 -1241,7 +1253,7 @@@ impl Perform for MarkPrivateMessageAsRe
      websocket_id: Option<ConnectionId>,
    ) -> Result<PrivateMessageResponse, LemmyError> {
      let data: &MarkPrivateMessageAsRead = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      // Checking permissions
      let private_message_id = data.private_message_id;
@@@ -1301,7 -1299,7 +1311,7 @@@ impl Perform for GetPrivateMessages 
      _websocket_id: Option<ConnectionId>,
    ) -> Result<PrivateMessagesResponse, LemmyError> {
      let data: &GetPrivateMessages = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
      let user_id = user.id;
  
      let page = data.page;
@@@ -1332,7 -1330,7 +1342,7 @@@ impl Perform for GetReportCount 
      websocket_id: Option<ConnectionId>,
    ) -> Result<GetReportCountResponse, LemmyError> {
      let data: &GetReportCount = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let user = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      let user_id = user.id;
      let community_id = data.community;
index 4342f15b845e6ae1630680f9cb3d6ddf65257543,58933712d38e245518bc58240c2847d304d5629a..47e21091f5b3b5fb7b792b320b3bd443628227e8
@@@ -1,6 -1,6 +1,6 @@@
--use crate::{get_user_from_jwt, Perform};
++use crate::{get_local_user_view_from_jwt, Perform};
  use actix_web::web::Data;
- use lemmy_structs::websocket::*;
+ use lemmy_api_structs::websocket::*;
  use lemmy_utils::{ConnectionId, LemmyError};
  use lemmy_websocket::{
    messages::{JoinCommunityRoom, JoinModRoom, JoinPostRoom, JoinUserRoom},
@@@ -17,11 -17,11 +17,12 @@@ impl Perform for UserJoin 
      websocket_id: Option<ConnectionId>,
    ) -> Result<UserJoinResponse, LemmyError> {
      let data: &UserJoin = &self;
--    let user = get_user_from_jwt(&data.auth, context.pool()).await?;
++    let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
  
      if let Some(ws_id) = websocket_id {
        context.chat_server().do_send(JoinUserRoom {
--        user_id: user.id,
++        // TODO this should probably be the local_user_id
++        user_id: local_user_view.person.id,
          id: ws_id,
        });
      }
index fbbf2e4035d1aa522138e9ecf2b75becd345267e,ee349cb0416292d6fb475ca304b90463d3fd10e1..d9313ce98e9060c14b8813d0f80c0524852071bc
@@@ -2,7 -2,7 +2,7 @@@ use lemmy_db_views_actor::
    community_follower_view::CommunityFollowerView,
    community_moderator_view::CommunityModeratorView,
    community_view::CommunityView,
--  user_view::UserViewSafe,
++  person_view::PersonViewSafe,
  };
  use serde::{Deserialize, Serialize};
  
@@@ -54,7 -53,7 +53,7 @@@ pub struct ListCommunitiesResponse 
  #[derive(Deserialize, Clone)]
  pub struct BanFromCommunity {
    pub community_id: i32,
--  pub user_id: i32,
++  pub person_id: i32,
    pub ban: bool,
    pub remove_data: bool,
    pub reason: Option<String>,
  
  #[derive(Serialize, Clone)]
  pub struct BanFromCommunityResponse {
--  pub user_view: UserViewSafe,
++  pub person_view: PersonViewSafe,
    pub banned: bool,
  }
  
  #[derive(Deserialize)]
  pub struct AddModToCommunity {
    pub community_id: i32,
--  pub user_id: i32,
++  pub person_id: i32,
    pub added: bool,
    pub auth: String,
  }
@@@ -129,6 -127,6 +127,6 @@@ pub struct GetFollowedCommunitiesRespon
  #[derive(Deserialize)]
  pub struct TransferCommunity {
    pub community_id: i32,
--  pub user_id: i32,
++  pub person_id: i32,
    pub auth: String,
  }
index 8b56fab6b9c970c63e3dea3810a079b049ac9a06,800fe6c8bb6d27aa18283edc5bb3cc4194f79599..b28cb37f9067c9ece9b5fbaf95f0f1dec6c0a7b9
@@@ -2,18 -2,18 +2,19 @@@ pub mod comment
  pub mod community;
  pub mod post;
  pub mod site;
--pub mod user;
++pub mod person;
  pub mod websocket;
  
  use diesel::PgConnection;
--use lemmy_db_queries::{source::user::User, Crud, DbPool};
++use lemmy_db_queries::{Crud, DbPool};
  use lemmy_db_schema::source::{
    comment::Comment,
    post::Post,
--  user::User_,
--  user_mention::{UserMention, UserMentionForm},
++  person::Person,
++  person_mention::{PersonMention, PersonMentionForm},
  };
- use lemmy_utils::{email::send_email, settings::Settings, utils::MentionData, LemmyError};
++use lemmy_db_views::local_user_view::LocalUserView;
+ use lemmy_utils::{email::send_email, settings::structs::Settings, utils::MentionData, LemmyError};
  use log::error;
  use serde::{Deserialize, Serialize};
  use url::Url;
@@@ -54,25 -54,25 +55,25 @@@ wher
  pub async fn send_local_notifs(
    mentions: Vec<MentionData>,
    comment: Comment,
--  user: &User_,
++  person: Person,
    post: Post,
    pool: &DbPool,
    do_send_email: bool,
  ) -> Result<Vec<i32>, LemmyError> {
--  let user2 = user.clone();
    let ids = blocking(pool, move |conn| {
--    do_send_local_notifs(conn, &mentions, &comment, &user2, &post, do_send_email)
++    do_send_local_notifs(conn, &mentions, &comment, &person, &post, do_send_email)
    })
    .await?;
  
    Ok(ids)
  }
  
++// TODO should this really use person_ids as recipient ids? or local_user_ids ?
  fn do_send_local_notifs(
    conn: &PgConnection,
    mentions: &[MentionData],
    comment: &Comment,
--  user: &User_,
++  person: &Person,
    post: &Post,
    do_send_email: bool,
  ) -> Vec<i32> {
    // Send the local mentions
    for mention in mentions
      .iter()
--    .filter(|m| m.is_local() && m.name.ne(&user.name))
++    .filter(|m| m.is_local() && m.name.ne(&person.name))
      .collect::<Vec<&MentionData>>()
    {
--    if let Ok(mention_user) = User_::read_from_name(&conn, &mention.name) {
++    // TODO do a local user fetch
++    if let Ok(mention_user_view) = LocalUserView::read_from_name(&conn, &mention.name) {
        // TODO
        // At some point, make it so you can't tag the parent creator either
        // This can cause two notifications, one for reply and the other for mention
--      recipient_ids.push(mention_user.id);
++      recipient_ids.push(mention_user_view.person.id);
  
--      let user_mention_form = UserMentionForm {
--        recipient_id: mention_user.id,
++      let user_mention_form = PersonMentionForm {
++        recipient_id: mention_user_view.person.id,
          comment_id: comment.id,
          read: None,
        };
  
        // Allow this to fail softly, since comment edits might re-update or replace it
        // Let the uniqueness handle this fail
--      let _ = UserMention::create(&conn, &user_mention_form);
++      PersonMention::create(&conn, &user_mention_form).ok();
  
        // Send an email to those users that have notifications on
--      if do_send_email && mention_user.send_notifications_to_email {
++      if do_send_email && mention_user_view.local_user.send_notifications_to_email {
          send_email_to_user(
--          mention_user,
++          mention_user_view,
            "Mentioned by",
--          "User Mention",
++          "Person Mention",
            &comment.content,
          )
        }
    match comment.parent_id {
      Some(parent_id) => {
        if let Ok(parent_comment) = Comment::read(&conn, parent_id) {
--        if parent_comment.creator_id != user.id {
--          if let Ok(parent_user) = User_::read(&conn, parent_comment.creator_id) {
--            recipient_ids.push(parent_user.id);
++        if parent_comment.creator_id != person.id {
++          if let Ok(parent_user_view) = LocalUserView::read(&conn, parent_comment.creator_id) {
++            recipient_ids.push(parent_user_view.person.id);
  
--            if do_send_email && parent_user.send_notifications_to_email {
--              send_email_to_user(parent_user, "Reply from", "Comment Reply", &comment.content)
++            if do_send_email && parent_user_view.local_user.send_notifications_to_email {
++              send_email_to_user(parent_user_view, "Reply from", "Comment Reply", &comment.content)
              }
            }
          }
      }
      // Its a post
      None => {
--      if post.creator_id != user.id {
--        if let Ok(parent_user) = User_::read(&conn, post.creator_id) {
--          recipient_ids.push(parent_user.id);
++      if post.creator_id != person.id {
++        if let Ok(parent_user_view) = LocalUserView::read(&conn, post.creator_id) {
++          recipient_ids.push(parent_user_view.person.id);
  
--          if do_send_email && parent_user.send_notifications_to_email {
--            send_email_to_user(parent_user, "Reply from", "Post Reply", &comment.content)
++          if do_send_email && parent_user_view.local_user.send_notifications_to_email {
++            send_email_to_user(parent_user_view, "Reply from", "Post Reply", &comment.content)
            }
          }
        }
    recipient_ids
  }
  
--pub fn send_email_to_user(user: User_, subject_text: &str, body_text: &str, comment_content: &str) {
--  if user.banned {
++pub fn send_email_to_user(local_user_view: LocalUserView, subject_text: &str, body_text: &str, comment_content: &str) {
++  if local_user_view.person.banned {
      return;
    }
  
--  if let Some(user_email) = user.email {
++  if let Some(user_email) = local_user_view.local_user.email {
      let subject = &format!(
        "{} - {} {}",
        subject_text,
-       Settings::get().hostname,
-       user.name,
+       Settings::get().hostname(),
 -      user.name,
++      local_user_view.person.name,
      );
      let html = &format!(
        "<h1>{}</h1><br><div>{} - {}</div><br><a href={}/inbox>inbox</a>",
        body_text,
--      user.name,
++      local_user_view.person.name,
        comment_content,
        Settings::get().get_protocol_and_hostname()
      );
--    match send_email(subject, &user_email, &user.name, html) {
++    match send_email(subject, &user_email, &local_user_view.person.name, html) {
        Ok(_o) => _o,
        Err(e) => error!("{}", e),
      };
index dcc35f06c161bc16890c465a499b6c873904bded,dcc35f06c161bc16890c465a499b6c873904bded..ac1cca8587d38b8ac232df75427f8d0b46e6f248
@@@ -6,8 -6,8 +6,8 @@@ use lemmy_db_views::
  use lemmy_db_views_actor::{
    community_follower_view::CommunityFollowerView,
    community_moderator_view::CommunityModeratorView,
--  user_mention_view::UserMentionView,
--  user_view::UserViewSafe,
++  person_mention_view::PersonMentionView,
++  person_view::PersonViewSafe,
  };
  use serde::{Deserialize, Serialize};
  
@@@ -70,8 -70,8 +70,8 @@@ pub struct LoginResponse 
  }
  
  #[derive(Deserialize)]
--pub struct GetUserDetails {
--  pub user_id: Option<i32>,
++pub struct GetPersonDetails {
++  pub person_id: Option<i32>,
    pub username: Option<String>,
    pub sort: String,
    pub page: Option<i64>,
@@@ -82,8 -82,8 +82,8 @@@
  }
  
  #[derive(Serialize)]
--pub struct GetUserDetailsResponse {
--  pub user_view: UserViewSafe,
++pub struct GetPersonDetailsResponse {
++  pub person_view: PersonViewSafe,
    pub follows: Vec<CommunityFollowerView>,
    pub moderates: Vec<CommunityModeratorView>,
    pub comments: Vec<CommentView>,
@@@ -96,8 -96,8 +96,8 @@@ pub struct GetRepliesResponse 
  }
  
  #[derive(Serialize)]
--pub struct GetUserMentionsResponse {
--  pub mentions: Vec<UserMentionView>,
++pub struct GetPersonMentionsResponse {
++  pub mentions: Vec<PersonMentionView>,
  }
  
  #[derive(Deserialize)]
@@@ -107,19 -107,19 +107,19 @@@ pub struct MarkAllAsRead 
  
  #[derive(Deserialize)]
  pub struct AddAdmin {
--  pub user_id: i32,
++  pub person_id: i32,
    pub added: bool,
    pub auth: String,
  }
  
  #[derive(Serialize, Clone)]
  pub struct AddAdminResponse {
--  pub admins: Vec<UserViewSafe>,
++  pub admins: Vec<PersonViewSafe>,
  }
  
  #[derive(Deserialize)]
--pub struct BanUser {
--  pub user_id: i32,
++pub struct BanPerson {
++  pub person_id: i32,
    pub ban: bool,
    pub remove_data: bool,
    pub reason: Option<String>,
  }
  
  #[derive(Serialize, Clone)]
--pub struct BanUserResponse {
--  pub user_view: UserViewSafe,
++pub struct BanPersonResponse {
++  pub person_view: PersonViewSafe,
    pub banned: bool,
  }
  
@@@ -143,7 -143,7 +143,7 @@@ pub struct GetReplies 
  }
  
  #[derive(Deserialize)]
--pub struct GetUserMentions {
++pub struct GetPersonMentions {
    pub sort: String,
    pub page: Option<i64>,
    pub limit: Option<i64>,
  }
  
  #[derive(Deserialize)]
--pub struct MarkUserMentionAsRead {
--  pub user_mention_id: i32,
++pub struct MarkPersonMentionAsRead {
++  pub person_mention_id: i32,
    pub read: bool,
    pub auth: String,
  }
  
  #[derive(Serialize, Clone)]
--pub struct UserMentionResponse {
--  pub user_mention_view: UserMentionView,
++pub struct PersonMentionResponse {
++  pub person_mention_view: PersonMentionView,
  }
  
  #[derive(Deserialize)]
index ef878ba523d3c1664f75bba552b8cdabdaf13c06,9f69e63bcc2ddb3a6f804ae75ada0f3888e5447e..d574a1604b366730ff1b7564ea39197880e6a8fc
@@@ -1,6 -1,6 +1,5 @@@
--use lemmy_db_schema::source::user::UserSafeSettings;
--use lemmy_db_views::{comment_view::CommentView, post_view::PostView, site_view::SiteView};
--use lemmy_db_views_actor::{community_view::CommunityView, user_view::UserViewSafe};
++use lemmy_db_views::{comment_view::CommentView, post_view::PostView, site_view::SiteView, local_user_view::LocalUserSettingsView};
++use lemmy_db_views_actor::{community_view::CommunityView, person_view::PersonViewSafe};
  use lemmy_db_views_moderator::{
    mod_add_community_view::ModAddCommunityView,
    mod_add_view::ModAddView,
@@@ -32,12 -33,12 +32,12 @@@ pub struct SearchResponse 
    pub comments: Vec<CommentView>,
    pub posts: Vec<PostView>,
    pub communities: Vec<CommunityView>,
--  pub users: Vec<UserViewSafe>,
++  pub users: Vec<PersonViewSafe>,
  }
  
  #[derive(Deserialize)]
  pub struct GetModlog {
--  pub mod_user_id: Option<i32>,
++  pub mod_person_id: Option<i32>,
    pub community_id: Option<i32>,
    pub page: Option<i64>,
    pub limit: Option<i64>,
@@@ -93,17 -94,17 +93,17 @@@ pub struct SiteResponse 
  #[derive(Serialize)]
  pub struct GetSiteResponse {
    pub site_view: Option<SiteView>, // Because the site might not be set up yet
--  pub admins: Vec<UserViewSafe>,
--  pub banned: Vec<UserViewSafe>,
++  pub admins: Vec<PersonViewSafe>,
++  pub banned: Vec<PersonViewSafe>,
    pub online: usize,
    pub version: String,
--  pub my_user: Option<UserSafeSettings>,
++  pub my_user: Option<LocalUserSettingsView>,
    pub federated_instances: Option<FederatedInstances>, // Federation may be disabled
  }
  
  #[derive(Deserialize)]
  pub struct TransferSite {
--  pub user_id: i32,
++  pub person_id: i32,
    pub auth: String,
  }
  
index 6d1817938cf51dcae4eca0d4de32d89ee78cc562,591b6f33a279321378daf9fea0a7f95c7bb8f46d..5e01533d92fd01a15641343c859c9116a07e7151
@@@ -1,4 -1,4 +1,4 @@@
--use crate::{activities::receive::get_actor_as_user, objects::FromApub, ActorType, NoteExt};
++use crate::{activities::receive::get_actor_as_person, objects::FromApub, ActorType, NoteExt};
  use activitystreams::{
    activity::{ActorAndObjectRefExt, Create, Dislike, Like, Remove, Update},
    base::ExtendsExt,
@@@ -19,11 -19,11 +19,11 @@@ pub(crate) async fn receive_create_comm
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(&create, context, request_counter).await?;
++  let person = get_actor_as_person(&create, context, request_counter).await?;
    let note = NoteExt::from_any_base(create.object().to_owned().one().context(location_info!())?)?
      .context(location_info!())?;
  
--  let comment = Comment::from_apub(&note, context, user.actor_id(), request_counter).await?;
++  let comment = Comment::from_apub(&note, context, person.actor_id(), request_counter).await?;
  
    let post_id = comment.post_id;
    let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
@@@ -34,7 -34,7 +34,7 @@@
    // anyway.
    let mentions = scrape_text_for_mentions(&comment.content);
    let recipient_ids =
--    send_local_notifs(mentions, comment.clone(), &user, post, context.pool(), true).await?;
++    send_local_notifs(mentions, comment.clone(), person, post, context.pool(), true).await?;
  
    // Refetch the view
    let comment_view = blocking(context.pool(), move |conn| {
@@@ -64,9 -64,9 +64,9 @@@ pub(crate) async fn receive_update_comm
  ) -> Result<(), LemmyError> {
    let note = NoteExt::from_any_base(update.object().to_owned().one().context(location_info!())?)?
      .context(location_info!())?;
--  let user = get_actor_as_user(&update, context, request_counter).await?;
++  let person = get_actor_as_person(&update, context, request_counter).await?;
  
--  let comment = Comment::from_apub(&note, context, user.actor_id(), request_counter).await?;
++  let comment = Comment::from_apub(&note, context, person.actor_id(), request_counter).await?;
  
    let comment_id = comment.id;
    let post_id = comment.post_id;
@@@ -74,7 -74,7 +74,7 @@@
  
    let mentions = scrape_text_for_mentions(&comment.content);
    let recipient_ids =
--    send_local_notifs(mentions, comment, &user, post, context.pool(), false).await?;
++    send_local_notifs(mentions, comment, person, post, context.pool(), false).await?;
  
    // Refetch the view
    let comment_view = blocking(context.pool(), move |conn| {
@@@ -103,18 -103,18 +103,18 @@@ pub(crate) async fn receive_like_commen
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(&like, context, request_counter).await?;
++  let person = get_actor_as_person(&like, context, request_counter).await?;
  
    let comment_id = comment.id;
    let like_form = CommentLikeForm {
      comment_id,
      post_id: comment.post_id,
-     person_id: user.id,
 -    user_id: user.id,
++    person_id: person.id,
      score: 1,
    };
--  let user_id = user.id;
++  let person_id = person.id;
    blocking(context.pool(), move |conn| {
--    CommentLike::remove(conn, user_id, comment_id)?;
++    CommentLike::remove(conn, person_id, comment_id)?;
      CommentLike::like(conn, &like_form)
    })
    .await??;
@@@ -148,18 -148,18 +148,18 @@@ pub(crate) async fn receive_dislike_com
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(&dislike, context, request_counter).await?;
++  let person = get_actor_as_person(&dislike, context, request_counter).await?;
  
    let comment_id = comment.id;
    let like_form = CommentLikeForm {
      comment_id,
      post_id: comment.post_id,
-     person_id: user.id,
 -    user_id: user.id,
++    person_id: person.id,
      score: -1,
    };
--  let user_id = user.id;
++  let person_id = person.id;
    blocking(context.pool(), move |conn| {
--    CommentLike::remove(conn, user_id, comment_id)?;
++    CommentLike::remove(conn, person_id, comment_id)?;
      CommentLike::like(conn, &like_form)
    })
    .await??;
index 5dc021ad3753cf951f80d1b7cd8ecbb536361a75,7027171554ec5bf28565cfb9d31958ac9afe09f6..22594f3380999137099ff71cb37e61a8b693d282
@@@ -1,5 -1,6 +1,6 @@@
--use crate::activities::receive::get_actor_as_user;
++use crate::activities::receive::get_actor_as_person;
  use activitystreams::activity::{Dislike, Like};
+ use lemmy_api_structs::{blocking, comment::CommentResponse};
  use lemmy_db_queries::{source::comment::Comment_, Likeable};
  use lemmy_db_schema::source::comment::{Comment, CommentLike};
  use lemmy_db_views::comment_view::CommentView;
@@@ -13,12 -13,12 +13,12 @@@ pub(crate) async fn receive_undo_like_c
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(like, context, request_counter).await?;
++  let person = get_actor_as_person(like, context, request_counter).await?;
  
    let comment_id = comment.id;
--  let user_id = user.id;
++  let person_id = person.id;
    blocking(context.pool(), move |conn| {
--    CommentLike::remove(conn, user_id, comment_id)
++    CommentLike::remove(conn, person_id, comment_id)
    })
    .await??;
  
@@@ -51,12 -51,12 +51,12 @@@ pub(crate) async fn receive_undo_dislik
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(dislike, context, request_counter).await?;
++  let person = get_actor_as_person(dislike, context, request_counter).await?;
  
    let comment_id = comment.id;
--  let user_id = user.id;
++  let person_id = person.id;
    blocking(context.pool(), move |conn| {
--    CommentLike::remove(conn, user_id, comment_id)
++    CommentLike::remove(conn, person_id, comment_id)
    })
    .await??;
  
index a03e1ef529fcbe26d31bf8d6cf5ac11ad203c0a1,a03e1ef529fcbe26d31bf8d6cf5ac11ad203c0a1..1d5fcc300f1cb8552cd4b3733b32b0ec2f3b27f7
@@@ -1,11 -1,11 +1,11 @@@
--use crate::fetcher::user::get_or_fetch_and_upsert_user;
++use crate::fetcher::person::get_or_fetch_and_upsert_person;
  use activitystreams::{
    activity::{ActorAndObjectRef, ActorAndObjectRefExt},
    base::{AsBase, BaseExt},
    error::DomainError,
  };
  use anyhow::{anyhow, Context};
--use lemmy_db_schema::source::user::User_;
++use lemmy_db_schema::source::person::Person;
  use lemmy_utils::{location_info, LemmyError};
  use lemmy_websocket::LemmyContext;
  use log::debug;
@@@ -28,18 -28,18 +28,18 @@@ wher
    Err(anyhow!("Activity not supported").into())
  }
  
--/// Reads the actor field of an activity and returns the corresponding `User_`.
--pub(crate) async fn get_actor_as_user<T, A>(
++/// Reads the actor field of an activity and returns the corresponding `Person`.
++pub(crate) async fn get_actor_as_person<T, A>(
    activity: &T,
    context: &LemmyContext,
    request_counter: &mut i32,
--) -> Result<User_, LemmyError>
++) -> Result<Person, LemmyError>
  where
    T: AsBase<A> + ActorAndObjectRef,
  {
    let actor = activity.actor()?;
--  let user_uri = actor.as_single_xsd_any_uri().context(location_info!())?;
--  get_or_fetch_and_upsert_user(&user_uri, context, request_counter).await
++  let person_uri = actor.as_single_xsd_any_uri().context(location_info!())?;
++  get_or_fetch_and_upsert_person(&person_uri, context, request_counter).await
  }
  
  /// Ensure that the ID of an incoming activity comes from the same domain as the actor. Optionally
index 4f15300450c8bc1ed9d33d0ae0dd7882cd527528,0fb6c88071420b68b3dd76e481b610b0f0acba24..528b1276aa74edd690d1d38e4e0e53cc4f01ee2a
@@@ -1,4 -1,4 +1,4 @@@
--use crate::{activities::receive::get_actor_as_user, objects::FromApub, ActorType, PageExt};
++use crate::{activities::receive::get_actor_as_person, objects::FromApub, ActorType, PageExt};
  use activitystreams::{
    activity::{Create, Dislike, Like, Remove, Update},
    prelude::*,
@@@ -16,11 -16,11 +16,11 @@@ pub(crate) async fn receive_create_post
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(&create, context, request_counter).await?;
++  let person = get_actor_as_person(&create, context, request_counter).await?;
    let page = PageExt::from_any_base(create.object().to_owned().one().context(location_info!())?)?
      .context(location_info!())?;
  
--  let post = Post::from_apub(&page, context, user.actor_id(), request_counter).await?;
++  let post = Post::from_apub(&page, context, person.actor_id(), request_counter).await?;
  
    // Refetch the view
    let post_id = post.id;
@@@ -45,11 -45,11 +45,11 @@@ pub(crate) async fn receive_update_post
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(&update, context, request_counter).await?;
++  let person = get_actor_as_person(&update, context, request_counter).await?;
    let page = PageExt::from_any_base(update.object().to_owned().one().context(location_info!())?)?
      .context(location_info!())?;
  
--  let post = Post::from_apub(&page, context, user.actor_id(), request_counter).await?;
++  let post = Post::from_apub(&page, context, person.actor_id(), request_counter).await?;
  
    let post_id = post.id;
    // Refetch the view
@@@ -75,17 -75,17 +75,17 @@@ pub(crate) async fn receive_like_post
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(&like, context, request_counter).await?;
++  let person = get_actor_as_person(&like, context, request_counter).await?;
  
    let post_id = post.id;
    let like_form = PostLikeForm {
      post_id,
-     person_id: user.id,
 -    user_id: user.id,
++    person_id: person.id,
      score: 1,
    };
--  let user_id = user.id;
++  let person_id = person.id;
    blocking(context.pool(), move |conn| {
--    PostLike::remove(conn, user_id, post_id)?;
++    PostLike::remove(conn, person_id, post_id)?;
      PostLike::like(conn, &like_form)
    })
    .await??;
@@@ -113,17 -113,17 +113,17 @@@ pub(crate) async fn receive_dislike_pos
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(&dislike, context, request_counter).await?;
++  let person = get_actor_as_person(&dislike, context, request_counter).await?;
  
    let post_id = post.id;
    let like_form = PostLikeForm {
      post_id,
-     person_id: user.id,
 -    user_id: user.id,
++    person_id: person.id,
      score: -1,
    };
--  let user_id = user.id;
++  let person_id = person.id;
    blocking(context.pool(), move |conn| {
--    PostLike::remove(conn, user_id, post_id)?;
++    PostLike::remove(conn, person_id, post_id)?;
      PostLike::like(conn, &like_form)
    })
    .await??;
index 0b9d6f4a4e1d2b44e0350de6c62e768d890e959a,312010a9e88a93c915cbf22a219757609201efbe..67cc20df77df998ee35b03f93d4e7720d5421cb5
@@@ -1,5 -1,6 +1,6 @@@
--use crate::activities::receive::get_actor_as_user;
++use crate::activities::receive::get_actor_as_person;
  use activitystreams::activity::{Dislike, Like};
+ use lemmy_api_structs::{blocking, post::PostResponse};
  use lemmy_db_queries::{source::post::Post_, Likeable};
  use lemmy_db_schema::source::post::{Post, PostLike};
  use lemmy_db_views::post_view::PostView;
@@@ -13,12 -13,12 +13,12 @@@ pub(crate) async fn receive_undo_like_p
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(like, context, request_counter).await?;
++  let person = get_actor_as_person(like, context, request_counter).await?;
  
    let post_id = post.id;
--  let user_id = user.id;
++  let person_id = person.id;
    blocking(context.pool(), move |conn| {
--    PostLike::remove(conn, user_id, post_id)
++    PostLike::remove(conn, person_id, post_id)
    })
    .await??;
  
@@@ -45,12 -45,12 +45,12 @@@ pub(crate) async fn receive_undo_dislik
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
--  let user = get_actor_as_user(dislike, context, request_counter).await?;
++  let person = get_actor_as_person(dislike, context, request_counter).await?;
  
    let post_id = post.id;
--  let user_id = user.id;
++  let person_id = person.id;
    blocking(context.pool(), move |conn| {
--    PostLike::remove(conn, user_id, post_id)
++    PostLike::remove(conn, person_id, post_id)
    })
    .await??;
  
index 160b20ece50b6deb9007b3272a74763e98fe3525,98c25a58832b447ec273f663530b61dd54e4ff3c..45d4a689ddf4e0d6f657d93fa7b495d4f31b3470
@@@ -1,7 -1,7 +1,7 @@@
  use crate::{
    activities::receive::verify_activity_domains_valid,
    check_is_apub_id_valid,
--  fetcher::user::get_or_fetch_and_upsert_user,
++  fetcher::person::get_or_fetch_and_upsert_person,
    inbox::get_activity_to_and_cc,
    objects::FromApub,
    NoteExt,
@@@ -13,6 -13,7 +13,7 @@@ use activitystreams::
    public,
  };
  use anyhow::{anyhow, Context};
 -use lemmy_api_structs::{blocking, user::PrivateMessageResponse};
++use lemmy_api_structs::{blocking, person::PrivateMessageResponse};
  use lemmy_db_queries::source::private_message::PrivateMessage_;
  use lemmy_db_schema::source::private_message::PrivateMessage;
  use lemmy_db_views::private_message_view::PrivateMessageView;
@@@ -181,19 -181,19 +181,19 @@@ wher
  {
    let to_and_cc = get_activity_to_and_cc(activity);
    if to_and_cc.len() != 1 {
--    return Err(anyhow!("Private message can only be addressed to one user").into());
++    return Err(anyhow!("Private message can only be addressed to one person").into());
    }
    if to_and_cc.contains(&public()) {
      return Err(anyhow!("Private message cant be public").into());
    }
--  let user_id = activity
++  let person_id = activity
      .actor()?
      .to_owned()
      .single_xsd_any_uri()
      .context(location_info!())?;
--  check_is_apub_id_valid(&user_id)?;
--  // check that the sender is a user, not a community
--  get_or_fetch_and_upsert_user(&user_id, &context, request_counter).await?;
++  check_is_apub_id_valid(&person_id)?;
++  // check that the sender is a person, not a community
++  get_or_fetch_and_upsert_person(&person_id, &context, request_counter).await?;
  
    Ok(())
  }
index f007cda42dcff5e4374d3e538af351a25dc1bfe4,ac7e884a959252db416f1246b22a8b2f11fb6955..c11e86b73988ebdd961dcda23ba103524108e8a9
@@@ -2,7 -2,7 +2,7 @@@ use crate::
    activities::send::generate_activity_id,
    activity_queue::{send_comment_mentions, send_to_community},
    extensions::context::lemmy_context,
--  fetcher::user::get_or_fetch_and_upsert_user,
++  fetcher::person::get_or_fetch_and_upsert_person,
    objects::ToApub,
    ActorType,
    ApubLikeableType,
@@@ -26,12 -26,12 +26,12 @@@ use activitystreams::
  };
  use anyhow::anyhow;
  use itertools::Itertools;
+ use lemmy_api_structs::{blocking, WebFingerResponse};
  use lemmy_db_queries::{Crud, DbPool};
--use lemmy_db_schema::source::{comment::Comment, community::Community, post::Post, user::User_};
- use lemmy_structs::{blocking, WebFingerResponse};
++use lemmy_db_schema::source::{comment::Comment, community::Community, post::Post, person::Person};
  use lemmy_utils::{
    request::{retry, RecvError},
-   settings::Settings,
+   settings::structs::Settings,
    utils::{scrape_text_for_mentions, MentionData},
    LemmyError,
  };
@@@ -44,8 -44,8 +44,8 @@@ use url::Url
  #[async_trait::async_trait(?Send)]
  impl ApubObjectType for Comment {
    /// Send out information about a newly created comment, to the followers of the community and
--  /// mentioned users.
--  async fn send_create(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  /// mentioned persons.
++  async fn send_create(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let note = self.to_apub(context.pool()).await?;
  
      let post_id = self.post_id;
@@@ -77,8 -77,8 +77,8 @@@
    }
  
    /// Send out information about an edited post, to the followers of the community and mentioned
--  /// users.
--  async fn send_update(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  /// persons.
++  async fn send_update(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let note = self.to_apub(context.pool()).await?;
  
      let post_id = self.post_id;
      Ok(())
    }
  
--  async fn send_delete(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_delete(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let post_id = self.post_id;
      let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
  
    async fn send_undo_delete(
      &self,
--    creator: &User_,
++    creator: &Person,
      context: &LemmyContext,
    ) -> Result<(), LemmyError> {
      let post_id = self.post_id;
      Ok(())
    }
  
--  async fn send_remove(&self, mod_: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_remove(&self, mod_: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let post_id = self.post_id;
      let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
      Ok(())
    }
  
--  async fn send_undo_remove(&self, mod_: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_undo_remove(&self, mod_: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let post_id = self.post_id;
      let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
  
  #[async_trait::async_trait(?Send)]
  impl ApubLikeableType for Comment {
--  async fn send_like(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_like(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let post_id = self.post_id;
      let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
      Ok(())
    }
  
--  async fn send_dislike(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_dislike(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let post_id = self.post_id;
      let post = blocking(context.pool(), move |conn| Post::read(conn, post_id)).await??;
  
  
    async fn send_undo_like(
      &self,
--    creator: &User_,
++    creator: &Person,
      context: &LemmyContext,
    ) -> Result<(), LemmyError> {
      let post_id = self.post_id;
@@@ -342,7 -342,7 +342,7 @@@ impl MentionsAndAddresses 
  
  /// This takes a comment, and builds a list of to_addresses, inboxes,
  /// and mention tags, so they know where to be sent to.
--/// Addresses are the users / addresses that go in the cc field.
++/// Addresses are the persons / addresses that go in the cc field.
  async fn collect_non_local_mentions(
    comment: &Comment,
    community: &Community,
    // Add the mention tag
    let mut tags = Vec::new();
  
--  // Get the user IDs for any mentions
++  // Get the person IDs for any mentions
    let mentions = scrape_text_for_mentions(&comment.content)
      .into_iter()
      // Filter only the non-local ones
        debug!("mention actor_id: {}", actor_id);
        addressed_ccs.push(actor_id.to_owned().to_string().parse()?);
  
--      let mention_user = get_or_fetch_and_upsert_user(&actor_id, context, &mut 0).await?;
--      inboxes.push(mention_user.get_shared_inbox_or_inbox_url());
++      let mention_person = get_or_fetch_and_upsert_person(&actor_id, context, &mut 0).await?;
++      inboxes.push(mention_person.get_shared_inbox_or_inbox_url());
  
        let mut mention_tag = Mention::new();
        mention_tag.set_href(actor_id).set_name(mention.full_name());
    })
  }
  
--/// Returns the apub ID of the user this comment is responding to. Meaning, in case this is a
++/// Returns the apub ID of the person this comment is responding to. Meaning, in case this is a
  /// top-level comment, the creator of the post, otherwise the creator of the parent comment.
--async fn get_comment_parent_creator(pool: &DbPool, comment: &Comment) -> Result<User_, LemmyError> {
++async fn get_comment_parent_creator(pool: &DbPool, comment: &Comment) -> Result<Person, LemmyError> {
    let parent_creator_id = if let Some(parent_comment_id) = comment.parent_id {
      let parent_comment =
        blocking(pool, move |conn| Comment::read(conn, parent_comment_id)).await??;
      let parent_post = blocking(pool, move |conn| Post::read(conn, parent_post_id)).await??;
      parent_post.creator_id
    };
--  Ok(blocking(pool, move |conn| User_::read(conn, parent_creator_id)).await??)
++  Ok(blocking(pool, move |conn| Person::read(conn, parent_creator_id)).await??)
  }
  
--/// Turns a user id like `@name@example.com` into an apub ID, like `https://example.com/user/name`,
++/// Turns a person id like `@name@example.com` into an apub ID, like `https://example.com/user/name`,
  /// using webfinger.
  async fn fetch_webfinger_url(mention: &MentionData, client: &Client) -> Result<Url, LemmyError> {
    let fetch_url = format!(
index a574c7b85ba8e9455143a54e1a206a06b0e6cb47,3e77248f800d1163903aa930021996db47dfe4f9..9cef95b60a95a02bfca357ea1940b29b45ae0f85
@@@ -3,7 -3,7 +3,7 @@@ use crate::
    activity_queue::{send_activity_single_dest, send_to_community_followers},
    check_is_apub_id_valid,
    extensions::context::lemmy_context,
--  fetcher::user::get_or_fetch_and_upsert_user,
++  fetcher::person::get_or_fetch_and_upsert_person,
    ActorType,
  };
  use activitystreams::{
@@@ -70,7 -70,7 +70,7 @@@ impl ActorType for Community 
      unimplemented!()
    }
  
--  /// As a local community, accept the follow request from a remote user.
++  /// As a local community, accept the follow request from a remote person.
    async fn send_accept_follow(
      &self,
      follow: Follow,
@@@ -80,7 -80,7 +80,7 @@@
        .actor()?
        .as_single_xsd_any_uri()
        .context(location_info!())?;
--    let user = get_or_fetch_and_upsert_user(actor_uri, context, &mut 0).await?;
++    let person = get_or_fetch_and_upsert_person(actor_uri, context, &mut 0).await?;
  
      let mut accept = Accept::new(
        self.actor_id.to_owned().into_inner(),
@@@ -89,9 -89,9 +89,9 @@@
      accept
        .set_many_contexts(lemmy_context()?)
        .set_id(generate_activity_id(AcceptType::Accept)?)
--      .set_to(user.actor_id());
++      .set_to(person.actor_id());
  
--    send_activity_single_dest(accept, self, user.inbox_url.into(), context).await?;
++    send_activity_single_dest(accept, self, person.inbox_url.into(), context).await?;
      Ok(())
    }
  
index 166855e204c7592f674fd7f1da7edff1e4412a97,2da0b48c2d28bb152893739e071634ccdcbfb3c8..7f19d0426e7b6bc959bf8a4c57625a0edca6575f
@@@ -6,7 -6,7 +6,7 @@@ pub(crate) mod comment
  pub(crate) mod community;
  pub(crate) mod post;
  pub(crate) mod private_message;
--pub(crate) mod user;
++pub(crate) mod person;
  
  /// Generate a unique ID for an activity, in the format:
  /// `http(s)://example.com/receive/create/202daf0a-1489-45df-8d2e-c8a3173fed36`
index 13ec73400f20c2940e2b3dcb26bc5ba369a0ae9c,1dc62e0bca53d9191d51f5f6bdef2fcb570f7d0c..40cc142281acecf6851af31df60d0f502aeda851
@@@ -16,15 -17,14 +17,14 @@@ use lemmy_api_structs::blocking
  use lemmy_db_queries::{ApubObject, DbPool, Followable};
  use lemmy_db_schema::source::{
    community::{Community, CommunityFollower, CommunityFollowerForm},
--  user::User_,
++  person::Person,
  };
- use lemmy_structs::blocking;
  use lemmy_utils::LemmyError;
  use lemmy_websocket::LemmyContext;
  use url::Url;
  
  #[async_trait::async_trait(?Send)]
--impl ActorType for User_ {
++impl ActorType for Person {
    fn is_local(&self) -> bool {
      self.local
    }
@@@ -48,7 -48,7 +48,7 @@@
        .into()
    }
  
--  /// As a given local user, send out a follow request to a remote community.
++  /// As a given local person, send out a follow request to a remote community.
    async fn send_follow(
      &self,
      follow_actor_id: &Url,
index ce74d20a5e746f5a936923c325e989312c5b719b,44f5b895f48202981604561b951e16d2db011e8e..0fe3f6344c60cf8cb7b5522c8796ff00efbf8067
@@@ -21,16 -21,16 +21,16 @@@ use activitystreams::
    prelude::*,
    public,
  };
+ use lemmy_api_structs::blocking;
  use lemmy_db_queries::Crud;
--use lemmy_db_schema::source::{community::Community, post::Post, user::User_};
- use lemmy_structs::blocking;
++use lemmy_db_schema::source::{community::Community, post::Post, person::Person};
  use lemmy_utils::LemmyError;
  use lemmy_websocket::LemmyContext;
  
  #[async_trait::async_trait(?Send)]
  impl ApubObjectType for Post {
    /// Send out information about a newly created post, to the followers of the community.
--  async fn send_create(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_create(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let page = self.to_apub(context.pool()).await?;
  
      let community_id = self.community_id;
@@@ -54,7 -54,7 +54,7 @@@
    }
  
    /// Send out information about an edited post, to the followers of the community.
--  async fn send_update(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_update(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let page = self.to_apub(context.pool()).await?;
  
      let community_id = self.community_id;
@@@ -77,7 -77,7 +77,7 @@@
      Ok(())
    }
  
--  async fn send_delete(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_delete(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let community_id = self.community_id;
      let community = blocking(context.pool(), move |conn| {
        Community::read(conn, community_id)
  
    async fn send_undo_delete(
      &self,
--    creator: &User_,
++    creator: &Person,
      context: &LemmyContext,
    ) -> Result<(), LemmyError> {
      let community_id = self.community_id;
      Ok(())
    }
  
--  async fn send_remove(&self, mod_: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_remove(&self, mod_: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let community_id = self.community_id;
      let community = blocking(context.pool(), move |conn| {
        Community::read(conn, community_id)
      Ok(())
    }
  
--  async fn send_undo_remove(&self, mod_: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_undo_remove(&self, mod_: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let community_id = self.community_id;
      let community = blocking(context.pool(), move |conn| {
        Community::read(conn, community_id)
  
  #[async_trait::async_trait(?Send)]
  impl ApubLikeableType for Post {
--  async fn send_like(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_like(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let community_id = self.community_id;
      let community = blocking(context.pool(), move |conn| {
        Community::read(conn, community_id)
      Ok(())
    }
  
--  async fn send_dislike(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_dislike(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let community_id = self.community_id;
      let community = blocking(context.pool(), move |conn| {
        Community::read(conn, community_id)
  
    async fn send_undo_like(
      &self,
--    creator: &User_,
++    creator: &Person,
      context: &LemmyContext,
    ) -> Result<(), LemmyError> {
      let community_id = self.community_id;
index 31184a702aaf96ee6593f8334e1880eae3140b6a,322eee5f7f0f7699f33ed4decfb55b12732d6b79..cf0046fa4e8881966bec42dcc661bd4b702ea297
@@@ -16,20 -16,20 +16,20 @@@ use activitystreams::
    },
    prelude::*,
  };
+ use lemmy_api_structs::blocking;
  use lemmy_db_queries::Crud;
--use lemmy_db_schema::source::{private_message::PrivateMessage, user::User_};
- use lemmy_structs::blocking;
++use lemmy_db_schema::source::{private_message::PrivateMessage, person::Person};
  use lemmy_utils::LemmyError;
  use lemmy_websocket::LemmyContext;
  
  #[async_trait::async_trait(?Send)]
  impl ApubObjectType for PrivateMessage {
    /// Send out information about a newly created private message
--  async fn send_create(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_create(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let note = self.to_apub(context.pool()).await?;
  
      let recipient_id = self.recipient_id;
--    let recipient = blocking(context.pool(), move |conn| User_::read(conn, recipient_id)).await??;
++    let recipient = blocking(context.pool(), move |conn| Person::read(conn, recipient_id)).await??;
  
      let mut create = Create::new(
        creator.actor_id.to_owned().into_inner(),
    }
  
    /// Send out information about an edited private message, to the followers of the community.
--  async fn send_update(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_update(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let note = self.to_apub(context.pool()).await?;
  
      let recipient_id = self.recipient_id;
--    let recipient = blocking(context.pool(), move |conn| User_::read(conn, recipient_id)).await??;
++    let recipient = blocking(context.pool(), move |conn| Person::read(conn, recipient_id)).await??;
  
      let mut update = Update::new(
        creator.actor_id.to_owned().into_inner(),
@@@ -65,9 -65,9 +65,9 @@@
      Ok(())
    }
  
--  async fn send_delete(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_delete(&self, creator: &Person, context: &LemmyContext) -> Result<(), LemmyError> {
      let recipient_id = self.recipient_id;
--    let recipient = blocking(context.pool(), move |conn| User_::read(conn, recipient_id)).await??;
++    let recipient = blocking(context.pool(), move |conn| Person::read(conn, recipient_id)).await??;
  
      let mut delete = Delete::new(
        creator.actor_id.to_owned().into_inner(),
  
    async fn send_undo_delete(
      &self,
--    creator: &User_,
++    creator: &Person,
      context: &LemmyContext,
    ) -> Result<(), LemmyError> {
      let recipient_id = self.recipient_id;
--    let recipient = blocking(context.pool(), move |conn| User_::read(conn, recipient_id)).await??;
++    let recipient = blocking(context.pool(), move |conn| Person::read(conn, recipient_id)).await??;
  
      let mut delete = Delete::new(
        creator.actor_id.to_owned().into_inner(),
      Ok(())
    }
  
--  async fn send_remove(&self, _mod_: &User_, _context: &LemmyContext) -> Result<(), LemmyError> {
++  async fn send_remove(&self, _mod_: &Person, _context: &LemmyContext) -> Result<(), LemmyError> {
      unimplemented!()
    }
  
    async fn send_undo_remove(
      &self,
--    _mod_: &User_,
++    _mod_: &Person,
      _context: &LemmyContext,
    ) -> Result<(), LemmyError> {
      unimplemented!()
index c0c4ac46808759053e1245f56ad561014b5c5947,f607dafe009c89b959f6f412855a7edf856a19e0..ccee1b90370398d57c697ba4d328fe0d0e421454
@@@ -21,8 -21,8 +21,8 @@@ use background_jobs::
  };
  use itertools::Itertools;
  use lemmy_db_queries::DbPool;
--use lemmy_db_schema::source::{community::Community, user::User_};
- use lemmy_utils::{location_info, settings::Settings, LemmyError};
++use lemmy_db_schema::source::{community::Community, person::Person};
+ use lemmy_utils::{location_info, settings::structs::Settings, LemmyError};
  use lemmy_websocket::LemmyContext;
  use log::{debug, warn};
  use reqwest::Client;
@@@ -112,7 -112,7 +112,7 @@@ wher
    Ok(())
  }
  
--/// Sends an activity from a local user to a remote community.
++/// Sends an activity from a local person to a remote community.
  ///
  /// * `activity` the activity to send
  /// * `creator` the creator of the activity
  ///
  pub(crate) async fn send_to_community<T, Kind>(
    activity: T,
--  creator: &User_,
++  creator: &Person,
    community: &Community,
    context: &LemmyContext,
  ) -> Result<(), LemmyError>
@@@ -157,13 -157,13 +157,13 @@@ wher
    Ok(())
  }
  
--/// Sends notification to any users mentioned in a comment
++/// Sends notification to any persons mentioned in a comment
  ///
--/// * `creator` user who created the comment
--/// * `mentions` list of inboxes of users which are mentioned in the comment
++/// * `creator` person who created the comment
++/// * `mentions` list of inboxes of persons which are mentioned in the comment
  /// * `activity` either a `Create/Note` or `Update/Note`
  pub(crate) async fn send_comment_mentions<T, Kind>(
--  creator: &User_,
++  creator: &Person,
    mentions: Vec<Url>,
    activity: T,
    context: &LemmyContext,
index ebbf9a0a484fa54b4a7f7879bb1bf9865354972e,ebbf9a0a484fa54b4a7f7879bb1bf9865354972e..a9b4cfbdf0af94a849420cc75f90f784652aa4fa
@@@ -95,7 -95,7 +95,7 @@@ pub(crate) fn verify_signature
    }
  }
  
--/// Extension for actor public key, which is needed on user and community for HTTP signatures.
++/// Extension for actor public key, which is needed on person and community for HTTP signatures.
  ///
  /// Taken from: https://docs.rs/activitystreams/0.5.0-alpha.17/activitystreams/ext/index.html
  #[derive(Clone, Debug, Deserialize, Serialize)]
index e1211f33b23103b0a24ee00ab85f6aae7fef4969,fb545ed6ae2530d8ff7b11416179880c282fdb58..12821bbe85ef3c6659c5becdf98f3bf12040ff44
@@@ -1,11 -1,11 +1,11 @@@
  use crate::{
    fetcher::{
      fetch::fetch_remote_object,
--    get_or_fetch_and_upsert_user,
++    get_or_fetch_and_upsert_person,
      is_deleted,
      should_refetch_actor,
    },
--  inbox::user_inbox::receive_announce,
++  inbox::person_inbox::receive_announce,
    objects::FromApub,
    GroupExt,
  };
@@@ -92,7 -92,7 +92,7 @@@ async fn fetch_remote_community
    let mut creator_and_moderators = Vec::new();
  
    for uri in creator_and_moderator_uris {
--    let c_or_m = get_or_fetch_and_upsert_user(uri, context, recursion_counter).await?;
++    let c_or_m = get_or_fetch_and_upsert_person(uri, context, recursion_counter).await?;
  
      creator_and_moderators.push(c_or_m);
    }
index 593b163fa322d2ce9dfcd81d911d95d3c8e48f79,593b163fa322d2ce9dfcd81d911d95d3c8e48f79..2c1b6b9afc59fe73daf0d1f36e05516e0c595f93
@@@ -2,13 -2,13 +2,13 @@@ pub(crate) mod community
  mod fetch;
  pub(crate) mod objects;
  pub mod search;
--pub(crate) mod user;
++pub(crate) mod person;
  
  use crate::{
    fetcher::{
      community::get_or_fetch_and_upsert_community,
      fetch::FetchError,
--    user::get_or_fetch_and_upsert_user,
++    person::get_or_fetch_and_upsert_person,
    },
    ActorType,
  };
@@@ -37,8 -37,8 +37,8 @@@ wher
    false
  }
  
--/// Get a remote actor from its apub ID (either a user or a community). Thin wrapper around
--/// `get_or_fetch_and_upsert_user()` and `get_or_fetch_and_upsert_community()`.
++/// Get a remote actor from its apub ID (either a person or a community). Thin wrapper around
++/// `get_or_fetch_and_upsert_person()` and `get_or_fetch_and_upsert_community()`.
  ///
  /// If it exists locally and `!should_refetch_actor()`, it is returned directly from the database.
  /// Otherwise it is fetched from the remote instance, stored and returned.
@@@ -50,7 -50,7 +50,7 @@@ pub(crate) async fn get_or_fetch_and_up
    let community = get_or_fetch_and_upsert_community(apub_id, context, recursion_counter).await;
    let actor: Box<dyn ActorType> = match community {
      Ok(c) => Box::new(c),
--    Err(_) => Box::new(get_or_fetch_and_upsert_user(apub_id, context, recursion_counter).await?),
++    Err(_) => Box::new(get_or_fetch_and_upsert_person(apub_id, context, recursion_counter).await?),
    };
    Ok(actor)
  }
index 21cdfb3489913dde2d286f325c732a6cc24657dc,e3ef41c74ea1ebe52a8d16e5dfbf47fd72cbac5d..120ff8453787192dfd405cccf1e82677dd60fd1e
@@@ -5,66 -5,66 +5,66 @@@ use crate::
  };
  use anyhow::anyhow;
  use diesel::result::Error::NotFound;
- use lemmy_db_queries::{source::user::User, ApubObject};
- use lemmy_db_schema::source::user::User_;
- use lemmy_structs::blocking;
+ use lemmy_api_structs::blocking;
 -use lemmy_db_queries::{source::user::User, ApubObject};
 -use lemmy_db_schema::source::user::User_;
++use lemmy_db_queries::{source::person::Person_, ApubObject};
++use lemmy_db_schema::source::person::Person;
  use lemmy_utils::LemmyError;
  use lemmy_websocket::LemmyContext;
  use log::debug;
  use url::Url;
  
--/// Get a user from its apub ID.
++/// Get a person from its apub ID.
  ///
  /// If it exists locally and `!should_refetch_actor()`, it is returned directly from the database.
  /// Otherwise it is fetched from the remote instance, stored and returned.
--pub(crate) async fn get_or_fetch_and_upsert_user(
++pub(crate) async fn get_or_fetch_and_upsert_person(
    apub_id: &Url,
    context: &LemmyContext,
    recursion_counter: &mut i32,
--) -> Result<User_, LemmyError> {
++) -> Result<Person, LemmyError> {
    let apub_id_owned = apub_id.to_owned();
--  let user = blocking(context.pool(), move |conn| {
--    User_::read_from_apub_id(conn, &apub_id_owned.into())
++  let person = blocking(context.pool(), move |conn| {
++    Person::read_from_apub_id(conn, &apub_id_owned.into())
    })
    .await?;
  
--  match user {
++  match person {
      // If its older than a day, re-fetch it
      Ok(u) if !u.local && should_refetch_actor(u.last_refreshed_at) => {
--      debug!("Fetching and updating from remote user: {}", apub_id);
++      debug!("Fetching and updating from remote person: {}", apub_id);
        let person =
          fetch_remote_object::<PersonExt>(context.client(), apub_id, recursion_counter).await;
  
        if is_deleted(&person) {
--        // TODO: use User_::update_deleted() once implemented
++        // TODO: use Person::update_deleted() once implemented
          blocking(context.pool(), move |conn| {
--          User_::delete_account(conn, u.id)
++          Person::delete_account(conn, u.id)
          })
          .await??;
--        return Err(anyhow!("User was deleted by remote instance").into());
++        return Err(anyhow!("Person was deleted by remote instance").into());
        } else if person.is_err() {
          return Ok(u);
        }
  
--      let user = User_::from_apub(&person?, context, apub_id.to_owned(), recursion_counter).await?;
++      let person = Person::from_apub(&person?, context, apub_id.to_owned(), recursion_counter).await?;
  
--      let user_id = user.id;
++      let person_id = person.id;
        blocking(context.pool(), move |conn| {
--        User_::mark_as_updated(conn, user_id)
++        Person::mark_as_updated(conn, person_id)
        })
        .await??;
  
--      Ok(user)
++      Ok(person)
      }
      Ok(u) => Ok(u),
      Err(NotFound {}) => {
--      debug!("Fetching and creating remote user: {}", apub_id);
++      debug!("Fetching and creating remote person: {}", apub_id);
        let person =
          fetch_remote_object::<PersonExt>(context.client(), apub_id, recursion_counter).await?;
  
--      let user = User_::from_apub(&person, context, apub_id.to_owned(), recursion_counter).await?;
++      let person = Person::from_apub(&person, context, apub_id.to_owned(), recursion_counter).await?;
  
--      Ok(user)
++      Ok(person)
      }
      Err(e) => Err(e.into()),
    }
index a831ac404028dd15eead65d0d5c0027d0d561dde,acaccff280855d28fc767c9ea25e90b454d61f08..0b2921c7bdb3519126f022b26b59752e49d8174c
@@@ -2,7 -2,7 +2,7 @@@ use crate::
    fetcher::{
      fetch::fetch_remote_object,
      get_or_fetch_and_upsert_community,
--    get_or_fetch_and_upsert_user,
++    get_or_fetch_and_upsert_person,
      is_deleted,
    },
    find_object_by_id,
@@@ -21,7 -22,7 +22,7 @@@ use lemmy_db_queries::
      community::Community_,
      post::Post_,
      private_message::PrivateMessage_,
--    user::User,
++    person::Person_,
    },
    SearchType,
  };
@@@ -30,12 -31,11 +31,11 @@@ use lemmy_db_schema::source::
    community::Community,
    post::Post,
    private_message::PrivateMessage,
--  user::User_,
++  person::Person,
  };
  use lemmy_db_views::{comment_view::CommentView, post_view::PostView};
--use lemmy_db_views_actor::{community_view::CommunityView, user_view::UserViewSafe};
- use lemmy_structs::{blocking, site::SearchResponse};
- use lemmy_utils::{settings::Settings, LemmyError};
++use lemmy_db_views_actor::{community_view::CommunityView, person_view::PersonViewSafe};
+ use lemmy_utils::{settings::structs::Settings, LemmyError};
  use lemmy_websocket::LemmyContext;
  use log::debug;
  use url::Url;
@@@ -66,7 -66,7 +66,7 @@@ pub async fn search_by_apub_id
      debug!("Search for {}", query);
      let split = query.split('@').collect::<Vec<&str>>();
  
--    // User type will look like ['', username, instance]
++    // Person type will look like ['', username, instance]
      // Community will look like [!community, instance]
      let (name, instance) = if split.len() == 3 {
        (format!("/u/{}", split[1]), split[2])
@@@ -122,13 -122,13 +122,13 @@@ async fn build_response
  
    match fetch_response {
      SearchAcceptedObjects::Person(p) => {
--      let user_uri = p.inner.id(domain)?.context("person has no id")?;
++      let person_uri = p.inner.id(domain)?.context("person has no id")?;
  
--      let user = get_or_fetch_and_upsert_user(&user_uri, context, recursion_counter).await?;
++      let person = get_or_fetch_and_upsert_person(&person_uri, context, recursion_counter).await?;
  
        response.users = vec![
          blocking(context.pool(), move |conn| {
--          UserViewSafe::read(conn, user.id)
++          PersonViewSafe::read(conn, person.id)
          })
          .await??,
        ];
@@@ -182,10 -182,10 +182,10 @@@ async fn delete_object_locally(query_ur
        })
        .await??;
      }
--    Object::User(u) => {
++    Object::Person(u) => {
        // TODO: implement update_deleted() for user, move it to ApubObject trait
        blocking(context.pool(), move |conn| {
--        User_::delete_account(conn, u.id)
++        Person::delete_account(conn, u.id)
        })
        .await??;
      }
index f0ffbcb1e1ca90e99f84a5f5dfcc1e94f64e88ec,6bf4bbde6a3c6e8a6c9d87340d9b99296e00be08..5a1add8d7b2bf8ccd5d52e0da180a4704efeea03
@@@ -11,7 -12,7 +12,7 @@@ use url::Url
  pub mod comment;
  pub mod community;
  pub mod post;
--pub mod user;
++pub mod person;
  
  /// Convert the data to json and turn it into an HTTP Response with the correct ActivityPub
  /// headers.
index 7c7653e575e9be4869a15f972b1db2475000fc50,77c40d855d9a66f8cd8b07911216d9213643f98b..89d678cf59b4de8b28e45453ae73a5ba223b6770
@@@ -9,70 -9,70 +9,70 @@@ use activitystreams::
    collection::{CollectionExt, OrderedCollection},
  };
  use actix_web::{body::Body, web, HttpResponse};
- use lemmy_db_queries::source::user::User;
- use lemmy_db_schema::source::user::User_;
- use lemmy_structs::blocking;
+ use lemmy_api_structs::blocking;
 -use lemmy_db_queries::source::user::User;
 -use lemmy_db_schema::source::user::User_;
++use lemmy_db_queries::source::person::Person_;
++use lemmy_db_schema::source::person::Person;
  use lemmy_utils::LemmyError;
  use lemmy_websocket::LemmyContext;
  use serde::Deserialize;
  use url::Url;
  
  #[derive(Deserialize)]
--pub struct UserQuery {
++pub struct PersonQuery {
    user_name: String,
  }
  
--/// Return the ActivityPub json representation of a local user over HTTP.
--pub async fn get_apub_user_http(
--  info: web::Path<UserQuery>,
++/// Return the ActivityPub json representation of a local person over HTTP.
++pub async fn get_apub_person_http(
++  info: web::Path<PersonQuery>,
    context: web::Data<LemmyContext>,
  ) -> Result<HttpResponse<Body>, LemmyError> {
    let user_name = info.into_inner().user_name;
--  // TODO: this needs to be able to read deleted users, so that it can send tombstones
--  let user = blocking(context.pool(), move |conn| {
--    User_::find_by_email_or_username(conn, &user_name)
++  // TODO: this needs to be able to read deleted persons, so that it can send tombstones
++  let person = blocking(context.pool(), move |conn| {
++    Person::find_by_name(conn, &user_name)
    })
    .await??;
  
--  if !user.deleted {
--    let apub = user.to_apub(context.pool()).await?;
++  if !person.deleted {
++    let apub = person.to_apub(context.pool()).await?;
  
      Ok(create_apub_response(&apub))
    } else {
--    Ok(create_apub_tombstone_response(&user.to_tombstone()?))
++    Ok(create_apub_tombstone_response(&person.to_tombstone()?))
    }
  }
  
--pub async fn get_apub_user_outbox(
--  info: web::Path<UserQuery>,
++pub async fn get_apub_person_outbox(
++  info: web::Path<PersonQuery>,
    context: web::Data<LemmyContext>,
  ) -> Result<HttpResponse<Body>, LemmyError> {
--  let user = blocking(context.pool(), move |conn| {
--    User_::read_from_name(&conn, &info.user_name)
++  let person = blocking(context.pool(), move |conn| {
++    Person::find_by_name(&conn, &info.user_name)
    })
    .await??;
--  // TODO: populate the user outbox
++  // TODO: populate the person outbox
    let mut collection = OrderedCollection::new();
    collection
      .set_many_items(Vec::<Url>::new())
      .set_many_contexts(lemmy_context()?)
--    .set_id(user.get_outbox_url()?)
++    .set_id(person.get_outbox_url()?)
      .set_total_items(0_u64);
    Ok(create_apub_response(&collection))
  }
  
--pub async fn get_apub_user_inbox(
--  info: web::Path<UserQuery>,
++pub async fn get_apub_person_inbox(
++  info: web::Path<PersonQuery>,
    context: web::Data<LemmyContext>,
  ) -> Result<HttpResponse<Body>, LemmyError> {
--  let user = blocking(context.pool(), move |conn| {
--    User_::read_from_name(&conn, &info.user_name)
++  let person = blocking(context.pool(), move |conn| {
++    Person::find_by_name(&conn, &info.user_name)
    })
    .await??;
  
    let mut collection = OrderedCollection::new();
    collection
--    .set_id(format!("{}/inbox", user.actor_id.into_inner()).parse()?)
++    .set_id(format!("{}/inbox", person.actor_id.into_inner()).parse()?)
      .set_many_contexts(lemmy_context()?);
    Ok(create_apub_response(&collection))
  }
index 6a51f9fd7a0e20928b616f289c1b2b2bd7a21566,f003fb16fecff1110957c5e796714c09a9e91a4d..f82b1b55fc1354c57dcf3a56af767ef3fb3eed30
@@@ -29,10 -30,9 +30,9 @@@ use lemmy_api_structs::blocking
  use lemmy_db_queries::{source::community::Community_, ApubObject, DbPool, Followable};
  use lemmy_db_schema::source::{
    community::{Community, CommunityFollower, CommunityFollowerForm},
--  user::User_,
++  person::Person,
  };
--use lemmy_db_views_actor::community_user_ban_view::CommunityUserBanView;
- use lemmy_structs::blocking;
++use lemmy_db_views_actor::community_person_ban_view::CommunityPersonBanView;
  use lemmy_utils::{location_info, LemmyError};
  use lemmy_websocket::LemmyContext;
  use log::info;
@@@ -44,8 -44,8 +44,8 @@@ use url::Url
  #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, Deserialize, Serialize)]
  #[serde(rename_all = "PascalCase")]
  pub enum CommunityValidTypes {
--  Follow,  // follow request from a user
--  Undo,    // unfollow from a user
++  Follow,  // follow request from a person
++  Undo,    // unfollow from a person
    Create,  // create post or comment
    Update,  // update post or comment
    Like,    // upvote post or comment
@@@ -113,21 -113,21 +113,21 @@@ pub(crate) async fn community_receive_m
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<HttpResponse, LemmyError> {
--  // Only users can send activities to the community, so we can get the actor as user
++  // Only persons can send activities to the community, so we can get the actor as person
    // unconditionally.
    let actor_id = actor.actor_id();
--  let user = blocking(&context.pool(), move |conn| {
--    User_::read_from_apub_id(&conn, &actor_id.into())
++  let person = blocking(&context.pool(), move |conn| {
++    Person::read_from_apub_id(&conn, &actor_id.into())
    })
    .await??;
--  check_community_or_site_ban(&user, to_community.id, context.pool()).await?;
++  check_community_or_site_ban(&person, to_community.id, context.pool()).await?;
  
    let any_base = activity.clone().into_any_base()?;
    let actor_url = actor.actor_id();
    let activity_kind = activity.kind().context(location_info!())?;
    let do_announce = match activity_kind {
      CommunityValidTypes::Follow => {
--      handle_follow(any_base.clone(), user, &to_community, &context).await?;
++      handle_follow(any_base.clone(), person, &to_community, &context).await?;
        false
      }
      CommunityValidTypes::Undo => {
      }
      CommunityValidTypes::Remove => {
        // TODO: we dont support remote mods, so this is ignored for now
--      //receive_remove_for_community(context, any_base.clone(), &user_url).await?
++      //receive_remove_for_community(context, any_base.clone(), &person_url).await?
        false
      }
    };
    Ok(HttpResponse::Ok().finish())
  }
  
--/// Handle a follow request from a remote user, adding the user as follower and returning an
++/// Handle a follow request from a remote person, adding the person as follower and returning an
  /// Accept activity.
  async fn handle_follow(
    activity: AnyBase,
--  user: User_,
++  person: Person,
    community: &Community,
    context: &LemmyContext,
  ) -> Result<HttpResponse, LemmyError> {
    let follow = Follow::from_any_base(activity)?.context(location_info!())?;
--  verify_activity_domains_valid(&follow, &user.actor_id(), false)?;
++  verify_activity_domains_valid(&follow, &person.actor_id(), false)?;
  
    let community_follower_form = CommunityFollowerForm {
      community_id: community.id,
-     person_id: user.id,
 -    user_id: user.id,
++    person_id: person.id,
      pending: false,
    };
  
@@@ -226,27 -226,27 +226,27 @@@ async fn handle_undo
    }
  }
  
--/// Handle `Undo/Follow` from a user, removing the user from followers list.
++/// Handle `Undo/Follow` from a person, removing the person from followers list.
  async fn handle_undo_follow(
    activity: AnyBase,
--  user_url: Url,
++  person_url: Url,
    community: &Community,
    context: &LemmyContext,
  ) -> Result<(), LemmyError> {
    let undo = Undo::from_any_base(activity)?.context(location_info!())?;
--  verify_activity_domains_valid(&undo, &user_url, true)?;
++  verify_activity_domains_valid(&undo, &person_url, true)?;
  
    let object = undo.object().to_owned().one().context(location_info!())?;
    let follow = Follow::from_any_base(object)?.context(location_info!())?;
--  verify_activity_domains_valid(&follow, &user_url, false)?;
++  verify_activity_domains_valid(&follow, &person_url, false)?;
  
--  let user = blocking(&context.pool(), move |conn| {
--    User_::read_from_apub_id(&conn, &user_url.into())
++  let person = blocking(&context.pool(), move |conn| {
++    Person::read_from_apub_id(&conn, &person_url.into())
    })
    .await??;
    let community_follower_form = CommunityFollowerForm {
      community_id: community.id,
-     person_id: user.id,
 -    user_id: user.id,
++    person_id: person.id,
      pending: false,
    };
  
  }
  
  pub(crate) async fn check_community_or_site_ban(
--  user: &User_,
++  person: &Person,
    community_id: i32,
    pool: &DbPool,
  ) -> Result<(), LemmyError> {
--  if user.banned {
--    return Err(anyhow!("User is banned from site").into());
++  if person.banned {
++    return Err(anyhow!("Person is banned from site").into());
    }
--  let user_id = user.id;
--  let is_banned = move |conn: &'_ _| CommunityUserBanView::get(conn, user_id, community_id).is_ok();
++  let person_id = person.id;
++  let is_banned = move |conn: &'_ _| CommunityPersonBanView::get(conn, person_id, community_id).is_ok();
    if blocking(pool, is_banned).await? {
--    return Err(anyhow!("User is banned from community").into());
++    return Err(anyhow!("Person is banned from community").into());
    }
  
    Ok(())
index 765d5dff46d22aa34facb69bd23121e6edfb36c3,21585aa6ab1e52c8e24d3f95c45b0fdb35defc65..71d1c133841b07e976500007fa6bd2059e13f707
@@@ -17,9 -18,8 +18,8 @@@ use lemmy_db_queries::
    ApubObject,
    DbPool,
  };
--use lemmy_db_schema::source::{activity::Activity, community::Community, user::User_};
- use lemmy_structs::blocking;
- use lemmy_utils::{location_info, settings::Settings, LemmyError};
++use lemmy_db_schema::source::{activity::Activity, community::Community, person::Person};
+ use lemmy_utils::{location_info, settings::structs::Settings, LemmyError};
  use lemmy_websocket::LemmyContext;
  use serde::Serialize;
  use std::fmt::Debug;
@@@ -28,7 -28,7 +28,7 @@@ use url::Url
  pub mod community_inbox;
  mod receive_for_community;
  pub mod shared_inbox;
--pub mod user_inbox;
++pub mod person_inbox;
  
  pub(crate) fn get_activity_id<T, Kind>(activity: &T, creator_uri: &Url) -> Result<Url, LemmyError>
  where
@@@ -119,17 -119,17 +119,17 @@@ wher
  }
  
  /// Returns true if `to_and_cc` contains at least one local user.
--pub(crate) async fn is_addressed_to_local_user(
++pub(crate) async fn is_addressed_to_local_person(
    to_and_cc: &[Url],
    pool: &DbPool,
  ) -> Result<bool, LemmyError> {
    for url in to_and_cc {
      let url = url.to_owned();
--    let user = blocking(&pool, move |conn| {
--      User_::read_from_apub_id(&conn, &url.into())
++    let person = blocking(&pool, move |conn| {
++      Person::read_from_apub_id(&conn, &url.into())
      })
      .await?;
--    if let Ok(u) = user {
++    if let Ok(u) = person {
        if u.local {
          return Ok(true);
        }
index 5657faf1e0526896071a93584740d0acbe20f050,1a906d627b2a2d57a33b06bc89161997f2428171..c83c5037b0ccf94d2db81e019ae8883245328a03
@@@ -25,7 -25,7 +25,7 @@@ use crate::
      inbox_verify_http_signature,
      is_activity_already_known,
      is_addressed_to_community_followers,
--    is_addressed_to_local_user,
++    is_addressed_to_local_person,
      is_addressed_to_public,
      receive_for_community::{
        receive_create_for_community,
@@@ -48,13 -48,13 +48,13 @@@ use activitystreams::
  use actix_web::{web, HttpRequest, HttpResponse};
  use anyhow::{anyhow, Context};
  use diesel::NotFound;
- use lemmy_db_queries::{source::user::User, ApubObject, Followable};
+ use lemmy_api_structs::blocking;
 -use lemmy_db_queries::{source::user::User, ApubObject, Followable};
++use lemmy_db_queries::{source::person::Person_, ApubObject, Followable};
  use lemmy_db_schema::source::{
    community::{Community, CommunityFollower},
    private_message::PrivateMessage,
--  user::User_,
++  person::Person,
  };
- use lemmy_structs::blocking;
  use lemmy_utils::{location_info, LemmyError};
  use lemmy_websocket::LemmyContext;
  use log::debug;
@@@ -63,10 -63,10 +63,10 @@@ use std::fmt::Debug
  use strum_macros::EnumString;
  use url::Url;
  
--/// Allowed activities for user inbox.
++/// Allowed activities for person inbox.
  #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, Deserialize, Serialize)]
  #[serde(rename_all = "PascalCase")]
--pub enum UserValidTypes {
++pub enum PersonValidTypes {
    Accept,   // community accepted our follow request
    Create,   // create private message
    Update,   // edit private message
    Announce, // post, comment or vote in community
  }
  
--pub type UserAcceptedActivities = ActorAndObject<UserValidTypes>;
++pub type PersonAcceptedActivities = ActorAndObject<PersonValidTypes>;
  
--/// Handler for all incoming activities to user inboxes.
--pub async fn user_inbox(
++/// Handler for all incoming activities to person inboxes.
++pub async fn person_inbox(
    request: HttpRequest,
--  input: web::Json<UserAcceptedActivities>,
++  input: web::Json<PersonAcceptedActivities>,
    path: web::Path<String>,
    context: web::Data<LemmyContext>,
  ) -> Result<HttpResponse, LemmyError> {
  
    // Check if the activity is actually meant for us
    let username = path.into_inner();
--  let user = blocking(&context.pool(), move |conn| {
--    User_::read_from_name(&conn, &username)
++  let person = blocking(&context.pool(), move |conn| {
++    Person::find_by_name(&conn, &username)
    })
    .await??;
    let to_and_cc = get_activity_to_and_cc(&activity);
    // TODO: we should also accept activities that are sent to community followers
--  if !to_and_cc.contains(&&user.actor_id()) {
--    return Err(anyhow!("Activity delivered to wrong user").into());
++  if !to_and_cc.contains(&&person.actor_id()) {
++    return Err(anyhow!("Activity delivered to wrong person").into());
    }
  
    assert_activity_not_local(&activity)?;
    insert_activity(&activity_id, activity.clone(), false, true, context.pool()).await?;
  
    debug!(
--    "User {} received activity {:?} from {}",
--    user.name,
++    "Person {} received activity {:?} from {}",
++    person.name,
      &activity.id_unchecked(),
      &actor.actor_id()
    );
  
--  user_receive_message(
++  person_receive_message(
      activity.clone(),
--    Some(user.clone()),
++    Some(person.clone()),
      actor.as_ref(),
      &context,
      request_counter,
  }
  
  /// Receives Accept/Follow, Announce, private messages and community (undo) remove, (undo) delete
--pub(crate) async fn user_receive_message(
--  activity: UserAcceptedActivities,
--  to_user: Option<User_>,
++pub(crate) async fn person_receive_message(
++  activity: PersonAcceptedActivities,
++  to_person: Option<Person>,
    actor: &dyn ActorType,
    context: &LemmyContext,
    request_counter: &mut i32,
  ) -> Result<HttpResponse, LemmyError> {
--  is_for_user_inbox(context, &activity).await?;
++  is_for_person_inbox(context, &activity).await?;
  
    let any_base = activity.clone().into_any_base()?;
    let kind = activity.kind().context(location_info!())?;
    let actor_url = actor.actor_id();
    match kind {
--    UserValidTypes::Accept => {
-       receive_accept(&context, any_base, actor, to_user.unwrap(), request_counter).await?;
++    PersonValidTypes::Accept => {
+       receive_accept(
+         &context,
+         any_base,
+         actor,
 -        to_user.expect("user provided"),
++        to_person.expect("person provided"),
+         request_counter,
+       )
+       .await?;
      }
--    UserValidTypes::Announce => {
++    PersonValidTypes::Announce => {
        receive_announce(&context, any_base, actor, request_counter).await?
      }
--    UserValidTypes::Create => {
++    PersonValidTypes::Create => {
        receive_create(&context, any_base, actor_url, request_counter).await?
      }
--    UserValidTypes::Update => {
++    PersonValidTypes::Update => {
        receive_update(&context, any_base, actor_url, request_counter).await?
      }
--    UserValidTypes::Delete => {
++    PersonValidTypes::Delete => {
        receive_delete(context, any_base, &actor_url, request_counter).await?
      }
--    UserValidTypes::Undo => receive_undo(context, any_base, &actor_url, request_counter).await?,
--    UserValidTypes::Remove => receive_remove_community(&context, any_base, &actor_url).await?,
++    PersonValidTypes::Undo => receive_undo(context, any_base, &actor_url, request_counter).await?,
++    PersonValidTypes::Remove => receive_remove_community(&context, any_base, &actor_url).await?,
    };
  
    // TODO: would be logical to move websocket notification code here
    Ok(HttpResponse::Ok().finish())
  }
  
--/// Returns true if the activity is addressed directly to one or more local users, or if it is
--/// addressed to the followers collection of a remote community, and at least one local user follows
++/// Returns true if the activity is addressed directly to one or more local persons, or if it is
++/// addressed to the followers collection of a remote community, and at least one local person follows
  /// it.
--async fn is_for_user_inbox(
++async fn is_for_person_inbox(
    context: &LemmyContext,
--  activity: &UserAcceptedActivities,
++  activity: &PersonAcceptedActivities,
  ) -> Result<(), LemmyError> {
    let to_and_cc = get_activity_to_and_cc(activity);
--  // Check if it is addressed directly to any local user
--  if is_addressed_to_local_user(&to_and_cc, context.pool()).await? {
++  // Check if it is addressed directly to any local person
++  if is_addressed_to_local_person(&to_and_cc, context.pool()).await? {
      return Ok(());
    }
  
      }
    }
  
--  Err(anyhow!("Not addressed for any local user").into())
++  Err(anyhow!("Not addressed for any local person").into())
  }
  
  /// Handle accepted follows.
@@@ -206,7 -213,7 +213,7 @@@ async fn receive_accept
    context: &LemmyContext,
    activity: AnyBase,
    actor: &dyn ActorType,
--  user: User_,
++  person: Person,
    request_counter: &mut i32,
  ) -> Result<(), LemmyError> {
    let accept = Accept::from_any_base(activity)?.context(location_info!())?;
  
    let object = accept.object().to_owned().one().context(location_info!())?;
    let follow = Follow::from_any_base(object)?.context(location_info!())?;
--  verify_activity_domains_valid(&follow, &user.actor_id(), false)?;
++  verify_activity_domains_valid(&follow, &person.actor_id(), false)?;
  
    let community_uri = accept
      .actor()?
      get_or_fetch_and_upsert_community(&community_uri, context, request_counter).await?;
  
    let community_id = community.id;
--  let user_id = user.id;
++  let person_id = person.id;
    // This will throw an error if no follow was requested
    blocking(&context.pool(), move |conn| {
--    CommunityFollower::follow_accepted(conn, community_id, user_id)
++    CommunityFollower::follow_accepted(conn, community_id, person_id)
    })
    .await??;
  
index e3704d97a6db167d1ba07abdff1bcbd28b25a2e8,a3ffbf11678e509e9ca1e56f9869c5c49420a4dd..3c5c2303419eb902dbbd11c926dc6baa1dea20cd
@@@ -58,7 -58,7 +58,7 @@@ enum PageOrNote 
  }
  
  /// This file is for post/comment activities received by the community, and for post/comment
--///       activities announced by the community and received by the user.
++///       activities announced by the community and received by the person.
  
  /// A post or comment being created
  pub(in crate::inbox) async fn receive_create_for_community(
index 93df6e7284fda380b91f9cad13f2892374772582,8c197a85f6eea95a8b32dd46df869c9f5f07a105..dd82110a9299528c824c50db39b0164a2e95f559
@@@ -7,8 -7,8 +7,8 @@@ use crate::
      inbox_verify_http_signature,
      is_activity_already_known,
      is_addressed_to_community_followers,
--    is_addressed_to_local_user,
--    user_inbox::{user_receive_message, UserAcceptedActivities},
++    is_addressed_to_local_person,
++    person_inbox::{person_receive_message, PersonAcceptedActivities},
    },
    insert_activity,
  };
@@@ -69,9 -69,9 +69,9 @@@ pub async fn shared_inbox
    let mut res: Option<HttpResponse> = None;
    let to_and_cc = get_activity_to_and_cc(&activity);
    // Handle community first, so in case the sender is banned by the community, it will error out.
--  // If we handled the user receive first, the activity would be inserted to the database before the
++  // If we handled the person receive first, the activity would be inserted to the database before the
    // community could check for bans.
--  // Note that an activity can be addressed to a community and to a user (or multiple users) at the
++  // Note that an activity can be addressed to a community and to a person (or multiple persons) at the
    // same time. In this case we still only handle it once, to avoid duplicate websocket
    // notifications.
    let community = extract_local_community_from_destinations(&to_and_cc, context.pool()).await?;
        )
        .await?,
      );
--  } else if is_addressed_to_local_user(&to_and_cc, context.pool()).await? {
--    let user_activity = UserAcceptedActivities::from_any_base(activity_any_base.clone())?
++  } else if is_addressed_to_local_person(&to_and_cc, context.pool()).await? {
++    let person_activity = PersonAcceptedActivities::from_any_base(activity_any_base.clone())?
        .context(location_info!())?;
--    // `to_user` is only used for follow activities (which we dont receive here), so no need to pass
++    // `to_person` is only used for follow activities (which we dont receive here), so no need to pass
      // it in
--    user_receive_message(
--      user_activity,
++    person_receive_message(
++      person_activity,
        None,
        actor.as_ref(),
        &context,
      .await?
      .is_some()
    {
--    let user_activity = UserAcceptedActivities::from_any_base(activity_any_base.clone())?
++    let person_activity = PersonAcceptedActivities::from_any_base(activity_any_base.clone())?
        .context(location_info!())?;
      res = Some(
--      user_receive_message(
--        user_activity,
++      person_receive_message(
++        person_activity,
          None,
          actor.as_ref(),
          &context,
index 388d57e6a9b5f3292e973e5e14a23464dc280479,850ef503e4494ddbaf7d5bb8e006064e912ccf39..2def37d9110018b289b081f32f07a22caa431d83
@@@ -24,17 -24,20 +24,20 @@@ use activitystreams::
  use activitystreams_ext::{Ext1, Ext2};
  use anyhow::{anyhow, Context};
  use diesel::NotFound;
+ use lemmy_api_structs::blocking;
  use lemmy_db_queries::{source::activity::Activity_, ApubObject, DbPool};
- use lemmy_db_schema::source::{
-   activity::Activity,
-   comment::Comment,
-   community::Community,
-   post::Post,
-   private_message::PrivateMessage,
-   user::User_,
+ use lemmy_db_schema::{
+   source::{
+     activity::Activity,
+     comment::Comment,
+     community::Community,
+     post::Post,
+     private_message::PrivateMessage,
 -    user::User_,
++    person::Person as DbPerson,
+   },
+   DbUrl,
  };
- use lemmy_structs::blocking;
- use lemmy_utils::{location_info, settings::Settings, LemmyError};
+ use lemmy_utils::{location_info, settings::structs::Settings, LemmyError};
  use lemmy_websocket::LemmyContext;
  use serde::Serialize;
  use std::net::IpAddr;
@@@ -42,7 -45,7 +45,7 @@@ use url::{ParseError, Url}
  
  /// Activitystreams type for community
  type GroupExt = Ext2<ApActor<ApObject<Group>>, GroupExtension, PublicKeyExtension>;
--/// Activitystreams type for user
++/// Activitystreams type for person
  type PersonExt = Ext1<ApActor<ApObject<Person>>, PublicKeyExtension>;
  /// Activitystreams type for post
  type PageExt = Ext1<ApObject<Page>, PageExtension>;
@@@ -117,27 -121,27 +121,27 @@@ fn check_is_apub_id_valid(apub_id: &Url
  /// and actors in Lemmy.
  #[async_trait::async_trait(?Send)]
  pub trait ApubObjectType {
--  async fn send_create(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError>;
--  async fn send_update(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError>;
--  async fn send_delete(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError>;
++  async fn send_create(&self, creator: &DbPerson, context: &LemmyContext) -> Result<(), LemmyError>;
++  async fn send_update(&self, creator: &DbPerson, context: &LemmyContext) -> Result<(), LemmyError>;
++  async fn send_delete(&self, creator: &DbPerson, context: &LemmyContext) -> Result<(), LemmyError>;
    async fn send_undo_delete(
      &self,
--    creator: &User_,
++    creator: &DbPerson,
      context: &LemmyContext,
    ) -> Result<(), LemmyError>;
--  async fn send_remove(&self, mod_: &User_, context: &LemmyContext) -> Result<(), LemmyError>;
--  async fn send_undo_remove(&self, mod_: &User_, context: &LemmyContext) -> Result<(), LemmyError>;
++  async fn send_remove(&self, mod_: &DbPerson, context: &LemmyContext) -> Result<(), LemmyError>;
++  async fn send_undo_remove(&self, mod_: &DbPerson, context: &LemmyContext) -> Result<(), LemmyError>;
  }
  
  #[async_trait::async_trait(?Send)]
  pub trait ApubLikeableType {
--  async fn send_like(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError>;
--  async fn send_dislike(&self, creator: &User_, context: &LemmyContext) -> Result<(), LemmyError>;
--  async fn send_undo_like(&self, creator: &User_, context: &LemmyContext)
++  async fn send_like(&self, creator: &DbPerson, context: &LemmyContext) -> Result<(), LemmyError>;
++  async fn send_dislike(&self, creator: &DbPerson, context: &LemmyContext) -> Result<(), LemmyError>;
++  async fn send_undo_like(&self, creator: &DbPerson, context: &LemmyContext)
      -> Result<(), LemmyError>;
  }
  
--/// Common methods provided by ActivityPub actors (community and user). Not all methods are
++/// Common methods provided by ActivityPub actors (community and person). Not all methods are
  /// implemented by all actors.
  #[async_trait::async_trait(?Send)]
  pub trait ActorType {
  
  pub enum EndpointType {
    Community,
--  User,
++  Person,
    Post,
    Comment,
    PrivateMessage,
  pub fn generate_apub_endpoint(
    endpoint_type: EndpointType,
    name: &str,
- ) -> Result<lemmy_db_schema::Url, ParseError> {
+ ) -> Result<DbUrl, ParseError> {
    let point = match endpoint_type {
      EndpointType::Community => "c",
--    EndpointType::User => "u",
++    EndpointType::Person => "u",
      EndpointType::Post => "post",
      EndpointType::Comment => "comment",
      EndpointType::PrivateMessage => "private_message",
@@@ -321,7 -319,7 +319,7 @@@ pub(crate) enum Object 
    Comment(Comment),
    Post(Post),
    Community(Community),
--  User(User_),
++  Person(DbPerson),
    PrivateMessage(PrivateMessage),
  }
  
@@@ -338,12 -336,12 +336,12 @@@ pub(crate) async fn find_object_by_id
    }
  
    let ap_id = apub_id.clone();
--  let user = blocking(context.pool(), move |conn| {
--    User_::read_from_apub_id(conn, &ap_id.into())
++  let person = blocking(context.pool(), move |conn| {
++    DbPerson::read_from_apub_id(conn, &ap_id.into())
    })
    .await?;
--  if let Ok(u) = user {
--    return Ok(Object::User(u));
++  if let Ok(u) = person {
++    return Ok(Object::Person(u));
    }
  
    let ap_id = apub_id.clone();
index 8452f3787304676b9a68591171b62ce7c201cf5d,6c218190ab6061e00ba6e84a715c507575dbd2dd..ae5537e3f7e386cb07b75f0dcfd1cb330c359e95
@@@ -6,7 -6,7 +6,7 @@@ use crate::
      check_object_for_community_or_site_ban,
      create_tombstone,
      get_object_from_apub,
--    get_or_fetch_and_upsert_user,
++    get_or_fetch_and_upsert_person,
      get_source_markdown_value,
      set_content_and_source,
      FromApub,
@@@ -25,9 -26,8 +26,8 @@@ use lemmy_db_queries::{Crud, DbPool}
  use lemmy_db_schema::source::{
    comment::{Comment, CommentForm},
    post::Post,
--  user::User_,
++  person::Person,
  };
- use lemmy_structs::blocking;
  use lemmy_utils::{
    location_info,
    utils::{convert_datetime, remove_slurs},
@@@ -44,7 -44,7 +44,7 @@@ impl ToApub for Comment 
      let mut comment = ApObject::new(Note::new());
  
      let creator_id = self.creator_id;
--    let creator = blocking(pool, move |conn| User_::read(conn, creator_id)).await??;
++    let creator = blocking(pool, move |conn| Person::read(conn, creator_id)).await??;
  
      let post_id = self.post_id;
      let post = blocking(pool, move |conn| Post::read(conn, post_id)).await??;
@@@ -135,7 -135,7 +135,7 @@@ impl FromApubToForm<NoteExt> for Commen
        .as_single_xsd_any_uri()
        .context(location_info!())?;
  
--    let creator = get_or_fetch_and_upsert_user(creator_actor_id, context, request_counter).await?;
++    let creator = get_or_fetch_and_upsert_person(creator_actor_id, context, request_counter).await?;
  
      let mut in_reply_tos = note
        .in_reply_to()
index 827eae294607011306d7680aa708b9a5cd6407e9,200497b73da4d2a6965b13087a83e24dbed6c008..936938130fc3ad5341a8db3f26a417ce720d038d
@@@ -1,6 -1,6 +1,6 @@@
  use crate::{
    extensions::{context::lemmy_context, group_extensions::GroupExtension},
--  fetcher::user::get_or_fetch_and_upsert_user,
++  fetcher::person::get_or_fetch_and_upsert_person,
    objects::{
      check_object_domain,
      create_tombstone,
@@@ -143,7 -143,7 +143,7 @@@ impl FromApubToForm<GroupExt> for Commu
        .as_xsd_any_uri()
        .context(location_info!())?;
  
--    let creator = get_or_fetch_and_upsert_user(creator_uri, context, request_counter).await?;
++    let creator = get_or_fetch_and_upsert_person(creator_uri, context, request_counter).await?;
      let name = group
        .inner
        .preferred_username()
index 79b9ad405ef6bd5f8002a8d3bde7c10995d38465,6b59e577660fbad42a8ceae67cd06f23914b7498..235d5223c39cc58676c57ea4a8d2338dc15f49c7
@@@ -1,6 -1,6 +1,6 @@@
  use crate::{
    check_is_apub_id_valid,
--  fetcher::{community::get_or_fetch_and_upsert_community, user::get_or_fetch_and_upsert_user},
++  fetcher::{community::get_or_fetch_and_upsert_community, person::get_or_fetch_and_upsert_person},
    inbox::community_inbox::check_community_or_site_ban,
  };
  use activitystreams::{
@@@ -23,7 -28,7 +28,7 @@@ pub(crate) mod comment
  pub(crate) mod community;
  pub(crate) mod post;
  pub(crate) mod private_message;
--pub(crate) mod user;
++pub(crate) mod person;
  
  /// Trait for converting an object or actor into the respective ActivityPub type.
  #[async_trait::async_trait(?Send)]
@@@ -214,13 -212,13 +212,13 @@@ pub(in crate::objects) async fn check_o
  where
    T: ObjectExt<Kind>,
  {
--  let user_id = object
++  let person_id = object
      .attributed_to()
      .context(location_info!())?
      .as_single_xsd_any_uri()
      .context(location_info!())?;
--  let user = get_or_fetch_and_upsert_user(user_id, context, request_counter).await?;
--  check_community_or_site_ban(&user, community_id, context.pool()).await
++  let person = get_or_fetch_and_upsert_person(person_id, context, request_counter).await?;
++  check_community_or_site_ban(&person, community_id, context.pool()).await
  }
  
  pub(in crate::objects) async fn get_to_community<T, Kind>(
index 8a911de27cec5538658aae6d3a4e5fa4cb08674d,83f75e49bceeb175fd1adf6c16e61e647a77da4e..a632fcdb056d37dae339b7a33b8fc1567865076d
@@@ -21,12 -22,11 +22,11 @@@ use lemmy_api_structs::blocking
  use lemmy_db_queries::{ApubObject, DbPool};
  use lemmy_db_schema::{
    naive_now,
--  source::user::{UserForm, User_},
++  source::person::{PersonForm, Person as DbPerson},
  };
- use lemmy_structs::blocking;
  use lemmy_utils::{
    location_info,
-   settings::Settings,
+   settings::structs::Settings,
    utils::{check_slurs, check_slurs_opt, convert_datetime},
    LemmyError,
  };
@@@ -34,7 -34,7 +34,7 @@@ use lemmy_websocket::LemmyContext
  use url::Url;
  
  #[async_trait::async_trait(?Send)]
--impl ToApub for User_ {
++impl ToApub for DbPerson {
    type ApubType = PersonExt;
  
    async fn to_apub(&self, _pool: &DbPool) -> Result<PersonExt, LemmyError> {
@@@ -88,7 -85,7 +85,7 @@@
  }
  
  #[async_trait::async_trait(?Send)]
--impl FromApub for User_ {
++impl FromApub for DbPerson {
    type ApubType = PersonExt;
  
    async fn from_apub(
      context: &LemmyContext,
      expected_domain: Url,
      request_counter: &mut i32,
--  ) -> Result<User_, LemmyError> {
--    let user_id = person.id_unchecked().context(location_info!())?.to_owned();
--    let domain = user_id.domain().context(location_info!())?;
-     if domain == Settings::get().hostname {
-       let user = blocking(context.pool(), move |conn| {
-         User_::read_from_apub_id(conn, &user_id.into())
++  ) -> Result<DbPerson, LemmyError> {
++    let person_id = person.id_unchecked().context(location_info!())?.to_owned();
++    let domain = person_id.domain().context(location_info!())?;
+     if domain == Settings::get().hostname() {
 -      let user = blocking(context.pool(), move |conn| {
 -        User_::read_from_apub_id(conn, &user_id.into())
++      let person = blocking(context.pool(), move |conn| {
++        DbPerson::read_from_apub_id(conn, &person_id.into())
        })
        .await??;
--      Ok(user)
++      Ok(person)
      } else {
--      let user_form =
--        UserForm::from_apub(person, context, expected_domain, request_counter).await?;
--      let user = blocking(context.pool(), move |conn| User_::upsert(conn, &user_form)).await??;
--      Ok(user)
++      let person_form =
++        PersonForm::from_apub(person, context, expected_domain, request_counter).await?;
++      let person = blocking(context.pool(), move |conn| DbPerson::upsert(conn, &person_form)).await??;
++      Ok(person)
      }
    }
  }
  
  #[async_trait::async_trait(?Send)]
--impl FromApubToForm<PersonExt> for UserForm {
++impl FromApubToForm<PersonExt> for PersonForm {
    async fn from_apub(
      person: &PersonExt,
      _context: &LemmyContext,
      check_slurs_opt(&preferred_username)?;
      check_slurs_opt(&bio)?;
  
--    Ok(UserForm {
++    Ok(PersonForm {
        name,
        preferred_username: Some(preferred_username),
--      password_encrypted: "".to_string(),
--      admin: false,
        banned: None,
--      email: None,
-       avatar,
-       banner,
++      deleted: None,
+       avatar: avatar.map(|o| o.map(|i| i.into())),
+       banner: banner.map(|o| o.map(|i| i.into())),
        published: person.inner.published().map(|u| u.to_owned().naive_local()),
        updated: person.updated().map(|u| u.to_owned().naive_local()),
--      show_nsfw: false,
--      theme: "".to_string(),
--      default_sort_type: 0,
--      default_listing_type: 0,
--      lang: "".to_string(),
--      show_avatars: false,
--      send_notifications_to_email: false,
--      matrix_user_id: None,
        actor_id: Some(check_object_domain(person, expected_domain)?),
        bio: Some(bio),
--      local: false,
++      local: Some(false),
        private_key: None,
--      public_key: Some(person.ext_one.public_key.to_owned().public_key_pem),
++      public_key: Some(Some(person.ext_one.public_key.to_owned().public_key_pem)),
        last_refreshed_at: Some(naive_now()),
        inbox_url: Some(person.inner.inbox()?.to_owned().into()),
        shared_inbox_url: Some(shared_inbox),
index 2cac67ea494d0156f87fd84297e6d7b679b340bd,b066e6f8cb5dc023be5b49c01d4cf752236c49a7..a189c2deef026be98482c1a1a46baa3e1bf13bcb
@@@ -1,6 -1,6 +1,6 @@@
  use crate::{
    extensions::{context::lemmy_context, page_extension::PageExtension},
--  fetcher::user::get_or_fetch_and_upsert_user,
++  fetcher::person::get_or_fetch_and_upsert_person,
    objects::{
      check_object_domain,
      check_object_for_community_or_site_ban,
@@@ -22,13 -22,16 +22,16 @@@ use activitystreams::
  };
  use activitystreams_ext::Ext1;
  use anyhow::Context;
+ use lemmy_api_structs::blocking;
  use lemmy_db_queries::{Crud, DbPool};
- use lemmy_db_schema::source::{
-   community::Community,
-   post::{Post, PostForm},
-   user::User_,
+ use lemmy_db_schema::{
+   self,
+   source::{
+     community::Community,
+     post::{Post, PostForm},
 -    user::User_,
++    person::Person,
+   },
  };
- use lemmy_structs::blocking;
  use lemmy_utils::{
    location_info,
    request::fetch_iframely_and_pictrs_data,
@@@ -47,7 -50,7 +50,7 @@@ impl ToApub for Post 
      let mut page = ApObject::new(Page::new());
  
      let creator_id = self.creator_id;
--    let creator = blocking(pool, move |conn| User_::read(conn, creator_id)).await??;
++    let creator = blocking(pool, move |conn| Person::read(conn, creator_id)).await??;
  
      let community_id = self.community_id;
      let community = blocking(pool, move |conn| Community::read(conn, community_id)).await??;
@@@ -142,7 -142,7 +142,7 @@@ impl FromApubToForm<PageExt> for PostFo
        .as_single_xsd_any_uri()
        .context(location_info!())?;
  
--    let creator = get_or_fetch_and_upsert_user(creator_actor_id, context, request_counter).await?;
++    let creator = get_or_fetch_and_upsert_person(creator_actor_id, context, request_counter).await?;
  
      let community = get_to_community(page, context, request_counter).await?;
  
index df91b03f0ebdf1ab49c0bfee2956ba7f26bb0b73,0bb753e2801200a3ae3b94b5e95f308133638611..09b49dd08c95557b0255aef3b64758d7568fafe5
@@@ -1,7 -1,7 +1,7 @@@
  use crate::{
    check_is_apub_id_valid,
    extensions::context::lemmy_context,
--  fetcher::user::get_or_fetch_and_upsert_user,
++  fetcher::person::get_or_fetch_and_upsert_person,
    objects::{
      check_object_domain,
      create_tombstone,
@@@ -22,9 -23,8 +23,8 @@@ use lemmy_api_structs::blocking
  use lemmy_db_queries::{Crud, DbPool};
  use lemmy_db_schema::source::{
    private_message::{PrivateMessage, PrivateMessageForm},
--  user::User_,
++  person::Person,
  };
- use lemmy_structs::blocking;
  use lemmy_utils::{location_info, utils::convert_datetime, LemmyError};
  use lemmy_websocket::LemmyContext;
  use url::Url;
@@@ -37,10 -37,10 +37,10 @@@ impl ToApub for PrivateMessage 
      let mut private_message = ApObject::new(Note::new());
  
      let creator_id = self.creator_id;
--    let creator = blocking(pool, move |conn| User_::read(conn, creator_id)).await??;
++    let creator = blocking(pool, move |conn| Person::read(conn, creator_id)).await??;
  
      let recipient_id = self.recipient_id;
--    let recipient = blocking(pool, move |conn| User_::read(conn, recipient_id)).await??;
++    let recipient = blocking(pool, move |conn| Person::read(conn, recipient_id)).await??;
  
      private_message
        .set_many_contexts(lemmy_context()?)
@@@ -97,7 -97,7 +97,7 @@@ impl FromApubToForm<NoteExt> for Privat
        .single_xsd_any_uri()
        .context(location_info!())?;
  
--    let creator = get_or_fetch_and_upsert_user(&creator_actor_id, context, request_counter).await?;
++    let creator = get_or_fetch_and_upsert_person(&creator_actor_id, context, request_counter).await?;
      let recipient_actor_id = note
        .to()
        .context(location_info!())?
        .single_xsd_any_uri()
        .context(location_info!())?;
      let recipient =
--      get_or_fetch_and_upsert_user(&recipient_actor_id, context, request_counter).await?;
++      get_or_fetch_and_upsert_person(&recipient_actor_id, context, request_counter).await?;
      let ap_id = note.id_unchecked().context(location_info!())?.to_string();
      check_is_apub_id_valid(&Url::parse(&ap_id)?)?;
  
index 3717a894f09e336e7d26bd904678ac38b2964657,07dcc7f88e5fa84d915bba0b1957ac0edecb86cc..6cc887785369205fc0193ba62a984b7ad50ea726
@@@ -9,9 -9,9 +9,9 @@@ use crate::
      },
      get_activity,
      post::get_apub_post,
--    user::{get_apub_user_http, get_apub_user_inbox, get_apub_user_outbox},
++    person::{get_apub_person_http, get_apub_person_inbox, get_apub_person_outbox},
    },
--  inbox::{community_inbox::community_inbox, shared_inbox::shared_inbox, user_inbox::user_inbox},
++  inbox::{community_inbox::community_inbox, shared_inbox::shared_inbox, person_inbox::person_inbox},
    APUB_JSON_CONTENT_TYPE,
  };
  use actix_web::*;
@@@ -55,9 -53,9 +53,9 @@@ pub fn config(cfg: &mut web::ServiceCon
              "/c/{community_name}/inbox",
              web::get().to(get_apub_community_inbox),
            )
--          .route("/u/{user_name}", web::get().to(get_apub_user_http))
--          .route("/u/{user_name}/outbox", web::get().to(get_apub_user_outbox))
--          .route("/u/{user_name}/inbox", web::get().to(get_apub_user_inbox))
++          .route("/u/{user_name}", web::get().to(get_apub_person_http))
++          .route("/u/{user_name}/outbox", web::get().to(get_apub_person_outbox))
++          .route("/u/{user_name}/inbox", web::get().to(get_apub_person_inbox))
            .route("/post/{post_id}", web::get().to(get_apub_post))
            .route("/comment/{comment_id}", web::get().to(get_apub_comment))
            .route("/activities/{type_}/{id}", web::get().to(get_activity)),
@@@ -68,7 -66,7 +66,7 @@@
            .wrap(digest_verifier)
            .guard(header_guard_content_type)
            .route("/c/{community_name}/inbox", web::post().to(community_inbox))
--          .route("/u/{user_name}/inbox", web::post().to(user_inbox))
++          .route("/u/{user_name}/inbox", web::post().to(person_inbox))
            .route("/inbox", web::post().to(shared_inbox)),
        );
    }
index 9f7d678e2cc52e951872bac64df5afc8624423c8,0826ae0d4b4dfed9b5a923f043a2e9a23df5879a..5d4fe5dc2fe4bf76f978e33fb4051a7de94501a1
@@@ -28,17 -28,19 +28,17 @@@ mod tests 
      establish_unpooled_connection,
      Crud,
      Likeable,
--    ListingType,
--    SortType,
    };
    use lemmy_db_schema::source::{
      comment::{Comment, CommentForm, CommentLike, CommentLikeForm},
      community::{Community, CommunityForm},
      post::{Post, PostForm},
 -    user::{UserForm, User_},
 +    person::{PersonForm, Person},
    };
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
index 159b323e85443b937d4edfd62a76c174aefbce25,ee60da9b287e8c599233aebc02952b89553a84f3..23fbe8bd6211b1b26bca55e471d76046fe8fef17
@@@ -32,32 -32,44 +32,32 @@@ mod tests 
      establish_unpooled_connection,
      Crud,
      Followable,
--    ListingType,
--    SortType,
    };
    use lemmy_db_schema::source::{
      comment::{Comment, CommentForm},
      community::{Community, CommunityFollower, CommunityFollowerForm, CommunityForm},
      post::{Post, PostForm},
 -    user::{UserForm, User_},
 +    person::{PersonForm, Person},
    };
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "thommy_community_agg".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
        shared_inbox_url: None,
      };
  
 -    let inserted_user = User_::create(&conn, &new_user).unwrap();
 +    let inserted_person = Person::create(&conn, &new_person).unwrap();
  
 -    let another_user = UserForm {
 +    let another_person = PersonForm {
        name: "jerry_community_agg".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index ccbba8db032e1cdb7feb594c8b1aff3bab17f98c,bdd16932a101a4f0bea727eda5c5e18ec52fcea8..cebf70b02ef07a9d1225730ba8202da402210248
@@@ -28,32 -28,44 +28,32 @@@ mod tests 
      establish_unpooled_connection,
      Crud,
      Likeable,
--    ListingType,
--    SortType,
    };
    use lemmy_db_schema::source::{
      comment::{Comment, CommentForm, CommentLike, CommentLikeForm},
      community::{Community, CommunityForm},
      post::{Post, PostForm, PostLike, PostLikeForm},
 -    user::{UserForm, User_},
 +    person::{PersonForm, Person},
    };
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "thommy_user_agg".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
        shared_inbox_url: None,
      };
  
 -    let inserted_user = User_::create(&conn, &new_user).unwrap();
 +    let inserted_person = Person::create(&conn, &new_person).unwrap();
  
 -    let another_user = UserForm {
 +    let another_person = PersonForm {
        name: "jerry_user_agg".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index f272e4f8c66caa3fa6f199ef172730834eb3ecd3,404257a7b75f6831f94a099cde7062233a2da1b9..be4e8dc72366ca7648591075a14e680bdb671a54
@@@ -31,30 -31,45 +31,33 @@@ mod tests 
      aggregates::post_aggregates::PostAggregates,
      establish_unpooled_connection,
      Crud,
 -    ListingType,
 -    SortType,
+     Likeable,
    };
    use lemmy_db_schema::source::{
      comment::{Comment, CommentForm},
      community::{Community, CommunityForm},
      post::{Post, PostForm, PostLike, PostLikeForm},
 -    user::{UserForm, User_},
 +    person::{PersonForm, Person},
    };
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "thommy_community_agg".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
        shared_inbox_url: None,
      };
  
 -    let inserted_user = User_::create(&conn, &new_user).unwrap();
 +    let inserted_person = Person::create(&conn, &new_person).unwrap();
  
 -    let another_user = UserForm {
 +    let another_person = PersonForm {
        name: "jerry_community_agg".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index 2f33b507d1b111a2c16adb3db676963a2691971b,81afed5c49d6540e043d3720b016479a8f5eae74..fe25c969d9e65af8343c1ab1b44a9f19fb321da5
@@@ -28,31 -28,46 +28,34 @@@ mod tests 
    use crate::{
      aggregates::site_aggregates::SiteAggregates,
      establish_unpooled_connection,
 -    ListingType,
 -    SortType,
+     Crud,
    };
    use lemmy_db_schema::source::{
      comment::{Comment, CommentForm},
      community::{Community, CommunityForm},
      post::{Post, PostForm},
      site::{Site, SiteForm},
 -    user::{UserForm, User_},
 +    person::{PersonForm, Person},
    };
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "thommy_site_agg".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index 7c00681e4cb480ef16d3842565749782826211d3,56b904e89c573df485c154a8e110e54eb402ec20..06b9bd8754a76cf3914d3af6d7fccaa9bb0ba31f
@@@ -127,11 -128,17 +128,14 @@@ mod tests 
    };
    use lemmy_db_schema::source::{
      activity::{Activity, ActivityForm},
 -    user::{UserForm, User_},
 +    person::{PersonForm, Person},
    };
    use serde_json::Value;
+   use serial_test::serial;
+   use url::Url;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
        shared_inbox_url: None,
      };
  
 -    let inserted_creator = User_::create(&conn, &creator_form).unwrap();
 +    let inserted_creator = Person::create(&conn, &creator_form).unwrap();
  
-     let ap_id =
-       "https://enterprise.lemmy.ml/activities/delete/f1b5d57c-80f8-4e03-a615-688d552e946c";
+     let ap_id: DbUrl = Url::parse(
+       "https://enterprise.lemmy.ml/activities/delete/f1b5d57c-80f8-4e03-a615-688d552e946c",
+     )
+     .unwrap()
+     .into();
      let test_json: Value = serde_json::from_str(
        r#"{
      "@context": "https://www.w3.org/ns/activitystreams",
      };
  
      let read_activity = Activity::read(&conn, inserted_activity.id).unwrap();
-     let read_activity_by_apub_id = Activity::read_from_apub_id(&conn, ap_id).unwrap();
+     let read_activity_by_apub_id = Activity::read_from_apub_id(&conn, &ap_id).unwrap();
 -    User_::delete(&conn, inserted_creator.id).unwrap();
 +    Person::delete(&conn, inserted_creator.id).unwrap();
      Activity::delete(&conn, inserted_activity.id).unwrap();
  
      assert_eq!(expected_activity, read_activity);
index 583a59e6d702ffed49780a08045b781204070f29,8dc9050cb63de62758ba819f5d34bf0ef501aa74..e4feef80c2eb3b67cc4975d660311dcd1dc727bf
@@@ -187,7 -187,7 +187,7 @@@ impl Saveable<CommentSavedForm> for Com
      use lemmy_db_schema::schema::comment_saved::dsl::*;
      insert_into(comment_saved)
        .values(comment_saved_form)
--      .on_conflict((comment_id, user_id))
++      .on_conflict((comment_id, person_id))
        .do_update()
        .set(comment_saved_form)
        .get_result::<Self>(conn)
      diesel::delete(
        comment_saved
          .filter(comment_id.eq(comment_saved_form.comment_id))
-         .filter(user_id.eq(comment_saved_form.person_id)),
 -        .filter(user_id.eq(comment_saved_form.user_id)),
++        .filter(person_id.eq(comment_saved_form.person_id)),
      )
      .execute(conn)
    }
  
  #[cfg(test)]
  mod tests {
--  use crate::{establish_unpooled_connection, Crud, Likeable, ListingType, Saveable, SortType};
++  use crate::{establish_unpooled_connection, Crud, Likeable, Saveable};
    use lemmy_db_schema::source::{
      comment::*,
      community::{Community, CommunityForm},
      post::*,
 -    user::{UserForm, User_},
 +    person::{PersonForm, Person},
    };
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "terry".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
        shared_inbox_url: None,
      };
  
-     let inserted_persod = Person::create(&conn, &new_person).unwrap();
 -    let inserted_user = User_::create(&conn, &new_user).unwrap();
++    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_persod.id,
 -      creator_id: inserted_user.id,
++      creator_id: inserted_person.id,
        removed: None,
        deleted: None,
        updated: None,
  
      let new_post = PostForm {
        name: "A test post".into(),
-       creator_id: inserted_persod.id,
 -      creator_id: inserted_user.id,
++      creator_id: inserted_person.id,
        url: None,
        body: None,
        community_id: inserted_community.id,
  
      let comment_form = CommentForm {
        content: "A test comment".into(),
-       creator_id: inserted_persod.id,
 -      creator_id: inserted_user.id,
++      creator_id: inserted_person.id,
        post_id: inserted_post.id,
        removed: None,
        deleted: None,
      let expected_comment = Comment {
        id: inserted_comment.id,
        content: "A test comment".into(),
-       creator_id: inserted_persod.id,
 -      creator_id: inserted_user.id,
++      creator_id: inserted_person.id,
        post_id: inserted_post.id,
        removed: false,
        deleted: false,
  
      let child_comment_form = CommentForm {
        content: "A child comment".into(),
-       creator_id: inserted_persod.id,
 -      creator_id: inserted_user.id,
++      creator_id: inserted_person.id,
        post_id: inserted_post.id,
        parent_id: Some(inserted_comment.id),
        removed: None,
      let comment_like_form = CommentLikeForm {
        comment_id: inserted_comment.id,
        post_id: inserted_post.id,
-       person_id: inserted_persod.id,
 -      user_id: inserted_user.id,
++      person_id: inserted_person.id,
        score: 1,
      };
  
        id: inserted_comment_like.id,
        comment_id: inserted_comment.id,
        post_id: inserted_post.id,
-       person_id: inserted_persod.id,
 -      user_id: inserted_user.id,
++      person_id: inserted_person.id,
        published: inserted_comment_like.published,
        score: 1,
      };
      // Comment Saved
      let comment_saved_form = CommentSavedForm {
        comment_id: inserted_comment.id,
-       person_id: inserted_persod.id,
 -      user_id: inserted_user.id,
++      person_id: inserted_person.id,
      };
  
      let inserted_comment_saved = CommentSaved::save(&conn, &comment_saved_form).unwrap();
      let expected_comment_saved = CommentSaved {
        id: inserted_comment_saved.id,
        comment_id: inserted_comment.id,
-       person_id: inserted_persod.id,
 -      user_id: inserted_user.id,
++      person_id: inserted_person.id,
        published: inserted_comment_saved.published,
      };
  
      let read_comment = Comment::read(&conn, inserted_comment.id).unwrap();
      let updated_comment = Comment::update(&conn, inserted_comment.id, &comment_form).unwrap();
-     let like_removed = CommentLike::remove(&conn, inserted_persod.id, inserted_comment.id).unwrap();
 -    let like_removed = CommentLike::remove(&conn, inserted_user.id, inserted_comment.id).unwrap();
++    let like_removed = CommentLike::remove(&conn, inserted_person.id, inserted_comment.id).unwrap();
      let saved_removed = CommentSaved::unsave(&conn, &comment_saved_form).unwrap();
      let num_deleted = Comment::delete(&conn, inserted_comment.id).unwrap();
      Comment::delete(&conn, inserted_child_comment.id).unwrap();
      Post::delete(&conn, inserted_post.id).unwrap();
      Community::delete(&conn, inserted_community.id).unwrap();
-     Person::delete(&conn, inserted_persod.id).unwrap();
 -    User_::delete(&conn, inserted_user.id).unwrap();
++    Person::delete(&conn, inserted_person.id).unwrap();
  
      assert_eq!(expected_comment, read_comment);
      assert_eq!(expected_comment, inserted_comment);
index 2b61d312f31ca8f06130cb5e38d2d5c62dc793e6,03484816cbf7933f61fe65fc2ca6945e7d0a91c2..9a6a0560febb5204669866bf64c9ebbf3e06003f
@@@ -9,10 -9,10 +9,10 @@@ use lemmy_db_schema::
      CommunityForm,
      CommunityModerator,
      CommunityModeratorForm,
 -    CommunityUserBan,
 -    CommunityUserBanForm,
 +    CommunityPersonBan,
 +    CommunityPersonBanForm,
    },
-   Url,
+   DbUrl,
  };
  
  mod safe_type {
@@@ -287,12 -290,12 +290,12 @@@ impl Followable<CommunityFollowerForm> 
      use lemmy_db_schema::schema::community_follower::dsl::*;
      insert_into(community_follower)
        .values(community_follower_form)
--      .on_conflict((community_id, user_id))
++      .on_conflict((community_id, person_id))
        .do_update()
        .set(community_follower_form)
        .get_result::<Self>(conn)
    }
--  fn follow_accepted(conn: &PgConnection, community_id_: i32, user_id_: i32) -> Result<Self, Error>
++  fn follow_accepted(conn: &PgConnection, community_id_: i32, person_id_: i32) -> Result<Self, Error>
    where
      Self: Sized,
    {
      diesel::update(
        community_follower
          .filter(community_id.eq(community_id_))
--        .filter(user_id.eq(user_id_)),
++        .filter(person_id.eq(person_id_)),
      )
      .set(pending.eq(true))
      .get_result::<Self>(conn)
      diesel::delete(
        community_follower
          .filter(community_id.eq(&community_follower_form.community_id))
-         .filter(user_id.eq(&community_follower_form.person_id)),
 -        .filter(user_id.eq(&community_follower_form.user_id)),
++        .filter(person_id.eq(&community_follower_form.person_id)),
      )
      .execute(conn)
    }
@@@ -336,27 -339,39 +339,27 @@@ mod tests 
      Crud,
      Followable,
      Joinable,
--    ListingType,
--    SortType,
    };
 -  use lemmy_db_schema::source::{community::*, user::*};
 +  use lemmy_db_schema::source::{community::*, person::*};
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "bobbee".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index 537438642f668dac41c022e46c80a2ca00907453,0000000000000000000000000000000000000000..644c3eacbab7f9eb95041fc0ac919ee3757ca079
mode 100644,000000..100644
--- /dev/null
@@@ -1,76 -1,0 +1,159 @@@
- use crate::{is_email_regex, ApubObject, Crud, ToSafeSettings};
++use crate::{is_email_regex, Crud, ToSafeSettings};
++use diesel::{dsl::*, result::Error, *};
++use lemmy_db_schema::source::local_user::LocalUserSettings;
++use lemmy_db_schema::schema::local_user::dsl::*;
++use lemmy_db_schema::source::local_user::{LocalUser, LocalUserForm};
++use bcrypt::{hash, DEFAULT_COST};
++
++mod safe_type {
++  use crate::ToSafe;
++  use lemmy_db_schema::{schema::local_user::columns::*, source::local_user::LocalUser};
++
++  type Columns = (
++  id,
++  person_id,
++  admin,
++  matrix_user_id,
++  );
++
++  impl ToSafe for LocalUser {
++    type SafeColumns = Columns;
++    fn safe_columns_tuple() -> Self::SafeColumns {
++      (
++        id,
++        person_id,
++        admin,
++        matrix_user_id,
++      )
++    }
++  }
++}
++
 +mod safe_settings_type {
 +  use crate::ToSafeSettings;
-   use lemmy_db_schema::{schema::user_::columns::*, source::user::User_};
++  use lemmy_db_schema::{schema::local_user::columns::*, source::local_user::LocalUser};
 +
 +  type Columns = (
 +    id,
-     name,
-     preferred_username,
++    person_id,
 +    email,
-     avatar,
 +    admin,
-     banned,
-     published,
-     updated,
 +    show_nsfw,
 +    theme,
 +    default_sort_type,
 +    default_listing_type,
 +    lang,
 +    show_avatars,
 +    send_notifications_to_email,
 +    matrix_user_id,
-     actor_id,
-     bio,
-     local,
-     last_refreshed_at,
-     banner,
-     deleted,
 +  );
 +
-   impl ToSafeSettings for User_ {
++  impl ToSafeSettings for LocalUser {
 +    type SafeSettingsColumns = Columns;
++    
++    /// Includes everything but the hashed password
 +    fn safe_settings_columns_tuple() -> Self::SafeSettingsColumns {
 +      (
 +        id,
-         name,
-         preferred_username,
++        person_id,
 +        email,
-         avatar,
 +        admin,
-         banned,
-         published,
-         updated,
 +        show_nsfw,
 +        theme,
 +        default_sort_type,
 +        default_listing_type,
 +        lang,
 +        show_avatars,
 +        send_notifications_to_email,
 +        matrix_user_id,
-         actor_id,
-         bio,
-         local,
-         last_refreshed_at,
-         banner,
-         deleted,
 +      )
 +    }
 +  }
 +}
 +
- pub trait UserSafeSettings_ {
-   fn read(conn: &PgConnection, user_id: i32) -> Result<UserSafeSettings, Error>;
++pub trait LocalUser_ {
++  fn register(conn: &PgConnection, form: &LocalUserForm) -> Result<LocalUser, Error>;
++  fn update_password(conn: &PgConnection, person_id: i32, new_password: &str)
++    -> Result<LocalUser, Error>;
++  fn add_admin(conn: &PgConnection, local_user_id: i32, added: bool) -> Result<LocalUser, Error>;
++  fn find_by_email(conn: &PgConnection, from_email: &str) -> Result<LocalUser, Error>;
++  fn find_by_person(conn: &PgConnection, from_person_id: i32) -> Result<LocalUser, Error>;
++}
++
++impl LocalUser_ for LocalUser {
++  fn register(conn: &PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
++    let mut edited_user = form.clone();
++    let password_hash =
++      hash(&form.password_encrypted, DEFAULT_COST).expect("Couldn't hash password");
++    edited_user.password_encrypted = password_hash;
++
++    Self::create(&conn, &edited_user)
++  }
++
++  // TODO do more individual updates like these
++  fn update_password(conn: &PgConnection, local_user_id: i32, new_password: &str) -> Result<Self, Error> {
++    let password_hash = hash(new_password, DEFAULT_COST).expect("Couldn't hash password");
++
++    diesel::update(local_user.find(local_user_id))
++      .set((
++        password_encrypted.eq(password_hash),
++      ))
++      .get_result::<Self>(conn)
++  }
++
++  // TODO is this used?
++  fn add_admin(conn: &PgConnection, local_user_id: i32, added: bool) -> Result<Self, Error> {
++    diesel::update(local_user.find(local_user_id))
++      .set(admin.eq(added))
++      .get_result::<Self>(conn)
++  }
++
++  // TODO is this used?
++  fn find_by_email(conn: &PgConnection, from_email: &str) -> Result<LocalUser, Error> {
++    local_user
++      .filter(email.eq(from_email))
++      .first::<LocalUser>(conn)
++  }
++
++  // TODO is this used?
++  fn find_by_person(conn: &PgConnection, for_person_id: i32) -> Result<LocalUser, Error> {
++    local_user
++      .filter(person_id.eq(for_person_id))
++      .first::<LocalUser>(conn)
++  }
++
++}
++
++impl Crud<LocalUserForm> for LocalUser {
++  fn read(conn: &PgConnection, local_user_id: i32) -> Result<Self, Error> {
++    local_user
++      .find(local_user_id)
++      .first::<Self>(conn)
++  }
++  fn delete(conn: &PgConnection, local_user_id: i32) -> Result<usize, Error> {
++    diesel::delete(local_user.find(local_user_id)).execute(conn)
++  }
++  fn create(conn: &PgConnection, form: &LocalUserForm) -> Result<Self, Error> {
++    insert_into(local_user).values(form).get_result::<Self>(conn)
++  }
++  fn update(conn: &PgConnection, local_user_id: i32, form: &LocalUserForm) -> Result<Self, Error> {
++    diesel::update(local_user.find(local_user_id))
++      .set(form)
++      .get_result::<Self>(conn)
++  }
++}
++
++// TODO is this used?
++pub trait LocalUserSettings_ {
++  fn read(conn: &PgConnection, user_id: i32) -> Result<LocalUserSettings, Error>;
 +}
 +
- impl UserSafeSettings_ for UserSafeSettings {
++// TODO is this used?
++impl LocalUserSettings_ for LocalUserSettings {
 +  fn read(conn: &PgConnection, user_id: i32) -> Result<Self, Error> {
-     user_
-       .select(User_::safe_settings_columns_tuple())
-       .filter(deleted.eq(false))
++    local_user
++      .select(LocalUser::safe_settings_columns_tuple())
 +      .find(user_id)
 +      .first::<Self>(conn)
 +  }
 +}
index 36d90fdd33e3cc9063b485af6dc6b793b93b0ae4,469ada089f1f2eb6dacbfb2e199189216be3c717..4477b55e4ca15350049e8d582338465ae769c9e1
@@@ -197,8 -197,9 +197,9 @@@ impl Crud<ModAddForm> for ModAdd 
  
  #[cfg(test)]
  mod tests {
--  use crate::{establish_unpooled_connection, Crud, ListingType, SortType};
 -  use lemmy_db_schema::source::{comment::*, community::*, moderator::*, post::*, user::*};
++  use crate::{establish_unpooled_connection, Crud};
 +  use lemmy_db_schema::source::{comment::*, community::*, moderator::*, post::*, person::*};
+   use serial_test::serial;
  
    // use Crud;
    #[test]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_mod = UserForm {
 +    let new_mod = PersonForm {
        name: "the mod".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
        shared_inbox_url: None,
      };
  
 -    let inserted_mod = User_::create(&conn, &new_mod).unwrap();
 +    let inserted_mod = Person::create(&conn, &new_mod).unwrap();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "jim2".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index a8524cfb55d75898bee82b745eb212fc4f594b2e,600037d8ac1719df6a6e8c150fb27f74b40e33a9..96fd06477031a83dc89339d695586609f6891632
@@@ -76,27 -76,39 +76,27 @@@ mod tests 
      establish_unpooled_connection,
      source::password_reset_request::PasswordResetRequest_,
      Crud,
--    ListingType,
--    SortType,
    };
 -  use lemmy_db_schema::source::{password_reset_request::PasswordResetRequest, user::*};
 +  use lemmy_db_schema::source::{password_reset_request::PasswordResetRequest, person::*};
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "thommy prw".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index e17fcda5aa4e741f0df829b1d9b6070ea5a88e20,0000000000000000000000000000000000000000..86b04925d538adb6256e327f092d5e02dc2fab79
mode 100644,000000..100644
--- /dev/null
@@@ -1,364 -1,0 +1,308 @@@
- use crate::{is_email_regex, ApubObject, Crud, ToSafeSettings};
- use bcrypt::{hash, DEFAULT_COST};
++use crate::{is_email_regex, ApubObject, Crud};
 +use diesel::{dsl::*, result::Error, *};
 +use lemmy_db_schema::{
 +  naive_now,
 +  schema::person::dsl::*,
 +  source::person::{PersonForm, Person},
-   Url,
++  DbUrl,
 +};
- use lemmy_utils::settings::Settings;
++use lemmy_utils::settings::structs::Settings;
 +
 +mod safe_type {
 +  use crate::ToSafe;
 +  use lemmy_db_schema::{schema::person::columns::*, source::person::Person};
 +
 +  type Columns = (
 +  id,
 +  name,
 +  preferred_username,
 +  avatar,
 +  banned,
 +  published,
 +  updated,
 +  actor_id,
 +  bio,
 +  local,
-   last_refreshed_at,
 +  banner,
 +  deleted,
 +  inbox_url,
 +  shared_inbox_url,
 +  );
 +
 +  impl ToSafe for Person {
 +    type SafeColumns = Columns;
 +    fn safe_columns_tuple() -> Self::SafeColumns {
 +      (
 +        id,
 +        name,
 +        preferred_username,
 +        avatar,
 +        banned,
 +        published,
 +        updated,
 +        actor_id,
 +        bio,
 +        local,
-         last_refreshed_at,
 +        banner,
 +        deleted,
 +        inbox_url,
 +        shared_inbox_url,
 +      )
 +    }
 +  }
 +}
 +
 +mod safe_type_alias_1 {
 +  use crate::ToSafe;
 +  use lemmy_db_schema::{schema::person_alias_1::columns::*, source::person::PersonAlias1};
 +
 +  type Columns = (
 +        id,
 +        name,
 +        preferred_username,
 +        avatar,
 +        banned,
 +        published,
 +        updated,
 +        actor_id,
 +        bio,
 +        local,
-         last_refreshed_at,
 +        banner,
 +        deleted,
 +        inbox_url,
 +        shared_inbox_url,
 +  );
 +
 +  impl ToSafe for PersonAlias1 {
 +    type SafeColumns = Columns;
 +    fn safe_columns_tuple() -> Self::SafeColumns {
 +      (
 +        id,
 +        name,
 +        preferred_username,
 +        avatar,
 +        banned,
 +        published,
 +        updated,
 +        actor_id,
 +        bio,
 +        local,
-         last_refreshed_at,
 +        banner,
 +        deleted,
 +        inbox_url,
 +        shared_inbox_url,
 +      )
 +    }
 +  }
 +}
 +
 +mod safe_type_alias_2 {
 +  use crate::ToSafe;
 +  use lemmy_db_schema::{schema::person_alias_2::columns::*, source::person::PersonAlias2};
 +
 +  type Columns = (
 +        id,
 +        name,
 +        preferred_username,
 +        avatar,
 +        banned,
 +        published,
 +        updated,
 +        actor_id,
 +        bio,
 +        local,
-         last_refreshed_at,
 +        banner,
 +        deleted,
 +        inbox_url,
 +        shared_inbox_url,
 +  );
 +
 +  impl ToSafe for PersonAlias2 {
 +    type SafeColumns = Columns;
 +    fn safe_columns_tuple() -> Self::SafeColumns {
 +      (
 +        id,
 +        name,
 +        preferred_username,
 +        avatar,
 +        banned,
 +        published,
 +        updated,
 +        actor_id,
 +        bio,
 +        local,
-         last_refreshed_at,
 +        banner,
 +        deleted,
 +        inbox_url,
 +        shared_inbox_url,
 +      )
 +    }
 +  }
 +}
 +
 +impl Crud<PersonForm> for Person {
 +  fn read(conn: &PgConnection, person_id: i32) -> Result<Self, Error> {
 +    person
 +      .filter(deleted.eq(false))
 +      .find(person_id)
 +      .first::<Self>(conn)
 +  }
 +  fn delete(conn: &PgConnection, person_id: i32) -> Result<usize, Error> {
 +    diesel::delete(person.find(person_id)).execute(conn)
 +  }
 +  fn create(conn: &PgConnection, form: &PersonForm) -> Result<Self, Error> {
 +    insert_into(person).values(form).get_result::<Self>(conn)
 +  }
 +  fn update(conn: &PgConnection, person_id: i32, form: &PersonForm) -> Result<Self, Error> {
 +    diesel::update(person.find(person_id))
 +      .set(form)
 +      .get_result::<Self>(conn)
 +  }
 +}
 +
 +impl ApubObject<PersonForm> for Person {
-   fn read_from_apub_id(conn: &PgConnection, object_id: &Url) -> Result<Self, Error> {
++  fn read_from_apub_id(conn: &PgConnection, object_id: &DbUrl) -> Result<Self, Error> {
 +    use lemmy_db_schema::schema::person::dsl::*;
 +    person
 +      .filter(deleted.eq(false))
 +      .filter(actor_id.eq(object_id))
 +      .first::<Self>(conn)
 +  }
 +
 +  fn upsert(conn: &PgConnection, person_form: &PersonForm) -> Result<Person, Error> {
 +    insert_into(person)
 +      .values(person_form)
 +      .on_conflict(actor_id)
 +      .do_update()
 +      .set(person_form)
 +      .get_result::<Self>(conn)
 +  }
 +}
 +
 +pub trait Person_ {
-   fn register(conn: &PgConnection, form: &PersonForm) -> Result<Person, Error>;
-   fn update_password(conn: &PgConnection, person_id: i32, new_password: &str)
-     -> Result<Person, Error>;
-   fn read_from_name(conn: &PgConnection, from_name: &str) -> Result<Person, Error>;
-   fn add_admin(conn: &PgConnection, person_id: i32, added: bool) -> Result<Person, Error>;
 +  fn ban_person(conn: &PgConnection, person_id: i32, ban: bool) -> Result<Person, Error>;
-   fn find_by_email_or_name(
-     conn: &PgConnection,
-     name_or_email: &str,
-   ) -> Result<Person, Error>;
++  // TODO
++  // fn find_by_email_or_name(
++  //   conn: &PgConnection,
++  //   name_or_email: &str,
++  // ) -> Result<Person, Error>;
 +  fn find_by_name(conn: &PgConnection, name: &str) -> Result<Person, Error>;
-   fn find_by_email(conn: &PgConnection, from_email: &str) -> Result<Person, Error>;
-   fn get_profile_url(&self, hostname: &str) -> String;
 +  fn mark_as_updated(conn: &PgConnection, person_id: i32) -> Result<Person, Error>;
 +  fn delete_account(conn: &PgConnection, person_id: i32) -> Result<Person, Error>;
 +}
 +
 +impl Person_ for Person {
-   fn register(conn: &PgConnection, form: &PersonForm) -> Result<Self, Error> {
-     let mut edited_person = form.clone();
-     let password_hash =
-       hash(&form.password_encrypted, DEFAULT_COST).expect("Couldn't hash password");
-     edited_person.password_encrypted = password_hash;
-     Self::create(&conn, &edited_person)
-   }
-   // TODO do more individual updates like these
-   fn update_password(conn: &PgConnection, person_id: i32, new_password: &str) -> Result<Self, Error> {
-     let password_hash = hash(new_password, DEFAULT_COST).expect("Couldn't hash password");
-     diesel::update(person.find(person_id))
-       .set((
-         password_encrypted.eq(password_hash),
-         updated.eq(naive_now()),
-       ))
-       .get_result::<Self>(conn)
-   }
-   fn read_from_name(conn: &PgConnection, from_name: &str) -> Result<Self, Error> {
-     person
-       .filter(local.eq(true))
-       .filter(deleted.eq(false))
-       .filter(name.eq(from_name))
-       .first::<Self>(conn)
-   }
-   fn add_admin(conn: &PgConnection, person_id: i32, added: bool) -> Result<Self, Error> {
-     diesel::update(person.find(person_id))
-       .set(admin.eq(added))
-       .get_result::<Self>(conn)
-   }
 +
 +  fn ban_person(conn: &PgConnection, person_id: i32, ban: bool) -> Result<Self, Error> {
 +    diesel::update(person.find(person_id))
 +      .set(banned.eq(ban))
 +      .get_result::<Self>(conn)
 +  }
 +
-   fn find_by_email_or_name(
-     conn: &PgConnection,
-     name_or_email: &str,
-   ) -> Result<Self, Error> {
-     if is_email_regex(name_or_email) {
-       Self::find_by_email(conn, name_or_email)
-     } else {
-       Self::find_by_name(conn, name_or_email)
-     }
-   }
-   fn find_by_name(conn: &PgConnection, name: &str) -> Result<Person, Error> {
-     person
-       .filter(deleted.eq(false))
-       .filter(local.eq(true))
-       .filter(name.ilike(name))
-       .first::<Person>(conn)
-   }
-   fn find_by_email(conn: &PgConnection, from_email: &str) -> Result<Person, Error> {
++  // TODO this needs to get moved to aggregates i think
++  // fn find_by_email_or_name(
++  //   conn: &PgConnection,
++  //   name_or_email: &str,
++  // ) -> Result<Self, Error> {
++  //   if is_email_regex(name_or_email) {
++  //     Self::find_by_email(conn, name_or_email)
++  //   } else {
++  //     Self::find_by_name(conn, name_or_email)
++  //   }
++  // }
++
++  fn find_by_name(conn: &PgConnection, from_name: &str) -> Result<Person, Error> {
 +    person
 +      .filter(deleted.eq(false))
 +      .filter(local.eq(true))
-       .filter(email.eq(from_email))
++      .filter(name.ilike(from_name))
 +      .first::<Person>(conn)
 +  }
 +
-   fn get_profile_url(&self, hostname: &str) -> String {
-     format!(
-       "{}://{}/u/{}",
-       Settings::get().get_protocol_string(),
-       hostname,
-       self.name
-     )
-   }
 +  fn mark_as_updated(conn: &PgConnection, person_id: i32) -> Result<Person, Error> {
 +    diesel::update(person.find(person_id))
 +      .set((last_refreshed_at.eq(naive_now()),))
 +      .get_result::<Self>(conn)
 +  }
 +
 +  fn delete_account(conn: &PgConnection, person_id: i32) -> Result<Person, Error> {
++    use lemmy_db_schema::schema::local_user;
++
++    // Set the local user info to none
++    diesel::update(local_user::table.filter(local_user::person_id.eq(person_id)))
++      .set((
++        local_user::email.eq::<Option<String>>(None),
++        local_user::matrix_user_id.eq::<Option<String>>(None),
++      ))
++      .execute(conn)?;
++
 +    diesel::update(person.find(person_id))
 +      .set((
 +        preferred_username.eq::<Option<String>>(None),
-         email.eq::<Option<String>>(None),
-         matrix_user_id.eq::<Option<String>>(None),
 +        bio.eq::<Option<String>>(None),
 +        deleted.eq(true),
 +        updated.eq(naive_now()),
 +      ))
 +      .get_result::<Self>(conn)
 +  }
 +}
 +
 +#[cfg(test)]
 +mod tests {
-   use crate::{establish_unpooled_connection, source::person::*, ListingType, SortType};
++  use crate::{establish_unpooled_connection, source::person::*};
 +
 +  #[test]
 +  fn test_crud() {
 +    let conn = establish_unpooled_connection();
 +
 +    let new_person = PersonForm {
 +      name: "thommy".into(),
 +      preferred_username: None,
 +      avatar: None,
 +      banner: None,
-       banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
 +      published: None,
 +      updated: None,
 +      actor_id: None,
 +      bio: None,
-       local: true,
++      local: None,
 +      private_key: None,
 +      public_key: None,
 +      last_refreshed_at: None,
 +      inbox_url: None,
 +      shared_inbox_url: None,
 +    };
 +
 +    let inserted_person = Person::create(&conn, &new_person).unwrap();
 +
 +    let expected_person = Person {
 +      id: inserted_person.id,
 +      name: "thommy".into(),
 +      preferred_username: None,
 +      avatar: None,
 +      banner: None,
 +      banned: false,
 +      deleted: false,
 +      published: inserted_person.published,
 +      updated: None,
 +      actor_id: inserted_person.actor_id.to_owned(),
 +      bio: None,
 +      local: true,
 +      private_key: None,
 +      public_key: None,
 +      last_refreshed_at: inserted_person.published,
-       deleted: false,
 +      inbox_url: inserted_person.inbox_url.to_owned(),
 +      shared_inbox_url: None,
 +    };
 +
 +    let read_person = Person::read(&conn, inserted_person.id).unwrap();
 +    let updated_person = Person::update(&conn, inserted_person.id, &new_person).unwrap();
 +    let num_deleted = Person::delete(&conn, inserted_person.id).unwrap();
 +
 +    assert_eq!(expected_person, read_person);
 +    assert_eq!(expected_person, inserted_person);
 +    assert_eq!(expected_person, updated_person);
 +    assert_eq!(1, num_deleted);
 +  }
 +}
index 73543b959ea58233c6bfafc0057b99aa69297938,5efc95bf66c1c553a2760f879fdf0050e4060db2..ba40c17fe645b4f6beee241fb2b6d7cba6e89966
@@@ -73,31 -73,43 +73,33 @@@ impl PersonMention_ for PersonMention 
  
  #[cfg(test)]
  mod tests {
--  use crate::{establish_unpooled_connection, Crud, ListingType, SortType};
++  use crate::{establish_unpooled_connection, Crud};
    use lemmy_db_schema::source::{
      comment::*,
      community::{Community, CommunityForm},
      post::*,
 -    user::*,
 -    user_mention::*,
 +    person::*,
 +    person_mention::*,
    };
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "terrylake".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
        shared_inbox_url: None,
      };
  
 -    let inserted_user = User_::create(&conn, &new_user).unwrap();
 +    let inserted_person = Person::create(&conn, &new_person).unwrap();
  
 -    let recipient_form = UserForm {
 +    let recipient_form = PersonForm {
        name: "terrylakes recipient".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index 6a66a79c1d146e392e527eecf5b577fef9cea200,f105dc738ea7848b93d4240a7f6f19b456302b50..6ac5039e092cfaea511ef4b4795a4446ce842d0a
@@@ -226,28 -226,40 +226,30 @@@ impl Readable<PostReadForm> for PostRea
  
  #[cfg(test)]
  mod tests {
--  use crate::{establish_unpooled_connection, source::post::*, ListingType, SortType};
++  use crate::{establish_unpooled_connection, source::post::*};
    use lemmy_db_schema::source::{
      community::{Community, CommunityForm},
 -    user::*,
 +    person::*,
    };
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let new_user = UserForm {
 +    let new_person = PersonForm {
        name: "jim".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index e4ca3c6b31e7820947f2a80d378b7dafda6124bd,c437252ef928abcc798d3f8d9673a66e67fd222e..c0f74367f85218e54a20dcf07fbab02d1ea01b4a
@@@ -143,27 -143,39 +143,27 @@@ mod tests 
      establish_unpooled_connection,
      source::private_message::PrivateMessage_,
      Crud,
--    ListingType,
--    SortType,
    };
 -  use lemmy_db_schema::source::{private_message::*, user::*};
 +  use lemmy_db_schema::source::{private_message::*, person::*};
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
 -    let creator_form = UserForm {
 +    let creator_form = PersonForm {
        name: "creator_pm".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
        shared_inbox_url: None,
      };
  
 -    let inserted_creator = User_::create(&conn, &creator_form).unwrap();
 +    let inserted_creator = Person::create(&conn, &creator_form).unwrap();
  
 -    let recipient_form = UserForm {
 +    let recipient_form = PersonForm {
        name: "recipient_pm".into(),
        preferred_username: None,
 -      password_encrypted: "nope".into(),
 -      email: None,
 -      matrix_user_id: None,
        avatar: None,
        banner: None,
 -      admin: false,
--      banned: Some(false),
-       deleted: false,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
 -      show_nsfw: false,
 -      theme: "browser".into(),
 -      default_sort_type: SortType::Hot as i16,
 -      default_listing_type: ListingType::Subscribed as i16,
 -      lang: "browser".into(),
 -      show_avatars: true,
 -      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
index 0000000000000000000000000000000000000000,d0e7411a5c7ac3be9e8160400fc3767ca57082ae..077b3e7839dc95ea1c686dacd29e283592cbd54d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,460 +1,459 @@@
 -  fn find_by_email(conn: &PgConnection, from_email: &str) -> Result<User_, Error>;
+ use crate::{is_email_regex, ApubObject, Crud, ToSafeSettings};
+ use bcrypt::{hash, DEFAULT_COST};
+ use diesel::{dsl::*, result::Error, *};
+ use lemmy_db_schema::{
+   naive_now,
+   schema::user_::dsl::*,
+   source::user::{UserForm, UserSafeSettings, User_},
+   DbUrl,
+ };
+ use lemmy_utils::settings::structs::Settings;
+ mod safe_type {
+   use crate::ToSafe;
+   use lemmy_db_schema::{schema::user_::columns::*, source::user::User_};
+   type Columns = (
+     id,
+     name,
+     preferred_username,
+     avatar,
+     admin,
+     banned,
+     published,
+     updated,
+     matrix_user_id,
+     actor_id,
+     bio,
+     local,
+     banner,
+     deleted,
+     inbox_url,
+     shared_inbox_url,
+   );
+   impl ToSafe for User_ {
+     type SafeColumns = Columns;
+     fn safe_columns_tuple() -> Self::SafeColumns {
+       (
+         id,
+         name,
+         preferred_username,
+         avatar,
+         admin,
+         banned,
+         published,
+         updated,
+         matrix_user_id,
+         actor_id,
+         bio,
+         local,
+         banner,
+         deleted,
+         inbox_url,
+         shared_inbox_url,
+       )
+     }
+   }
+ }
+ mod safe_type_alias_1 {
+   use crate::ToSafe;
+   use lemmy_db_schema::{schema::user_alias_1::columns::*, source::user::UserAlias1};
+   type Columns = (
+     id,
+     name,
+     preferred_username,
+     avatar,
+     admin,
+     banned,
+     published,
+     updated,
+     matrix_user_id,
+     actor_id,
+     bio,
+     local,
+     banner,
+     deleted,
+   );
+   impl ToSafe for UserAlias1 {
+     type SafeColumns = Columns;
+     fn safe_columns_tuple() -> Self::SafeColumns {
+       (
+         id,
+         name,
+         preferred_username,
+         avatar,
+         admin,
+         banned,
+         published,
+         updated,
+         matrix_user_id,
+         actor_id,
+         bio,
+         local,
+         banner,
+         deleted,
+       )
+     }
+   }
+ }
+ mod safe_type_alias_2 {
+   use crate::ToSafe;
+   use lemmy_db_schema::{schema::user_alias_2::columns::*, source::user::UserAlias2};
+   type Columns = (
+     id,
+     name,
+     preferred_username,
+     avatar,
+     admin,
+     banned,
+     published,
+     updated,
+     matrix_user_id,
+     actor_id,
+     bio,
+     local,
+     banner,
+     deleted,
+   );
+   impl ToSafe for UserAlias2 {
+     type SafeColumns = Columns;
+     fn safe_columns_tuple() -> Self::SafeColumns {
+       (
+         id,
+         name,
+         preferred_username,
+         avatar,
+         admin,
+         banned,
+         published,
+         updated,
+         matrix_user_id,
+         actor_id,
+         bio,
+         local,
+         banner,
+         deleted,
+       )
+     }
+   }
+ }
+ mod safe_settings_type {
+   use crate::ToSafeSettings;
+   use lemmy_db_schema::{schema::user_::columns::*, source::user::User_};
+   type Columns = (
+     id,
+     name,
+     preferred_username,
+     email,
+     avatar,
+     admin,
+     banned,
+     published,
+     updated,
+     show_nsfw,
+     theme,
+     default_sort_type,
+     default_listing_type,
+     lang,
+     show_avatars,
+     send_notifications_to_email,
+     matrix_user_id,
+     actor_id,
+     bio,
+     local,
+     last_refreshed_at,
+     banner,
+     deleted,
+   );
+   impl ToSafeSettings for User_ {
+     type SafeSettingsColumns = Columns;
+     fn safe_settings_columns_tuple() -> Self::SafeSettingsColumns {
+       (
+         id,
+         name,
+         preferred_username,
+         email,
+         avatar,
+         admin,
+         banned,
+         published,
+         updated,
+         show_nsfw,
+         theme,
+         default_sort_type,
+         default_listing_type,
+         lang,
+         show_avatars,
+         send_notifications_to_email,
+         matrix_user_id,
+         actor_id,
+         bio,
+         local,
+         last_refreshed_at,
+         banner,
+         deleted,
+       )
+     }
+   }
+ }
+ pub trait UserSafeSettings_ {
+   fn read(conn: &PgConnection, user_id: i32) -> Result<UserSafeSettings, Error>;
+ }
+ impl UserSafeSettings_ for UserSafeSettings {
+   fn read(conn: &PgConnection, user_id: i32) -> Result<Self, Error> {
+     user_
+       .select(User_::safe_settings_columns_tuple())
+       .filter(deleted.eq(false))
+       .find(user_id)
+       .first::<Self>(conn)
+   }
+ }
+ impl Crud<UserForm> for User_ {
+   fn read(conn: &PgConnection, user_id: i32) -> Result<Self, Error> {
+     user_
+       .filter(deleted.eq(false))
+       .find(user_id)
+       .first::<Self>(conn)
+   }
+   fn delete(conn: &PgConnection, user_id: i32) -> Result<usize, Error> {
+     diesel::delete(user_.find(user_id)).execute(conn)
+   }
+   fn create(conn: &PgConnection, form: &UserForm) -> Result<Self, Error> {
+     insert_into(user_).values(form).get_result::<Self>(conn)
+   }
+   fn update(conn: &PgConnection, user_id: i32, form: &UserForm) -> Result<Self, Error> {
+     diesel::update(user_.find(user_id))
+       .set(form)
+       .get_result::<Self>(conn)
+   }
+ }
+ impl ApubObject<UserForm> for User_ {
+   fn read_from_apub_id(conn: &PgConnection, object_id: &DbUrl) -> Result<Self, Error> {
+     use lemmy_db_schema::schema::user_::dsl::*;
+     user_
+       .filter(deleted.eq(false))
+       .filter(actor_id.eq(object_id))
+       .first::<Self>(conn)
+   }
+   fn upsert(conn: &PgConnection, user_form: &UserForm) -> Result<User_, Error> {
+     insert_into(user_)
+       .values(user_form)
+       .on_conflict(actor_id)
+       .do_update()
+       .set(user_form)
+       .get_result::<Self>(conn)
+   }
+ }
+ pub trait User {
+   fn register(conn: &PgConnection, form: &UserForm) -> Result<User_, Error>;
+   fn update_password(conn: &PgConnection, user_id: i32, new_password: &str)
+     -> Result<User_, Error>;
+   fn read_from_name(conn: &PgConnection, from_user_name: &str) -> Result<User_, Error>;
+   fn add_admin(conn: &PgConnection, user_id: i32, added: bool) -> Result<User_, Error>;
+   fn ban_user(conn: &PgConnection, user_id: i32, ban: bool) -> Result<User_, Error>;
+   fn find_by_email_or_username(
+     conn: &PgConnection,
+     username_or_email: &str,
+   ) -> Result<User_, Error>;
+   fn find_by_username(conn: &PgConnection, username: &str) -> Result<User_, Error>;
+   fn get_profile_url(&self, hostname: &str) -> String;
+   fn mark_as_updated(conn: &PgConnection, user_id: i32) -> Result<User_, Error>;
+   fn delete_account(conn: &PgConnection, user_id: i32) -> Result<User_, Error>;
+ }
+ impl User for User_ {
+   fn register(conn: &PgConnection, form: &UserForm) -> Result<Self, Error> {
+     let mut edited_user = form.clone();
+     let password_hash =
+       hash(&form.password_encrypted, DEFAULT_COST).expect("Couldn't hash password");
+     edited_user.password_encrypted = password_hash;
+     Self::create(&conn, &edited_user)
+   }
+   // TODO do more individual updates like these
+   fn update_password(conn: &PgConnection, user_id: i32, new_password: &str) -> Result<Self, Error> {
+     let password_hash = hash(new_password, DEFAULT_COST).expect("Couldn't hash password");
+     diesel::update(user_.find(user_id))
+       .set((
+         password_encrypted.eq(password_hash),
+         updated.eq(naive_now()),
+       ))
+       .get_result::<Self>(conn)
+   }
+   fn read_from_name(conn: &PgConnection, from_user_name: &str) -> Result<Self, Error> {
+     user_
+       .filter(local.eq(true))
+       .filter(deleted.eq(false))
+       .filter(name.eq(from_user_name))
+       .first::<Self>(conn)
+   }
+   fn add_admin(conn: &PgConnection, user_id: i32, added: bool) -> Result<Self, Error> {
+     diesel::update(user_.find(user_id))
+       .set(admin.eq(added))
+       .get_result::<Self>(conn)
+   }
+   fn ban_user(conn: &PgConnection, user_id: i32, ban: bool) -> Result<Self, Error> {
+     diesel::update(user_.find(user_id))
+       .set(banned.eq(ban))
+       .get_result::<Self>(conn)
+   }
+   fn find_by_email_or_username(
+     conn: &PgConnection,
+     username_or_email: &str,
+   ) -> Result<Self, Error> {
+     if is_email_regex(username_or_email) {
+       Self::find_by_email(conn, username_or_email)
+     } else {
+       Self::find_by_username(conn, username_or_email)
+     }
+   }
+   fn find_by_username(conn: &PgConnection, username: &str) -> Result<User_, Error> {
+     user_
+       .filter(deleted.eq(false))
+       .filter(local.eq(true))
+       .filter(name.ilike(username))
+       .first::<User_>(conn)
+   }
+   fn find_by_email(conn: &PgConnection, from_email: &str) -> Result<User_, Error> {
+     user_
+       .filter(deleted.eq(false))
+       .filter(local.eq(true))
+       .filter(email.eq(from_email))
+       .first::<User_>(conn)
+   }
+   fn get_profile_url(&self, hostname: &str) -> String {
+     format!(
+       "{}://{}/u/{}",
+       Settings::get().get_protocol_string(),
+       hostname,
+       self.name
+     )
+   }
+   fn mark_as_updated(conn: &PgConnection, user_id: i32) -> Result<User_, Error> {
+     diesel::update(user_.find(user_id))
+       .set((last_refreshed_at.eq(naive_now()),))
+       .get_result::<Self>(conn)
+   }
+   fn delete_account(conn: &PgConnection, user_id: i32) -> Result<User_, Error> {
+     diesel::update(user_.find(user_id))
+       .set((
+         preferred_username.eq::<Option<String>>(None),
+         email.eq::<Option<String>>(None),
+         matrix_user_id.eq::<Option<String>>(None),
+         bio.eq::<Option<String>>(None),
+         deleted.eq(true),
+         updated.eq(naive_now()),
+       ))
+       .get_result::<Self>(conn)
+   }
+ }
+ #[cfg(test)]
+ mod tests {
+   use crate::{establish_unpooled_connection, source::user::*, ListingType, SortType};
+   use serial_test::serial;
+   #[test]
+   #[serial]
+   fn test_crud() {
+     let conn = establish_unpooled_connection();
+     let new_user = UserForm {
+       name: "thommy".into(),
+       preferred_username: None,
+       password_encrypted: "nope".into(),
+       email: None,
+       matrix_user_id: None,
+       avatar: None,
+       banner: None,
+       admin: false,
+       banned: Some(false),
+       published: None,
+       updated: None,
+       show_nsfw: false,
+       theme: "browser".into(),
+       default_sort_type: SortType::Hot as i16,
+       default_listing_type: ListingType::Subscribed as i16,
+       lang: "browser".into(),
+       show_avatars: true,
+       send_notifications_to_email: false,
+       actor_id: None,
+       bio: None,
+       local: true,
+       private_key: None,
+       public_key: None,
+       last_refreshed_at: None,
+       inbox_url: None,
+       shared_inbox_url: None,
+     };
+     let inserted_user = User_::create(&conn, &new_user).unwrap();
+     let expected_user = User_ {
+       id: inserted_user.id,
+       name: "thommy".into(),
+       preferred_username: None,
+       password_encrypted: "nope".into(),
+       email: None,
+       matrix_user_id: None,
+       avatar: None,
+       banner: None,
+       admin: false,
+       banned: false,
+       published: inserted_user.published,
+       updated: None,
+       show_nsfw: false,
+       theme: "browser".into(),
+       default_sort_type: SortType::Hot as i16,
+       default_listing_type: ListingType::Subscribed as i16,
+       lang: "browser".into(),
+       show_avatars: true,
+       send_notifications_to_email: false,
+       actor_id: inserted_user.actor_id.to_owned(),
+       bio: None,
+       local: true,
+       private_key: None,
+       public_key: None,
+       last_refreshed_at: inserted_user.published,
+       deleted: false,
+       inbox_url: inserted_user.inbox_url.to_owned(),
+       shared_inbox_url: None,
+     };
+     let read_user = User_::read(&conn, inserted_user.id).unwrap();
+     let updated_user = User_::update(&conn, inserted_user.id, &new_user).unwrap();
+     let num_deleted = User_::delete(&conn, inserted_user.id).unwrap();
+     assert_eq!(expected_user, read_user);
+     assert_eq!(expected_user, inserted_user);
+     assert_eq!(expected_user, updated_user);
+     assert_eq!(1, num_deleted);
+   }
+ }
index 0641bdee00f3f704228e6c935c0ca6e866dcf27e,3786e00ca6abb741fa01bd51b97d971054a5983b..c5bf7d2fed75dfdebaa1087e3d8483b668da05ef
@@@ -89,11 -89,11 +89,11 @@@ table! 
          private_key -> Nullable<Text>,
          public_key -> Nullable<Text>,
          last_refreshed_at -> Timestamp,
--        icon -> Nullable<Text>,
--        banner -> Nullable<Text>,
 -        followers_url -> Text,
 -        inbox_url -> Text,
 -        shared_inbox_url -> Nullable<Text>,
++        icon -> Nullable<Varchar>,
++        banner -> Nullable<Varchar>,
 +        followers_url -> Varchar,
 +        inbox_url -> Varchar,
 +        shared_inbox_url -> Nullable<Varchar>,
      }
  }
  
@@@ -261,60 -243,9 +261,60 @@@ table! 
  table! {
      password_reset_request (id) {
          id -> Int4,
 -        user_id -> Int4,
          token_encrypted -> Text,
          published -> Timestamp,
-         avatar -> Nullable<Text>,
 +        local_user_id -> Int4,
 +    }
 +}
 +
 +table! {
 +    person (id) {
 +        id -> Int4,
 +        name -> Varchar,
 +        preferred_username -> Nullable<Varchar>,
-         banner -> Nullable<Text>,
++        avatar -> Nullable<Varchar>,
 +        banned -> Bool,
 +        published -> Timestamp,
 +        updated -> Nullable<Timestamp>,
 +        actor_id -> Varchar,
 +        bio -> Nullable<Text>,
 +        local -> Bool,
 +        private_key -> Nullable<Text>,
 +        public_key -> Nullable<Text>,
 +        last_refreshed_at -> Timestamp,
++        banner -> Nullable<Varchar>,
 +        deleted -> Bool,
 +        inbox_url -> Varchar,
 +        shared_inbox_url -> Nullable<Varchar>,
 +    }
 +}
 +
 +table! {
 +    person_aggregates (id) {
 +        id -> Int4,
 +        person_id -> Int4,
 +        post_count -> Int8,
 +        post_score -> Int8,
 +        comment_count -> Int8,
 +        comment_score -> Int8,
 +    }
 +}
 +
 +table! {
 +    person_ban (id) {
 +        id -> Int4,
 +        person_id -> Int4,
 +        published -> Timestamp,
 +    }
 +}
 +
 +table! {
 +    person_mention (id) {
 +        id -> Int4,
 +        recipient_id -> Int4,
 +        comment_id -> Int4,
 +        read -> Bool,
 +        published -> Timestamp,
      }
  }
  
@@@ -322,7 -253,7 +322,7 @@@ table! 
      post (id) {
          id -> Int4,
          name -> Varchar,
--        url -> Nullable<Text>,
++        url -> Nullable<Varchar>,
          body -> Nullable<Text>,
          creator_id -> Int4,
          community_id -> Int4,
@@@ -427,8 -358,8 +427,8 @@@ table! 
          enable_downvotes -> Bool,
          open_registration -> Bool,
          enable_nsfw -> Bool,
--        icon -> Nullable<Text>,
--        banner -> Nullable<Text>,
++        icon -> Nullable<Varchar>,
++        banner -> Nullable<Varchar>,
      }
  }
  
@@@ -470,7 -463,10 +470,7 @@@ table! 
          id -> Int4,
          name -> Varchar,
          preferred_username -> Nullable<Varchar>,
 -        password_encrypted -> Text,
 -        email -> Nullable<Text>,
--        avatar -> Nullable<Text>,
 -        admin -> Bool,
++        avatar -> Nullable<Varchar>,
          banned -> Bool,
          published -> Timestamp,
          updated -> Nullable<Timestamp>,
          private_key -> Nullable<Text>,
          public_key -> Nullable<Text>,
          last_refreshed_at -> Timestamp,
--        banner -> Nullable<Text>,
++        banner -> Nullable<Varchar>,
          deleted -> Bool,
 +        inbox_url -> Varchar,
 +        shared_inbox_url -> Nullable<Varchar>,
      }
  }
  
@@@ -492,7 -494,10 +492,7 @@@ table! 
          id -> Int4,
          name -> Varchar,
          preferred_username -> Nullable<Varchar>,
 -        password_encrypted -> Text,
 -        email -> Nullable<Text>,
--        avatar -> Nullable<Text>,
 -        admin -> Bool,
++        avatar -> Nullable<Varchar>,
          banned -> Bool,
          published -> Timestamp,
          updated -> Nullable<Timestamp>,
          private_key -> Nullable<Text>,
          public_key -> Nullable<Text>,
          last_refreshed_at -> Timestamp,
--        banner -> Nullable<Text>,
++        banner -> Nullable<Varchar>,
          deleted -> Bool,
 +        inbox_url -> Varchar,
 +        shared_inbox_url -> Nullable<Varchar>,
      }
  }
  
index bc99a575a43b27f69af6a626fe1391e316ebc857,b9fe12493939dc1b39c56c8807c8273b18dc8a13..98c302dc709f5055627b4021735b7f8a3766870b
@@@ -1,6 -1,6 +1,6 @@@
  use crate::{
 -  schema::{community, community_follower, community_moderator, community_user_ban},
 +  schema::{community, community_follower, community_moderator, community_person_ban},
-   Url,
+   DbUrl,
  };
  use serde::Serialize;
  
index c4300dfdb93f0bb864fb299d04ee0f399c8dac24,0000000000000000000000000000000000000000..68a8bdcfc72fa5e1c989177f84583f007817b906
mode 100644,000000..100644
--- /dev/null
@@@ -1,66 -1,0 +1,56 @@@
- /// A safe local user view, without settings, password, or email
- #[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
- #[table_name = "local_user"]
- pub struct LocalUserSafe {
-   pub id: i32,                                  
-   pub person_id: i32,                          
-   pub admin: bool,                              
-   pub matrix_user_id: Option<String>,           
- }
 +use crate::schema::local_user;
 +use serde::Serialize;
 +
 +#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
 +#[table_name = "local_user"]
 +pub struct LocalUser {
 +  pub id: i32,                                  
 +  pub person_id: i32,                          
 +  pub password_encrypted: String,               
 +  pub email: Option<String>,                    
 +  pub admin: bool,                              
 +  pub show_nsfw: bool,                          
 +  pub theme: String,                            
 +  pub default_sort_type: i16,                   
 +  pub default_listing_type: i16,                
 +  pub lang: String,                             
 +  pub show_avatars: bool,                       
 +  pub send_notifications_to_email: bool,        
 +  pub matrix_user_id: Option<String>,           
 +}
 +
 +// TODO redo these, check table defaults
 +#[derive(Insertable, AsChangeset, Clone)]
 +#[table_name = "local_user"]
 +pub struct LocalUserForm {
 +  pub person_id: i32,                          
 +  pub password_encrypted: String,               
 +  pub email: Option<Option<String>>,
 +  pub admin: Option<bool>,                              
 +  pub show_nsfw: Option<bool>,                          
 +  pub theme: Option<String>,                            
 +  pub default_sort_type: Option<i16>,                   
 +  pub default_listing_type: Option<i16>,                
 +  pub lang: Option<String>,                             
 +  pub show_avatars: Option<bool>,                       
 +  pub send_notifications_to_email: Option<bool>,        
 +  pub matrix_user_id: Option<Option<String>>,
 +}
 +
 +/// A local user view that removes password encrypted
 +#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
 +#[table_name = "local_user"]
 +pub struct LocalUserSettings{
 +  pub id: i32,                                  
 +  pub person_id: i32,                          
 +  pub email: Option<String>,                    
 +  pub admin: bool,                              
 +  pub show_nsfw: bool,                          
 +  pub theme: String,                            
 +  pub default_sort_type: i16,                   
 +  pub default_listing_type: i16,                
 +  pub lang: String,                             
 +  pub show_avatars: bool,                       
 +  pub send_notifications_to_email: bool,        
 +  pub matrix_user_id: Option<String>,           
 +}
index ce1a423f156af9b4ccf65a29ab850a5286c13ba3,f81f28efe6809cc0147b56a75c284c49c756839d..f03bcb0380fef628b72f9b6f24b29a7f8048c4f4
@@@ -4,9 -4,9 +4,9 @@@ use crate::schema::password_reset_reque
  #[table_name = "password_reset_request"]
  pub struct PasswordResetRequest {
    pub id: i32,
-   pub local_user_id: i32,
 -  pub user_id: i32,
    pub token_encrypted: String,
    pub published: chrono::NaiveDateTime,
++  pub local_user_id: i32,
  }
  
  #[derive(Insertable, AsChangeset)]
index cd0720776e0f760d7e679fcff5b4842678d1ebec,0000000000000000000000000000000000000000..5971d9303ba82993076b6834cad8dae78bec8d58
mode 100644,000000..100644
--- /dev/null
@@@ -1,154 -1,0 +1,151 @@@
-   Url,
 +use crate::{
 +  schema::{person, person_alias_1, person_alias_2},
-   pub avatar: Option<String>,                   
++  DbUrl,
 +};
 +use serde::Serialize;
 +
 +#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
 +#[table_name = "person"]
 +pub struct Person {
 +  pub id: i32,                                  
 +  pub name: String,                             
 +  pub preferred_username: Option<String>,       
-   pub actor_id: Url,                            
++  pub avatar: Option<DbUrl>,                   
 +  pub banned: bool,                             
 +  pub published: chrono::NaiveDateTime,         
 +  pub updated: Option<chrono::NaiveDateTime>,   
-   pub banner: Option<String>,                   
++  pub actor_id: DbUrl,                            
 +  pub bio: Option<String>,                      
 +  pub local: bool,                              
 +  pub private_key: Option<String>,              
 +  pub public_key: Option<String>,               
 +  pub last_refreshed_at: chrono::NaiveDateTime, 
-   pub inbox_url: Url,                           
-   pub shared_inbox_url: Option<Url>,            
++  pub banner: Option<DbUrl>,                   
 +  pub deleted: bool,                            
-   pub avatar: Option<String>,                   
++  pub inbox_url: DbUrl,                           
++  pub shared_inbox_url: Option<DbUrl>,            
 +}
 +
 +/// A safe representation of user, without the sensitive info
 +#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
 +#[table_name = "person"]
 +pub struct PersonSafe {
 +  pub id: i32,                                  
 +  pub name: String,                             
 +  pub preferred_username: Option<String>,       
-   pub actor_id: Url,                            
++  pub avatar: Option<DbUrl>,                   
 +  pub banned: bool,                             
 +  pub published: chrono::NaiveDateTime,         
 +  pub updated: Option<chrono::NaiveDateTime>,   
-   pub last_refreshed_at: chrono::NaiveDateTime, 
-   pub banner: Option<String>,                   
++  pub actor_id: DbUrl,                            
 +  pub bio: Option<String>,                      
 +  pub local: bool,                              
-   pub inbox_url: Url,                           
-   pub shared_inbox_url: Option<Url>,            
++  pub banner: Option<DbUrl>,                   
 +  pub deleted: bool,                            
-   pub avatar: Option<String>,                   
++  pub inbox_url: DbUrl,                           
++  pub shared_inbox_url: Option<DbUrl>,            
 +}
 +
 +
 +#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
 +#[table_name = "person_alias_1"]
 +pub struct PersonAlias1 {
 +  pub id: i32,                                  
 +  pub name: String,                             
 +  pub preferred_username: Option<String>,       
-   pub actor_id: Url,                            
++  pub avatar: Option<DbUrl>,                   
 +  pub banned: bool,                             
 +  pub published: chrono::NaiveDateTime,         
 +  pub updated: Option<chrono::NaiveDateTime>,   
-   pub banner: Option<String>,                   
++  pub actor_id: DbUrl,                            
 +  pub bio: Option<String>,                      
 +  pub local: bool,                              
 +  pub private_key: Option<String>,              
 +  pub public_key: Option<String>,               
 +  pub last_refreshed_at: chrono::NaiveDateTime, 
-   pub inbox_url: Url,                           
-   pub shared_inbox_url: Option<Url>,            
++  pub banner: Option<DbUrl>,                   
 +  pub deleted: bool,                            
-   pub avatar: Option<String>,                   
++  pub inbox_url: DbUrl,                           
++  pub shared_inbox_url: Option<DbUrl>,            
 +}
 +
 +#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
 +#[table_name = "person_alias_1"]
 +pub struct PersonSafeAlias1 {
 +  pub id: i32,                                  
 +  pub name: String,                             
 +  pub preferred_username: Option<String>,       
-   pub actor_id: Url,                            
++  pub avatar: Option<DbUrl>,                   
 +  pub banned: bool,                             
 +  pub published: chrono::NaiveDateTime,         
 +  pub updated: Option<chrono::NaiveDateTime>,   
-   pub last_refreshed_at: chrono::NaiveDateTime, 
-   pub banner: Option<String>,                   
++  pub actor_id: DbUrl,                            
 +  pub bio: Option<String>,                      
 +  pub local: bool,                              
-   pub inbox_url: Url,                           
-   pub shared_inbox_url: Option<Url>,            
++  pub banner: Option<DbUrl>,                   
 +  pub deleted: bool,                            
-   pub avatar: Option<String>,                   
++  pub inbox_url: DbUrl,                           
++  pub shared_inbox_url: Option<DbUrl>,            
 +}
 +
 +#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
 +#[table_name = "person_alias_2"]
 +pub struct PersonAlias2 {
 +  pub id: i32,                                  
 +  pub name: String,                             
 +  pub preferred_username: Option<String>,       
-   pub actor_id: Url,                            
++  pub avatar: Option<DbUrl>,                   
 +  pub banned: bool,                             
 +  pub published: chrono::NaiveDateTime,         
 +  pub updated: Option<chrono::NaiveDateTime>,   
-   pub banner: Option<String>,                   
++  pub actor_id: DbUrl,                            
 +  pub bio: Option<String>,                      
 +  pub local: bool,                              
 +  pub private_key: Option<String>,              
 +  pub public_key: Option<String>,               
 +  pub last_refreshed_at: chrono::NaiveDateTime, 
-   pub inbox_url: Url,                           
-   pub shared_inbox_url: Option<Url>,            
++  pub banner: Option<DbUrl>,                   
 +  pub deleted: bool,                            
-   pub avatar: Option<String>,                   
++  pub inbox_url: DbUrl,                           
++  pub shared_inbox_url: Option<DbUrl>,            
 +}
 +
 +#[derive(Clone, Queryable, Identifiable, PartialEq, Debug, Serialize)]
 +#[table_name = "person_alias_1"]
 +pub struct PersonSafeAlias2 {
 +  pub id: i32,                                  
 +  pub name: String,                             
 +  pub preferred_username: Option<String>,       
-   pub actor_id: Url,                            
++  pub avatar: Option<DbUrl>,                   
 +  pub banned: bool,                             
 +  pub published: chrono::NaiveDateTime,         
 +  pub updated: Option<chrono::NaiveDateTime>,   
-   pub last_refreshed_at: chrono::NaiveDateTime, 
-   pub banner: Option<String>,                   
++  pub actor_id: DbUrl,                            
 +  pub bio: Option<String>,                      
 +  pub local: bool,                              
-   pub inbox_url: Url,                           
-   pub shared_inbox_url: Option<Url>,            
++  pub banner: Option<DbUrl>,                   
 +  pub deleted: bool,                            
-   pub avatar: Option<Option<String>>,
++  pub inbox_url: DbUrl,                           
++  pub shared_inbox_url: Option<DbUrl>,            
 +}
 +
 +#[derive(Insertable, AsChangeset, Clone)]
 +#[table_name = "person"]
 +pub struct PersonForm {
 +  pub name: String,                             
 +  pub preferred_username: Option<Option<String>>,
-   pub actor_id: Option<Url>,                            
++  pub avatar: Option<Option<DbUrl>>,
 +  pub banned: Option<bool>,                             
 +  pub published: Option<chrono::NaiveDateTime>,
 +  pub updated: Option<chrono::NaiveDateTime>,
-   pub banner: Option<Option<String>>,
++  pub actor_id: Option<DbUrl>,                            
 +  pub bio: Option<Option<String>>,                      
 +  pub local: Option<bool>,                              
 +  pub private_key: Option<Option<String>>,              
 +  pub public_key: Option<Option<String>>,               
 +  pub last_refreshed_at: Option<chrono::NaiveDateTime>,
-   pub inbox_url: Option<Url>,                           
-   pub shared_inbox_url: Option<Option<Url>>,
++  pub banner: Option<Option<DbUrl>>,
 +  pub deleted: Option<bool>,                            
++  pub inbox_url: Option<DbUrl>,                           
++  pub shared_inbox_url: Option<Option<DbUrl>>,
 +}
Simple merge
index 2863f6259fe97d1e64a500692a12343a7fc615e3,2863f6259fe97d1e64a500692a12343a7fc615e3..eb10bffbedda23466dd94f25355034cec0cc7c66
@@@ -1,13 -1,13 +1,13 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, MaybeOptional, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{comment, comment_report, community, post, user_, user_alias_1, user_alias_2},
++  schema::{comment, comment_report, community, post, person, person_alias_1, person_alias_2},
    source::{
      comment::Comment,
      comment_report::CommentReport,
      community::{Community, CommunitySafe},
      post::Post,
--    user::{UserAlias1, UserAlias2, UserSafe, UserSafeAlias1, UserSafeAlias2, User_},
++    person::{PersonAlias1, PersonAlias2, PersonSafe, PersonSafeAlias1, PersonSafeAlias2, Person},
    },
  };
  use serde::Serialize;
@@@ -18,9 -18,9 +18,9 @@@ pub struct CommentReportView 
    pub comment: Comment,
    pub post: Post,
    pub community: CommunitySafe,
--  pub creator: UserSafe,
--  pub comment_creator: UserSafeAlias1,
--  pub resolver: Option<UserSafeAlias2>,
++  pub creator: PersonSafe,
++  pub comment_creator: PersonSafeAlias1,
++  pub resolver: Option<PersonSafeAlias2>,
  }
  
  type CommentReportViewTuple = (
@@@ -28,9 -28,9 +28,9 @@@
    Comment,
    Post,
    CommunitySafe,
--  UserSafe,
--  UserSafeAlias1,
--  Option<UserSafeAlias2>,
++  PersonSafe,
++  PersonSafeAlias1,
++  Option<PersonSafeAlias2>,
  );
  
  impl CommentReportView {
          .inner_join(comment::table)
          .inner_join(post::table.on(comment::post_id.eq(post::id)))
          .inner_join(community::table.on(post::community_id.eq(community::id)))
--        .inner_join(user_::table.on(comment_report::creator_id.eq(user_::id)))
--        .inner_join(user_alias_1::table.on(post::creator_id.eq(user_alias_1::id)))
++        .inner_join(person::table.on(comment_report::creator_id.eq(person::id)))
++        .inner_join(person_alias_1::table.on(post::creator_id.eq(person_alias_1::id)))
          .left_join(
--          user_alias_2::table.on(comment_report::resolver_id.eq(user_alias_2::id.nullable())),
++          person_alias_2::table.on(comment_report::resolver_id.eq(person_alias_2::id.nullable())),
          )
          .select((
            comment_report::all_columns,
            comment::all_columns,
            post::all_columns,
            Community::safe_columns_tuple(),
--          User_::safe_columns_tuple(),
--          UserAlias1::safe_columns_tuple(),
--          UserAlias2::safe_columns_tuple().nullable(),
++          Person::safe_columns_tuple(),
++          PersonAlias1::safe_columns_tuple(),
++          PersonAlias2::safe_columns_tuple().nullable(),
          ))
          .first::<CommentReportViewTuple>(conn)?;
  
@@@ -75,7 -75,7 +75,7 @@@
    ///
    /// * `community_ids` - a Vec<i32> of community_ids to get a count for
    /// TODO this eq_any is a bad way to do this, would be better to join to communitymoderator
--  /// for a user id
++  /// for a person id
    pub fn get_report_count(conn: &PgConnection, community_ids: &[i32]) -> Result<i64, Error> {
      use diesel::dsl::*;
      comment_report::table
@@@ -135,19 -135,19 +135,19 @@@ impl<'a> CommentReportQueryBuilder<'a> 
        .inner_join(comment::table)
        .inner_join(post::table.on(comment::post_id.eq(post::id)))
        .inner_join(community::table.on(post::community_id.eq(community::id)))
--      .inner_join(user_::table.on(comment_report::creator_id.eq(user_::id)))
--      .inner_join(user_alias_1::table.on(post::creator_id.eq(user_alias_1::id)))
++      .inner_join(person::table.on(comment_report::creator_id.eq(person::id)))
++      .inner_join(person_alias_1::table.on(post::creator_id.eq(person_alias_1::id)))
        .left_join(
--        user_alias_2::table.on(comment_report::resolver_id.eq(user_alias_2::id.nullable())),
++        person_alias_2::table.on(comment_report::resolver_id.eq(person_alias_2::id.nullable())),
        )
        .select((
          comment_report::all_columns,
          comment::all_columns,
          post::all_columns,
          Community::safe_columns_tuple(),
--        User_::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
--        UserAlias2::safe_columns_tuple().nullable(),
++        Person::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
++        PersonAlias2::safe_columns_tuple().nullable(),
        ))
        .into_boxed();
  
index 0db27794b0411ba1ea23c43acc8ed68c857c5852,56b22a7f00aaaae52e13ba08f096c61efe7c32fa..eb95a2ccdcc6a6fd3e8d3ed36cff0d26950f1c4e
@@@ -19,16 -19,16 +19,16 @@@ use lemmy_db_schema::
      comment_saved,
      community,
      community_follower,
--    community_user_ban,
++    community_person_ban,
      post,
--    user_,
--    user_alias_1,
++    person,
++    person_alias_1,
    },
    source::{
      comment::{Comment, CommentAlias1, CommentSaved},
 -    community::{Community, CommunityFollower, CommunitySafe, CommunityUserBan},
 +    community::{Community, CommunityFollower, CommunitySafe, CommunityPersonBan},
      post::Post,
--    user::{UserAlias1, UserSafe, UserSafeAlias1, User_},
++    person::{PersonAlias1, PersonSafe, PersonSafeAlias1, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, PartialEq, Serialize, Clone)]
  pub struct CommentView {
    pub comment: Comment,
--  pub creator: UserSafe,
--  pub recipient: Option<UserSafeAlias1>, // Left joins to comment and user
++  pub creator: PersonSafe,
++  pub recipient: Option<PersonSafeAlias1>, // Left joins to comment and person
    pub post: Post,
    pub community: CommunitySafe,
    pub counts: CommentAggregates,
--  pub creator_banned_from_community: bool, // Left Join to CommunityUserBan
++  pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
    pub subscribed: bool,                    // Left join to CommunityFollower
    pub saved: bool,                         // Left join to CommentSaved
    pub my_vote: Option<i16>,                // Left join to CommentLike
@@@ -49,9 -49,9 +49,9 @@@
  
  type CommentViewTuple = (
    Comment,
--  UserSafe,
++  PersonSafe,
    Option<CommentAlias1>,
--  Option<UserSafeAlias1>,
++  Option<PersonSafeAlias1>,
    Post,
    CommunitySafe,
    CommentAggregates,
@@@ -65,10 -65,10 +65,10 @@@ impl CommentView 
    pub fn read(
      conn: &PgConnection,
      comment_id: i32,
--    my_user_id: Option<i32>,
++    my_person_id: Option<i32>,
    ) -> Result<Self, Error> {
      // The left join below will return None in this case
--    let user_id_join = my_user_id.unwrap_or(-1);
++    let person_id_join = my_person_id.unwrap_or(-1);
  
      let (
        comment,
        comment_like,
      ) = comment::table
        .find(comment_id)
--      .inner_join(user_::table)
++      .inner_join(person::table)
        // recipient here
        .left_join(comment_alias_1::table.on(comment_alias_1::id.nullable().eq(comment::parent_id)))
--      .left_join(user_alias_1::table.on(user_alias_1::id.eq(comment_alias_1::creator_id)))
++      .left_join(person_alias_1::table.on(person_alias_1::id.eq(comment_alias_1::creator_id)))
        .inner_join(post::table)
        .inner_join(community::table.on(post::community_id.eq(community::id)))
        .inner_join(comment_aggregates::table)
        .left_join(
--        community_user_ban::table.on(
++        community_person_ban::table.on(
            community::id
--            .eq(community_user_ban::community_id)
--            .and(community_user_ban::user_id.eq(comment::creator_id)),
++            .eq(community_person_ban::community_id)
++            .and(community_person_ban::person_id.eq(comment::creator_id)),
          ),
        )
        .left_join(
          community_follower::table.on(
            post::community_id
              .eq(community_follower::community_id)
--            .and(community_follower::user_id.eq(user_id_join)),
++            .and(community_follower::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          comment_saved::table.on(
            comment::id
              .eq(comment_saved::comment_id)
--            .and(comment_saved::user_id.eq(user_id_join)),
++            .and(comment_saved::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          comment_like::table.on(
            comment::id
              .eq(comment_like::comment_id)
--            .and(comment_like::user_id.eq(user_id_join)),
++            .and(comment_like::person_id.eq(person_id_join)),
          ),
        )
        .select((
          comment::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          comment_alias_1::all_columns.nullable(),
--        UserAlias1::safe_columns_tuple().nullable(),
++        PersonAlias1::safe_columns_tuple().nullable(),
          post::all_columns,
          Community::safe_columns_tuple(),
          comment_aggregates::all_columns,
--        community_user_ban::all_columns.nullable(),
++        community_person_ban::all_columns.nullable(),
          community_follower::all_columns.nullable(),
          comment_saved::all_columns.nullable(),
          comment_like::score.nullable(),
        ))
        .first::<CommentViewTuple>(conn)?;
  
--    // If a user is given, then my_vote, if None, should be 0, not null
--    // Necessary to differentiate between other user's votes
--    let my_vote = if my_user_id.is_some() && comment_like.is_none() {
++    // If a person is given, then my_vote, if None, should be 0, not null
++    // Necessary to differentiate between other person's votes
++    let my_vote = if my_person_id.is_some() && comment_like.is_none() {
        Some(0)
      } else {
        comment_like
      })
    }
  
--  /// Gets the recipient user id.
++  /// Gets the recipient person id.
    /// If there is no parent comment, its the post creator
    pub fn get_recipient_id(&self) -> i32 {
      match &self.recipient {
@@@ -175,7 -175,7 +175,7 @@@ pub struct CommentQueryBuilder<'a> 
    post_id: Option<i32>,
    creator_id: Option<i32>,
    recipient_id: Option<i32>,
--  my_user_id: Option<i32>,
++  my_person_id: Option<i32>,
    search_term: Option<String>,
    saved_only: bool,
    unread_only: bool,
@@@ -194,7 -194,7 +194,7 @@@ impl<'a> CommentQueryBuilder<'a> 
        post_id: None,
        creator_id: None,
        recipient_id: None,
--      my_user_id: None,
++      my_person_id: None,
        search_term: None,
        saved_only: false,
        unread_only: false,
      self
    }
  
--  pub fn my_user_id<T: MaybeOptional<i32>>(mut self, my_user_id: T) -> Self {
--    self.my_user_id = my_user_id.get_optional();
++  pub fn my_person_id<T: MaybeOptional<i32>>(mut self, my_person_id: T) -> Self {
++    self.my_person_id = my_person_id.get_optional();
      self
    }
  
      use diesel::dsl::*;
  
      // The left join below will return None in this case
--    let user_id_join = self.my_user_id.unwrap_or(-1);
++    let person_id_join = self.my_person_id.unwrap_or(-1);
  
      let mut query = comment::table
--      .inner_join(user_::table)
++      .inner_join(person::table)
        // recipient here
        .left_join(comment_alias_1::table.on(comment_alias_1::id.nullable().eq(comment::parent_id)))
--      .left_join(user_alias_1::table.on(user_alias_1::id.eq(comment_alias_1::creator_id)))
++      .left_join(person_alias_1::table.on(person_alias_1::id.eq(comment_alias_1::creator_id)))
        .inner_join(post::table)
        .inner_join(community::table.on(post::community_id.eq(community::id)))
        .inner_join(comment_aggregates::table)
        .left_join(
--        community_user_ban::table.on(
++        community_person_ban::table.on(
            community::id
--            .eq(community_user_ban::community_id)
--            .and(community_user_ban::user_id.eq(comment::creator_id)),
++            .eq(community_person_ban::community_id)
++            .and(community_person_ban::person_id.eq(comment::creator_id)),
          ),
        )
        .left_join(
          community_follower::table.on(
            post::community_id
              .eq(community_follower::community_id)
--            .and(community_follower::user_id.eq(user_id_join)),
++            .and(community_follower::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          comment_saved::table.on(
            comment::id
              .eq(comment_saved::comment_id)
--            .and(comment_saved::user_id.eq(user_id_join)),
++            .and(comment_saved::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          comment_like::table.on(
            comment::id
              .eq(comment_like::comment_id)
--            .and(comment_like::user_id.eq(user_id_join)),
++            .and(comment_like::person_id.eq(person_id_join)),
          ),
        )
        .select((
          comment::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          comment_alias_1::all_columns.nullable(),
--        UserAlias1::safe_columns_tuple().nullable(),
++        PersonAlias1::safe_columns_tuple().nullable(),
          post::all_columns,
          Community::safe_columns_tuple(),
          comment_aggregates::all_columns,
--        community_user_ban::all_columns.nullable(),
++        community_person_ban::all_columns.nullable(),
          community_follower::all_columns.nullable(),
          comment_saved::all_columns.nullable(),
          comment_like::score.nullable(),
      if let Some(recipient_id) = self.recipient_id {
        query = query
          // TODO needs lots of testing
--        .filter(user_alias_1::id.eq(recipient_id)) // Gets the comment replies
++        .filter(person_alias_1::id.eq(recipient_id)) // Gets the comment replies
          .or_filter(
            comment::parent_id
              .is_null()
  
      query = match self.listing_type {
        // ListingType::Subscribed => query.filter(community_follower::subscribed.eq(true)),
--      ListingType::Subscribed => query.filter(community_follower::user_id.is_not_null()), // TODO could be this: and(community_follower::user_id.eq(user_id_join)),
++      ListingType::Subscribed => query.filter(community_follower::person_id.is_not_null()), // TODO could be this: and(community_follower::user_id.eq(user_id_join)),
        ListingType::Local => query.filter(community::local.eq(true)),
        _ => query,
      };
@@@ -439,37 -439,39 +439,27 @@@ mod tests 
      establish_unpooled_connection,
      Crud,
      Likeable,
--    ListingType,
--    SortType,
    };
--  use lemmy_db_schema::source::{comment::*, community::*, post::*, user::*};
++  use lemmy_db_schema::source::{comment::*, community::*, post::*, person::*};
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
--    let new_user = UserForm {
--      name: "timmy".into(),
++    let new_person = PersonForm {
++      name: "thommy".into(),
        preferred_username: None,
--      password_encrypted: "nope".into(),
--      email: None,
--      matrix_user_id: None,
        avatar: None,
        banner: None,
--      admin: false,
--      banned: Some(false),
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
--      show_nsfw: false,
--      theme: "browser".into(),
--      default_sort_type: SortType::Hot as i16,
--      default_listing_type: ListingType::Subscribed as i16,
--      lang: "browser".into(),
--      show_avatars: true,
--      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
        shared_inbox_url: None,
      };
  
--    let inserted_user = User_::create(&conn, &new_user).unwrap();
++    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_user.id,
++      creator_id: inserted_person.id,
        removed: None,
        deleted: None,
        updated: None,
  
      let new_post = PostForm {
        name: "A test post 2".into(),
--      creator_id: inserted_user.id,
++      creator_id: inserted_person.id,
        url: None,
        body: None,
        community_id: inserted_community.id,
  
      let comment_form = CommentForm {
        content: "A test comment 32".into(),
--      creator_id: inserted_user.id,
++      creator_id: inserted_person.id,
        post_id: inserted_post.id,
        parent_id: None,
        removed: None,
      let comment_like_form = CommentLikeForm {
        comment_id: inserted_comment.id,
        post_id: inserted_post.id,
-       person_id: inserted_user.id,
 -      user_id: inserted_user.id,
++      person_id: inserted_person.id,
        score: 1,
      };
  
  
      let agg = CommentAggregates::read(&conn, inserted_comment.id).unwrap();
  
--    let expected_comment_view_no_user = CommentView {
++    let expected_comment_view_no_person = CommentView {
        creator_banned_from_community: false,
        my_vote: None,
        subscribed: false,
        comment: Comment {
          id: inserted_comment.id,
          content: "A test comment 32".into(),
--        creator_id: inserted_user.id,
++        creator_id: inserted_person.id,
          post_id: inserted_post.id,
          parent_id: None,
          removed: false,
          updated: None,
          local: true,
        },
--      creator: UserSafe {
--        id: inserted_user.id,
++      creator: PersonSafe {
++        id: inserted_person.id,
          name: "timmy".into(),
          preferred_username: None,
--        published: inserted_user.published,
++        published: inserted_person.published,
          avatar: None,
--        actor_id: inserted_user.actor_id.to_owned(),
++        actor_id: inserted_person.actor_id.to_owned(),
          local: true,
          banned: false,
          deleted: false,
          bio: None,
          banner: None,
--        admin: false,
          updated: None,
--        matrix_user_id: None,
--        inbox_url: inserted_user.inbox_url.to_owned(),
++        inbox_url: inserted_person.inbox_url.to_owned(),
          shared_inbox_url: None,
        },
        recipient: None,
        post: Post {
          id: inserted_post.id,
          name: inserted_post.name.to_owned(),
--        creator_id: inserted_user.id,
++        creator_id: inserted_person.id,
          url: None,
          body: None,
          published: inserted_post.published,
          local: true,
          title: "nada".to_owned(),
          description: None,
--        creator_id: inserted_user.id,
++        creator_id: inserted_person.id,
          updated: None,
          banner: None,
          published: inserted_community.published,
        },
      };
  
--    let mut expected_comment_view_with_user = expected_comment_view_no_user.to_owned();
--    expected_comment_view_with_user.my_vote = Some(1);
++    let mut expected_comment_view_with_person = expected_comment_view_no_person.to_owned();
++    expected_comment_view_with_person.my_vote = Some(1);
  
--    let read_comment_views_no_user = CommentQueryBuilder::create(&conn)
++    let read_comment_views_no_person = CommentQueryBuilder::create(&conn)
        .post_id(inserted_post.id)
        .list()
        .unwrap();
  
--    let read_comment_views_with_user = CommentQueryBuilder::create(&conn)
++    let read_comment_views_with_person = CommentQueryBuilder::create(&conn)
        .post_id(inserted_post.id)
--      .my_user_id(inserted_user.id)
++      .my_person_id(inserted_person.id)
        .list()
        .unwrap();
  
--    let like_removed = CommentLike::remove(&conn, inserted_user.id, inserted_comment.id).unwrap();
++    let like_removed = CommentLike::remove(&conn, inserted_person.id, inserted_comment.id).unwrap();
      let num_deleted = Comment::delete(&conn, inserted_comment.id).unwrap();
      Post::delete(&conn, inserted_post.id).unwrap();
      Community::delete(&conn, inserted_community.id).unwrap();
--    User_::delete(&conn, inserted_user.id).unwrap();
++    Person::delete(&conn, inserted_person.id).unwrap();
  
--    assert_eq!(expected_comment_view_no_user, read_comment_views_no_user[0]);
++    assert_eq!(expected_comment_view_no_person, read_comment_views_no_person[0]);
      assert_eq!(
--      expected_comment_view_with_user,
--      read_comment_views_with_user[0]
++      expected_comment_view_with_person,
++      read_comment_views_with_person[0]
      );
      assert_eq!(1, num_deleted);
      assert_eq!(1, like_removed);
index b46ec5a4645f32f852ae4902c4ea830a3d1f6860,a9369ed2496f5775773d4e8b7ef67cd35152d327..d37a1d3ed9ca1ecbd461764c69a1e85f88ba9711
@@@ -4,3 -7,3 +7,4 @@@ pub mod post_report_view
  pub mod post_view;
  pub mod private_message_view;
  pub mod site_view;
++pub mod local_user_view;
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..384bf900702555f0ff7f03fa7bebb7463be303fb
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,78 @@@
++use diesel::{result::Error, *};
++use lemmy_db_queries::{
++  aggregates::person_aggregates::PersonAggregates,
++  ToSafe,
++  ToSafeSettings,
++};
++use lemmy_db_schema::{
++  schema::{person, person_aggregates, local_user},
++  source::person::{PersonSafe, Person},
++  source::local_user::{LocalUser, LocalUserSettings},
++};
++use serde::Serialize;
++
++#[derive(Debug, Serialize, Clone)]
++pub struct LocalUserView {
++  pub person: Person,
++  pub counts: PersonAggregates,
++  pub local_user: LocalUser,
++}
++
++type LocalUserViewTuple = (Person, PersonAggregates, LocalUser);
++
++impl LocalUserView {
++  pub fn read(conn: &PgConnection, person_id: i32) -> Result<Self, Error> {
++    let (person, counts, local_user) = person::table
++      .find(person_id)
++      .inner_join(person_aggregates::table)
++      .inner_join(local_user::table)
++      .select((person::all_columns, person_aggregates::all_columns, local_user::all_columns))
++      .first::<LocalUserViewTuple>(conn)?;
++    Ok(Self { person, counts, local_user })
++  }
++
++  // TODO check where this is used
++  pub fn read_from_name(conn: &PgConnection, name: &str) -> Result<Self, Error> {
++    let (person, counts, local_user) = person::table
++      .filter(person::name.eq(name))
++      .inner_join(person_aggregates::table)
++      .inner_join(local_user::table)
++      .select((person::all_columns, person_aggregates::all_columns, local_user::all_columns))
++      .first::<LocalUserViewTuple>(conn)?;
++    Ok(Self { person, counts, local_user })
++  }
++
++  pub fn find_by_email_or_name(
++    conn: &PgConnection,
++    name_or_email: &str,
++  ) -> Result<Self, Error> {
++    let (person, counts, local_user) = person::table
++      .inner_join(person_aggregates::table)
++      .inner_join(local_user::table)
++      .filter(person::name.ilike(name_or_email).or(local_user::email.ilike(name_or_email)))
++      .select((person::all_columns, person_aggregates::all_columns, local_user::all_columns))
++      .first::<LocalUserViewTuple>(conn)?;
++    Ok(Self { person, counts, local_user })
++  }
++}
++
++#[derive(Debug, Serialize, Clone)]
++pub struct LocalUserSettingsView {
++  pub person: PersonSafe,
++  pub counts: PersonAggregates,
++  pub local_user: LocalUserSettings,
++}
++
++type LocalUserSettingsViewTuple = (PersonSafe, PersonAggregates, LocalUserSettings);
++
++impl LocalUserSettingsView {
++  pub fn read(conn: &PgConnection, person_id: i32) -> Result<Self, Error> {
++    let (person, counts, local_user) = person::table
++      .find(person_id)
++      .inner_join(person_aggregates::table)
++      .inner_join(local_user::table)
++      .select((Person::safe_columns_tuple(), person_aggregates::all_columns, LocalUser::safe_settings_columns_tuple()))
++      .first::<LocalUserSettingsViewTuple>(conn)?;
++    Ok(Self { person, counts, local_user })
++  }
++}
index 741162e3e9895800ca7cb4309e31718aa68a6e8b,741162e3e9895800ca7cb4309e31718aa68a6e8b..192a3d7b108469c77dec289f7602d01bb019ebc1
@@@ -1,12 -1,12 +1,12 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, MaybeOptional, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{community, post, post_report, user_, user_alias_1, user_alias_2},
++  schema::{community, post, post_report, person, person_alias_1, person_alias_2},
    source::{
      community::{Community, CommunitySafe},
      post::Post,
      post_report::PostReport,
--    user::{UserAlias1, UserAlias2, UserSafe, UserSafeAlias1, UserSafeAlias2, User_},
++    person::{PersonAlias1, PersonAlias2, PersonSafe, PersonSafeAlias1, PersonSafeAlias2, Person},
    },
  };
  use serde::Serialize;
@@@ -16,18 -16,18 +16,18 @@@ pub struct PostReportView 
    pub post_report: PostReport,
    pub post: Post,
    pub community: CommunitySafe,
--  pub creator: UserSafe,
--  pub post_creator: UserSafeAlias1,
--  pub resolver: Option<UserSafeAlias2>,
++  pub creator: PersonSafe,
++  pub post_creator: PersonSafeAlias1,
++  pub resolver: Option<PersonSafeAlias2>,
  }
  
  type PostReportViewTuple = (
    PostReport,
    Post,
    CommunitySafe,
--  UserSafe,
--  UserSafeAlias1,
--  Option<UserSafeAlias2>,
++  PersonSafe,
++  PersonSafeAlias1,
++  Option<PersonSafeAlias2>,
  );
  
  impl PostReportView {
        .find(report_id)
        .inner_join(post::table)
        .inner_join(community::table.on(post::community_id.eq(community::id)))
--      .inner_join(user_::table.on(post_report::creator_id.eq(user_::id)))
--      .inner_join(user_alias_1::table.on(post::creator_id.eq(user_alias_1::id)))
--      .left_join(user_alias_2::table.on(post_report::resolver_id.eq(user_alias_2::id.nullable())))
++      .inner_join(person::table.on(post_report::creator_id.eq(person::id)))
++      .inner_join(person_alias_1::table.on(post::creator_id.eq(person_alias_1::id)))
++      .left_join(person_alias_2::table.on(post_report::resolver_id.eq(person_alias_2::id.nullable())))
        .select((
          post_report::all_columns,
          post::all_columns,
          Community::safe_columns_tuple(),
--        User_::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
--        UserAlias2::safe_columns_tuple().nullable(),
++        Person::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
++        PersonAlias2::safe_columns_tuple().nullable(),
        ))
        .first::<PostReportViewTuple>(conn)?;
  
@@@ -66,7 -66,7 +66,7 @@@
    ///
    /// * `community_ids` - a Vec<i32> of community_ids to get a count for
    /// TODO this eq_any is a bad way to do this, would be better to join to communitymoderator
--  /// for a user id
++  /// for a person id
    pub fn get_report_count(conn: &PgConnection, community_ids: &[i32]) -> Result<i64, Error> {
      use diesel::dsl::*;
      post_report::table
@@@ -124,16 -124,16 +124,16 @@@ impl<'a> PostReportQueryBuilder<'a> 
      let mut query = post_report::table
        .inner_join(post::table)
        .inner_join(community::table.on(post::community_id.eq(community::id)))
--      .inner_join(user_::table.on(post_report::creator_id.eq(user_::id)))
--      .inner_join(user_alias_1::table.on(post::creator_id.eq(user_alias_1::id)))
--      .left_join(user_alias_2::table.on(post_report::resolver_id.eq(user_alias_2::id.nullable())))
++      .inner_join(person::table.on(post_report::creator_id.eq(person::id)))
++      .inner_join(person_alias_1::table.on(post::creator_id.eq(person_alias_1::id)))
++      .left_join(person_alias_2::table.on(post_report::resolver_id.eq(person_alias_2::id.nullable())))
        .select((
          post_report::all_columns,
          post::all_columns,
          Community::safe_columns_tuple(),
--        User_::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
--        UserAlias2::safe_columns_tuple().nullable(),
++        Person::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
++        PersonAlias2::safe_columns_tuple().nullable(),
        ))
        .into_boxed();
  
index f56c2f9be752e96c614504b6dd513351d5b082b7,e7b488275f7e9cf5d4a7ed2bbb96a63289ce9895..4aca33286c8ded38b3286684f1cbb4346b0b20de
@@@ -14,18 -14,18 +14,18 @@@ use lemmy_db_schema::
    schema::{
      community,
      community_follower,
--    community_user_ban,
++    community_person_ban,
      post,
      post_aggregates,
      post_like,
      post_read,
      post_saved,
--    user_,
++    person,
    },
    source::{
 -    community::{Community, CommunityFollower, CommunitySafe, CommunityUserBan},
 +    community::{Community, CommunityFollower, CommunitySafe, CommunityPersonBan},
      post::{Post, PostRead, PostSaved},
--    user::{UserSafe, User_},
++    person::{PersonSafe, Person},
    },
  };
  use log::debug;
@@@ -34,9 -34,9 +34,9 @@@ use serde::Serialize
  #[derive(Debug, PartialEq, Serialize, Clone)]
  pub struct PostView {
    pub post: Post,
--  pub creator: UserSafe,
++  pub creator: PersonSafe,
    pub community: CommunitySafe,
--  pub creator_banned_from_community: bool, // Left Join to CommunityUserBan
++  pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
    pub counts: PostAggregates,
    pub subscribed: bool,     // Left join to CommunityFollower
    pub saved: bool,          // Left join to PostSaved
@@@ -46,9 -46,9 +46,9 @@@
  
  type PostViewTuple = (
    Post,
--  UserSafe,
++  PersonSafe,
    CommunitySafe,
 -  Option<CommunityUserBan>,
 +  Option<CommunityPersonBan>,
    PostAggregates,
    Option<CommunityFollower>,
    Option<PostSaved>,
@@@ -57,9 -57,9 +57,9 @@@
  );
  
  impl PostView {
--  pub fn read(conn: &PgConnection, post_id: i32, my_user_id: Option<i32>) -> Result<Self, Error> {
++  pub fn read(conn: &PgConnection, post_id: i32, my_person_id: Option<i32>) -> Result<Self, Error> {
      // The left join below will return None in this case
--    let user_id_join = my_user_id.unwrap_or(-1);
++    let person_id_join = my_person_id.unwrap_or(-1);
  
      let (
        post,
        post_like,
      ) = post::table
        .find(post_id)
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(community::table)
        .left_join(
--        community_user_ban::table.on(
++        community_person_ban::table.on(
            post::community_id
--            .eq(community_user_ban::community_id)
--            .and(community_user_ban::user_id.eq(post::creator_id)),
++            .eq(community_person_ban::community_id)
++            .and(community_person_ban::person_id.eq(post::creator_id)),
          ),
        )
        .inner_join(post_aggregates::table)
          community_follower::table.on(
            post::community_id
              .eq(community_follower::community_id)
--            .and(community_follower::user_id.eq(user_id_join)),
++            .and(community_follower::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          post_saved::table.on(
            post::id
              .eq(post_saved::post_id)
--            .and(post_saved::user_id.eq(user_id_join)),
++            .and(post_saved::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          post_read::table.on(
            post::id
              .eq(post_read::post_id)
--            .and(post_read::user_id.eq(user_id_join)),
++            .and(post_read::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          post_like::table.on(
            post::id
              .eq(post_like::post_id)
--            .and(post_like::user_id.eq(user_id_join)),
++            .and(post_like::person_id.eq(person_id_join)),
          ),
        )
        .select((
          post::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          Community::safe_columns_tuple(),
--        community_user_ban::all_columns.nullable(),
++        community_person_ban::all_columns.nullable(),
          post_aggregates::all_columns,
          community_follower::all_columns.nullable(),
          post_saved::all_columns.nullable(),
        ))
        .first::<PostViewTuple>(conn)?;
  
--    // If a user is given, then my_vote, if None, should be 0, not null
--    // Necessary to differentiate between other user's votes
--    let my_vote = if my_user_id.is_some() && post_like.is_none() {
++    // If a person is given, then my_vote, if None, should be 0, not null
++    // Necessary to differentiate between other person's votes
++    let my_vote = if my_person_id.is_some() && post_like.is_none() {
        Some(0)
      } else {
        post_like
@@@ -153,7 -153,7 +153,7 @@@ pub struct PostQueryBuilder<'a> 
    creator_id: Option<i32>,
    community_id: Option<i32>,
    community_name: Option<String>,
--  my_user_id: Option<i32>,
++  my_person_id: Option<i32>,
    search_term: Option<String>,
    url_search: Option<String>,
    show_nsfw: bool,
@@@ -172,7 -172,7 +172,7 @@@ impl<'a> PostQueryBuilder<'a> 
        creator_id: None,
        community_id: None,
        community_name: None,
--      my_user_id: None,
++      my_person_id: None,
        search_term: None,
        url_search: None,
        show_nsfw: true,
      self
    }
  
--  pub fn my_user_id<T: MaybeOptional<i32>>(mut self, my_user_id: T) -> Self {
--    self.my_user_id = my_user_id.get_optional();
++  pub fn my_person_id<T: MaybeOptional<i32>>(mut self, my_person_id: T) -> Self {
++    self.my_person_id = my_person_id.get_optional();
      self
    }
  
      use diesel::dsl::*;
  
      // The left join below will return None in this case
--    let user_id_join = self.my_user_id.unwrap_or(-1);
++    let person_id_join = self.my_person_id.unwrap_or(-1);
  
      let mut query = post::table
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(community::table)
        .left_join(
--        community_user_ban::table.on(
++        community_person_ban::table.on(
            post::community_id
--            .eq(community_user_ban::community_id)
--            .and(community_user_ban::user_id.eq(community::creator_id)),
++            .eq(community_person_ban::community_id)
++            .and(community_person_ban::person_id.eq(community::creator_id)),
          ),
        )
        .inner_join(post_aggregates::table)
          community_follower::table.on(
            post::community_id
              .eq(community_follower::community_id)
--            .and(community_follower::user_id.eq(user_id_join)),
++            .and(community_follower::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          post_saved::table.on(
            post::id
              .eq(post_saved::post_id)
--            .and(post_saved::user_id.eq(user_id_join)),
++            .and(post_saved::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          post_read::table.on(
            post::id
              .eq(post_read::post_id)
--            .and(post_read::user_id.eq(user_id_join)),
++            .and(post_read::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          post_like::table.on(
            post::id
              .eq(post_like::post_id)
--            .and(post_like::user_id.eq(user_id_join)),
++            .and(post_like::person_id.eq(person_id_join)),
          ),
        )
        .select((
          post::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          Community::safe_columns_tuple(),
--        community_user_ban::all_columns.nullable(),
++        community_person_ban::all_columns.nullable(),
          post_aggregates::all_columns,
          community_follower::all_columns.nullable(),
          post_saved::all_columns.nullable(),
        .into_boxed();
  
      query = match self.listing_type {
--      ListingType::Subscribed => query.filter(community_follower::user_id.is_not_null()), // TODO could be this: and(community_follower::user_id.eq(user_id_join)),
++      ListingType::Subscribed => query.filter(community_follower::person_id.is_not_null()), // TODO could be this: and(community_follower::person_id.eq(person_id_join)),
        ListingType::Local => query.filter(community::local.eq(true)),
        _ => query,
      };
        );
      }
  
--    // If its for a specific user, show the removed / deleted
++    // If its for a specific person, show the removed / deleted
      if let Some(creator_id) = self.creator_id {
        query = query.filter(post::creator_id.eq(creator_id));
      }
@@@ -433,38 -433,40 +433,30 @@@ mod tests 
      ListingType,
      SortType,
    };
--  use lemmy_db_schema::source::{community::*, post::*, user::*};
++  use lemmy_db_schema::source::{community::*, post::*, person::*};
+   use serial_test::serial;
  
    #[test]
+   #[serial]
    fn test_crud() {
      let conn = establish_unpooled_connection();
  
--    let user_name = "tegan".to_string();
++    let person_name = "tegan".to_string();
      let community_name = "test_community_3".to_string();
      let post_name = "test post 3".to_string();
  
--    let new_user = UserForm {
--      name: user_name.to_owned(),
++    let new_person = PersonForm {
++      name: person_name.to_owned(),
        preferred_username: None,
--      password_encrypted: "nope".into(),
--      email: None,
--      matrix_user_id: None,
        avatar: None,
        banner: None,
++      banned: None,
++      deleted: None,
        published: None,
        updated: None,
--      admin: false,
--      banned: Some(false),
--      show_nsfw: false,
--      theme: "browser".into(),
--      default_sort_type: SortType::Hot as i16,
--      default_listing_type: ListingType::Subscribed as i16,
--      lang: "browser".into(),
--      show_avatars: true,
--      send_notifications_to_email: false,
        actor_id: None,
        bio: None,
--      local: true,
++      local: None,
        private_key: None,
        public_key: None,
        last_refreshed_at: None,
        shared_inbox_url: None,
      };
  
--    let inserted_user = User_::create(&conn, &new_user).unwrap();
++    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_user.id,
++      creator_id: inserted_person.id,
        removed: None,
        deleted: None,
        updated: None,
        name: post_name.to_owned(),
        url: None,
        body: None,
--      creator_id: inserted_user.id,
++      creator_id: inserted_person.id,
        community_id: inserted_community.id,
        removed: None,
        deleted: None,
  
      let post_like_form = PostLikeForm {
        post_id: inserted_post.id,
-       person_id: inserted_user.id,
 -      user_id: inserted_user.id,
++      person_id: inserted_person.id,
        score: 1,
      };
  
      let expected_post_like = PostLike {
        id: inserted_post_like.id,
        post_id: inserted_post.id,
-       person_id: inserted_user.id,
 -      user_id: inserted_user.id,
++      person_id: inserted_person.id,
        published: inserted_post_like.published,
        score: 1,
      };
  
--    let read_post_listings_with_user = PostQueryBuilder::create(&conn)
++    let read_post_listings_with_person = PostQueryBuilder::create(&conn)
        .listing_type(&ListingType::Community)
        .sort(&SortType::New)
        .community_id(inserted_community.id)
--      .my_user_id(inserted_user.id)
++      .my_person_id(inserted_person.id)
        .list()
        .unwrap();
  
--    let read_post_listings_no_user = PostQueryBuilder::create(&conn)
++    let read_post_listings_no_person = PostQueryBuilder::create(&conn)
        .listing_type(&ListingType::Community)
        .sort(&SortType::New)
        .community_id(inserted_community.id)
        .list()
        .unwrap();
  
--    let read_post_listing_no_user = PostView::read(&conn, inserted_post.id, None).unwrap();
--    let read_post_listing_with_user =
--      PostView::read(&conn, inserted_post.id, Some(inserted_user.id)).unwrap();
++    let read_post_listing_no_person = PostView::read(&conn, inserted_post.id, None).unwrap();
++    let read_post_listing_with_person =
++      PostView::read(&conn, inserted_post.id, Some(inserted_person.id)).unwrap();
  
      let agg = PostAggregates::read(&conn, inserted_post.id).unwrap();
  
--    // the non user version
--    let expected_post_listing_no_user = PostView {
++    // the non person version
++    let expected_post_listing_no_person = PostView {
        post: Post {
          id: inserted_post.id,
          name: post_name,
--        creator_id: inserted_user.id,
++        creator_id: inserted_person.id,
          url: None,
          body: None,
          published: inserted_post.published,
          local: true,
        },
        my_vote: None,
--      creator: UserSafe {
--        id: inserted_user.id,
--        name: user_name,
++      creator: PersonSafe {
++        id: inserted_person.id,
++        name: person_name,
          preferred_username: None,
--        published: inserted_user.published,
++        published: inserted_person.published,
          avatar: None,
--        actor_id: inserted_user.actor_id.to_owned(),
++        actor_id: inserted_person.actor_id.to_owned(),
          local: true,
          banned: false,
          deleted: false,
          bio: None,
          banner: None,
--        admin: false,
          updated: None,
--        matrix_user_id: None,
--        inbox_url: inserted_user.inbox_url.to_owned(),
++        inbox_url: inserted_person.inbox_url.to_owned(),
          shared_inbox_url: None,
        },
        creator_banned_from_community: false,
          local: true,
          title: "nada".to_owned(),
          description: None,
--        creator_id: inserted_user.id,
++        creator_id: inserted_person.id,
          updated: None,
          banner: None,
          published: inserted_community.published,
      };
  
      // TODO More needs to be added here
--    let mut expected_post_listing_with_user = expected_post_listing_no_user.to_owned();
++    let mut expected_post_listing_with_user = expected_post_listing_no_person.to_owned();
      expected_post_listing_with_user.my_vote = Some(1);
  
--    let like_removed = PostLike::remove(&conn, inserted_user.id, inserted_post.id).unwrap();
++    let like_removed = PostLike::remove(&conn, inserted_person.id, inserted_post.id).unwrap();
      let num_deleted = Post::delete(&conn, inserted_post.id).unwrap();
      Community::delete(&conn, inserted_community.id).unwrap();
--    User_::delete(&conn, inserted_user.id).unwrap();
++    Person::delete(&conn, inserted_person.id).unwrap();
  
      // The with user
      assert_eq!(
        expected_post_listing_with_user,
--      read_post_listings_with_user[0]
++      read_post_listings_with_person[0]
      );
--    assert_eq!(expected_post_listing_with_user, read_post_listing_with_user);
--    assert_eq!(1, read_post_listings_with_user.len());
++    assert_eq!(expected_post_listing_with_user, read_post_listing_with_person);
++    assert_eq!(1, read_post_listings_with_person.len());
  
      // Without the user
--    assert_eq!(expected_post_listing_no_user, read_post_listings_no_user[0]);
--    assert_eq!(expected_post_listing_no_user, read_post_listing_no_user);
--    assert_eq!(1, read_post_listings_no_user.len());
++    assert_eq!(expected_post_listing_no_person, read_post_listings_no_person[0]);
++    assert_eq!(expected_post_listing_no_person, read_post_listing_no_person);
++    assert_eq!(1, read_post_listings_no_person.len());
  
      // assert_eq!(expected_post, inserted_post);
      // assert_eq!(expected_post, updated_post);
index 578af80e9946707e9d2ff39ff39cf2b1ab6c08aa,578af80e9946707e9d2ff39ff39cf2b1ab6c08aa..29b1e46442502bb3d898521d0d84e3e8be5bd70f
@@@ -1,10 -1,10 +1,10 @@@
  use diesel::{pg::Pg, result::Error, *};
  use lemmy_db_queries::{limit_and_offset, MaybeOptional, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{private_message, user_, user_alias_1},
++  schema::{private_message, person, person_alias_1},
    source::{
      private_message::PrivateMessage,
--    user::{UserAlias1, UserSafe, UserSafeAlias1, User_},
++    person::{PersonAlias1, PersonSafe, PersonSafeAlias1, Person},
    },
  };
  use log::debug;
@@@ -13,23 -13,23 +13,23 @@@ use serde::Serialize
  #[derive(Debug, PartialEq, Serialize, Clone)]
  pub struct PrivateMessageView {
    pub private_message: PrivateMessage,
--  pub creator: UserSafe,
--  pub recipient: UserSafeAlias1,
++  pub creator: PersonSafe,
++  pub recipient: PersonSafeAlias1,
  }
  
--type PrivateMessageViewTuple = (PrivateMessage, UserSafe, UserSafeAlias1);
++type PrivateMessageViewTuple = (PrivateMessage, PersonSafe, PersonSafeAlias1);
  
  impl PrivateMessageView {
    pub fn read(conn: &PgConnection, private_message_id: i32) -> Result<Self, Error> {
      let (private_message, creator, recipient) = private_message::table
        .find(private_message_id)
--      .inner_join(user_::table.on(private_message::creator_id.eq(user_::id)))
--      .inner_join(user_alias_1::table.on(private_message::recipient_id.eq(user_alias_1::id)))
++      .inner_join(person::table.on(private_message::creator_id.eq(person::id)))
++      .inner_join(person_alias_1::table.on(private_message::recipient_id.eq(person_alias_1::id)))
        .order_by(private_message::published.desc())
        .select((
          private_message::all_columns,
--        User_::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
        ))
        .first::<PrivateMessageViewTuple>(conn)?;
  
@@@ -77,12 -77,12 +77,12 @@@ impl<'a> PrivateMessageQueryBuilder<'a
  
    pub fn list(self) -> Result<Vec<PrivateMessageView>, Error> {
      let mut query = private_message::table
--      .inner_join(user_::table.on(private_message::creator_id.eq(user_::id)))
--      .inner_join(user_alias_1::table.on(private_message::recipient_id.eq(user_alias_1::id)))
++      .inner_join(person::table.on(private_message::creator_id.eq(person::id)))
++      .inner_join(person_alias_1::table.on(private_message::recipient_id.eq(person_alias_1::id)))
        .select((
          private_message::all_columns,
--        User_::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
        ))
        .into_boxed();
  
index c04e85e9c8cf079e007ce8c670301e880b631080,c04e85e9c8cf079e007ce8c670301e880b631080..391cf84b18b5d927f79df3675b9575203f180d09
@@@ -1,10 -1,10 +1,10 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{aggregates::site_aggregates::SiteAggregates, ToSafe};
  use lemmy_db_schema::{
--  schema::{site, site_aggregates, user_},
++  schema::{site, site_aggregates, person},
    source::{
      site::Site,
--    user::{UserSafe, User_},
++    person::{PersonSafe, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct SiteView {
    pub site: Site,
--  pub creator: UserSafe,
++  pub creator: PersonSafe,
    pub counts: SiteAggregates,
  }
  
  impl SiteView {
    pub fn read(conn: &PgConnection) -> Result<Self, Error> {
      let (site, creator, counts) = site::table
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(site_aggregates::table)
        .select((
          site::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          site_aggregates::all_columns,
        ))
--      .first::<(Site, UserSafe, SiteAggregates)>(conn)?;
++      .first::<(Site, PersonSafe, SiteAggregates)>(conn)?;
  
      Ok(SiteView {
        site,
index a4f2b20dcaa3277f5d1af41a13681078f39244dc,a4f2b20dcaa3277f5d1af41a13681078f39244dc..6673acb536aff7692236bddb50cbc6b198f349c9
@@@ -1,10 -1,10 +1,10 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{community, community_follower, user_},
++  schema::{community, community_follower, person},
    source::{
      community::{Community, CommunitySafe},
--    user::{UserSafe, User_},
++    person::{PersonSafe, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct CommunityFollowerView {
    pub community: CommunitySafe,
--  pub follower: UserSafe,
++  pub follower: PersonSafe,
  }
  
--type CommunityFollowerViewTuple = (CommunitySafe, UserSafe);
++type CommunityFollowerViewTuple = (CommunitySafe, PersonSafe);
  
  impl CommunityFollowerView {
    pub fn for_community(conn: &PgConnection, community_id: i32) -> Result<Vec<Self>, Error> {
      let res = community_follower::table
        .inner_join(community::table)
--      .inner_join(user_::table)
--      .select((Community::safe_columns_tuple(), User_::safe_columns_tuple()))
++      .inner_join(person::table)
++      .select((Community::safe_columns_tuple(), Person::safe_columns_tuple()))
        .filter(community_follower::community_id.eq(community_id))
        .order_by(community_follower::published)
        .load::<CommunityFollowerViewTuple>(conn)?;
      Ok(Self::from_tuple_to_vec(res))
    }
  
--  pub fn for_user(conn: &PgConnection, user_id: i32) -> Result<Vec<Self>, Error> {
++  pub fn for_person(conn: &PgConnection, person_id: i32) -> Result<Vec<Self>, Error> {
      let res = community_follower::table
        .inner_join(community::table)
--      .inner_join(user_::table)
--      .select((Community::safe_columns_tuple(), User_::safe_columns_tuple()))
--      .filter(community_follower::user_id.eq(user_id))
++      .inner_join(person::table)
++      .select((Community::safe_columns_tuple(), Person::safe_columns_tuple()))
++      .filter(community_follower::person_id.eq(person_id))
        .order_by(community_follower::published)
        .load::<CommunityFollowerViewTuple>(conn)?;
  
index fe8b3c2228ae4b4e72b512697ac3d17971602b82,fe8b3c2228ae4b4e72b512697ac3d17971602b82..7cc208472e128829be6c7ae8c156cefb91b1ae7c
@@@ -1,10 -1,10 +1,10 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{community, community_moderator, user_},
++  schema::{community, community_moderator, person},
    source::{
      community::{Community, CommunitySafe},
--    user::{UserSafe, User_},
++    person::{PersonSafe, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct CommunityModeratorView {
    pub community: CommunitySafe,
--  pub moderator: UserSafe,
++  pub moderator: PersonSafe,
  }
  
--type CommunityModeratorViewTuple = (CommunitySafe, UserSafe);
++type CommunityModeratorViewTuple = (CommunitySafe, PersonSafe);
  
  impl CommunityModeratorView {
    pub fn for_community(conn: &PgConnection, community_id: i32) -> Result<Vec<Self>, Error> {
      let res = community_moderator::table
        .inner_join(community::table)
--      .inner_join(user_::table)
--      .select((Community::safe_columns_tuple(), User_::safe_columns_tuple()))
++      .inner_join(person::table)
++      .select((Community::safe_columns_tuple(), Person::safe_columns_tuple()))
        .filter(community_moderator::community_id.eq(community_id))
        .order_by(community_moderator::published)
        .load::<CommunityModeratorViewTuple>(conn)?;
      Ok(Self::from_tuple_to_vec(res))
    }
  
--  pub fn for_user(conn: &PgConnection, user_id: i32) -> Result<Vec<Self>, Error> {
++  pub fn for_person(conn: &PgConnection, person_id: i32) -> Result<Vec<Self>, Error> {
      let res = community_moderator::table
        .inner_join(community::table)
--      .inner_join(user_::table)
--      .select((Community::safe_columns_tuple(), User_::safe_columns_tuple()))
--      .filter(community_moderator::user_id.eq(user_id))
++      .inner_join(person::table)
++      .select((Community::safe_columns_tuple(), Person::safe_columns_tuple()))
++      .filter(community_moderator::person_id.eq(person_id))
        .order_by(community_moderator::published)
        .load::<CommunityModeratorViewTuple>(conn)?;
  
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..651fcbf8ea060bd7f8a14503692cf1a16514a42c
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,35 @@@
++use diesel::{result::Error, *};
++use lemmy_db_queries::ToSafe;
++use lemmy_db_schema::{
++  schema::{community, community_person_ban, person},
++  source::{
++    community::{Community, CommunitySafe},
++    person::{PersonSafe, Person},
++  },
++};
++use serde::Serialize;
++
++#[derive(Debug, Serialize, Clone)]
++pub struct CommunityPersonBanView {
++  pub community: CommunitySafe,
++  pub person: PersonSafe,
++}
++
++impl CommunityPersonBanView {
++  pub fn get(
++    conn: &PgConnection,
++    from_person_id: i32,
++    from_community_id: i32,
++  ) -> Result<Self, Error> {
++    let (community, person) = community_person_ban::table
++      .inner_join(community::table)
++      .inner_join(person::table)
++      .select((Community::safe_columns_tuple(), Person::safe_columns_tuple()))
++      .filter(community_person_ban::community_id.eq(from_community_id))
++      .filter(community_person_ban::person_id.eq(from_person_id))
++      .order_by(community_person_ban::published)
++      .first::<(CommunitySafe, PersonSafe)>(conn)?;
++
++    Ok(CommunityPersonBanView { community, person })
++  }
++}
diff --cc crates/db_views_actor/src/community_user_ban_view.rs
index d0a925848f9ec38d2ae4d6458f8f751d2e5995ba,d0a925848f9ec38d2ae4d6458f8f751d2e5995ba..0000000000000000000000000000000000000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,35 -1,35 +1,0 @@@
--use diesel::{result::Error, *};
--use lemmy_db_queries::ToSafe;
--use lemmy_db_schema::{
--  schema::{community, community_user_ban, user_},
--  source::{
--    community::{Community, CommunitySafe},
--    user::{UserSafe, User_},
--  },
--};
--use serde::Serialize;
--
--#[derive(Debug, Serialize, Clone)]
--pub struct CommunityUserBanView {
--  pub community: CommunitySafe,
--  pub user: UserSafe,
--}
--
--impl CommunityUserBanView {
--  pub fn get(
--    conn: &PgConnection,
--    from_user_id: i32,
--    from_community_id: i32,
--  ) -> Result<Self, Error> {
--    let (community, user) = community_user_ban::table
--      .inner_join(community::table)
--      .inner_join(user_::table)
--      .select((Community::safe_columns_tuple(), User_::safe_columns_tuple()))
--      .filter(community_user_ban::community_id.eq(from_community_id))
--      .filter(community_user_ban::user_id.eq(from_user_id))
--      .order_by(community_user_ban::published)
--      .first::<(CommunitySafe, UserSafe)>(conn)?;
--
--    Ok(CommunityUserBanView { community, user })
--  }
--}
index 9187696db1d8f42642af3e6ea357a43d0ad5f203,9187696db1d8f42642af3e6ea357a43d0ad5f203..47d0b1e225fee3ff4f1543647c403fcfbaff2991
@@@ -1,4 -1,4 +1,4 @@@
--use crate::{community_moderator_view::CommunityModeratorView, user_view::UserViewSafe};
++use crate::{community_moderator_view::CommunityModeratorView, person_view::PersonViewSafe};
  use diesel::{result::Error, *};
  use lemmy_db_queries::{
    aggregates::community_aggregates::CommunityAggregates,
    ViewToVec,
  };
  use lemmy_db_schema::{
--  schema::{community, community_aggregates, community_follower, user_},
++  schema::{community, community_aggregates, community_follower, person},
    source::{
      community::{Community, CommunityFollower, CommunitySafe},
--    user::{UserSafe, User_},
++    person::{PersonSafe, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct CommunityView {
    pub community: CommunitySafe,
--  pub creator: UserSafe,
++  pub creator: PersonSafe,
    pub subscribed: bool,
    pub counts: CommunityAggregates,
  }
  
  type CommunityViewTuple = (
    CommunitySafe,
--  UserSafe,
++  PersonSafe,
    CommunityAggregates,
    Option<CommunityFollower>,
  );
@@@ -39,25 -39,25 +39,25 @@@ impl CommunityView 
    pub fn read(
      conn: &PgConnection,
      community_id: i32,
--    my_user_id: Option<i32>,
++    my_person_id: Option<i32>,
    ) -> Result<Self, Error> {
      // The left join below will return None in this case
--    let user_id_join = my_user_id.unwrap_or(-1);
++    let person_id_join = my_person_id.unwrap_or(-1);
  
      let (community, creator, counts, follower) = community::table
        .find(community_id)
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(community_aggregates::table)
        .left_join(
          community_follower::table.on(
            community::id
              .eq(community_follower::community_id)
--            .and(community_follower::user_id.eq(user_id_join)),
++            .and(community_follower::person_id.eq(person_id_join)),
          ),
        )
        .select((
          Community::safe_columns_tuple(),
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          community_aggregates::all_columns,
          community_follower::all_columns.nullable(),
        ))
          .map(|v| v.into_iter().map(|m| m.moderator.id).collect())?,
      );
      mods_and_admins
--      .append(&mut UserViewSafe::admins(conn).map(|v| v.into_iter().map(|a| a.user.id).collect())?);
++      .append(&mut PersonViewSafe::admins(conn).map(|v| v.into_iter().map(|a| a.person.id).collect())?);
      Ok(mods_and_admins)
    }
  
--  pub fn is_mod_or_admin(conn: &PgConnection, user_id: i32, community_id: i32) -> bool {
++  pub fn is_mod_or_admin(conn: &PgConnection, person_id: i32, community_id: i32) -> bool {
      Self::community_mods_and_admins(conn, community_id)
        .unwrap_or_default()
--      .contains(&user_id)
++      .contains(&person_id)
    }
  }
  
@@@ -94,7 -94,7 +94,7 @@@ pub struct CommunityQueryBuilder<'a> 
    conn: &'a PgConnection,
    listing_type: &'a ListingType,
    sort: &'a SortType,
--  my_user_id: Option<i32>,
++  my_person_id: Option<i32>,
    show_nsfw: bool,
    search_term: Option<String>,
    page: Option<i64>,
@@@ -105,7 -105,7 +105,7 @@@ impl<'a> CommunityQueryBuilder<'a> 
    pub fn create(conn: &'a PgConnection) -> Self {
      CommunityQueryBuilder {
        conn,
--      my_user_id: None,
++      my_person_id: None,
        listing_type: &ListingType::All,
        sort: &SortType::Hot,
        show_nsfw: true,
      self
    }
  
--  pub fn my_user_id<T: MaybeOptional<i32>>(mut self, my_user_id: T) -> Self {
--    self.my_user_id = my_user_id.get_optional();
++  pub fn my_person_id<T: MaybeOptional<i32>>(mut self, my_person_id: T) -> Self {
++    self.my_person_id = my_person_id.get_optional();
      self
    }
  
  
    pub fn list(self) -> Result<Vec<CommunityView>, Error> {
      // The left join below will return None in this case
--    let user_id_join = self.my_user_id.unwrap_or(-1);
++    let person_id_join = self.my_person_id.unwrap_or(-1);
  
      let mut query = community::table
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(community_aggregates::table)
        .left_join(
          community_follower::table.on(
            community::id
              .eq(community_follower::community_id)
--            .and(community_follower::user_id.eq(user_id_join)),
++            .and(community_follower::person_id.eq(person_id_join)),
          ),
        )
        .select((
          Community::safe_columns_tuple(),
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          community_aggregates::all_columns,
          community_follower::all_columns.nullable(),
        ))
      };
  
      query = match self.listing_type {
--      ListingType::Subscribed => query.filter(community_follower::user_id.is_not_null()), // TODO could be this: and(community_follower::user_id.eq(user_id_join)),
++      ListingType::Subscribed => query.filter(community_follower::person_id.is_not_null()), // TODO could be this: and(community_follower::person_id.eq(person_id_join)),
        ListingType::Local => query.filter(community::local.eq(true)),
        _ => query,
      };
index a2ac31937cb12da1f59887e80ff3ce043136ff31,a2ac31937cb12da1f59887e80ff3ce043136ff31..5d5203c56640bcd1471fa03e62d5df5e50ea8730
@@@ -1,6 -1,6 +1,6 @@@
  pub mod community_follower_view;
  pub mod community_moderator_view;
--pub mod community_user_ban_view;
++pub mod community_person_ban_view;
  pub mod community_view;
--pub mod user_mention_view;
--pub mod user_view;
++pub mod person_mention_view;
++pub mod person_view;
index dc37a8804b608e57465c0d6603ec389a4f907979,ffdbe0300637cdfce990350dcb5b9665c292f4e4..5d7ee983302667141a4e246d5a0e03793e51debe
@@@ -16,62 -16,62 +16,62 @@@ use lemmy_db_schema::
      comment_saved,
      community,
      community_follower,
--    community_user_ban,
++    community_person_ban,
      post,
--    user_,
--    user_alias_1,
--    user_mention,
++    person,
++    person_alias_1,
++    person_mention,
    },
    source::{
      comment::{Comment, CommentSaved},
 -    community::{Community, CommunityFollower, CommunitySafe, CommunityUserBan},
 +    community::{Community, CommunityFollower, CommunitySafe, CommunityPersonBan},
      post::Post,
--    user::{UserAlias1, UserSafe, UserSafeAlias1, User_},
--    user_mention::UserMention,
++    person::{PersonAlias1, PersonSafe, PersonSafeAlias1, Person},
++    person_mention::PersonMention,
    },
  };
  use serde::Serialize;
  
  #[derive(Debug, PartialEq, Serialize, Clone)]
--pub struct UserMentionView {
--  pub user_mention: UserMention,
++pub struct PersonMentionView {
++  pub person_mention: PersonMention,
    pub comment: Comment,
--  pub creator: UserSafe,
++  pub creator: PersonSafe,
    pub post: Post,
    pub community: CommunitySafe,
--  pub recipient: UserSafeAlias1,
++  pub recipient: PersonSafeAlias1,
    pub counts: CommentAggregates,
--  pub creator_banned_from_community: bool, // Left Join to CommunityUserBan
++  pub creator_banned_from_community: bool, // Left Join to CommunityPersonBan
    pub subscribed: bool,                    // Left join to CommunityFollower
    pub saved: bool,                         // Left join to CommentSaved
    pub my_vote: Option<i16>,                // Left join to CommentLike
  }
  
--type UserMentionViewTuple = (
--  UserMention,
++type PersonMentionViewTuple = (
++  PersonMention,
    Comment,
--  UserSafe,
++  PersonSafe,
    Post,
    CommunitySafe,
--  UserSafeAlias1,
++  PersonSafeAlias1,
    CommentAggregates,
 -  Option<CommunityUserBan>,
 +  Option<CommunityPersonBan>,
    Option<CommunityFollower>,
    Option<CommentSaved>,
    Option<i16>,
  );
  
--impl UserMentionView {
++impl PersonMentionView {
    pub fn read(
      conn: &PgConnection,
--    user_mention_id: i32,
--    my_user_id: Option<i32>,
++    person_mention_id: i32,
++    my_person_id: Option<i32>,
    ) -> Result<Self, Error> {
      // The left join below will return None in this case
--    let user_id_join = my_user_id.unwrap_or(-1);
++    let person_id_join = my_person_id.unwrap_or(-1);
  
      let (
--      user_mention,
++      person_mention,
        comment,
        creator,
        post,
        subscribed,
        saved,
        my_vote,
--    ) = user_mention::table
--      .find(user_mention_id)
++    ) = person_mention::table
++      .find(person_mention_id)
        .inner_join(comment::table)
--      .inner_join(user_::table.on(comment::creator_id.eq(user_::id)))
++      .inner_join(person::table.on(comment::creator_id.eq(person::id)))
        .inner_join(post::table.on(comment::post_id.eq(post::id)))
        .inner_join(community::table.on(post::community_id.eq(community::id)))
--      .inner_join(user_alias_1::table)
++      .inner_join(person_alias_1::table)
        .inner_join(comment_aggregates::table.on(comment::id.eq(comment_aggregates::comment_id)))
        .left_join(
--        community_user_ban::table.on(
++        community_person_ban::table.on(
            community::id
--            .eq(community_user_ban::community_id)
--            .and(community_user_ban::user_id.eq(comment::creator_id)),
++            .eq(community_person_ban::community_id)
++            .and(community_person_ban::person_id.eq(comment::creator_id)),
          ),
        )
        .left_join(
          community_follower::table.on(
            post::community_id
              .eq(community_follower::community_id)
--            .and(community_follower::user_id.eq(user_id_join)),
++            .and(community_follower::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          comment_saved::table.on(
            comment::id
              .eq(comment_saved::comment_id)
--            .and(comment_saved::user_id.eq(user_id_join)),
++            .and(comment_saved::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          comment_like::table.on(
            comment::id
              .eq(comment_like::comment_id)
--            .and(comment_like::user_id.eq(user_id_join)),
++            .and(comment_like::person_id.eq(person_id_join)),
          ),
        )
        .select((
--        user_mention::all_columns,
++        person_mention::all_columns,
          comment::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          post::all_columns,
          Community::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
          comment_aggregates::all_columns,
--        community_user_ban::all_columns.nullable(),
++        community_person_ban::all_columns.nullable(),
          community_follower::all_columns.nullable(),
          comment_saved::all_columns.nullable(),
          comment_like::score.nullable(),
        ))
--      .first::<UserMentionViewTuple>(conn)?;
++      .first::<PersonMentionViewTuple>(conn)?;
  
--    Ok(UserMentionView {
--      user_mention,
++    Ok(PersonMentionView {
++      person_mention,
        comment,
        creator,
        post,
    }
  }
  
--pub struct UserMentionQueryBuilder<'a> {
++pub struct PersonMentionQueryBuilder<'a> {
    conn: &'a PgConnection,
--  my_user_id: Option<i32>,
++  my_person_id: Option<i32>,
    recipient_id: Option<i32>,
    sort: &'a SortType,
    unread_only: bool,
    limit: Option<i64>,
  }
  
--impl<'a> UserMentionQueryBuilder<'a> {
++impl<'a> PersonMentionQueryBuilder<'a> {
    pub fn create(conn: &'a PgConnection) -> Self {
--    UserMentionQueryBuilder {
++    PersonMentionQueryBuilder {
        conn,
--      my_user_id: None,
++      my_person_id: None,
        recipient_id: None,
        sort: &SortType::New,
        unread_only: false,
      self
    }
  
--  pub fn my_user_id<T: MaybeOptional<i32>>(mut self, my_user_id: T) -> Self {
--    self.my_user_id = my_user_id.get_optional();
++  pub fn my_person_id<T: MaybeOptional<i32>>(mut self, my_person_id: T) -> Self {
++    self.my_person_id = my_person_id.get_optional();
      self
    }
  
      self
    }
  
--  pub fn list(self) -> Result<Vec<UserMentionView>, Error> {
++  pub fn list(self) -> Result<Vec<PersonMentionView>, Error> {
      use diesel::dsl::*;
  
      // The left join below will return None in this case
--    let user_id_join = self.my_user_id.unwrap_or(-1);
++    let person_id_join = self.my_person_id.unwrap_or(-1);
  
--    let mut query = user_mention::table
++    let mut query = person_mention::table
        .inner_join(comment::table)
--      .inner_join(user_::table.on(comment::creator_id.eq(user_::id)))
++      .inner_join(person::table.on(comment::creator_id.eq(person::id)))
        .inner_join(post::table.on(comment::post_id.eq(post::id)))
        .inner_join(community::table.on(post::community_id.eq(community::id)))
--      .inner_join(user_alias_1::table)
++      .inner_join(person_alias_1::table)
        .inner_join(comment_aggregates::table.on(comment::id.eq(comment_aggregates::comment_id)))
        .left_join(
--        community_user_ban::table.on(
++        community_person_ban::table.on(
            community::id
--            .eq(community_user_ban::community_id)
--            .and(community_user_ban::user_id.eq(comment::creator_id)),
++            .eq(community_person_ban::community_id)
++            .and(community_person_ban::person_id.eq(comment::creator_id)),
          ),
        )
        .left_join(
          community_follower::table.on(
            post::community_id
              .eq(community_follower::community_id)
--            .and(community_follower::user_id.eq(user_id_join)),
++            .and(community_follower::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          comment_saved::table.on(
            comment::id
              .eq(comment_saved::comment_id)
--            .and(comment_saved::user_id.eq(user_id_join)),
++            .and(comment_saved::person_id.eq(person_id_join)),
          ),
        )
        .left_join(
          comment_like::table.on(
            comment::id
              .eq(comment_like::comment_id)
--            .and(comment_like::user_id.eq(user_id_join)),
++            .and(comment_like::person_id.eq(person_id_join)),
          ),
        )
        .select((
--        user_mention::all_columns,
++        person_mention::all_columns,
          comment::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          post::all_columns,
          Community::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
          comment_aggregates::all_columns,
--        community_user_ban::all_columns.nullable(),
++        community_person_ban::all_columns.nullable(),
          community_follower::all_columns.nullable(),
          comment_saved::all_columns.nullable(),
          comment_like::score.nullable(),
        .into_boxed();
  
      if let Some(recipient_id) = self.recipient_id {
--      query = query.filter(user_mention::recipient_id.eq(recipient_id));
++      query = query.filter(person_mention::recipient_id.eq(recipient_id));
      }
  
      if self.unread_only {
--      query = query.filter(user_mention::read.eq(false));
++      query = query.filter(person_mention::read.eq(false));
      }
  
      query = match self.sort {
      let res = query
        .limit(limit)
        .offset(offset)
--      .load::<UserMentionViewTuple>(self.conn)?;
++      .load::<PersonMentionViewTuple>(self.conn)?;
  
--    Ok(UserMentionView::from_tuple_to_vec(res))
++    Ok(PersonMentionView::from_tuple_to_vec(res))
    }
  }
  
--impl ViewToVec for UserMentionView {
--  type DbTuple = UserMentionViewTuple;
++impl ViewToVec for PersonMentionView {
++  type DbTuple = PersonMentionViewTuple;
    fn from_tuple_to_vec(items: Vec<Self::DbTuple>) -> Vec<Self> {
      items
        .iter()
        .map(|a| Self {
--        user_mention: a.0.to_owned(),
++        person_mention: a.0.to_owned(),
          comment: a.1.to_owned(),
          creator: a.2.to_owned(),
          post: a.3.to_owned(),
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..ff936d6de5d5e05afb94faf9f02f93d568e5e8fe
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,152 @@@
++use diesel::{dsl::*, result::Error, *};
++use lemmy_db_queries::{
++  aggregates::person_aggregates::PersonAggregates,
++  fuzzy_search,
++  limit_and_offset,
++  MaybeOptional,
++  SortType,
++  ToSafe,
++  ViewToVec,
++};
++use lemmy_db_schema::{
++  schema::{person, person_aggregates, local_user},
++  source::person::{PersonSafe, Person},
++};
++use serde::Serialize;
++
++#[derive(Debug, Serialize, Clone)]
++pub struct PersonViewSafe {
++  pub person: PersonSafe,
++  pub counts: PersonAggregates,
++}
++
++type PersonViewSafeTuple = (PersonSafe, PersonAggregates);
++
++impl PersonViewSafe {
++  pub fn read(conn: &PgConnection, id: i32) -> Result<Self, Error> {
++    let (person, counts) = person::table
++      .find(id)
++      .inner_join(person_aggregates::table)
++      .select((Person::safe_columns_tuple(), person_aggregates::all_columns))
++      .first::<PersonViewSafeTuple>(conn)?;
++    Ok(Self { person, counts })
++  }
++
++  pub fn admins(conn: &PgConnection) -> Result<Vec<Self>, Error> {
++    let admins = person::table
++      .inner_join(person_aggregates::table)
++      .inner_join(local_user::table)
++      .select((Person::safe_columns_tuple(), person_aggregates::all_columns))
++      .filter(local_user::admin.eq(true))
++      .order_by(person::published)
++      .load::<PersonViewSafeTuple>(conn)?;
++
++    Ok(Self::from_tuple_to_vec(admins))
++  }
++
++  pub fn banned(conn: &PgConnection) -> Result<Vec<Self>, Error> {
++    let banned = person::table
++      .inner_join(person_aggregates::table)
++      .select((Person::safe_columns_tuple(), person_aggregates::all_columns))
++      .filter(person::banned.eq(true))
++      .load::<PersonViewSafeTuple>(conn)?;
++
++    Ok(Self::from_tuple_to_vec(banned))
++  }
++}
++
++pub struct PersonQueryBuilder<'a> {
++  conn: &'a PgConnection,
++  sort: &'a SortType,
++  search_term: Option<String>,
++  page: Option<i64>,
++  limit: Option<i64>,
++}
++
++impl<'a> PersonQueryBuilder<'a> {
++  pub fn create(conn: &'a PgConnection) -> Self {
++    PersonQueryBuilder {
++      conn,
++      search_term: None,
++      sort: &SortType::Hot,
++      page: None,
++      limit: None,
++    }
++  }
++
++  pub fn sort(mut self, sort: &'a SortType) -> Self {
++    self.sort = sort;
++    self
++  }
++
++  pub fn search_term<T: MaybeOptional<String>>(mut self, search_term: T) -> Self {
++    self.search_term = search_term.get_optional();
++    self
++  }
++
++  pub fn page<T: MaybeOptional<i64>>(mut self, page: T) -> Self {
++    self.page = page.get_optional();
++    self
++  }
++
++  pub fn limit<T: MaybeOptional<i64>>(mut self, limit: T) -> Self {
++    self.limit = limit.get_optional();
++    self
++  }
++
++  pub fn list(self) -> Result<Vec<PersonViewSafe>, Error> {
++    let mut query = person::table
++      .inner_join(person_aggregates::table)
++      .select((Person::safe_columns_tuple(), person_aggregates::all_columns))
++      .into_boxed();
++
++    if let Some(search_term) = self.search_term {
++      query = query.filter(person::name.ilike(fuzzy_search(&search_term)));
++    }
++
++    query = match self.sort {
++      SortType::Hot => query
++        .order_by(person_aggregates::comment_score.desc())
++        .then_order_by(person::published.desc()),
++      SortType::Active => query
++        .order_by(person_aggregates::comment_score.desc())
++        .then_order_by(person::published.desc()),
++      SortType::New | SortType::MostComments | SortType::NewComments => {
++        query.order_by(person::published.desc())
++      }
++      SortType::TopAll => query.order_by(person_aggregates::comment_score.desc()),
++      SortType::TopYear => query
++        .filter(person::published.gt(now - 1.years()))
++        .order_by(person_aggregates::comment_score.desc()),
++      SortType::TopMonth => query
++        .filter(person::published.gt(now - 1.months()))
++        .order_by(person_aggregates::comment_score.desc()),
++      SortType::TopWeek => query
++        .filter(person::published.gt(now - 1.weeks()))
++        .order_by(person_aggregates::comment_score.desc()),
++      SortType::TopDay => query
++        .filter(person::published.gt(now - 1.days()))
++        .order_by(person_aggregates::comment_score.desc()),
++    };
++
++    let (limit, offset) = limit_and_offset(self.page, self.limit);
++    query = query.limit(limit).offset(offset);
++
++    let res = query.load::<PersonViewSafeTuple>(self.conn)?;
++
++    Ok(PersonViewSafe::from_tuple_to_vec(res))
++  }
++}
++
++impl ViewToVec for PersonViewSafe {
++  type DbTuple = PersonViewSafeTuple;
++  fn from_tuple_to_vec(items: Vec<Self::DbTuple>) -> Vec<Self> {
++    items
++      .iter()
++      .map(|a| Self {
++        person: a.0.to_owned(),
++        counts: a.1.to_owned(),
++      })
++      .collect::<Vec<Self>>()
++  }
++}
diff --cc crates/db_views_actor/src/user_view.rs
index bbe889a2584d59f7a6cf2a4651d3445d8d645aec,bbe889a2584d59f7a6cf2a4651d3445d8d645aec..0000000000000000000000000000000000000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,151 -1,151 +1,0 @@@
--use diesel::{dsl::*, result::Error, *};
--use lemmy_db_queries::{
--  aggregates::user_aggregates::UserAggregates,
--  fuzzy_search,
--  limit_and_offset,
--  MaybeOptional,
--  SortType,
--  ToSafe,
--  ViewToVec,
--};
--use lemmy_db_schema::{
--  schema::{user_, user_aggregates},
--  source::user::{UserSafe, User_},
--};
--use serde::Serialize;
--
--#[derive(Debug, Serialize, Clone)]
--pub struct UserViewSafe {
--  pub user: UserSafe,
--  pub counts: UserAggregates,
--}
--
--type UserViewSafeTuple = (UserSafe, UserAggregates);
--
--impl UserViewSafe {
--  pub fn read(conn: &PgConnection, id: i32) -> Result<Self, Error> {
--    let (user, counts) = user_::table
--      .find(id)
--      .inner_join(user_aggregates::table)
--      .select((User_::safe_columns_tuple(), user_aggregates::all_columns))
--      .first::<UserViewSafeTuple>(conn)?;
--    Ok(Self { user, counts })
--  }
--
--  pub fn admins(conn: &PgConnection) -> Result<Vec<Self>, Error> {
--    let admins = user_::table
--      .inner_join(user_aggregates::table)
--      .select((User_::safe_columns_tuple(), user_aggregates::all_columns))
--      .filter(user_::admin.eq(true))
--      .order_by(user_::published)
--      .load::<UserViewSafeTuple>(conn)?;
--
--    Ok(Self::from_tuple_to_vec(admins))
--  }
--
--  pub fn banned(conn: &PgConnection) -> Result<Vec<Self>, Error> {
--    let banned = user_::table
--      .inner_join(user_aggregates::table)
--      .select((User_::safe_columns_tuple(), user_aggregates::all_columns))
--      .filter(user_::banned.eq(true))
--      .load::<UserViewSafeTuple>(conn)?;
--
--    Ok(Self::from_tuple_to_vec(banned))
--  }
--}
--
--pub struct UserQueryBuilder<'a> {
--  conn: &'a PgConnection,
--  sort: &'a SortType,
--  search_term: Option<String>,
--  page: Option<i64>,
--  limit: Option<i64>,
--}
--
--impl<'a> UserQueryBuilder<'a> {
--  pub fn create(conn: &'a PgConnection) -> Self {
--    UserQueryBuilder {
--      conn,
--      search_term: None,
--      sort: &SortType::Hot,
--      page: None,
--      limit: None,
--    }
--  }
--
--  pub fn sort(mut self, sort: &'a SortType) -> Self {
--    self.sort = sort;
--    self
--  }
--
--  pub fn search_term<T: MaybeOptional<String>>(mut self, search_term: T) -> Self {
--    self.search_term = search_term.get_optional();
--    self
--  }
--
--  pub fn page<T: MaybeOptional<i64>>(mut self, page: T) -> Self {
--    self.page = page.get_optional();
--    self
--  }
--
--  pub fn limit<T: MaybeOptional<i64>>(mut self, limit: T) -> Self {
--    self.limit = limit.get_optional();
--    self
--  }
--
--  pub fn list(self) -> Result<Vec<UserViewSafe>, Error> {
--    let mut query = user_::table
--      .inner_join(user_aggregates::table)
--      .select((User_::safe_columns_tuple(), user_aggregates::all_columns))
--      .into_boxed();
--
--    if let Some(search_term) = self.search_term {
--      query = query.filter(user_::name.ilike(fuzzy_search(&search_term)));
--    }
--
--    query = match self.sort {
--      SortType::Hot => query
--        .order_by(user_aggregates::comment_score.desc())
--        .then_order_by(user_::published.desc()),
--      SortType::Active => query
--        .order_by(user_aggregates::comment_score.desc())
--        .then_order_by(user_::published.desc()),
--      SortType::New | SortType::MostComments | SortType::NewComments => {
--        query.order_by(user_::published.desc())
--      }
--      SortType::TopAll => query.order_by(user_aggregates::comment_score.desc()),
--      SortType::TopYear => query
--        .filter(user_::published.gt(now - 1.years()))
--        .order_by(user_aggregates::comment_score.desc()),
--      SortType::TopMonth => query
--        .filter(user_::published.gt(now - 1.months()))
--        .order_by(user_aggregates::comment_score.desc()),
--      SortType::TopWeek => query
--        .filter(user_::published.gt(now - 1.weeks()))
--        .order_by(user_aggregates::comment_score.desc()),
--      SortType::TopDay => query
--        .filter(user_::published.gt(now - 1.days()))
--        .order_by(user_aggregates::comment_score.desc()),
--    };
--
--    let (limit, offset) = limit_and_offset(self.page, self.limit);
--    query = query.limit(limit).offset(offset);
--
--    let res = query.load::<UserViewSafeTuple>(self.conn)?;
--
--    Ok(UserViewSafe::from_tuple_to_vec(res))
--  }
--}
--
--impl ViewToVec for UserViewSafe {
--  type DbTuple = UserViewSafeTuple;
--  fn from_tuple_to_vec(items: Vec<Self::DbTuple>) -> Vec<Self> {
--    items
--      .iter()
--      .map(|a| Self {
--        user: a.0.to_owned(),
--        counts: a.1.to_owned(),
--      })
--      .collect::<Vec<Self>>()
--  }
--}
index dfb7de7e61adbf2c28fe607696541145415f4d83,dfb7de7e61adbf2c28fe607696541145415f4d83..32988c1900cf7a9581a427d612df96f3daec3c29
@@@ -1,11 -1,11 +1,11 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{community, mod_add_community, user_, user_alias_1},
++  schema::{community, mod_add_community, person, person_alias_1},
    source::{
      community::{Community, CommunitySafe},
      moderator::ModAddCommunity,
--    user::{UserAlias1, UserSafe, UserSafeAlias1, User_},
++    person::{PersonAlias1, PersonSafe, PersonSafeAlias1, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct ModAddCommunityView {
    pub mod_add_community: ModAddCommunity,
--  pub moderator: UserSafe,
++  pub moderator: PersonSafe,
    pub community: CommunitySafe,
--  pub modded_user: UserSafeAlias1,
++  pub modded_person: PersonSafeAlias1,
  }
  
--type ModAddCommunityViewTuple = (ModAddCommunity, UserSafe, CommunitySafe, UserSafeAlias1);
++type ModAddCommunityViewTuple = (ModAddCommunity, PersonSafe, CommunitySafe, PersonSafeAlias1);
  
  impl ModAddCommunityView {
    pub fn list(
      conn: &PgConnection,
      community_id: Option<i32>,
--    mod_user_id: Option<i32>,
++    mod_person_id: Option<i32>,
      page: Option<i64>,
      limit: Option<i64>,
    ) -> Result<Vec<Self>, Error> {
      let mut query = mod_add_community::table
--      .inner_join(user_::table.on(mod_add_community::mod_user_id.eq(user_::id)))
++      .inner_join(person::table.on(mod_add_community::mod_person_id.eq(person::id)))
        .inner_join(community::table)
--      .inner_join(user_alias_1::table.on(mod_add_community::other_user_id.eq(user_alias_1::id)))
++      .inner_join(person_alias_1::table.on(mod_add_community::other_person_id.eq(person_alias_1::id)))
        .select((
          mod_add_community::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          Community::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
        ))
        .into_boxed();
  
--    if let Some(mod_user_id) = mod_user_id {
--      query = query.filter(mod_add_community::mod_user_id.eq(mod_user_id));
++    if let Some(mod_person_id) = mod_person_id {
++      query = query.filter(mod_add_community::mod_person_id.eq(mod_person_id));
      };
  
      if let Some(community_id) = community_id {
@@@ -69,7 -69,7 +69,7 @@@ impl ViewToVec for ModAddCommunityView 
          mod_add_community: a.0.to_owned(),
          moderator: a.1.to_owned(),
          community: a.2.to_owned(),
--        modded_user: a.3.to_owned(),
++        modded_person: a.3.to_owned(),
        })
        .collect::<Vec<Self>>()
    }
index 06c7091cc0e48ddc388a3df71d1d3c77f07adf58,06c7091cc0e48ddc388a3df71d1d3c77f07adf58..e4a665c5e748ec15cb40743d90d9a49d8b0155fd
@@@ -1,10 -1,10 +1,10 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{mod_add, user_, user_alias_1},
++  schema::{mod_add, person, person_alias_1},
    source::{
      moderator::ModAdd,
--    user::{UserAlias1, UserSafe, UserSafeAlias1, User_},
++    person::{PersonAlias1, PersonSafe, PersonSafeAlias1, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct ModAddView {
    pub mod_add: ModAdd,
--  pub moderator: UserSafe,
--  pub modded_user: UserSafeAlias1,
++  pub moderator: PersonSafe,
++  pub modded_person: PersonSafeAlias1,
  }
  
--type ModAddViewTuple = (ModAdd, UserSafe, UserSafeAlias1);
++type ModAddViewTuple = (ModAdd, PersonSafe, PersonSafeAlias1);
  
  impl ModAddView {
    pub fn list(
      conn: &PgConnection,
--    mod_user_id: Option<i32>,
++    mod_person_id: Option<i32>,
      page: Option<i64>,
      limit: Option<i64>,
    ) -> Result<Vec<Self>, Error> {
      let mut query = mod_add::table
--      .inner_join(user_::table.on(mod_add::mod_user_id.eq(user_::id)))
--      .inner_join(user_alias_1::table.on(mod_add::other_user_id.eq(user_alias_1::id)))
++      .inner_join(person::table.on(mod_add::mod_person_id.eq(person::id)))
++      .inner_join(person_alias_1::table.on(mod_add::other_person_id.eq(person_alias_1::id)))
        .select((
          mod_add::all_columns,
--        User_::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
        ))
        .into_boxed();
  
--    if let Some(mod_user_id) = mod_user_id {
--      query = query.filter(mod_add::mod_user_id.eq(mod_user_id));
++    if let Some(mod_person_id) = mod_person_id {
++      query = query.filter(mod_add::mod_person_id.eq(mod_person_id));
      };
  
      let (limit, offset) = limit_and_offset(page, limit);
@@@ -59,7 -59,7 +59,7 @@@ impl ViewToVec for ModAddView 
        .map(|a| Self {
          mod_add: a.0.to_owned(),
          moderator: a.1.to_owned(),
--        modded_user: a.2.to_owned(),
++        modded_person: a.2.to_owned(),
        })
        .collect::<Vec<Self>>()
    }
index 1d9b1fafdd88f906acc483ac07ac769a178cf9b9,1d9b1fafdd88f906acc483ac07ac769a178cf9b9..a60ede61be6a1d9d28fc6d744c22cecb7ff9af7c
@@@ -1,11 -1,11 +1,11 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{community, mod_ban_from_community, user_, user_alias_1},
++  schema::{community, mod_ban_from_community, person, person_alias_1},
    source::{
      community::{Community, CommunitySafe},
      moderator::ModBanFromCommunity,
--    user::{UserAlias1, UserSafe, UserSafeAlias1, User_},
++    person::{PersonAlias1, PersonSafe, PersonSafeAlias1, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct ModBanFromCommunityView {
    pub mod_ban_from_community: ModBanFromCommunity,
--  pub moderator: UserSafe,
++  pub moderator: PersonSafe,
    pub community: CommunitySafe,
--  pub banned_user: UserSafeAlias1,
++  pub banned_person: PersonSafeAlias1,
  }
  
--type ModBanFromCommunityViewTuple = (ModBanFromCommunity, UserSafe, CommunitySafe, UserSafeAlias1);
++type ModBanFromCommunityViewTuple = (ModBanFromCommunity, PersonSafe, CommunitySafe, PersonSafeAlias1);
  
  impl ModBanFromCommunityView {
    pub fn list(
      conn: &PgConnection,
      community_id: Option<i32>,
--    mod_user_id: Option<i32>,
++    mod_person_id: Option<i32>,
      page: Option<i64>,
      limit: Option<i64>,
    ) -> Result<Vec<Self>, Error> {
      let mut query = mod_ban_from_community::table
--      .inner_join(user_::table.on(mod_ban_from_community::mod_user_id.eq(user_::id)))
++      .inner_join(person::table.on(mod_ban_from_community::mod_person_id.eq(person::id)))
        .inner_join(community::table)
        .inner_join(
--        user_alias_1::table.on(mod_ban_from_community::other_user_id.eq(user_alias_1::id)),
++        person_alias_1::table.on(mod_ban_from_community::other_person_id.eq(person_alias_1::id)),
        )
        .select((
          mod_ban_from_community::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          Community::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
        ))
        .into_boxed();
  
--    if let Some(mod_user_id) = mod_user_id {
--      query = query.filter(mod_ban_from_community::mod_user_id.eq(mod_user_id));
++    if let Some(mod_person_id) = mod_person_id {
++      query = query.filter(mod_ban_from_community::mod_person_id.eq(mod_person_id));
      };
  
      if let Some(community_id) = community_id {
@@@ -71,7 -71,7 +71,7 @@@ impl ViewToVec for ModBanFromCommunityV
          mod_ban_from_community: a.0.to_owned(),
          moderator: a.1.to_owned(),
          community: a.2.to_owned(),
--        banned_user: a.3.to_owned(),
++        banned_person: a.3.to_owned(),
        })
        .collect::<Vec<Self>>()
    }
index ff599e18771108db3da312704823aad0729e61ef,ff599e18771108db3da312704823aad0729e61ef..2c55d5149b6c8246c38a7a4b302ac1f6cd883d70
@@@ -1,10 -1,10 +1,10 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{mod_ban, user_, user_alias_1},
++  schema::{mod_ban, person, person_alias_1},
    source::{
      moderator::ModBan,
--    user::{UserAlias1, UserSafe, UserSafeAlias1, User_},
++    person::{PersonAlias1, PersonSafe, PersonSafeAlias1, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct ModBanView {
    pub mod_ban: ModBan,
--  pub moderator: UserSafe,
--  pub banned_user: UserSafeAlias1,
++  pub moderator: PersonSafe,
++  pub banned_person: PersonSafeAlias1,
  }
  
--type ModBanViewTuple = (ModBan, UserSafe, UserSafeAlias1);
++type ModBanViewTuple = (ModBan, PersonSafe, PersonSafeAlias1);
  
  impl ModBanView {
    pub fn list(
      conn: &PgConnection,
--    mod_user_id: Option<i32>,
++    mod_person_id: Option<i32>,
      page: Option<i64>,
      limit: Option<i64>,
    ) -> Result<Vec<Self>, Error> {
      let mut query = mod_ban::table
--      .inner_join(user_::table.on(mod_ban::mod_user_id.eq(user_::id)))
--      .inner_join(user_alias_1::table.on(mod_ban::other_user_id.eq(user_alias_1::id)))
++      .inner_join(person::table.on(mod_ban::mod_person_id.eq(person::id)))
++      .inner_join(person_alias_1::table.on(mod_ban::other_person_id.eq(person_alias_1::id)))
        .select((
          mod_ban::all_columns,
--        User_::safe_columns_tuple(),
--        UserAlias1::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
        ))
        .into_boxed();
  
--    if let Some(mod_user_id) = mod_user_id {
--      query = query.filter(mod_ban::mod_user_id.eq(mod_user_id));
++    if let Some(mod_person_id) = mod_person_id {
++      query = query.filter(mod_ban::mod_person_id.eq(mod_person_id));
      };
  
      let (limit, offset) = limit_and_offset(page, limit);
@@@ -59,7 -59,7 +59,7 @@@ impl ViewToVec for ModBanView 
        .map(|a| Self {
          mod_ban: a.0.to_owned(),
          moderator: a.1.to_owned(),
--        banned_user: a.2.to_owned(),
++        banned_person: a.2.to_owned(),
        })
        .collect::<Vec<Self>>()
    }
index e6c697af76046ddc17d6f52b209f3c7cc34c5c73,e6c697af76046ddc17d6f52b209f3c7cc34c5c73..9369ba99b23d3b6e60597e0a906ba9f09a36c34f
@@@ -1,12 -1,12 +1,12 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{community, mod_lock_post, post, user_},
++  schema::{community, mod_lock_post, post, person},
    source::{
      community::{Community, CommunitySafe},
      moderator::ModLockPost,
      post::Post,
--    user::{UserSafe, User_},
++    person::{PersonSafe, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct ModLockPostView {
    pub mod_lock_post: ModLockPost,
--  pub moderator: UserSafe,
++  pub moderator: PersonSafe,
    pub post: Post,
    pub community: CommunitySafe,
  }
  
--type ModLockPostViewTuple = (ModLockPost, UserSafe, Post, CommunitySafe);
++type ModLockPostViewTuple = (ModLockPost, PersonSafe, Post, CommunitySafe);
  
  impl ModLockPostView {
    pub fn list(
      conn: &PgConnection,
      community_id: Option<i32>,
--    mod_user_id: Option<i32>,
++    mod_person_id: Option<i32>,
      page: Option<i64>,
      limit: Option<i64>,
    ) -> Result<Vec<Self>, Error> {
      let mut query = mod_lock_post::table
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(post::table)
        .inner_join(community::table.on(post::community_id.eq(community::id)))
        .select((
          mod_lock_post::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          post::all_columns,
          Community::safe_columns_tuple(),
        ))
@@@ -45,8 -45,8 +45,8 @@@
        query = query.filter(post::community_id.eq(community_id));
      };
  
--    if let Some(mod_user_id) = mod_user_id {
--      query = query.filter(mod_lock_post::mod_user_id.eq(mod_user_id));
++    if let Some(mod_person_id) = mod_person_id {
++      query = query.filter(mod_lock_post::mod_person_id.eq(mod_person_id));
      };
  
      let (limit, offset) = limit_and_offset(page, limit);
index 082703532e917be963adfb22ee810968b210d574,082703532e917be963adfb22ee810968b210d574..9633f2009c025705be4acbc9e7ccd86790a0f448
@@@ -1,13 -1,13 +1,13 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{comment, community, mod_remove_comment, post, user_, user_alias_1},
++  schema::{comment, community, mod_remove_comment, post, person, person_alias_1},
    source::{
      comment::Comment,
      community::{Community, CommunitySafe},
      moderator::ModRemoveComment,
      post::Post,
--    user::{UserAlias1, UserSafe, UserSafeAlias1, User_},
++    person::{PersonAlias1, PersonSafe, PersonSafeAlias1, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct ModRemoveCommentView {
    pub mod_remove_comment: ModRemoveComment,
--  pub moderator: UserSafe,
++  pub moderator: PersonSafe,
    pub comment: Comment,
--  pub commenter: UserSafeAlias1,
++  pub commenter: PersonSafeAlias1,
    pub post: Post,
    pub community: CommunitySafe,
  }
  
  type ModRemoveCommentViewTuple = (
    ModRemoveComment,
--  UserSafe,
++  PersonSafe,
    Comment,
--  UserSafeAlias1,
++  PersonSafeAlias1,
    Post,
    CommunitySafe,
  );
@@@ -35,21 -35,21 +35,21 @@@ impl ModRemoveCommentView 
    pub fn list(
      conn: &PgConnection,
      community_id: Option<i32>,
--    mod_user_id: Option<i32>,
++    mod_person_id: Option<i32>,
      page: Option<i64>,
      limit: Option<i64>,
    ) -> Result<Vec<Self>, Error> {
      let mut query = mod_remove_comment::table
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(comment::table)
--      .inner_join(user_alias_1::table.on(comment::creator_id.eq(user_alias_1::id)))
++      .inner_join(person_alias_1::table.on(comment::creator_id.eq(person_alias_1::id)))
        .inner_join(post::table.on(comment::post_id.eq(post::id)))
        .inner_join(community::table.on(post::community_id.eq(community::id)))
        .select((
          mod_remove_comment::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          comment::all_columns,
--        UserAlias1::safe_columns_tuple(),
++        PersonAlias1::safe_columns_tuple(),
          post::all_columns,
          Community::safe_columns_tuple(),
        ))
@@@ -59,8 -59,8 +59,8 @@@
        query = query.filter(post::community_id.eq(community_id));
      };
  
--    if let Some(mod_user_id) = mod_user_id {
--      query = query.filter(mod_remove_comment::mod_user_id.eq(mod_user_id));
++    if let Some(mod_person_id) = mod_person_id {
++      query = query.filter(mod_remove_comment::mod_person_id.eq(mod_person_id));
      };
  
      let (limit, offset) = limit_and_offset(page, limit);
index ff62ac15fe01cae8c51b127c780c1b74523b40f3,ff62ac15fe01cae8c51b127c780c1b74523b40f3..6d49acbe5d1e17dc1fc6dc261a4a1a46ca42f1fa
@@@ -1,11 -1,11 +1,11 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{community, mod_remove_community, user_},
++  schema::{community, mod_remove_community, person},
    source::{
      community::{Community, CommunitySafe},
      moderator::ModRemoveCommunity,
--    user::{UserSafe, User_},
++    person::{PersonSafe, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct ModRemoveCommunityView {
    pub mod_remove_community: ModRemoveCommunity,
--  pub moderator: UserSafe,
++  pub moderator: PersonSafe,
    pub community: CommunitySafe,
  }
  
--type ModRemoveCommunityTuple = (ModRemoveCommunity, UserSafe, CommunitySafe);
++type ModRemoveCommunityTuple = (ModRemoveCommunity, PersonSafe, CommunitySafe);
  
  impl ModRemoveCommunityView {
    pub fn list(
      conn: &PgConnection,
--    mod_user_id: Option<i32>,
++    mod_person_id: Option<i32>,
      page: Option<i64>,
      limit: Option<i64>,
    ) -> Result<Vec<Self>, Error> {
      let mut query = mod_remove_community::table
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(community::table)
        .select((
          mod_remove_community::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          Community::safe_columns_tuple(),
        ))
        .into_boxed();
  
--    if let Some(mod_user_id) = mod_user_id {
--      query = query.filter(mod_remove_community::mod_user_id.eq(mod_user_id));
++    if let Some(mod_person_id) = mod_person_id {
++      query = query.filter(mod_remove_community::mod_person_id.eq(mod_person_id));
      };
  
      let (limit, offset) = limit_and_offset(page, limit);
index 530ae03966f33b20ea088f242d54cf2c07628f04,530ae03966f33b20ea088f242d54cf2c07628f04..8530656cc29e36a5f99ff64ea52f41c9bab45a59
@@@ -1,12 -1,12 +1,12 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{community, mod_remove_post, post, user_},
++  schema::{community, mod_remove_post, post, person},
    source::{
      community::{Community, CommunitySafe},
      moderator::ModRemovePost,
      post::Post,
--    user::{UserSafe, User_},
++    person::{PersonSafe, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct ModRemovePostView {
    pub mod_remove_post: ModRemovePost,
--  pub moderator: UserSafe,
++  pub moderator: PersonSafe,
    pub post: Post,
    pub community: CommunitySafe,
  }
  
--type ModRemovePostViewTuple = (ModRemovePost, UserSafe, Post, CommunitySafe);
++type ModRemovePostViewTuple = (ModRemovePost, PersonSafe, Post, CommunitySafe);
  
  impl ModRemovePostView {
    pub fn list(
      conn: &PgConnection,
      community_id: Option<i32>,
--    mod_user_id: Option<i32>,
++    mod_person_id: Option<i32>,
      page: Option<i64>,
      limit: Option<i64>,
    ) -> Result<Vec<Self>, Error> {
      let mut query = mod_remove_post::table
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(post::table)
        .inner_join(community::table.on(post::community_id.eq(community::id)))
        .select((
          mod_remove_post::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          post::all_columns,
          Community::safe_columns_tuple(),
        ))
@@@ -45,8 -45,8 +45,8 @@@
        query = query.filter(post::community_id.eq(community_id));
      };
  
--    if let Some(mod_user_id) = mod_user_id {
--      query = query.filter(mod_remove_post::mod_user_id.eq(mod_user_id));
++    if let Some(mod_person_id) = mod_person_id {
++      query = query.filter(mod_remove_post::mod_person_id.eq(mod_person_id));
      };
  
      let (limit, offset) = limit_and_offset(page, limit);
index 1d726ca7ce6bbbe5d7e2a2d6f341df6717974c6b,1d726ca7ce6bbbe5d7e2a2d6f341df6717974c6b..9f4ea4af6303efa02c31d2626109573b8cc5d575
@@@ -1,12 -1,12 +1,12 @@@
  use diesel::{result::Error, *};
  use lemmy_db_queries::{limit_and_offset, ToSafe, ViewToVec};
  use lemmy_db_schema::{
--  schema::{community, mod_sticky_post, post, user_},
++  schema::{community, mod_sticky_post, post, person},
    source::{
      community::{Community, CommunitySafe},
      moderator::ModStickyPost,
      post::Post,
--    user::{UserSafe, User_},
++    person::{PersonSafe, Person},
    },
  };
  use serde::Serialize;
  #[derive(Debug, Serialize, Clone)]
  pub struct ModStickyPostView {
    pub mod_sticky_post: ModStickyPost,
--  pub moderator: UserSafe,
++  pub moderator: PersonSafe,
    pub post: Post,
    pub community: CommunitySafe,
  }
  
--type ModStickyPostViewTuple = (ModStickyPost, UserSafe, Post, CommunitySafe);
++type ModStickyPostViewTuple = (ModStickyPost, PersonSafe, Post, CommunitySafe);
  
  impl ModStickyPostView {
    pub fn list(
      conn: &PgConnection,
      community_id: Option<i32>,
--    mod_user_id: Option<i32>,
++    mod_person_id: Option<i32>,
      page: Option<i64>,
      limit: Option<i64>,
    ) -> Result<Vec<Self>, Error> {
      let mut query = mod_sticky_post::table
--      .inner_join(user_::table)
++      .inner_join(person::table)
        .inner_join(post::table)
        .inner_join(community::table.on(post::community_id.eq(community::id)))
        .select((
          mod_sticky_post::all_columns,
--        User_::safe_columns_tuple(),
++        Person::safe_columns_tuple(),
          post::all_columns,
          Community::safe_columns_tuple(),
        ))
@@@ -45,8 -45,8 +45,8 @@@
        query = query.filter(post::community_id.eq(community_id));
      };
  
--    if let Some(mod_user_id) = mod_user_id {
--      query = query.filter(mod_sticky_post::mod_user_id.eq(mod_user_id));
++    if let Some(mod_person_id) = mod_person_id {
++      query = query.filter(mod_sticky_post::mod_person_id.eq(mod_person_id));
      };
  
      let (limit, offset) = limit_and_offset(page, limit);
index 837e1489afebeb91b826fb1e7c4bdcbf3835c23e,105f9662d9bb3cab3bf9a54398a78126bee6224b..568107984b54e5b5b9fbce29b8aa1aa81f7b90ef
@@@ -2,20 -2,25 +2,25 @@@ use actix_web::{error::ErrorBadRequest
  use anyhow::anyhow;
  use chrono::{DateTime, NaiveDateTime, Utc};
  use diesel::PgConnection;
+ use lemmy_api_structs::blocking;
  use lemmy_db_queries::{
--  source::{community::Community_, user::User},
++  source::{community::Community_, person::Person_},
    ListingType,
    SortType,
  };
--use lemmy_db_schema::source::{community::Community, user::User_};
++use lemmy_db_schema::source::{community::Community, person::Person};
  use lemmy_db_views::{
    comment_view::{CommentQueryBuilder, CommentView},
    post_view::{PostQueryBuilder, PostView},
    site_view::SiteView,
  };
--use lemmy_db_views_actor::user_mention_view::{UserMentionQueryBuilder, UserMentionView};
- use lemmy_structs::blocking;
- use lemmy_utils::{claims::Claims, settings::Settings, utils::markdown_to_html, LemmyError};
++use lemmy_db_views_actor::person_mention_view::{PersonMentionQueryBuilder, PersonMentionView};
+ use lemmy_utils::{
+   claims::Claims,
+   settings::structs::Settings,
+   utils::markdown_to_html,
+   LemmyError,
+ };
  use lemmy_websocket::LemmyContext;
  use rss::{
    extension::dublincore::DublinCoreExtensionBuilder,
@@@ -162,13 -167,13 +167,12 @@@ fn get_feed_user
    user_name: String,
  ) -> Result<ChannelBuilder, LemmyError> {
    let site_view = SiteView::read(&conn)?;
--  let user = User_::find_by_username(&conn, &user_name)?;
-   let user_url = user.get_profile_url(&Settings::get().hostname);
 -  let user_url = user.get_profile_url(&Settings::get().hostname());
++  let person = Person::find_by_name(&conn, &user_name)?;
  
    let posts = PostQueryBuilder::create(&conn)
      .listing_type(&ListingType::All)
      .sort(sort_type)
--    .creator_id(user.id)
++    .creator_id(person.id)
      .list()?;
  
    let items = create_post_items(posts)?;
    let mut channel_builder = ChannelBuilder::default();
    channel_builder
      .namespaces(RSS_NAMESPACE.to_owned())
--    .title(&format!("{} - {}", site_view.site.name, user.name))
--    .link(user_url)
++    .title(&format!("{} - {}", site_view.site.name, person.name))
++    .link(person.actor_id.to_string())
      .items(items);
  
    Ok(channel_builder)
@@@ -219,11 -224,11 +223,11 @@@ fn get_feed_front
    jwt: String,
  ) -> Result<ChannelBuilder, LemmyError> {
    let site_view = SiteView::read(&conn)?;
--  let user_id = Claims::decode(&jwt)?.claims.id;
++  let person_id = Claims::decode(&jwt)?.claims.id;
  
    let posts = PostQueryBuilder::create(&conn)
      .listing_type(&ListingType::Subscribed)
--    .my_user_id(user_id)
++    .my_person_id(person_id)
      .sort(sort_type)
      .list()?;
  
  
  fn get_feed_inbox(conn: &PgConnection, jwt: String) -> Result<ChannelBuilder, LemmyError> {
    let site_view = SiteView::read(&conn)?;
--  let user_id = Claims::decode(&jwt)?.claims.id;
++  let person_id = Claims::decode(&jwt)?.claims.id;
  
    let sort = SortType::New;
  
    let replies = CommentQueryBuilder::create(&conn)
--    .recipient_id(user_id)
--    .my_user_id(user_id)
++    .recipient_id(person_id)
++    .my_person_id(person_id)
      .sort(&sort)
      .list()?;
  
--  let mentions = UserMentionQueryBuilder::create(&conn)
--    .recipient_id(user_id)
--    .my_user_id(user_id)
++  let mentions = PersonMentionQueryBuilder::create(&conn)
++    .recipient_id(person_id)
++    .my_person_id(person_id)
      .sort(&sort)
      .list()?;
  
  
  fn create_reply_and_mention_items(
    replies: Vec<CommentView>,
--  mentions: Vec<UserMentionView>,
++  mentions: Vec<PersonMentionView>,
  ) -> Result<Vec<Item>, LemmyError> {
    let mut reply_items: Vec<Item> = replies
      .iter()
index 4059e0f893d0491e774c22fa4d76e9f0c87df70b,e044373473355a23970837772905482514388daf..c444451e94f49458cdb5e09b92062cc2fefdf8af
@@@ -1,10 -1,10 +1,10 @@@
  use actix_web::{error::ErrorBadRequest, web::Query, *};
  use anyhow::anyhow;
- use lemmy_db_queries::source::{community::Community_, user::User};
- use lemmy_db_schema::source::{community::Community, user::User_};
- use lemmy_structs::{blocking, WebFingerLink, WebFingerResponse};
+ use lemmy_api_structs::{blocking, WebFingerLink, WebFingerResponse};
 -use lemmy_db_queries::source::{community::Community_, user::User};
 -use lemmy_db_schema::source::{community::Community, user::User_};
++use lemmy_db_queries::source::{community::Community_, person::Person_};
++use lemmy_db_schema::source::{community::Community, person::Person};
  use lemmy_utils::{
-   settings::Settings,
+   settings::structs::Settings,
    LemmyError,
    WEBFINGER_COMMUNITY_REGEX,
    WEBFINGER_USER_REGEX,
@@@ -55,11 -55,11 +55,11 @@@ async fn get_webfinger_response
      .await?
      .map_err(|_| ErrorBadRequest(LemmyError::from(anyhow!("not_found"))))?
      .actor_id
--  } else if let Some(user_name) = user_regex_parsed {
--    let user_name = user_name.as_str().to_owned();
++  } else if let Some(person_name) = user_regex_parsed {
++    let person_name = person_name.as_str().to_owned();
      // Make sure the requested user exists.
      blocking(context.pool(), move |conn| {
--      User_::read_from_name(conn, &user_name)
++      Person::find_by_name(conn, &person_name)
      })
      .await?
      .map_err(|_| ErrorBadRequest(LemmyError::from(anyhow!("not_found"))))?
index 4723c7141b5c24e7ca103c815e884228a2ae1155,4723c7141b5c24e7ca103c815e884228a2ae1155..56b18a179d803b4d705978626244cc43d831d891
@@@ -117,10 -117,10 +117,10 @@@ pub enum UserOperation 
    RemoveCommunity,
    FollowCommunity,
    GetFollowedCommunities,
--  GetUserDetails,
++  GetPersonDetails,
    GetReplies,
--  GetUserMentions,
--  MarkUserMentionAsRead,
++  GetPersonMentions,
++  MarkPersonMentionAsRead,
    GetModlog,
    BanFromCommunity,
    AddModToCommunity,
    EditSite,
    GetSite,
    AddAdmin,
--  BanUser,
++  BanPerson,
    Search,
    MarkAllAsRead,
    SaveUserSettings,
index e1d55a205b3a12ccd02ab526158ddbc7e790e033,0000000000000000000000000000000000000000..e1d55a205b3a12ccd02ab526158ddbc7e790e033
mode 100644,000000..100644
--- /dev/null
index d20bf021376c76522b919caae9dbbbef9740f66f,0000000000000000000000000000000000000000..db3547e5fb569aade06900998865540dfd35a417
mode 100644,000000..100644
--- /dev/null
@@@ -1,391 -1,0 +1,391 @@@
-   email text,
 +-- Person
 +-- Drop the 2 views user_alias_1, user_alias_2
 +drop view user_alias_1, user_alias_2;
 +
 +-- rename the user_ table to person
 +alter table user_ rename to person;
 +alter sequence user__id_seq rename to person_id_seq;
 +
 +-- create a new table local_user
 +create table local_user (
 +  id serial primary key,
 +  person_id int references person on update cascade on delete cascade not null,
 +  password_encrypted text not null,
++  email text unique,
 +  admin boolean default false not null,
 +  show_nsfw boolean default false not null,
 +  theme character varying(20) default 'darkly'::character varying not null,
 +  default_sort_type smallint default 0 not null,
 +  default_listing_type smallint default 1 not null,
 +  lang character varying(20) default 'browser'::character varying not null,
 +  show_avatars boolean default true not null,
 +  send_notifications_to_email boolean default false not null,
 +  matrix_user_id text,
 +  unique (person_id)
 +);
 +
 +-- Copy the local users over to the new table
 +insert into local_user 
 +(
 +  person_id,
 +  password_encrypted,
 +  email,
 +  admin,
 +  show_nsfw,
 +  theme,
 +  default_sort_type,
 +  default_listing_type,
 +  lang,
 +  show_avatars,
 +  send_notifications_to_email,
 +  matrix_user_id
 +)
 +select
 +  id,
 +  password_encrypted,
 +  email,
 +  admin,
 +  show_nsfw,
 +  theme,
 +  default_sort_type,
 +  default_listing_type,
 +  lang,
 +  show_avatars,
 +  send_notifications_to_email,
 +  matrix_user_id
 +from person
 +where local = true;
 +
 +-- Drop those columns from person
 +alter table person 
 +  drop column password_encrypted,
 +  drop column email,
 +  drop column admin,
 +  drop column show_nsfw,
 +  drop column theme,
 +  drop column default_sort_type,
 +  drop column default_listing_type,
 +  drop column lang,
 +  drop column show_avatars,
 +  drop column send_notifications_to_email,
 +  drop column matrix_user_id;
 +
 +-- Rename indexes
 +alter index user__pkey rename to person__pkey;
 +alter index idx_user_actor_id rename to idx_person_actor_id;
 +alter index idx_user_inbox_url rename to idx_person_inbox_url;
 +alter index idx_user_lower_actor_id rename to idx_person_lower_actor_id;
 +alter index idx_user_published rename to idx_person_published;
 +
 +-- Rename triggers
 +alter trigger site_aggregates_user_delete on person rename to site_aggregates_person_delete;
 +alter trigger site_aggregates_user_insert on person rename to site_aggregates_person_insert;
 +
 +-- Rename the trigger functions
 +alter function site_aggregates_user_delete() rename to site_aggregates_person_delete;
 +alter function site_aggregates_user_insert() rename to site_aggregates_person_insert;
 +
 +-- Create views
 +create view person_alias_1 as select * from person;
 +create view person_alias_2 as select * from person;
 +
 +-- Redo user aggregates into person_aggregates
 +alter table user_aggregates rename to person_aggregates;
 +alter sequence user_aggregates_id_seq rename to person_aggregates_id_seq;
 +alter table person_aggregates rename column user_id to person_id;
 +
 +-- index
 +alter index user_aggregates_pkey rename to person_aggregates_pkey;
 +alter index idx_user_aggregates_comment_score rename to idx_person_aggregates_comment_score;
 +alter index user_aggregates_user_id_key rename to person_aggregates_person_id_key;
 +alter table person_aggregates rename constraint user_aggregates_user_id_fkey to person_aggregates_person_id_fkey;
 +
 +
 +-- Drop all the old triggers and functions
 +drop trigger user_aggregates_user on person;
 +drop trigger user_aggregates_post_count on post;
 +drop trigger user_aggregates_post_score on post_like;
 +drop trigger user_aggregates_comment_count on comment;
 +drop trigger user_aggregates_comment_score on comment_like;
 +drop function 
 +  user_aggregates_user, 
 +  user_aggregates_post_count,
 +  user_aggregates_post_score,
 +  user_aggregates_comment_count,
 +  user_aggregates_comment_score;
 +
 +-- initial user add
 +create function person_aggregates_person()
 +returns trigger language plpgsql
 +as $$
 +begin
 +  IF (TG_OP = 'INSERT') THEN
 +    insert into person_aggregates (person_id) values (NEW.id);
 +  ELSIF (TG_OP = 'DELETE') THEN
 +    delete from person_aggregates where person_id = OLD.id;
 +  END IF;
 +  return null;
 +end $$;
 +
 +create trigger person_aggregates_person
 +after insert or delete on person
 +for each row
 +execute procedure person_aggregates_person();
 +
 +-- post count
 +create function person_aggregates_post_count()
 +returns trigger language plpgsql
 +as $$
 +begin
 +  IF (TG_OP = 'INSERT') THEN
 +    update person_aggregates 
 +    set post_count = post_count + 1 where person_id = NEW.creator_id;
 +
 +  ELSIF (TG_OP = 'DELETE') THEN
 +    update person_aggregates 
 +    set post_count = post_count - 1 where person_id = OLD.creator_id;
 +
 +    -- If the post gets deleted, the score calculation trigger won't fire, 
 +    -- so you need to re-calculate
 +    update person_aggregates ua
 +    set post_score = pd.score
 +    from (
 +      select u.id,
 +      coalesce(0, sum(pl.score)) as score
 +      -- User join because posts could be empty
 +      from person u 
 +      left join post p on u.id = p.creator_id
 +      left join post_like pl on p.id = pl.post_id
 +      group by u.id
 +    ) pd 
 +    where ua.person_id = OLD.creator_id;
 +
 +  END IF;
 +  return null;
 +end $$;
 +
 +create trigger person_aggregates_post_count
 +after insert or delete on post
 +for each row
 +execute procedure person_aggregates_post_count();
 +
 +-- post score
 +create function person_aggregates_post_score()
 +returns trigger language plpgsql
 +as $$
 +begin
 +  IF (TG_OP = 'INSERT') THEN
 +    -- Need to get the post creator, not the voter
 +    update person_aggregates ua
 +    set post_score = post_score + NEW.score
 +    from post p
 +    where ua.person_id = p.creator_id and p.id = NEW.post_id;
 +    
 +  ELSIF (TG_OP = 'DELETE') THEN
 +    update person_aggregates ua
 +    set post_score = post_score - OLD.score
 +    from post p
 +    where ua.person_id = p.creator_id and p.id = OLD.post_id;
 +  END IF;
 +  return null;
 +end $$;
 +
 +create trigger person_aggregates_post_score
 +after insert or delete on post_like
 +for each row
 +execute procedure person_aggregates_post_score();
 +
 +-- comment count
 +create function person_aggregates_comment_count()
 +returns trigger language plpgsql
 +as $$
 +begin
 +  IF (TG_OP = 'INSERT') THEN
 +    update person_aggregates 
 +    set comment_count = comment_count + 1 where person_id = NEW.creator_id;
 +  ELSIF (TG_OP = 'DELETE') THEN
 +    update person_aggregates 
 +    set comment_count = comment_count - 1 where person_id = OLD.creator_id;
 +
 +    -- If the comment gets deleted, the score calculation trigger won't fire, 
 +    -- so you need to re-calculate
 +    update person_aggregates ua
 +    set comment_score = cd.score
 +    from (
 +      select u.id,
 +      coalesce(0, sum(cl.score)) as score
 +      -- User join because comments could be empty
 +      from person u 
 +      left join comment c on u.id = c.creator_id
 +      left join comment_like cl on c.id = cl.comment_id
 +      group by u.id
 +    ) cd 
 +    where ua.person_id = OLD.creator_id;
 +  END IF;
 +  return null;
 +end $$;
 +
 +create trigger person_aggregates_comment_count
 +after insert or delete on comment
 +for each row
 +execute procedure person_aggregates_comment_count();
 +
 +-- comment score
 +create function person_aggregates_comment_score()
 +returns trigger language plpgsql
 +as $$
 +begin
 +  IF (TG_OP = 'INSERT') THEN
 +    -- Need to get the post creator, not the voter
 +    update person_aggregates ua
 +    set comment_score = comment_score + NEW.score
 +    from comment c
 +    where ua.person_id = c.creator_id and c.id = NEW.comment_id;
 +  ELSIF (TG_OP = 'DELETE') THEN
 +    update person_aggregates ua
 +    set comment_score = comment_score - OLD.score
 +    from comment c
 +    where ua.person_id = c.creator_id and c.id = OLD.comment_id;
 +  END IF;
 +  return null;
 +end $$;
 +
 +create trigger person_aggregates_comment_score
 +after insert or delete on comment_like
 +for each row
 +execute procedure person_aggregates_comment_score();
 +
 +-- person_mention
 +alter table user_mention rename to person_mention;
 +alter sequence user_mention_id_seq rename to person_mention_id_seq;
 +alter index user_mention_pkey rename to person_mention_pkey;
 +alter index user_mention_recipient_id_comment_id_key rename to person_mention_recipient_id_comment_id_key;
 +alter table person_mention rename constraint user_mention_comment_id_fkey to person_mention_comment_id_fkey;
 +alter table person_mention rename constraint user_mention_recipient_id_fkey to person_mention_recipient_id_fkey;
 +
 +-- user_ban
 +alter table user_ban rename to person_ban;
 +alter sequence user_ban_id_seq rename to person_ban_id_seq;
 +alter index user_ban_pkey rename to person_ban_pkey;
 +alter index user_ban_user_id_key rename to person_ban_person_id_key;
 +alter table person_ban rename column user_id to person_id;
 +alter table person_ban rename constraint user_ban_user_id_fkey to person_ban_person_id_fkey;
 +
 +-- comment_like
 +alter table comment_like rename column user_id to person_id;
 +alter index idx_comment_like_user rename to idx_comment_like_person;
 +alter table comment_like rename constraint comment_like_comment_id_user_id_key to comment_like_comment_id_person_id_key;
 +alter table comment_like rename constraint comment_like_user_id_fkey to comment_like_person_id_fkey;
 +
 +-- comment_saved
 +alter table comment_saved rename column user_id to person_id;
 +alter table comment_saved rename constraint comment_saved_comment_id_user_id_key to comment_saved_comment_id_person_id_key;
 +alter table comment_saved rename constraint comment_saved_user_id_fkey to comment_saved_person_id_fkey;
 +
 +-- community_follower
 +alter table community_follower rename column user_id to person_id;
 +alter table community_follower rename constraint community_follower_community_id_user_id_key to community_follower_community_id_person_id_key;
 +alter table community_follower rename constraint community_follower_user_id_fkey to community_follower_person_id_fkey;
 +
 +-- community_moderator
 +alter table community_moderator rename column user_id to person_id;
 +alter table community_moderator rename constraint community_moderator_community_id_user_id_key to community_moderator_community_id_person_id_key;
 +alter table community_moderator rename constraint community_moderator_user_id_fkey to community_moderator_person_id_fkey;
 +
 +-- community_user_ban
 +alter table community_user_ban rename to community_person_ban;
 +alter sequence community_user_ban_id_seq rename to community_person_ban_id_seq;
 +alter table community_person_ban rename column user_id to person_id;
 +alter table community_person_ban rename constraint community_user_ban_pkey to community_person_ban_pkey; 
 +alter table community_person_ban rename constraint community_user_ban_community_id_fkey to community_person_ban_community_id_fkey;
 +alter table community_person_ban rename constraint community_user_ban_community_id_user_id_key to community_person_ban_community_id_person_id_key;
 +alter table community_person_ban rename constraint community_user_ban_user_id_fkey to community_person_ban_person_id_fkey;
 +
 +-- mod_add
 +alter table mod_add rename column mod_user_id to mod_person_id; 
 +alter table mod_add rename column other_user_id to other_person_id; 
 +alter table mod_add rename constraint mod_add_mod_user_id_fkey to mod_add_mod_person_id_fkey;
 +alter table mod_add rename constraint mod_add_other_user_id_fkey to mod_add_other_person_id_fkey;
 +
 +-- mod_add_community
 +alter table mod_add_community rename column mod_user_id to mod_person_id; 
 +alter table mod_add_community rename column other_user_id to other_person_id; 
 +alter table mod_add_community rename constraint mod_add_community_mod_user_id_fkey to mod_add_community_mod_person_id_fkey;
 +alter table mod_add_community rename constraint mod_add_community_other_user_id_fkey to mod_add_community_other_person_id_fkey;
 +
 +-- mod_ban
 +alter table mod_ban rename column mod_user_id to mod_person_id; 
 +alter table mod_ban rename column other_user_id to other_person_id; 
 +alter table mod_ban rename constraint mod_ban_mod_user_id_fkey to mod_ban_mod_person_id_fkey;
 +alter table mod_ban rename constraint mod_ban_other_user_id_fkey to mod_ban_other_person_id_fkey;
 +
 +-- mod_ban_community
 +alter table mod_ban_from_community rename column mod_user_id to mod_person_id; 
 +alter table mod_ban_from_community rename column other_user_id to other_person_id; 
 +alter table mod_ban_from_community rename constraint mod_ban_from_community_mod_user_id_fkey to mod_ban_from_community_mod_person_id_fkey;
 +alter table mod_ban_from_community rename constraint mod_ban_from_community_other_user_id_fkey to mod_ban_from_community_other_person_id_fkey;
 +
 +-- mod_lock_post
 +alter table mod_lock_post rename column mod_user_id to mod_person_id; 
 +alter table mod_lock_post rename constraint mod_lock_post_mod_user_id_fkey to mod_lock_post_mod_person_id_fkey;
 +
 +-- mod_remove_comment
 +alter table mod_remove_comment rename column mod_user_id to mod_person_id; 
 +alter table mod_remove_comment rename constraint mod_remove_comment_mod_user_id_fkey to mod_remove_comment_mod_person_id_fkey;
 +
 +-- mod_remove_community
 +alter table mod_remove_community rename column mod_user_id to mod_person_id; 
 +alter table mod_remove_community rename constraint mod_remove_community_mod_user_id_fkey to mod_remove_community_mod_person_id_fkey;
 +
 +-- mod_remove_post
 +alter table mod_remove_post rename column mod_user_id to mod_person_id; 
 +alter table mod_remove_post rename constraint mod_remove_post_mod_user_id_fkey to mod_remove_post_mod_person_id_fkey;
 +
 +-- mod_sticky_post
 +alter table mod_sticky_post rename column mod_user_id to mod_person_id; 
 +alter table mod_sticky_post rename constraint mod_sticky_post_mod_user_id_fkey to mod_sticky_post_mod_person_id_fkey;
 +
 +-- password_reset_request
 +delete from password_reset_request;
 +alter table password_reset_request drop column user_id;
 +alter table password_reset_request add column local_user_id integer not null references local_user(id) on update cascade on delete cascade;
 +
 +-- post_like
 +alter table post_like rename column user_id to person_id;
 +alter index idx_post_like_user rename to idx_post_like_person;
 +alter table post_like rename constraint post_like_post_id_user_id_key to post_like_post_id_person_id_key;
 +alter table post_like rename constraint post_like_user_id_fkey to post_like_person_id_fkey;
 +
 +-- post_read
 +alter table post_read rename column user_id to person_id;
 +alter table post_read rename constraint post_read_post_id_user_id_key to post_read_post_id_person_id_key;
 +alter table post_read rename constraint post_read_user_id_fkey to post_read_person_id_fkey;
 +
 +-- post_saved
 +alter table post_saved rename column user_id to person_id;
 +alter table post_saved rename constraint post_saved_post_id_user_id_key to post_saved_post_id_person_id_key;
 +alter table post_saved rename constraint post_saved_user_id_fkey to post_saved_person_id_fkey;
 +
 +-- redo site aggregates trigger
 +create or replace function site_aggregates_activity(i text) returns integer
 +    language plpgsql
 +    as $$
 +declare
 +   count_ integer;
 +begin
 +  select count(*)
 +  into count_
 +  from (
 +    select c.creator_id from comment c
 +    inner join person u on c.creator_id = u.id
 +    where c.published > ('now'::timestamp - i::interval) 
 +    and u.local = true
 +    union
 +    select p.creator_id from post p
 +    inner join person u on p.creator_id = u.id
 +    where p.published > ('now'::timestamp - i::interval)
 +    and u.local = true
 +  ) a;
 +  return count_;
 +end;
 +$$;
diff --cc restore_db.sh
index 0000000000000000000000000000000000000000,0000000000000000000000000000000000000000..318b99099dba889e4c638f5d16eda722a2026787
new file mode 100755 (executable)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,5 @@@
++#!/bin/bash
++
++psql -U lemmy -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"
++cat docker/dev/lemmy_dump_2021-01-29_16_13_40.sqldump | psql -U lemmy
++psql -U lemmy -c "alter user lemmy with password 'password'"
index ea11e32d3be60b9c4f3a8fed2e64555f04b6aad4,f3bc3df53f193149c33d41d440b9ceb59a0eafe4..009b7afb6257841937046f049703dab5bde66393
@@@ -72,7 -72,7 +72,7 @@@ fn user_updates_2020_04_02(conn: &PgCon
        lang: cuser.lang.to_owned(),
        show_avatars: cuser.show_avatars,
        send_notifications_to_email: cuser.send_notifications_to_email,
--      actor_id: Some(generate_apub_endpoint(EndpointType::User, &cuser.name)?),
++      actor_id: Some(generate_apub_endpoint(EndpointType::Person, &cuser.name)?),
        bio: Some(cuser.bio.to_owned()),
        local: cuser.local,
        private_key: Some(keypair.private_key),