mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 21:47:02 +00:00
20 lines
457 B
Rust
20 lines
457 B
Rust
use crate::database::*;
|
|
use crate::util::result::{Error, Result};
|
|
|
|
use rocket_contrib::json::JsonValue;
|
|
|
|
#[get("/<target>")]
|
|
pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
|
|
let target = target.fetch_channel().await?;
|
|
|
|
let perm = permissions::PermissionCalculator::new(&user)
|
|
.with_channel(&target)
|
|
.for_channel()
|
|
.await?;
|
|
if !perm.get_view() {
|
|
Err(Error::LabelMe)?
|
|
}
|
|
|
|
Ok(json!(target))
|
|
}
|