Move legacy Filter type to mod v1; publish fields
This commit is contained in:
parent
acef484b73
commit
6ee2f277d8
|
@ -1,16 +1,29 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use time::{serde::iso8601, OffsetDateTime};
|
|
||||||
|
|
||||||
/// Represents a single Filter
|
mod v1 {
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
pub use super::FilterContext;
|
||||||
pub struct Filter {
|
use serde::{Deserialize, Serialize};
|
||||||
id: String,
|
use time::{serde::iso8601, OffsetDateTime};
|
||||||
phrase: String,
|
|
||||||
context: Vec<FilterContext>,
|
/// Represents a single Filter
|
||||||
#[serde(with = "iso8601::option")]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
expires_at: Option<OffsetDateTime>,
|
pub struct Filter {
|
||||||
irreversible: bool,
|
/// The ID of the Filter in the database.
|
||||||
whole_word: bool,
|
pub id: String,
|
||||||
|
/// The text to be filtered.
|
||||||
|
pub phrase: String,
|
||||||
|
/// The contexts in which the filter should be applied.
|
||||||
|
pub context: Vec<FilterContext>,
|
||||||
|
/// When the filter should no longer be applied.
|
||||||
|
///
|
||||||
|
/// `None` indicates that the filter does not expire.
|
||||||
|
#[serde(with = "iso8601::option")]
|
||||||
|
pub expires_at: Option<OffsetDateTime>,
|
||||||
|
/// Should matching entities in home and notifications be dropped by the server?
|
||||||
|
pub irreversible: bool,
|
||||||
|
/// Should the filter consider word boundaries?
|
||||||
|
pub whole_word: bool,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents the various types of Filter contexts
|
/// Represents the various types of Filter contexts
|
||||||
|
|
Loading…
Reference in New Issue