mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-03 19:54:14 +00:00 
			
		
		
		
	Can push public notifications for group.
This commit is contained in:
		@@ -393,18 +393,14 @@ class PostsController {
 | 
				
			|||||||
		if($postID < 0)
 | 
							if($postID < 0)
 | 
				
			||||||
			Rest_fatal_error(400, "Couldn't create post !");
 | 
								Rest_fatal_error(400, "Couldn't create post !");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if($post->get_kind_page() == Posts::PAGE_KIND_USER){
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			//Create a notification
 | 
							//Create a notification
 | 
				
			||||||
			$notification = new Notification();
 | 
							$notification = new Notification();
 | 
				
			||||||
			$notification->set_from_user_id(userID);
 | 
							$notification->set_from_user_id(userID);
 | 
				
			||||||
			$notification->set_on_elem_id($postID);
 | 
							$notification->set_on_elem_id($postID);
 | 
				
			||||||
			$notification->set_on_elem_type(Notification::POST);
 | 
							$notification->set_on_elem_type(Notification::POST);
 | 
				
			||||||
			$notification->set_type(Notification::ELEM_CREATED);
 | 
							$notification->set_type(Notification::ELEM_CREATED);
 | 
				
			||||||
			components()->notifications->push($notification);
 | 
							components()->notifications->push($notification);
 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//Success
 | 
							//Success
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -160,8 +160,24 @@ class notificationComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			//For the posts on groups
 | 
								//For the posts on groups
 | 
				
			||||||
			else if($notification->get_from_container_type() == Notification::GROUP_PAGE){
 | 
								else if($notification->get_from_container_type() == Notification::GROUP_PAGE){
 | 
				
			||||||
				//TODO : implement
 | 
									
 | 
				
			||||||
				return TRUE;
 | 
									//Get the list of the members of the group that follows it
 | 
				
			||||||
 | 
									$list = components()->groups->getListFollowers($notification->get_from_container_id());
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									//Process the list of followers
 | 
				
			||||||
 | 
									$target_users = array();
 | 
				
			||||||
 | 
									foreach($list as $userID){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										//If the current follower is the user creating the notification
 | 
				
			||||||
 | 
										if($userID == $notification->get_from_user_id())
 | 
				
			||||||
 | 
											continue;
 | 
				
			||||||
 | 
										
 | 
				
			||||||
 | 
										$target_users[] = $userID;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									//Push the notification
 | 
				
			||||||
 | 
									return $this->push_public($notification, $target_users);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			//Unimplemented scenario
 | 
								//Unimplemented scenario
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user