Add route which wasn't declared, fix send message.

This commit is contained in:
Paul Makles
2020-02-18 11:26:08 +00:00
parent 35623452aa
commit ee5c4fc3e3
2 changed files with 10 additions and 1 deletions

View File

@@ -155,6 +155,15 @@ pub fn send_message(user: User, target: Channel, message: Json<SendMessage>) ->
None
) {
Ok(_) => {
if target.channel_type == ChannelType::DM as u8 {
let col = database::get_collection("channels");
col.update_one(
doc! { "_id": target.id.clone() },
doc! { "active": true },
None
).unwrap();
}
websocket::queue_message(
get_recipients(&target),
json!({

View File

@@ -10,5 +10,5 @@ pub fn mount(rocket: Rocket) -> Rocket {
.mount("/api", routes![ root::root ])
.mount("/api/account", routes![ account::create, account::verify_email, account::resend_email, account::login, account::token ])
.mount("/api/users", routes![ user::me, user::user, user::lookup, user::dms, user::dm, user::get_friends, user::get_friend, user::add_friend, user::remove_friend ])
.mount("/api/channels", routes![ channel::channel, channel::delete, channel::messages, channel::send_message, channel::edit_message, channel::delete_message ])
.mount("/api/channels", routes![ channel::channel, channel::delete, channel::messages, channel::get_message, channel::send_message, channel::edit_message, channel::delete_message ])
}