1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

Start to push notifications

This commit is contained in:
2021-01-23 14:52:05 +01:00
parent 0e80564f85
commit 4d6ff8fef3
7 changed files with 213 additions and 3 deletions

View File

@ -8,8 +8,9 @@ use crate::constants::PATH_COMMENTS_IMAGES;
use crate::controllers::routes::RequestResult;
use crate::data::comment::Comment;
use crate::data::http_request_handler::HttpRequestHandler;
use crate::data::notification::NotifEventType;
use crate::data::post::PostAccessLevel;
use crate::helpers::{comments_helper, posts_helper};
use crate::helpers::{comments_helper, notifications_helper, posts_helper};
use crate::utils::date_utils::time;
use crate::utils::string_utils::remove_html_nodes;
@ -45,7 +46,9 @@ pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
let comment_id = comments_helper::create(&comment)?;
// TODO : Create notifications
// Create notifications
notifications_helper::create_post_notification(&r.user_id()?, post.id, NotifEventType::COMMENT_CREATED)?;
// TODO : Remove notifications targeting current user about the post
r.set_response(ResCreateComment::new(comment_id))