refactor admin command visibilities and use statements
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
c6f4b20e17
commit
50ce87161b
30 changed files with 145 additions and 152 deletions
|
@ -1,9 +1,10 @@
|
|||
use conduit::Result;
|
||||
use ruma::{events::room::message::RoomMessageEventContent, EventId, MxcUri};
|
||||
use tracing::{debug, info};
|
||||
|
||||
use crate::{services, Result};
|
||||
use crate::services;
|
||||
|
||||
pub(crate) async fn delete(
|
||||
pub(super) async fn delete(
|
||||
_body: Vec<&str>, mxc: Option<Box<MxcUri>>, event_id: Option<Box<EventId>>,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
if event_id.is_some() && mxc.is_some() {
|
||||
|
@ -137,7 +138,7 @@ pub(crate) async fn delete(
|
|||
))
|
||||
}
|
||||
|
||||
pub(crate) async fn delete_list(body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
||||
pub(super) async fn delete_list(body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
||||
if body.len() < 2 || !body[0].trim().starts_with("```") || body.last().unwrap_or(&"").trim() != "```" {
|
||||
return Ok(RoomMessageEventContent::text_plain(
|
||||
"Expected code block in command body. Add --help for details.",
|
||||
|
@ -164,7 +165,7 @@ pub(crate) async fn delete_list(body: Vec<&str>) -> Result<RoomMessageEventConte
|
|||
)))
|
||||
}
|
||||
|
||||
pub(crate) async fn delete_past_remote_media(
|
||||
pub(super) async fn delete_past_remote_media(
|
||||
_body: Vec<&str>, duration: String, force: bool,
|
||||
) -> Result<RoomMessageEventContent> {
|
||||
let deleted_count = services()
|
|
@ -1,14 +1,14 @@
|
|||
mod commands;
|
||||
|
||||
use clap::Subcommand;
|
||||
use conduit::Result;
|
||||
use ruma::{events::room::message::RoomMessageEventContent, EventId, MxcUri};
|
||||
|
||||
use self::media_commands::{delete, delete_list, delete_past_remote_media};
|
||||
use crate::Result;
|
||||
|
||||
pub(crate) mod media_commands;
|
||||
use self::commands::*;
|
||||
|
||||
#[cfg_attr(test, derive(Debug))]
|
||||
#[derive(Subcommand)]
|
||||
pub(crate) enum MediaCommand {
|
||||
pub(super) enum MediaCommand {
|
||||
/// - Deletes a single media file from our database and on the filesystem
|
||||
/// via a single MXC URL
|
||||
Delete {
|
||||
|
@ -38,7 +38,7 @@ pub(crate) enum MediaCommand {
|
|||
},
|
||||
}
|
||||
|
||||
pub(crate) async fn process(command: MediaCommand, body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
||||
pub(super) async fn process(command: MediaCommand, body: Vec<&str>) -> Result<RoomMessageEventContent> {
|
||||
Ok(match command {
|
||||
MediaCommand::Delete {
|
||||
mxc,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue