mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Can extract users ID from a notification.
This commit is contained in:
		
							
								
								
									
										33
									
								
								assets/js/components/notifications/utils.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								assets/js/components/notifications/utils.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
/**
 | 
			
		||||
 * Notifications utilities
 | 
			
		||||
 * 
 | 
			
		||||
 * @author Pierre HUBERT
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
ComunicWeb.components.notifications.utils = {
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get the users ID that might be required to display the notifications
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param {array} list The list of notifications to process
 | 
			
		||||
	 * @return {array} The list of users id
 | 
			
		||||
	 */
 | 
			
		||||
	get_users_id: function(list){
 | 
			
		||||
 | 
			
		||||
		var users = [];
 | 
			
		||||
 | 
			
		||||
		for (let index = 0; index < list.length; index++) {
 | 
			
		||||
			const notif = list[index];
 | 
			
		||||
			
 | 
			
		||||
			if(!users.includes(notif.from_user_id))
 | 
			
		||||
				users.push(notif.from_user_id);
 | 
			
		||||
 | 
			
		||||
			if(!users.includes(notif.from_container_id) && notif.from_container_type == "user_page")
 | 
			
		||||
				users.push(notif.from_container_id);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return users;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user