Simplified contact id handling

This commit is contained in:
Michael 2022-01-16 18:40:18 +00:00
parent fd4926b0f3
commit 8e8ec9d2d2
4 changed files with 4 additions and 20 deletions

View File

@ -37,9 +37,7 @@ class Ids extends ContactEndpoint
$uid = BaseApi::getCurrentUserID(); $uid = BaseApi::getCurrentUserID();
// Expected value for user_id parameter: public/user contact id // Expected value for user_id parameter: public/user contact id
$contact_id = $this->getRequestValue($request, 'user_id', 0); $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
$screen_name = $this->getRequestValue($request, 'screen_name', '');
$profile_url = $this->getRequestValue($request, 'profile_url', '');
$cursor = $this->getRequestValue($request, 'cursor', -1); $cursor = $this->getRequestValue($request, 'cursor', -1);
$stringify_ids = $this->getRequestValue($request, 'stringify_ids', false); $stringify_ids = $this->getRequestValue($request, 'stringify_ids', false);
$count = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT); $count = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
@ -49,8 +47,6 @@ class Ids extends ContactEndpoint
$max_id = $this->getRequestValue($request, 'max_id', 0, 0); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$min_id = $this->getRequestValue($request, 'min_id', 0, 0); $min_id = $this->getRequestValue($request, 'min_id', 0, 0);
$cid = BaseApi::getContactIDForSearchterm($screen_name, $profile_url, $contact_id, $uid);
$params = ['order' => ['relation-cid' => true], 'limit' => $count]; $params = ['order' => ['relation-cid' => true], 'limit' => $count];
$condition = ['cid' => $cid, 'follows' => true]; $condition = ['cid' => $cid, 'follows' => true];

View File

@ -37,9 +37,7 @@ class Lists extends ContactEndpoint
$uid = BaseApi::getCurrentUserID(); $uid = BaseApi::getCurrentUserID();
// Expected value for user_id parameter: public/user contact id // Expected value for user_id parameter: public/user contact id
$contact_id = $this->getRequestValue($request, 'user_id', 0); $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
$screen_name = $this->getRequestValue($request, 'screen_name', '');
$profile_url = $this->getRequestValue($request, 'profile_url', '');
$cursor = $this->getRequestValue($request, 'cursor', -1); $cursor = $this->getRequestValue($request, 'cursor', -1);
$skip_status = $this->getRequestValue($request, 'skip_status', false); $skip_status = $this->getRequestValue($request, 'skip_status', false);
$include_user_entities = $this->getRequestValue($request, 'include_user_entities', false); $include_user_entities = $this->getRequestValue($request, 'include_user_entities', false);
@ -50,8 +48,6 @@ class Lists extends ContactEndpoint
$max_id = $this->getRequestValue($request, 'max_id', 0, 0); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$min_id = $this->getRequestValue($request, 'min_id', 0, 0); $min_id = $this->getRequestValue($request, 'min_id', 0, 0);
$cid = BaseApi::getContactIDForSearchterm($screen_name, $profile_url, $contact_id, $uid);
$params = ['order' => ['relation-cid' => true], 'limit' => $count]; $params = ['order' => ['relation-cid' => true], 'limit' => $count];
$condition = ['cid' => $cid, 'follows' => true]; $condition = ['cid' => $cid, 'follows' => true];

View File

@ -37,9 +37,7 @@ class Ids extends ContactEndpoint
$uid = BaseApi::getCurrentUserID(); $uid = BaseApi::getCurrentUserID();
// Expected value for user_id parameter: public/user contact id // Expected value for user_id parameter: public/user contact id
$contact_id = $this->getRequestValue($request, 'user_id', 0); $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
$screen_name = $this->getRequestValue($request, 'screen_name', '');
$profile_url = $this->getRequestValue($request, 'profile_url', '');
$cursor = $this->getRequestValue($request, 'cursor', -1); $cursor = $this->getRequestValue($request, 'cursor', -1);
$stringify_ids = $this->getRequestValue($request, 'stringify_ids', false); $stringify_ids = $this->getRequestValue($request, 'stringify_ids', false);
$count = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT); $count = $this->getRequestValue($request, 'count', self::DEFAULT_COUNT, 1, self::MAX_COUNT);
@ -49,8 +47,6 @@ class Ids extends ContactEndpoint
$max_id = $this->getRequestValue($request, 'max_id', 0, 0); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$min_id = $this->getRequestValue($request, 'min_id', 0, 0); $min_id = $this->getRequestValue($request, 'min_id', 0, 0);
$cid = BaseApi::getContactIDForSearchterm($screen_name, $profile_url, $contact_id, $uid);
$params = ['order' => ['cid' => true], 'limit' => $count]; $params = ['order' => ['cid' => true], 'limit' => $count];
$condition = ['relation-cid' => $cid, 'follows' => true]; $condition = ['relation-cid' => $cid, 'follows' => true];

View File

@ -37,9 +37,7 @@ class Lists extends ContactEndpoint
$uid = BaseApi::getCurrentUserID(); $uid = BaseApi::getCurrentUserID();
// Expected value for user_id parameter: public/user contact id // Expected value for user_id parameter: public/user contact id
$contact_id = $this->getRequestValue($request, 'user_id', 0); $cid = BaseApi::getContactIDForSearchterm($request['screen_name'] ?? '', $request['profileurl'] ?? '', $request['user_id'] ?? 0, $uid);
$screen_name = $this->getRequestValue($request, 'screen_name', '');
$profile_url = $this->getRequestValue($request, 'profile_url', '');
$cursor = $this->getRequestValue($request, 'cursor', -1); $cursor = $this->getRequestValue($request, 'cursor', -1);
$skip_status = $this->getRequestValue($request, 'skip_status', false); $skip_status = $this->getRequestValue($request, 'skip_status', false);
$include_user_entities = $this->getRequestValue($request, 'include_user_entities', false); $include_user_entities = $this->getRequestValue($request, 'include_user_entities', false);
@ -50,8 +48,6 @@ class Lists extends ContactEndpoint
$max_id = $this->getRequestValue($request, 'max_id', 0, 0); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$min_id = $this->getRequestValue($request, 'min_id', 0, 0); $min_id = $this->getRequestValue($request, 'min_id', 0, 0);
$cid = BaseApi::getContactIDForSearchterm($screen_name, $profile_url, $contact_id, $uid);
$params = ['order' => ['cid' => true], 'limit' => $count]; $params = ['order' => ['cid' => true], 'limit' => $count];
$condition = ['relation-cid' => $cid, 'follows' => true]; $condition = ['relation-cid' => $cid, 'follows' => true];