Remove extraneous $field parameter in Contact\Relation methods

This commit is contained in:
Hypolite Petovan 2020-08-04 22:44:18 -04:00
parent 73c112066d
commit ae23c69303
2 changed files with 10 additions and 12 deletions

View File

@ -431,7 +431,7 @@ class Relation
* @return array
* @throws Exception
*/
public static function listCommon(int $sourceId, int $targetId, array $fields = [], array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
public static function listCommon(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
{
$condition = DBA::mergeConditions($condition,
["`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
@ -439,7 +439,7 @@ class Relation
$sourceId, $targetId]
);
return DI::dba()->selectToArray('contact', $fields, $condition,
return DI::dba()->selectToArray('contact', [], $condition,
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
);
}
@ -470,7 +470,6 @@ class Relation
*
* @param int $sourceId Public contact id
* @param int $targetId Public contact id
* @param array $field Field list
* @param array $condition Additional condition array on the contact table
* @param int $count
* @param int $offset
@ -478,7 +477,7 @@ class Relation
* @return array
* @throws Exception
*/
public static function listCommonFollows(int $sourceId, int $targetId, array $fields = [], array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
public static function listCommonFollows(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
{
$condition = DBA::mergeConditions($condition,
["`id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `follows`)
@ -486,7 +485,7 @@ class Relation
$sourceId, $targetId]
);
return DI::dba()->selectToArray('contact', $fields, $condition,
return DI::dba()->selectToArray('contact', [], $condition,
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
);
}
@ -516,7 +515,6 @@ class Relation
*
* @param int $sourceId Public contact id
* @param int $targetId Public contact id
* @param array $field Field list
* @param array $condition Additional condition on the contact table
* @param int $count
* @param int $offset
@ -524,7 +522,7 @@ class Relation
* @return array
* @throws Exception
*/
public static function listCommonFollowers(int $sourceId, int $targetId, array $fields = [], array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
public static function listCommonFollowers(int $sourceId, int $targetId, array $condition = [], int $count = 30, int $offset = 0, bool $shuffle = false)
{
$condition = DBA::mergeConditions($condition,
["`id` IN (SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ? AND `follows`)
@ -532,7 +530,7 @@ class Relation
$sourceId, $targetId]
);
return DI::dba()->selectToArray('contact', $fields, $condition,
return DI::dba()->selectToArray('contact', [], $condition,
['limit' => [$offset, $count], 'order' => [$shuffle ? 'name' : 'RAND()']]
);
}

View File

@ -46,7 +46,7 @@ class GContact
$sourceId,
];
return Contact\Relation::countCommonFollows($sourceId, $targetIds['public'] ?? 0, [], $condition);
return Contact\Relation::countCommonFollows($sourceId, $targetIds['public'] ?? 0, $condition);
}
/**
@ -74,7 +74,7 @@ LIMIT 1",
$sourceId,
];
return Contact\Relation::countCommonFollowers($sourceId, $targetPublicContact['id'] ?? 0, [], $condition);
return Contact\Relation::countCommonFollowers($sourceId, $targetPublicContact['id'] ?? 0, $condition);
}
/**
@ -100,7 +100,7 @@ LIMIT 1",
$sourceId,
];
return Contact\Relation::listCommonFollows($sourceId, $targetIds['public'] ?? 0, [], $condition, $limit, $start, $shuffle);
return Contact\Relation::listCommonFollows($sourceId, $targetIds['public'] ?? 0, $condition, $limit, $start, $shuffle);
}
/**
@ -134,6 +134,6 @@ LIMIT 1",
$sourceId,
];
return Contact\Relation::listCommonFollows($sourceId, $targetPublicContact['id'] ?? 0, [], $condition, $limit, $start, $shuffle);
return Contact\Relation::listCommonFollows($sourceId, $targetPublicContact['id'] ?? 0, $condition, $limit, $start, $shuffle);
}
}