kopia lustrzana https://github.com/nextcloud/social
Merge branch 'master' into fix-ghost-account
commit
62c24da769
|
|
@ -148,9 +148,6 @@ class NavigationController extends Controller {
|
|||
]
|
||||
];
|
||||
|
||||
$checks = $this->checkService->checkDefault();
|
||||
$data['serverData']['checks'] = $checks;
|
||||
|
||||
try {
|
||||
$data['serverData']['cloudAddress'] = $this->configService->getCloudAddress();
|
||||
} catch (SocialAppConfigException $e) {
|
||||
|
|
@ -171,6 +168,11 @@ class NavigationController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
if ($data['serverData']['isAdmin']) {
|
||||
$checks = $this->checkService->checkDefault();
|
||||
$data['serverData']['checks'] = $checks;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create social user account if it doesn't exist yet
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -93,19 +93,21 @@ class QueueController extends Controller {
|
|||
* @param string $token
|
||||
*/
|
||||
public function asyncWithToken(string $token) {
|
||||
$this->async();
|
||||
|
||||
$requests = $this->queueService->getRequestFromToken($token, RequestQueue::STATUS_STANDBY);
|
||||
$this->activityService->manageInit();
|
||||
foreach ($requests as $request) {
|
||||
$request->setTimeout(ActivityService::TIMEOUT_ASYNC);
|
||||
try {
|
||||
$this->activityService->manageRequest($request);
|
||||
} catch (RequestException $e) {
|
||||
} catch (SocialAppConfigException $e) {
|
||||
|
||||
if (!empty($requests)) {
|
||||
$this->async();
|
||||
|
||||
$this->activityService->manageInit();
|
||||
foreach ($requests as $request) {
|
||||
$request->setTimeout(ActivityService::TIMEOUT_ASYNC);
|
||||
try {
|
||||
$this->activityService->manageRequest($request);
|
||||
} catch (RequestException $e) {
|
||||
} catch (SocialAppConfigException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// or it will feed the logs.
|
||||
exit();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,10 +62,13 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
|||
* insert cache about an Actor in database.
|
||||
*
|
||||
* @param Person $actor
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function save(Person $actor): int {
|
||||
public function save(Person $actor) {
|
||||
$source = $actor->getSource();
|
||||
if (strlen($source) >= CoreRequestBuilder::SOURCE_LENGTH) {
|
||||
$source = 'too_big';
|
||||
}
|
||||
|
||||
$qb = $this->getCacheActorsInsertSql();
|
||||
$qb->setValue('id', $qb->createNamedParameter($actor->getId()))
|
||||
->setValue('account', $qb->createNamedParameter($actor->getAccount()))
|
||||
|
|
@ -84,7 +87,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
|||
->setValue('name', $qb->createNamedParameter($actor->getName()))
|
||||
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||
->setValue('source', $qb->createNamedParameter($actor->getSource()))
|
||||
->setValue('source', $qb->createNamedParameter($source))
|
||||
->setValue('details', $qb->createNamedParameter(json_encode($actor->getDetails())))
|
||||
->setValue(
|
||||
'creation',
|
||||
|
|
@ -101,8 +104,6 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
|||
$qb->setValue('icon_id', $qb->createNamedParameter($iconId));
|
||||
|
||||
$qb->execute();
|
||||
|
||||
return $qb->getLastInsertId();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,9 @@ class CoreRequestBuilder {
|
|||
const TABLE_CACHE_DOCUMENTS = 'social_cache_documents';
|
||||
|
||||
|
||||
const SOURCE_LENGTH = 10000;
|
||||
|
||||
|
||||
/** @var IDBConnection */
|
||||
protected $dbConnection;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,13 +61,16 @@ class NotesRequest extends NotesRequestBuilder {
|
|||
* Insert a new Note in the database.
|
||||
*
|
||||
* @param Note $note
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function save(Note $note): int {
|
||||
public function save(Note $note) {
|
||||
$dTime = new DateTime();
|
||||
$dTime->setTimestamp($note->getPublishedTime());
|
||||
|
||||
$source = $note->getSource();
|
||||
if (strlen($source) >= CoreRequestBuilder::SOURCE_LENGTH) {
|
||||
$source = 'too_big';
|
||||
}
|
||||
|
||||
$qb = $this->getNotesInsertSql();
|
||||
$qb->setValue('id', $qb->createNamedParameter($note->getId()))
|
||||
->setValue('type', $qb->createNamedParameter($note->getType()))
|
||||
|
|
@ -95,7 +98,7 @@ class NotesRequest extends NotesRequestBuilder {
|
|||
)
|
||||
->setValue('attributed_to', $qb->createNamedParameter($note->getAttributedTo()))
|
||||
->setValue('in_reply_to', $qb->createNamedParameter($note->getInReplyTo()))
|
||||
->setValue('source', $qb->createNamedParameter($note->getSource()))
|
||||
->setValue('source', $qb->createNamedParameter($source))
|
||||
->setValue(
|
||||
'instances', $qb->createNamedParameter(
|
||||
json_encode($note->getInstancePaths(), JSON_UNESCAPED_SLASHES)
|
||||
|
|
@ -108,8 +111,6 @@ class NotesRequest extends NotesRequestBuilder {
|
|||
);
|
||||
|
||||
$qb->execute();
|
||||
|
||||
return $qb->getLastInsertId();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
* Nextcloud - Social Support
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OCA\Social\Migration;
|
||||
|
||||
|
||||
use Closure;
|
||||
use OCA\Social\Db\CoreRequestBuilder;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
|
||||
|
||||
/**
|
||||
* Class Version0001Date20181208185242
|
||||
*
|
||||
* @package OCA\Social\Migration
|
||||
*/
|
||||
class Version0001Date20181208185242 extends SimpleMigrationStep {
|
||||
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
*
|
||||
* @return ISchemaWrapper
|
||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
||||
*/
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options
|
||||
): ISchemaWrapper {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
$table = $schema->getTable(CoreRequestBuilder::TABLE_CACHE_ACTORS);
|
||||
$table->changeColumn(
|
||||
'source', [
|
||||
'notnull' => true,
|
||||
'length' => CoreRequestBuilder::SOURCE_LENGTH,
|
||||
]
|
||||
);
|
||||
|
||||
$table = $schema->getTable(CoreRequestBuilder::TABLE_SERVER_NOTES);
|
||||
$table->changeColumn(
|
||||
'source', [
|
||||
'notnull' => true,
|
||||
'length' => CoreRequestBuilder::SOURCE_LENGTH,
|
||||
]
|
||||
);
|
||||
|
||||
$table = $schema->getTable(CoreRequestBuilder::TABLE_REQUEST_QUEUE);
|
||||
$table->changeColumn(
|
||||
'activity', [
|
||||
'notnull' => true,
|
||||
'length' => CoreRequestBuilder::SOURCE_LENGTH,
|
||||
]
|
||||
);
|
||||
|
||||
return $schema;
|
||||
}
|
||||
}
|
||||
|
|
@ -45,7 +45,6 @@ use OCA\Social\Model\ActivityPub\Person;
|
|||
use OCA\Social\Service\ActivityPub\DocumentService;
|
||||
use OCA\Social\Service\ActivityPub\PersonService;
|
||||
use OCP\Accounts\IAccountManager;
|
||||
use OCP\Accounts\PropertyDoesNotExistException;
|
||||
use OCP\IUserManager;
|
||||
|
||||
|
||||
|
|
@ -297,14 +296,17 @@ class ActorService {
|
|||
if ($user === null) {
|
||||
throw new NoUserException();
|
||||
}
|
||||
$account = $this->accountManager->getAccount($user);
|
||||
|
||||
try {
|
||||
$account = $this->accountManager->getAccount($user);
|
||||
$displayNameProperty = $account->getProperty(IAccountManager::PROPERTY_DISPLAYNAME);
|
||||
if ($displayNameProperty->getScope() === IAccountManager::VISIBILITY_PUBLIC) {
|
||||
$actor->setName($displayNameProperty->getValue());
|
||||
}
|
||||
} catch (PropertyDoesNotExistException $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->miscService->log(
|
||||
'Issue while trying to updateCacheLocalActorName: ' . $e->getMessage(), 1
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ class ImportService {
|
|||
$service->parse($activity);
|
||||
} catch (Exception $e) {
|
||||
$this->miscService->log(
|
||||
2, 'Cannot parse ' . $activity->getType() . ': ' . $e->getMessage()
|
||||
'Cannot parse ' . $activity->getType() . ': ' . $e->getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Plik diff jest za duży
Load Diff
24
package.json
24
package.json
|
|
@ -29,17 +29,17 @@
|
|||
"dependencies": {
|
||||
"@babel/polyfill": "^7.0.0",
|
||||
"linkifyjs": "^2.1.7",
|
||||
"nextcloud-axios": "^0.1.2",
|
||||
"nextcloud-axios": "^0.1.3",
|
||||
"nextcloud-vue": "^0.4.6",
|
||||
"tributejs": "^3.3.5",
|
||||
"twemoji": "^11.2.0",
|
||||
"uuid": "^3.3.2",
|
||||
"v-tooltip": "^2.0.0-rc.33",
|
||||
"vue": "^2.5.16",
|
||||
"vue": "^2.5.21",
|
||||
"vue-click-outside": "^1.0.7",
|
||||
"vue-contenteditable-directive": "^1.2.0",
|
||||
"vue-emoji-picker": "^1.0.1",
|
||||
"vue-infinite-loading": "^2.4.1",
|
||||
"vue-infinite-loading": "^2.4.3",
|
||||
"vue-router": "^3.0.2",
|
||||
"vue-tribute": "^1.0.1",
|
||||
"vue-twemoji": "^1.0.1",
|
||||
|
|
@ -55,19 +55,19 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.2",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||
"@babel/preset-env": "^7.2.0",
|
||||
"@vue/test-utils": "^1.0.0-beta.25",
|
||||
"@vue/test-utils": "^1.0.0-beta.27",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-jest": "^23.6.0",
|
||||
"babel-loader": "^8.0.4",
|
||||
"css-loader": "^0.28.11",
|
||||
"css-loader": "^2.0.0",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-standard": "^11.0.0",
|
||||
"eslint-friendly-formatter": "^4.0.1",
|
||||
"eslint-loader": "^2.1.1",
|
||||
"eslint-plugin-import": "^2.13.0",
|
||||
"eslint-plugin-node": "^7.0.1",
|
||||
"eslint-plugin-node": "^8.0.0",
|
||||
"eslint-plugin-promise": "^4.0.1",
|
||||
"eslint-plugin-standard": "^3.1.0",
|
||||
"eslint-plugin-vue": "^4.5.0",
|
||||
|
|
@ -75,17 +75,17 @@
|
|||
"file-loader": "^1.1.11",
|
||||
"jest": "^23.6.0",
|
||||
"jest-serializer-vue": "^2.0.2",
|
||||
"mini-css-extract-plugin": "^0.4.5",
|
||||
"mini-css-extract-plugin": "^0.5.0",
|
||||
"prettier-eslint": "^8.8.2",
|
||||
"raw-loader": "^0.5.1",
|
||||
"raw-loader": "^1.0.0",
|
||||
"stylelint": "^8.4.0",
|
||||
"stylelint-config-recommended-scss": "^3.2.0",
|
||||
"stylelint-webpack-plugin": "^0.10.5",
|
||||
"vue-jest": "^2.6.0",
|
||||
"vue-jest": "^3.0.1",
|
||||
"vue-loader": "^15.4.2",
|
||||
"vue-style-loader": "^4.1.1",
|
||||
"vue-template-compiler": "^2.5.16",
|
||||
"webpack": "^4.23.1",
|
||||
"vue-template-compiler": "^2.5.21",
|
||||
"webpack": "^4.27.1",
|
||||
"webpack-cli": "^3.1.2",
|
||||
"webpack-merge": "^4.1.2"
|
||||
},
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue