mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-19 12:57:26 +00:00
Revert "Adding strum and simplifying imports."
This reverts commit 15f1671107
.
This commit is contained in:
parent
4b71bc6701
commit
45e312f020
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -2742,7 +2742,6 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_with",
|
"serde_with",
|
||||||
"serial_test",
|
"serial_test",
|
||||||
"strum",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"ts-rs",
|
"ts-rs",
|
||||||
]
|
]
|
||||||
|
|
|
@ -40,7 +40,6 @@ diesel-async = { workspace = true, features = [
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
serde_with = { workspace = true }
|
serde_with = { workspace = true }
|
||||||
ts-rs = { workspace = true, optional = true }
|
ts-rs = { workspace = true, optional = true }
|
||||||
strum = { workspace = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serial_test = { workspace = true }
|
serial_test = { workspace = true }
|
||||||
|
|
|
@ -70,29 +70,38 @@ use lemmy_utils::error::LemmyResult;
|
||||||
impl ModlogCombinedPaginationCursor {
|
impl ModlogCombinedPaginationCursor {
|
||||||
// get cursor for page that starts immediately after the given post
|
// get cursor for page that starts immediately after the given post
|
||||||
pub fn after_post(view: &ModlogCombinedView) -> ModlogCombinedPaginationCursor {
|
pub fn after_post(view: &ModlogCombinedView) -> ModlogCombinedPaginationCursor {
|
||||||
let id = match view {
|
let (prefix, id) = match view {
|
||||||
ModlogCombinedView::AdminAllowInstance(v) => v.admin_allow_instance.id.0,
|
ModlogCombinedView::AdminAllowInstance(v) => {
|
||||||
ModlogCombinedView::AdminBlockInstance(v) => v.admin_block_instance.id.0,
|
("AdminAllowInstance", v.admin_allow_instance.id.0)
|
||||||
ModlogCombinedView::AdminPurgeComment(v) => v.admin_purge_comment.id.0,
|
}
|
||||||
ModlogCombinedView::AdminPurgeCommunity(v) => v.admin_purge_community.id.0,
|
ModlogCombinedView::AdminBlockInstance(v) => {
|
||||||
ModlogCombinedView::AdminPurgePerson(v) => v.admin_purge_person.id.0,
|
("AdminBlockInstance", v.admin_block_instance.id.0)
|
||||||
ModlogCombinedView::AdminPurgePost(v) => v.admin_purge_post.id.0,
|
}
|
||||||
ModlogCombinedView::ModAdd(v) => v.mod_add.id.0,
|
ModlogCombinedView::AdminPurgeComment(v) => ("AdminPurgeComment", v.admin_purge_comment.id.0),
|
||||||
ModlogCombinedView::ModAddCommunity(v) => v.mod_add_community.id.0,
|
ModlogCombinedView::AdminPurgeCommunity(v) => {
|
||||||
ModlogCombinedView::ModBan(v) => v.mod_ban.id.0,
|
("AdminPurgeCommunity", v.admin_purge_community.id.0)
|
||||||
ModlogCombinedView::ModBanFromCommunity(v) => v.mod_ban_from_community.id.0,
|
}
|
||||||
|
ModlogCombinedView::AdminPurgePerson(v) => ("AdminPurgePerson", v.admin_purge_person.id.0),
|
||||||
ModlogCombinedView::ModFeaturePost(v) => v.mod_feature_post.id.0,
|
ModlogCombinedView::AdminPurgePost(v) => ("AdminPurgePost", v.admin_purge_post.id.0),
|
||||||
ModlogCombinedView::ModHideCommunity(v) => v.mod_hide_community.id.0,
|
ModlogCombinedView::ModAdd(v) => ("ModAdd", v.mod_add.id.0),
|
||||||
ModlogCombinedView::ModLockPost(v) => v.mod_lock_post.id.0,
|
ModlogCombinedView::ModAddCommunity(v) => ("ModAddCommunity", v.mod_add_community.id.0),
|
||||||
ModlogCombinedView::ModRemoveComment(v) => v.mod_remove_comment.id.0,
|
ModlogCombinedView::ModBan(v) => ("ModBan", v.mod_ban.id.0),
|
||||||
ModlogCombinedView::ModRemoveCommunity(v) => v.mod_remove_community.id.0,
|
ModlogCombinedView::ModBanFromCommunity(v) => {
|
||||||
|
("ModBanFromCommunity", v.mod_ban_from_community.id.0)
|
||||||
ModlogCombinedView::ModRemovePost(v) => v.mod_remove_post.id.0,
|
}
|
||||||
ModlogCombinedView::ModTransferCommunity(v) => v.mod_transfer_community.id.0,
|
ModlogCombinedView::ModFeaturePost(v) => ("ModFeaturePost", v.mod_feature_post.id.0),
|
||||||
|
ModlogCombinedView::ModHideCommunity(v) => ("ModHideCommunity", v.mod_hide_community.id.0),
|
||||||
|
ModlogCombinedView::ModLockPost(v) => ("ModLockPost", v.mod_lock_post.id.0),
|
||||||
|
ModlogCombinedView::ModRemoveComment(v) => ("ModRemoveComment", v.mod_remove_comment.id.0),
|
||||||
|
ModlogCombinedView::ModRemoveCommunity(v) => {
|
||||||
|
("ModRemoveCommunity", v.mod_remove_community.id.0)
|
||||||
|
}
|
||||||
|
ModlogCombinedView::ModRemovePost(v) => ("ModRemovePost", v.mod_remove_post.id.0),
|
||||||
|
ModlogCombinedView::ModTransferCommunity(v) => {
|
||||||
|
("ModTransferCommunity", v.mod_transfer_community.id.0)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// hex encoding to prevent ossification
|
// hex encoding to prevent ossification
|
||||||
let prefix = view.as_ref();
|
|
||||||
ModlogCombinedPaginationCursor(format!("{prefix}-{id:x}"))
|
ModlogCombinedPaginationCursor(format!("{prefix}-{id:x}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ use lemmy_db_schema::source::{
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::skip_serializing_none;
|
use serde_with::skip_serializing_none;
|
||||||
use strum::AsRefStr;
|
|
||||||
#[cfg(feature = "full")]
|
#[cfg(feature = "full")]
|
||||||
use ts_rs::TS;
|
use ts_rs::TS;
|
||||||
|
|
||||||
|
@ -307,7 +306,7 @@ pub struct ModlogCombinedViewInternal {
|
||||||
pub comment: Option<Comment>,
|
pub comment: Option<Comment>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(AsRefStr, Debug, PartialEq, Serialize, Deserialize, Clone)]
|
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(feature = "full", derive(TS))]
|
#[cfg_attr(feature = "full", derive(TS))]
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
// Use serde's internal tagging, to work easier with javascript libraries
|
// Use serde's internal tagging, to work easier with javascript libraries
|
||||||
|
|
Loading…
Reference in a new issue