mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 20:31:19 +00:00
When receiving delete reason as empty string, change to none
This commit is contained in:
parent
2d346a1487
commit
12a55ce63f
1 changed files with 8 additions and 2 deletions
|
@ -94,10 +94,17 @@ impl ActivityHandler for Delete {
|
||||||
request_counter: &mut i32,
|
request_counter: &mut i32,
|
||||||
) -> Result<(), LemmyError> {
|
) -> Result<(), LemmyError> {
|
||||||
if let Some(reason) = self.summary {
|
if let Some(reason) = self.summary {
|
||||||
|
// We set reason to empty string if it doesn't exist, to distinguish between delete and
|
||||||
|
// remove. Here we change it back to option, so we don't write it to db.
|
||||||
|
let reason = if reason.is_empty() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(reason)
|
||||||
|
};
|
||||||
receive_remove_action(
|
receive_remove_action(
|
||||||
&self.common.actor,
|
&self.common.actor,
|
||||||
&self.object,
|
&self.object,
|
||||||
Some(reason),
|
reason,
|
||||||
context,
|
context,
|
||||||
request_counter,
|
request_counter,
|
||||||
)
|
)
|
||||||
|
@ -152,7 +159,6 @@ impl Delete {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: reason is optional for compat with v0.11, make it mandatory after removing the migration
|
|
||||||
pub(in crate::activities) async fn receive_remove_action(
|
pub(in crate::activities) async fn receive_remove_action(
|
||||||
actor: &Url,
|
actor: &Url,
|
||||||
object: &Url,
|
object: &Url,
|
||||||
|
|
Loading…
Reference in a new issue