mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 12:09:21 +00:00
Send request on the server to mark a notification as seen.
This commit is contained in:
parent
53de79040a
commit
85eb0d9463
@ -38,4 +38,24 @@ ComunicWeb.components.notifications.interface = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Mark a notification as seen
|
||||
*
|
||||
* @param {number} id The ID of the notification to mark as seen
|
||||
* @param {boolean} delete_similar Specify if the similar notifications
|
||||
* associated to the user have to be delete too
|
||||
* @param {function} callback (Optionnal)
|
||||
*/
|
||||
mark_seen: function(id, delete_similar, callback){
|
||||
|
||||
//Perform an API request
|
||||
var apiURI = "notifications/mark_seen";
|
||||
var params = {
|
||||
notifID: id,
|
||||
delete_similar: delete_similar
|
||||
};
|
||||
|
||||
ComunicWeb.common.api.makeAPIrequest(apiURI, params, false, callback);
|
||||
|
||||
},
|
||||
}
|
@ -53,8 +53,13 @@ ComunicWeb.components.notifications.ui = {
|
||||
//Create notification action
|
||||
var action = function(){
|
||||
|
||||
//Mark the notification as seen
|
||||
ComunicWeb.components.notifications.interface.mark_seen(data.id, true);
|
||||
|
||||
//Process specific action
|
||||
if(data.on_elem_type = "post"){
|
||||
|
||||
//Open associated post page
|
||||
openPage("post/" + data.on_elem_id);
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user