mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-09 17:55:10 +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 a new issue