diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2020-06-22 16:55:46 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2020-06-22 16:55:46 -0100 |
commit | b3d146116eadb57d83a2e289d64a7c47f52c4a7b (patch) | |
tree | 9e243db239fcd06e4d41ef487a6c787fcec1e507 | |
parent | 2b5115b4703a1f8721d24dbd9ad97fc0bb731975 (diff) |
fixing hashtags
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r-- | appinfo/info.xml | 1 | ||||
-rw-r--r-- | lib/Command/CheckInstall.php | 23 | ||||
-rw-r--r-- | lib/Command/Reset.php | 1 | ||||
-rw-r--r-- | lib/Db/StreamTagsRequest.php | 15 |
4 files changed, 20 insertions, 20 deletions
diff --git a/appinfo/info.xml b/appinfo/info.xml index 4bda7b49..5ad8f7f8 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -55,6 +55,7 @@ <command>OCA\Social\Command\CacheRefresh</command> <command>OCA\Social\Command\CheckInstall</command> <command>OCA\Social\Command\Fediverse</command> + <command>OCA\Social\Command\MigrateAlpha3</command> <command>OCA\Social\Command\NoteLike</command> <command>OCA\Social\Command\NoteCreate</command> <command>OCA\Social\Command\NoteBoost</command> diff --git a/lib/Command/CheckInstall.php b/lib/Command/CheckInstall.php index c01d85fb..84bc805b 100644 --- a/lib/Command/CheckInstall.php +++ b/lib/Command/CheckInstall.php @@ -124,11 +124,11 @@ class CheckInstall extends Base { parent::configure(); $this->setName('social:check:install') ->addOption('index', '', InputOption::VALUE_NONE, 'regenerate your index') - ->addOption( - 'push', '', InputOption::VALUE_REQUIRED, - 'a local account used to test integration to Nextcloud Push', - '' - ) +// ->addOption( +// 'push', '', InputOption::VALUE_REQUIRED, +// 'a local account used to test integration to Nextcloud Push', +// '' +// ) ->setDescription('Check the integrity of the installation'); } @@ -144,9 +144,9 @@ class CheckInstall extends Base { return; } - if ($this->checkPushApp($input, $output)) { - return; - } +// if ($this->checkPushApp($input, $output)) { +// return; +// } $result = $this->checkService->checkInstallationStatus(); @@ -180,7 +180,7 @@ class CheckInstall extends Base { // push was not implemented on 18 // $wrapper = $this->pushService->testOnAccount($userId); - $output->writeln(json_encode($wrapper, JSON_PRETTY_PRINT)); +// $output->writeln(json_encode($wrapper, JSON_PRETTY_PRINT)); return true; } @@ -213,17 +213,16 @@ class CheckInstall extends Base { $this->streamDestRequest->emptyStreamDest(); $this->streamTagsRequest->emptyStreamTags(); - $this->regenerateIndex($input, $output); + $this->regenerateIndex($output); return true; } /** - * @param InputInterface $input * @param OutputInterface $output */ - private function regenerateIndex(InputInterface $input, OutputInterface $output) { + private function regenerateIndex(OutputInterface $output) { $streams = $this->streamRequest->getAll(); $progressBar = new ProgressBar($output, count($streams)); $progressBar->start(); diff --git a/lib/Command/Reset.php b/lib/Command/Reset.php index 5601aab4..0a24b5c8 100644 --- a/lib/Command/Reset.php +++ b/lib/Command/Reset.php @@ -47,6 +47,7 @@ use Symfony\Component\Console\Question\Question; class Reset extends Base { + /** @var CoreRequestBuilder */ private $coreRequestBuilder; /** @var CheckService */ diff --git a/lib/Db/StreamTagsRequest.php b/lib/Db/StreamTagsRequest.php index c8504c03..6fcba5ec 100644 --- a/lib/Db/StreamTagsRequest.php +++ b/lib/Db/StreamTagsRequest.php @@ -33,6 +33,7 @@ namespace OCA\Social\Db; use daita\MySmallPhpTools\Traits\TStringTools; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; +use OCA\Social\Model\ActivityPub\Object\Note; use OCA\Social\Model\ActivityPub\Stream; @@ -51,19 +52,17 @@ class StreamTagsRequest extends StreamTagsRequestBuilder { * @param Stream $stream */ public function generateStreamTags(Stream $stream) { - $hashtags = $stream->getTags(); + if ($stream->getType() !== Note::TYPE) { + return; + } - foreach ($hashtags as $hashtag) { - $tag = $this->get('name', $hashtag); - if ($this->get('type', $hashtag) !== 'Hashtag' || $tag === '') { - continue; - } + /** @var Note $stream */ + foreach ($stream->getHashTags() as $hashtag) { - $tag = substr($tag, 1); $qb = $this->getStreamTagsInsertSql(); $streamId = $qb->prim($stream->getId()); $qb->setValue('stream_id', $qb->createNamedParameter($streamId)); - $qb->setValue('hashtag', $qb->createNamedParameter($tag)); + $qb->setValue('hashtag', $qb->createNamedParameter($hashtag)); try { $qb->execute(); } catch (UniqueConstraintViolationException $e) { |