X-Git-Url: http://these/git/?a=blobdiff_plain;f=crates%2Fdb_views_moderator%2Fsrc%2Fmod_remove_comment_view.rs;h=c0b58845683c25e125ede8173946d7a274a7e53b;hb=c9f140742925d6da20103124b49f2b58a35fc2b8;hp=2ee230d112afe7a959f0ad4f64a574a015ffba23;hpb=4e6409f325bca5b2727b19c24d77ffa2b59109b1;p=lemmy.git diff --git a/crates/db_views_moderator/src/mod_remove_comment_view.rs b/crates/db_views_moderator/src/mod_remove_comment_view.rs index 2ee230d1..c0b58845 100644 --- a/crates/db_views_moderator/src/mod_remove_comment_view.rs +++ b/crates/db_views_moderator/src/mod_remove_comment_view.rs @@ -2,12 +2,12 @@ use crate::structs::{ModRemoveCommentView, ModlogListParams}; use diesel::{result::Error, *}; use lemmy_db_schema::{ newtypes::PersonId, - schema::{comment, community, mod_remove_comment, person, person_alias_1, post}, + schema::{comment, community, mod_remove_comment, person, post}, source::{ comment::Comment, community::{Community, CommunitySafe}, moderator::ModRemoveComment, - person::{Person, PersonAlias1, PersonSafe, PersonSafeAlias1}, + person::{Person, PersonSafe}, post::Post, }, traits::{ToSafe, ViewToVec}, @@ -18,13 +18,14 @@ type ModRemoveCommentViewTuple = ( ModRemoveComment, Option, Comment, - PersonSafeAlias1, + PersonSafe, Post, CommunitySafe, ); impl ModRemoveCommentView { - pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result, Error> { + pub fn list(conn: &mut PgConnection, params: ModlogListParams) -> Result, Error> { + let person_alias_1 = diesel::alias!(lemmy_db_schema::schema::person as person1); let admin_person_id_join = params.mod_person_id.unwrap_or(PersonId(-1)); let show_mod_names = !params.hide_modlog_names; let show_mod_names_expr = show_mod_names.as_sql::(); @@ -35,14 +36,14 @@ impl ModRemoveCommentView { let mut query = mod_remove_comment::table .left_join(person::table.on(admin_names_join)) .inner_join(comment::table) - .inner_join(person_alias_1::table.on(comment::creator_id.eq(person_alias_1::id))) + .inner_join(person_alias_1.on(comment::creator_id.eq(person_alias_1.field(person::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, Person::safe_columns_tuple().nullable(), comment::all_columns, - PersonAlias1::safe_columns_tuple(), + person_alias_1.fields(Person::safe_columns_tuple()), post::all_columns, Community::safe_columns_tuple(), )) @@ -57,7 +58,7 @@ impl ModRemoveCommentView { }; if let Some(other_person_id) = params.other_person_id { - query = query.filter(person_alias_1::id.eq(other_person_id)); + query = query.filter(person_alias_1.field(person::id).eq(other_person_id)); }; let (limit, offset) = limit_and_offset(params.page, params.limit)?;