summaryrefslogtreecommitdiff
path: root/src/message
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-10-22 23:25:24 -0400
committerOwen Jacobson <owen@grimoire.ca>2024-10-22 23:25:24 -0400
commit01f9f3549c76702fd56e58d44c5180fecddb4bfa (patch)
treee7a64e70975a8b50bc442d28c17161b82c42c63a /src/message
parent214a9e6c1fd729fc2c49eb2a5d41b5651ff5bc61 (diff)
Sort out the naming of the various parts of an identity.
* A `cookie::Identity` (`IdentityCookie`) is a specialized CookieJar for working with identities. * An `Identity` is a token/login pair. I hope for this to be a bit more legible. In service of this, `Login` is no longer extractable. You have to get an identity.
Diffstat (limited to 'src/message')
-rw-r--r--src/message/app.rs2
-rw-r--r--src/message/routes/message.rs10
2 files changed, 5 insertions, 7 deletions
diff --git a/src/message/app.rs b/src/message/app.rs
index 852b958..eed6ba4 100644
--- a/src/message/app.rs
+++ b/src/message/app.rs
@@ -136,8 +136,6 @@ impl From<channel::repo::LoadError> for SendError {
#[derive(Debug, thiserror::Error)]
pub enum DeleteError {
- #[error("channel {0} not found")]
- ChannelNotFound(channel::Id),
#[error("message {0} not found")]
NotFound(Id),
#[error("message {0} deleted")]
diff --git a/src/message/routes/message.rs b/src/message/routes/message.rs
index fbef35a..f83cb39 100644
--- a/src/message/routes/message.rs
+++ b/src/message/routes/message.rs
@@ -9,15 +9,15 @@ pub mod delete {
app::App,
clock::RequestedAt,
error::{Internal, NotFound},
- login::Login,
message::{self, app::DeleteError},
+ token::extract::Identity,
};
pub async fn handler(
State(app): State<App>,
Path(message): Path<message::Id>,
RequestedAt(deleted_at): RequestedAt,
- _: Login,
+ _: Identity,
) -> Result<StatusCode, Error> {
app.messages().delete(&message, &deleted_at).await?;
@@ -33,9 +33,9 @@ pub mod delete {
let Self(error) = self;
#[allow(clippy::match_wildcard_for_single_variants)]
match error {
- DeleteError::ChannelNotFound(_)
- | DeleteError::NotFound(_)
- | DeleteError::Deleted(_) => NotFound(error).into_response(),
+ DeleteError::NotFound(_) | DeleteError::Deleted(_) => {
+ NotFound(error).into_response()
+ }
other => Internal::from(other).into_response(),
}
}