mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 01:41:01 +00:00
* Dont allow blocking local instance (fixes #4241) * use localuserview
This commit is contained in:
parent
cef3f220a2
commit
e317947b75
2 changed files with 5 additions and 0 deletions
|
@ -19,6 +19,10 @@ pub async fn block_instance(
|
||||||
) -> Result<Json<BlockInstanceResponse>, LemmyError> {
|
) -> Result<Json<BlockInstanceResponse>, LemmyError> {
|
||||||
let instance_id = data.instance_id;
|
let instance_id = data.instance_id;
|
||||||
let person_id = local_user_view.person.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 {
|
let instance_block_form = InstanceBlockForm {
|
||||||
person_id,
|
person_id,
|
||||||
instance_id,
|
instance_id,
|
||||||
|
|
|
@ -227,6 +227,7 @@ pub enum LemmyErrorType {
|
||||||
BanExpirationInPast,
|
BanExpirationInPast,
|
||||||
InvalidUnixTime,
|
InvalidUnixTime,
|
||||||
InvalidBotAction,
|
InvalidBotAction,
|
||||||
|
CantBlockLocalInstance,
|
||||||
Unknown(String),
|
Unknown(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue