Merge pull request #142 from nextcloud-gmbh/fix-small-0512-2

cleaning & fixing
pull/147/head
Maxence Lange 2018-12-05 11:17:43 -01:00 zatwierdzone przez GitHub
commit 29fe65937e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 18 dodań i 4 usunięć

Wyświetl plik

@ -465,9 +465,9 @@ class LocalController extends Controller {
* @return DataResponse
*/
public function accountFollowers(string $username): DataResponse {
$this->initViewer();
try {
$this->initViewer();
$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

@ -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) {
}