- pub fn list(
- conn: &PgConnection,
- admin_person_id: Option<PersonId>,
- page: Option<i64>,
- limit: Option<i64>,
- ) -> Result<Vec<Self>, Error> {
+ pub fn list(conn: &PgConnection, params: ModlogListParams) -> Result<Vec<Self>, Error> {
+ 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::<diesel::sql_types::Bool>();
+
+ let admin_names_join = admin_purge_comment::admin_person_id
+ .eq(person::id)
+ .and(show_mod_names_expr.or(person::id.eq(admin_person_id_join)));
+