From da51a37b49c29fdf2d898946c5f90f26821a6a46 Mon Sep 17 00:00:00 2001 From: Erin Nova Date: Mon, 26 Jul 2021 15:00:35 -0400 Subject: [PATCH] Add user pronouns to message body, fixup changelog --- CHANGELOG.md | 18 +++++++++++------- Cargo.lock | 38 +++++++++++++++++++------------------- Cargo.toml | 2 +- src/chat.rs | 1 + src/message.rs | 1 + 5 files changed, 33 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac16f98..0ae3ca3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ - `/api/register` & `/api/login` now use JSON data - Changing user info now uses Enum (Name, Pin, or Pronouns) +### 0.6.1 +- Add basic support for different user roles & moderator commands +- Any user names "admin" will be made into an Admin user +- User pronouns are stored in message body now + +## 0.5.0 +- Most actions should now fail on a NULL token +- Cookie should now expire after a week +- Use sled database instead of json file to store users +- Now use `GET /api/token/` to validate a users session token + ### 0.5.2 - When changing a username, it now deletes the previous user instead of creating a new one - Database functions should now use some error handling @@ -13,13 +24,6 @@ - Add basic support for different message types - Messages now use unix timestamps - Backend finds timestamp - -## 0.5.0 -- Most actions should now fail on a NULL token -- Cookie should now expire after a week -- Use sled database instead of json file to store users -- Now use `GET /api/token/` to validate a users session token - ## 0.4.0 - Serve frontend code - Set cookie for token diff --git a/Cargo.lock b/Cargo.lock index 2b12326..7187173 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -576,6 +576,25 @@ version = "0.2.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" +[[package]] +name = "lila-chat" +version = "0.6.0" +dependencies = [ + "bincode", + "chrono", + "env_logger", + "log 0.4.14", + "once_cell", + "random-string", + "rocket", + "rocket_contrib", + "serde", + "serde_json", + "sha1", + "sled", + "uuid", +] + [[package]] name = "lock_api" version = "0.4.4" @@ -805,25 +824,6 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pogchat" -version = "0.6.0" -dependencies = [ - "bincode", - "chrono", - "env_logger", - "log 0.4.14", - "once_cell", - "random-string", - "rocket", - "rocket_contrib", - "serde", - "serde_json", - "sha1", - "sled", - "uuid", -] - [[package]] name = "polyval" version = "0.4.5" diff --git a/Cargo.toml b/Cargo.toml index 5b8f25f..f6e18eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lila-chat" description = "A basic chat server written in rust" -version = "0.6.0" +version = "0.6.1" documentation = "https://git.lavender.software/erin/lila-chat/wiki" repository = "https://git.lavender.software/erin/lila-chat/" license = "CNPLv6+" diff --git a/src/chat.rs b/src/chat.rs index 5d53524..40d056e 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -42,6 +42,7 @@ fn create_message(message: Json, user: &User) -> JsonValue { id: Uuid::new_v4(), event_type, user: user.name.to_lowercase().to_owned(), + pronouns: user.pronouns.to_lowercase().to_owned(), body: message.body.to_string(), created_at: Utc::now(), }; diff --git a/src/message.rs b/src/message.rs index a2bad5e..6de4ae1 100644 --- a/src/message.rs +++ b/src/message.rs @@ -21,6 +21,7 @@ pub struct Message { pub id: Uuid, pub event_type: MessageType, pub user: String, + pub pronouns: String, pub body: String, pub created_at: DateTime, }