fixing hashtags

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/899/head
Maxence Lange 2020-06-22 16:55:46 -01:00
rodzic 2b5115b470
commit b3d146116e
4 zmienionych plików z 20 dodań i 20 usunięć

Wyświetl plik

@ -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>

Wyświetl plik

@ -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();

Wyświetl plik

@ -47,6 +47,7 @@ use Symfony\Component\Console\Question\Question;
class Reset extends Base {
/** @var CoreRequestBuilder */
private $coreRequestBuilder;
/** @var CheckService */

Wyświetl plik

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