mirror of
				https://gitlab.com/comunic/comunicapiv3
				synced 2025-11-04 09:34:04 +00:00 
			
		
		
		
	Improve code readability
This commit is contained in:
		@@ -1,10 +1 @@
 | 
			
		||||
-- Create report table
 | 
			
		||||
CREATE TABLE `comunic_reports` (
 | 
			
		||||
  `id` INT NOT NULL AUTO_INCREMENT,
 | 
			
		||||
  `user_id` INT NOT NULL,
 | 
			
		||||
  `target_type` VARCHAR(25) NOT NULL,
 | 
			
		||||
  `target_id` INT NOT NULL,
 | 
			
		||||
  `time` INT NOT NULL,
 | 
			
		||||
  `cause` VARCHAR(20) NOT NULL,
 | 
			
		||||
  `comment` TEXT NULL,
 | 
			
		||||
  PRIMARY KEY (`id`));
 | 
			
		||||
-- Nothing yet
 | 
			
		||||
@@ -40,7 +40,7 @@ impl NotificationAPI {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn for_list(l: &Vec<Notification>) -> Vec<NotificationAPI> {
 | 
			
		||||
    pub fn for_list(l: &[Notification]) -> Vec<NotificationAPI> {
 | 
			
		||||
        l.iter().map(Self::new).collect()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -13,7 +13,7 @@ pub struct PostsTargets {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl PostsTargets {
 | 
			
		||||
    pub fn new(f: &Vec<UserID>, g: &Vec<GroupID>) -> PostsTargets {
 | 
			
		||||
    pub fn new(f: &[UserID], g: &[GroupID]) -> PostsTargets {
 | 
			
		||||
        PostsTargets {
 | 
			
		||||
            friends: f.iter().map(|f| f.id()).collect(),
 | 
			
		||||
            groups: g.iter().map(|f| f.id()).collect(),
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ impl UserMembershipAPI {
 | 
			
		||||
                membership_type: TypeContainerAPI::new("group".to_string()),
 | 
			
		||||
                id: Some(group_id.id()),
 | 
			
		||||
                friend: None,
 | 
			
		||||
                last_activity: Some(last_activity.clone()),
 | 
			
		||||
                last_activity: Some(*last_activity),
 | 
			
		||||
                conv: None,
 | 
			
		||||
            },
 | 
			
		||||
 | 
			
		||||
@@ -48,7 +48,7 @@ impl UserMembershipAPI {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn for_list(l: &Vec<UserMembership>) -> Vec<UserMembershipAPI> {
 | 
			
		||||
    pub fn for_list(l: &[UserMembership]) -> Vec<UserMembershipAPI> {
 | 
			
		||||
        l.iter().map(Self::new).collect()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user