cleaning & fixing

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/142/head
Maxence Lange 2018-12-05 10:38:16 -01:00
rodzic 2059a5f6cd
commit ec0e6253a7
5 zmienionych plików z 19 dodań i 4 usunięć

Wyświetl plik

@ -465,9 +465,9 @@ class LocalController extends Controller {
* @return DataResponse
*/
public function accountFollowers(string $username): DataResponse {
try {
$this->initViewer();
try {
$actor = $this->actorService->getActor($username);
$followers = $this->followService->getFollowers($actor);
@ -574,7 +574,7 @@ class LocalController extends Controller {
throw new InvalidResourceException('no avatar for this Actor');
}
} catch (Exception $e) {
return $this->fail($e, [], Http::STATUS_NOT_FOUND);
return $this->fail($e, [], Http::STATUS_NOT_FOUND, false);
}
}
@ -595,6 +595,14 @@ class LocalController extends Controller {
public function globalAccountsSearch(string $search): DataResponse {
$this->initViewer();
if (substr($search, 0, 1) === '@') {
$search = substr($search, 1);
}
if ($search === '') {
return $this->success(['accounts' => [], 'exact' => []]);
}
/* Look for an exactly matching account */
$match = null;
try {

Wyświetl plik

@ -97,6 +97,7 @@ class ActorsRequest extends ActorsRequestBuilder {
public function getFromUsername(string $username): Person {
$qb = $this->getActorsSelectSql();
$this->limitToPreferredUsername($qb, $username);
$this->limitToLocal($qb, true);
$cursor = $qb->execute();
$data = $cursor->fetch();

Wyświetl plik

@ -246,6 +246,10 @@ class Person extends ACore implements JsonSerializable {
* @return Person
*/
public function setAccount(string $account): Person {
if ($account !== '' && substr($account, 0, 1) === '@') {
$account = substr($account, 1);
}
$this->account = $account;
return $this;

Wyświetl plik

@ -38,6 +38,7 @@ use OCA\Social\Db\CacheActorsRequest;
use OCA\Social\Db\CacheDocumentsRequest;
use OCA\Social\Exceptions\CacheActorDoesNotExistException;
use OCA\Social\Exceptions\CacheDocumentDoesNotExistException;
use OCA\Social\Exceptions\InvalidResourceEntryException;
use OCA\Social\Exceptions\InvalidResourceException;
use OCA\Social\Exceptions\Request410Exception;
use OCA\Social\Exceptions\RequestException;
@ -227,6 +228,7 @@ class PersonService implements ICoreService {
* @throws InvalidResourceException
* @throws SocialAppConfigException
* @throws UrlCloudException
* @throws InvalidResourceEntryException
*/
private function generateActorFromObject(array $object) {

Wyświetl plik

@ -543,7 +543,7 @@ class ActivityService {
$target = '';
try {
$target = strtolower($request->getMethod()) . " " . $request->getPathInfo();
$target = strtolower($request->getMethod()) . " " . $request->getRequestUri();
} catch (Exception $e) {
}