pub enum ContractUserModerationAction {
Ban {
identity_id: Identifier,
reason: ContractModerationReason,
},
Unban {
identity_id: Identifier,
},
Suspend {
identity_id: Identifier,
until: TimestampMillis,
reason: ContractModerationReason,
},
Unsuspend {
identity_id: Identifier,
},
Warn {
identity_id: Identifier,
reason: ContractModerationReason,
},
ClearWarnings {
identity_id: Identifier,
},
DeleteDocument {
document_type_name: String,
document_id: Identifier,
reason: ContractModerationReason,
},
RestoreDocument {
document_type_name: String,
document: BinaryData,
},
ChangeDocumentFields {
document_type_name: String,
document_id: Identifier,
fields: BTreeMap<String, Value>,
reason: ContractModerationReason,
},
DeleteSettledDocument {
document_type_name: String,
document_id: Identifier,
reason: ContractModerationReason,
},
ApproveTeamAction {
action_id: Identifier,
},
}Expand description
What the moderator does on the contract: to one identity, or to one document.
Variants§
Ban
Puts the identity on the banlist. Removes a suspension it may carry.
Unban
Takes the identity off the banlist.
Fields
identity_id: IdentifierSuspend
Puts the identity on the suspension list until until (block time, milliseconds),
replacing a suspension it already carries.
Fields
identity_id: Identifieruntil: TimestampMillisreason: ContractModerationReasonWhy, stored with the suspension list entry.
Unsuspend
Takes the identity off the suspension list, lapsed or not.
Fields
identity_id: IdentifierWarn
Adds a warning, with the block time and reason, to the identity’s entry on the
warning list, which bars it from nothing. Refused once the entry holds
SystemLimits::max_contract_warnings_per_identity warnings.
ClearWarnings
Takes the identity off the warning list: every warning it carries goes.
Fields
identity_id: IdentifierDeleteDocument
Deletes a document of a document type that sets moderatorAbilities.delete, whoever
owns it, except the contract owner and the moderators. The document’s owner gets no
storage refund, and a ContractDocumentRemoval stays under the contract.
RestoreDocument
Brings back a document a moderator deleted, as it was: the document serialized under
its document type (Document::serialize), which must hash to what its removal record
holds, within SystemLimits::contract_document_restore_window_ms of the removal. The
document’s id, owner and content are all inside the bytes. The record stays, marked
restored; the signer pays for the document’s storage, whose refund stays the owner’s.
Fields
document: BinaryDataThe document as it was serialized when it was removed.
ChangeDocumentFields
Sets or removes fields of a document that only moderators write, the ones its document
type lists under moderatorAbilities.changeFields, whoever owns it. Every other
property, $updatedAt among them, stays as it was; $revision goes up by one, so a
replace its owner built on the earlier revision is refused. The signer pays for the
bytes the change adds, and a refund of the document’s storage stays the owner’s.
Fields
document_id: Identifierfields: BTreeMap<String, Value>Each field’s new value, by its top-level property name; null removes the field.
Read from an object or JSON in its canonical form
(ContractUserModerationAction::canonical_field_value), so a transition built by
a client and read back signs the same bytes.
reason: ContractModerationReasonWhy, checked against a seated team’s proposal like every other reason.
DeleteSettledDocument
Proposes the deletion of a settled document: one of a document type that says who must
approve it (moderatorAbilities.deleteSettled), past the window its moderators delete
in alone (moderatorAbilities.deleteWithin). Only a member of the contract’s seated
team proposes, and the proposal is its approval. It is kept under the contract as a
team action, by an id the proposer’s client computes
(ContractTeamAction::settled_deletion_action_id),
which the other members approve with Self::ApproveTeamAction. The approval that
meets the rule, the leader among the approvals when the rule says so, deletes the
document as a DeleteDocument would; a rule the proposer meets alone deletes it at once.
Fields
document_id: Identifierreason: ContractModerationReasonWhy: stored with the proposal and with the removal record the deletion leaves.
ApproveTeamAction
Approves a team action another member of the contract’s seated team proposed, by its id: what it does and why are the proposal’s.
Fields
action_id: IdentifierImplementations§
Source§impl ContractUserModerationAction
impl ContractUserModerationAction
Sourcepub fn canonical_field_value(value: Value) -> Value
pub fn canonical_field_value(value: Value) -> Value
A field value in the one form its content has, the form clients build a change’s fields
in: an integer as a U64, or an I64 when negative (U128 and I128 beyond them), 32
bytes as an Identifier and any other binary value as Bytes, maps and arrays
recursively. The signed bytes carry the variant, which an object or JSON form loses (a
JavaScript bigint reads back as the signed width, an identifier as plain bytes), so the
fields are read back in this form and built in it.
Sourcepub fn identity_id(&self) -> Option<Identifier>
pub fn identity_id(&self) -> Option<Identifier>
The identity the action targets. None for a document deletion: it names a document,
and whose it is is only known once the document is read.
Sourcepub fn document(&self) -> Option<(&str, Identifier)>
pub fn document(&self) -> Option<(&str, Identifier)>
The document a deletion targets, as its document type name and its id. None for an
action on an identity, for a field change (Self::changed_document), for the approval
of a settled document’s deletion (Self::settled_document), and for a restore, which
carries the document itself: its id is only known once the bytes are decoded under the
document type.
Sourcepub fn settled_document(
&self,
) -> Option<(&str, Identifier, &ContractModerationReason)>
pub fn settled_document( &self, ) -> Option<(&str, Identifier, &ContractModerationReason)>
The settled document whose deletion a proposal targets, as its document type name and
its id, with the reason. None for every other action.
Sourcepub fn approved_team_action(&self) -> Option<Identifier>
pub fn approved_team_action(&self) -> Option<Identifier>
The team action an approval approves, by its id. None for every other action.
Sourcepub fn restored_document(&self) -> Option<(&str, &[u8])>
pub fn restored_document(&self) -> Option<(&str, &[u8])>
The document a restore brings back, as its document type name and its serialized
bytes. None for every other action.
Sourcepub fn changed_document(
&self,
) -> Option<(&str, Identifier, &BTreeMap<String, Value>)>
pub fn changed_document( &self, ) -> Option<(&str, Identifier, &BTreeMap<String, Value>)>
The document a field change targets, as its document type name and its id, with the
fields it sets (a null value removes one). None for every other action.
Sourcepub fn document_type_name(&self) -> Option<&str>
pub fn document_type_name(&self) -> Option<&str>
The document type name a deletion, a restore, a field change or the approval of a
settled document’s deletion names, None for an action on an identity.
Sourcepub fn until(&self) -> Option<TimestampMillis>
pub fn until(&self) -> Option<TimestampMillis>
The suspension end for a suspend, None otherwise.
Sourcepub fn reason(&self) -> Option<&ContractModerationReason>
pub fn reason(&self) -> Option<&ContractModerationReason>
The reason a ban, a suspend, a warn, a document deletion, a field change or the approval
of a settled document’s deletion carries, None for an action that takes an identity
off a list, and for a restore.
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for ContractUserModerationAction
impl<'__de, __Context> BorrowDecode<'__de, __Context> for ContractUserModerationAction
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl<'__de, __Context> BorrowDecodeUntrusted<'__de, __Context> for ContractUserModerationAction
impl<'__de, __Context> BorrowDecodeUntrusted<'__de, __Context> for ContractUserModerationAction
Source§fn borrow_decode_untrusted<__D: BorrowUntrustedDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode_untrusted<__D: BorrowUntrustedDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl Clone for ContractUserModerationAction
impl Clone for ContractUserModerationAction
Source§fn clone(&self) -> ContractUserModerationAction
fn clone(&self) -> ContractUserModerationAction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContractUserModerationAction
impl Debug for ContractUserModerationAction
Source§impl<__Context> Decode<__Context> for ContractUserModerationAction
impl<__Context> Decode<__Context> for ContractUserModerationAction
Source§impl<__Context> DecodeUntrusted<__Context> for ContractUserModerationAction
impl<__Context> DecodeUntrusted<__Context> for ContractUserModerationAction
Source§fn decode_untrusted<__D: UntrustedDecoder<Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn decode_untrusted<__D: UntrustedDecoder<Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Source§impl<'de> Deserialize<'de> for ContractUserModerationAction
impl<'de> Deserialize<'de> for ContractUserModerationAction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl JsonSafeFields for ContractUserModerationAction
json-conversion only.impl StructuralPartialEq for ContractUserModerationAction
Auto Trait Implementations§
impl Freeze for ContractUserModerationAction
impl RefUnwindSafe for ContractUserModerationAction
impl Send for ContractUserModerationAction
impl Sync for ContractUserModerationAction
impl Unpin for ContractUserModerationAction
impl UnsafeUnpin for ContractUserModerationAction
impl UnwindSafe for ContractUserModerationAction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> CostsExt for T
impl<T> CostsExt for T
§fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
CostContext object with provided costs.§fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
CostContext object with costs computed using the
value getting wrapped.§impl<'de, T> DefaultBorrowDecode<'de> for Twhere
T: BorrowDecode<'de, ()>,
impl<'de, T> DefaultBorrowDecode<'de> for Twhere
T: BorrowDecode<'de, ()>,
fn borrow_decode<D>(decoder: &mut D) -> Result<Self, DecodeError>
§impl<T> DefaultDecode for T
impl<T> DefaultDecode for T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
impl<T, U> IntoOnNetwork<U> for Twhere
U: FromOnNetwork<T>,
§fn into_on_network(self, network: Network) -> U
fn into_on_network(self, network: Network) -> U
Calls U::from_on_network(self).
§impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
impl<T, U> IntoPlatformVersioned<U> for Twhere
U: FromPlatformVersioned<T>,
§fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
fn into_platform_versioned(self, platform_version: &PlatformVersion) -> U
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.