mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-26 15:29:21 +00:00
Add new TODOs
This commit is contained in:
parent
4a968b3d6f
commit
be858dc9cc
@ -330,6 +330,8 @@ impl Actor for WsSession {
|
||||
}
|
||||
|
||||
fn stopping(&mut self, ctx: &mut Self::Context) -> Running {
|
||||
// TODO : send an event (user_ws_closed)
|
||||
|
||||
remove_connection(ctx.address());
|
||||
Running::Stop
|
||||
}
|
||||
|
@ -107,7 +107,8 @@ pub fn exists_mail(mail: &str) -> ResultBoxError<bool> {
|
||||
|
||||
/// Destroy a given user login tokens
|
||||
pub fn destroy_login_tokens(id: &UserID, client: &APIClient) -> ResultBoxError<()> {
|
||||
user_ws_controller::disconnect_user_from_client(id, client)?;
|
||||
|
||||
// TODO : send an event (destroyed_login_tokens)
|
||||
|
||||
database::delete(DeleteQuery::new(USER_ACCESS_TOKENS_TABLE)
|
||||
.cond_u32("service_id", client.id)
|
||||
|
@ -23,6 +23,8 @@ pub fn create(c: &Comment) -> ResultBoxError<u64> {
|
||||
.insert()?
|
||||
.ok_or(ExecError::new("No ID returned after comment creation!"))?;
|
||||
|
||||
// TODO : emit an event
|
||||
|
||||
Ok(comment_id)
|
||||
}
|
||||
|
||||
@ -67,7 +69,11 @@ pub fn edit(comment_id: u64, new_content: &str) -> ResultBoxError {
|
||||
database::UpdateInfo::new(COMMENTS_TABLE)
|
||||
.cond_u64("ID", comment_id)
|
||||
.set_str("commentaire", new_content)
|
||||
.exec()
|
||||
.exec()?;
|
||||
|
||||
// TODO : emit an event
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete a single comment
|
||||
@ -88,6 +94,8 @@ pub fn delete(c: &Comment) -> ResultBoxError {
|
||||
.cond_u64("ID", c.id)
|
||||
.exec()?;
|
||||
|
||||
// TODO : emit an event
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -322,6 +322,9 @@ pub fn send_message(msg: &NewConversationMessage) -> ResultBoxError<()> {
|
||||
.set_legacy_bool("saw_last_message", false)
|
||||
.exec()?;
|
||||
|
||||
// TODO : send an event (updated_number_unread_conversations)
|
||||
// TODO : send an event (sent_conversation_message)
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -330,7 +333,11 @@ pub fn update_message_content(msg_id: u64, new_content: &str) -> ResultBoxError<
|
||||
database::UpdateInfo::new(CONV_MESSAGES_TABLE)
|
||||
.cond_u64("id", msg_id)
|
||||
.set_str("message", new_content)
|
||||
.exec()
|
||||
.exec()?;
|
||||
|
||||
// TODO : send an event (conv_message_updated)
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Remove a message from a conversation
|
||||
@ -348,6 +355,8 @@ pub fn delete_message(msg: &ConversationMessage) -> ResultBoxError<()> {
|
||||
.cond_u64("ID", msg.id)
|
||||
.exec()?;
|
||||
|
||||
// TODO : send en event (conv_message_deleted)
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -395,7 +404,11 @@ pub fn mark_user_seen(conv_id: u64, user_id: &UserID) -> ResultBoxError<()> {
|
||||
.cond_user_id("user_id", user_id)
|
||||
.cond_legacy_bool("saw_last_message", false)
|
||||
.set_legacy_bool("saw_last_message", true)
|
||||
.exec()
|
||||
.exec()?;
|
||||
|
||||
// TODO : push an event (updated_number_unread_conversations)
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Remove a user from a conversation
|
||||
|
@ -222,7 +222,7 @@ fn create(n: &PartialNotification) -> ResultBoxError {
|
||||
.add_values(notif_to_db(n, true))
|
||||
.insert_drop_result()?;
|
||||
|
||||
// TODO : WebSocket : trigger notify system
|
||||
// TODO : Send a notification (updated_number_conversations)
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -232,11 +232,14 @@ fn create(n: &PartialNotification) -> ResultBoxError {
|
||||
pub fn delete(notification: &PartialNotification) -> ResultBoxError {
|
||||
let conditions = notif_to_db(notification, false);
|
||||
|
||||
|
||||
// Delete the notifications
|
||||
database::DeleteQuery::new(NOTIFICATIONS_TABLE)
|
||||
.add_conditions(conditions)
|
||||
.exec()
|
||||
.exec()?;
|
||||
|
||||
// TODO : Send a notification (updated_number_conversations)
|
||||
|
||||
OK(())
|
||||
}
|
||||
|
||||
/// Delete all the notifications of a given user
|
||||
|
Loading…
Reference in New Issue
Block a user