mirror of
https://github.com/LemmyNet/lemmy
synced 2024-11-17 09:25:50 +00:00
* Dont allow blocking local instance (fixes #4241) * use localuserview
This commit is contained in:
parent
cef3f220a2
commit
e317947b75
@ -19,6 +19,10 @@ pub async fn block_instance(
|
||||
) -> Result<Json<BlockInstanceResponse>, LemmyError> {
|
||||
let instance_id = data.instance_id;
|
||||
let person_id = local_user_view.person.id;
|
||||
if local_user_view.person.instance_id == instance_id {
|
||||
return Err(LemmyErrorType::CantBlockLocalInstance)?;
|
||||
}
|
||||
|
||||
let instance_block_form = InstanceBlockForm {
|
||||
person_id,
|
||||
instance_id,
|
||||
|
@ -227,6 +227,7 @@ pub enum LemmyErrorType {
|
||||
BanExpirationInPast,
|
||||
InvalidUnixTime,
|
||||
InvalidBotAction,
|
||||
CantBlockLocalInstance,
|
||||
Unknown(String),
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user