mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Send request on the server to mark a notification as seen.
This commit is contained in:
		@@ -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
 | 
							//Create notification action
 | 
				
			||||||
		var action = function(){
 | 
							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"){
 | 
								if(data.on_elem_type = "post"){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									//Open associated post page
 | 
				
			||||||
				openPage("post/" + data.on_elem_id);
 | 
									openPage("post/" + data.on_elem_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user