Fix following collection error message
This commit is contained in:
parent
295d4a254d
commit
542c269885
@ -53,7 +53,7 @@ class apActorFollowersAction extends ManagedAction
|
|||||||
$profile = $user->getProfile ();
|
$profile = $user->getProfile ();
|
||||||
$url = $profile->profileurl;
|
$url = $profile->profileurl;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
ActivityPubReturn::error ('Invalid username');
|
ActivityPubReturn::error ('Invalid username.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset ($_GET["page"])) {
|
if (!isset ($_GET["page"])) {
|
||||||
@ -63,7 +63,7 @@ class apActorFollowersAction extends ManagedAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($page <= 0) {
|
if ($page <= 0) {
|
||||||
ActivityPubReturn::error ('Invalid page number');
|
ActivityPubReturn::error ('Invalid page number.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fetch Followers */
|
/* Fetch Followers */
|
||||||
@ -73,7 +73,7 @@ class apActorFollowersAction extends ManagedAction
|
|||||||
$sub = $profile->getSubscribers ($since, $limit);
|
$sub = $profile->getSubscribers ($since, $limit);
|
||||||
}
|
}
|
||||||
catch(NoResultException $e) {
|
catch(NoResultException $e) {
|
||||||
ActivityPubReturn::error ('This user has no followers');
|
ActivityPubReturn::error ('This user has no followers.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate total items */
|
/* Calculate total items */
|
||||||
@ -81,11 +81,11 @@ class apActorFollowersAction extends ManagedAction
|
|||||||
$total_pages = ceil ($total_subs / PROFILES_PER_MINILIST);
|
$total_pages = ceil ($total_subs / PROFILES_PER_MINILIST);
|
||||||
|
|
||||||
if ($total_pages == 0) {
|
if ($total_pages == 0) {
|
||||||
ActivityPubReturn::error ('This user has no followers');
|
ActivityPubReturn::error ('This user has no followers.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($page > $total_pages) {
|
if ($page > $total_pages) {
|
||||||
ActivityPubReturn::error ("There are only {$total_pages} pages");
|
ActivityPubReturn::error ("There are only {$total_pages} pages.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get followers' URLs */
|
/* Get followers' URLs */
|
||||||
|
@ -53,7 +53,7 @@ class apActorFollowingAction extends ManagedAction
|
|||||||
$profile = $user->getProfile ();
|
$profile = $user->getProfile ();
|
||||||
$url = $profile->profileurl;
|
$url = $profile->profileurl;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
ActivityPubReturn::error ('Invalid username');
|
ActivityPubReturn::error ('Invalid username.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset ($_GET["page"])) {
|
if (!isset ($_GET["page"])) {
|
||||||
@ -63,7 +63,7 @@ class apActorFollowingAction extends ManagedAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($page <= 0) {
|
if ($page <= 0) {
|
||||||
ActivityPubReturn::error ('Invalid page number');
|
ActivityPubReturn::error ('Invalid page number.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fetch Following */
|
/* Fetch Following */
|
||||||
@ -71,8 +71,8 @@ class apActorFollowingAction extends ManagedAction
|
|||||||
$since = ($page - 1) * PROFILES_PER_MINILIST;
|
$since = ($page - 1) * PROFILES_PER_MINILIST;
|
||||||
$limit = (($page - 1) == 0 ? 1 : $page) * PROFILES_PER_MINILIST;
|
$limit = (($page - 1) == 0 ? 1 : $page) * PROFILES_PER_MINILIST;
|
||||||
$sub = $profile->getSubscribed($since, $limit);
|
$sub = $profile->getSubscribed($since, $limit);
|
||||||
} catch(NoResultException $e) {
|
} catch (NoResultException $e) {
|
||||||
ActivityPubReturn::error ('This user is not following anyone');
|
ActivityPubReturn::error ('This user is not following anyone.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate total items */
|
/* Calculate total items */
|
||||||
@ -80,11 +80,11 @@ class apActorFollowingAction extends ManagedAction
|
|||||||
$total_pages = ceil ($total_subs / PROFILES_PER_MINILIST);
|
$total_pages = ceil ($total_subs / PROFILES_PER_MINILIST);
|
||||||
|
|
||||||
if ($total_pages == 0) {
|
if ($total_pages == 0) {
|
||||||
ActivityPubReturn::error ('This user has no followers');
|
ActivityPubReturn::error ('This user is not following anyone.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($page > $total_pages) {
|
if ($page > $total_pages) {
|
||||||
ActivityPubReturn::error ("There are only {$total_pages} pages");
|
ActivityPubReturn::error ("There are only {$total_pages} pages.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get followed' URLs */
|
/* Get followed' URLs */
|
||||||
|
@ -53,7 +53,7 @@ class apActorLikedCollectionAction extends ManagedAction
|
|||||||
$profile = $user->getProfile ();
|
$profile = $user->getProfile ();
|
||||||
$url = $profile->profileurl;
|
$url = $profile->profileurl;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
ActivityPubReturn::error ('Invalid username');
|
ActivityPubReturn::error ('Invalid username.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$limit = intval ($this->trimmed ('limit'));
|
$limit = intval ($this->trimmed ('limit'));
|
||||||
|
@ -54,7 +54,7 @@ class apActorProfileAction extends ManagedAction
|
|||||||
$profile = $user->getProfile ();
|
$profile = $user->getProfile ();
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
ActivityPubReturn::error ('Invalid username', 404);
|
ActivityPubReturn::error ('Invalid username.', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = Activitypub_profile::profileToObject ($profile);
|
$res = Activitypub_profile::profileToObject ($profile);
|
||||||
|
Reference in New Issue
Block a user