| 
						
						
							
								
							
						
						
					 | 
				
			
			 | 
			 | 
			
				@ -288,6 +288,22 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return false;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						public const USERS_PER_STAFF = 50;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						public const USERS_PER_STAFF_WARNING = 200;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						private function has_good_staff_rating(): bool {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							$recommended_staff_count = $this->active_users / CommunityRoom::USERS_PER_STAFF;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return count($this->get_staff()) >= $recommended_staff_count;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						private function has_poor_staff_rating(): bool {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if ($this->active_users <= 3) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								return false;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							$minimal_staff_count = $this->active_users / CommunityRoom::USERS_PER_STAFF_WARNING;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return count($this->get_staff()) < $minimal_staff_count;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						/**
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						 * Return the tags associated with this room.
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						 * @return \CommunityTag[] Tags as string array.
 | 
			
		
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
			
			 | 
			 | 
			
				@ -300,12 +316,44 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							 */
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							$derived_tags = [];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							$CHECK_MARK = CommunityTag::CHECK_MARK;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							$WARNING = CommunityTag::WARNING_ICON;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							$USERS_PER_STAFF = CommunityRoom::USERS_PER_STAFF;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							$USERS_PER_STAFF_WARNING = CommunityRoom::USERS_PER_STAFF_WARNING;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if ($this->is_official_room()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								$derived_tags[] = new CommunityTag("official", TagType::RESERVED_TAG);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								$derived_tags[] = new CommunityTag(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									"official",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									TagType::RESERVED_TAG,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									"This Community is maintained by the Session team. $CHECK_MARK"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if ($this->has_nsfw_keywords()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								$derived_tags[] = new CommunityTag("nsfw", TagType::WARNING_TAG);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								$derived_tags[] = 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									new CommunityTag(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										"nsfw", 
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										TagType::WARNING_TAG,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										"This Community may contain adult material. $WARNING"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if ($this->write && $this->has_good_staff_rating()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								$derived_tags[] =
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									new CommunityTag(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										"modded",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										TagType::RESERVED_TAG,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										"This Community has at least 1 staff per $USERS_PER_STAFF active users. $CHECK_MARK"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							if ($this->write && $this->has_poor_staff_rating()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								$derived_tags[] =
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									new CommunityTag(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										"not modded",
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										TagType::WARNING_TAG,
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										"This Community has less than 1 staff per $USERS_PER_STAFF_WARNING active users. $WARNING"
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return [...$derived_tags, ...$user_tags];
 | 
			
		
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
			
			 | 
			 | 
			
				
 
 |