summaryrefslogtreecommitdiff
path: root/src/ui/handlers/channel.rs
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2025-06-30 22:00:57 -0400
committerOwen Jacobson <owen@grimoire.ca>2025-07-03 22:43:42 -0400
commita15e3d580124f561864c6a39f1e035eb1b3aab13 (patch)
treeef80f725e7b02547a23b5c29a482fbf3fd188c0d /src/ui/handlers/channel.rs
parent5af4aea1e2f143499529b70f9cf191c6994265c6 (diff)
Rename "channel" to "conversation" within the server.
I've split this from the schema and API changes because, frankly, it's huge. Annoyingly so. There are no semantic changes in this, it's all symbol changes, but there are a _lot_ of them because the term "channel" leaks all over everything in a service whose primary role is managing messages sent to channels (now, conversations). I found a buggy test while working on this! It's not fixed in this commit, because it felt mean to hide a real change in the middle of this much chaff.
Diffstat (limited to 'src/ui/handlers/channel.rs')
-rw-r--r--src/ui/handlers/channel.rs58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/ui/handlers/channel.rs b/src/ui/handlers/channel.rs
deleted file mode 100644
index d3199dd..0000000
--- a/src/ui/handlers/channel.rs
+++ /dev/null
@@ -1,58 +0,0 @@
-use axum::{
- extract::{Path, State},
- response::{self, IntoResponse, Redirect},
-};
-
-use crate::{
- app::App,
- channel::{self, app},
- error::Internal,
- token::extract::Identity,
- ui::{
- assets::{Asset, Assets},
- error::NotFound,
- },
-};
-
-pub async fn handler(
- State(app): State<App>,
- identity: Option<Identity>,
- Path(channel): Path<channel::Id>,
-) -> Result<Asset, Error> {
- let _ = identity.ok_or(Error::NotLoggedIn)?;
- app.channels().get(&channel).await.map_err(Error::from)?;
-
- Assets::index().map_err(Error::Internal)
-}
-
-#[derive(Debug, thiserror::Error)]
-pub enum Error {
- #[error("channel not found")]
- NotFound,
- #[error("not logged in")]
- NotLoggedIn,
- #[error("{0}")]
- Internal(Internal),
-}
-
-impl From<app::Error> for Error {
- fn from(error: app::Error) -> Self {
- match error {
- app::Error::NotFound(_) | app::Error::Deleted(_) => Self::NotFound,
- other => Self::Internal(other.into()),
- }
- }
-}
-
-impl IntoResponse for Error {
- fn into_response(self) -> response::Response {
- match self {
- Self::NotFound => match Assets::index() {
- Ok(asset) => NotFound(asset).into_response(),
- Err(internal) => internal.into_response(),
- },
- Self::NotLoggedIn => Redirect::temporary("/login").into_response(),
- Self::Internal(error) => error.into_response(),
- }
- }
-}