new notification timeline

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
pull/531/head
Maxence Lange 2019-05-18 00:41:42 -01:00
rodzic 04ca8b54f4
commit 6d820876ab
4 zmienionych plików z 43 dodań i 8 usunięć

Wyświetl plik

@ -200,6 +200,15 @@ class CoreRequestBuilder {
}
/**
* @param IQueryBuilder $qb
* @param string $type
*/
protected function filterType(IQueryBuilder $qb, string $type) {
$this->filterDBField($qb, 'type', $type);
}
/**
* Limit the request to the Preferred Username
*
@ -484,14 +493,29 @@ class CoreRequestBuilder {
* @param IQueryBuilder $qb
* @param string $field
* @param string $value
* @param bool $eq
* @param bool $cs - case sensitive
* @param string $alias
*/
protected function filterDBField(
IQueryBuilder &$qb, string $field, string $value, bool $cs = true, string $alias = ''
) {
$expr = $this->exprLimitToDBField($qb, $field, $value, false, $cs, $alias);
$qb->andWhere($expr);
}
/**
* @param IQueryBuilder $qb
* @param string $field
* @param string $value
* @param bool $eq - true = limit, false = filter
* @param bool $cs
* @param string $alias
*
* @return string
*/
protected function exprLimitToDBField(
IQueryBuilder &$qb, string $field, string $value, bool $eq = true, bool $cs = true,
IQueryBuilder &$qb, string $field, string $value, bool $eq, bool $cs = true,
string $alias = ''
): string {
$expr = $qb->expr();
@ -502,9 +526,8 @@ class CoreRequestBuilder {
}
$field = $pf . $field;
if ($eq) {
$comp = 'eq';
} else {
$comp = 'eq';
if (!$eq) {
$comp = 'neq';
}

Wyświetl plik

@ -40,8 +40,10 @@ use OCA\Social\Exceptions\DateTimeException;
use OCA\Social\Exceptions\ItemUnknownException;
use OCA\Social\Exceptions\SocialAppConfigException;
use OCA\Social\Exceptions\StreamNotFoundException;
use OCA\Social\Interfaces\Internal\SocialAppNotificationInterface;
use OCA\Social\Model\ActivityPub\ACore;
use OCA\Social\Model\ActivityPub\Actor\Person;
use OCA\Social\Model\ActivityPub\Internal\SocialAppNotification;
use OCA\Social\Model\ActivityPub\Object\Note;
use OCA\Social\Model\ActivityPub\Stream;
use OCA\Social\Service\ConfigService;
@ -321,6 +323,7 @@ class StreamRequest extends StreamRequestBuilder {
$this->limitPaginate($qb, $since, $limit);
$this->limitToRecipient($qb, $actor->getId(), false);
$this->limitToType($qb, SocialAppNotification::TYPE);
$this->leftJoinCacheActors($qb, 'attributed_to');
$this->leftJoinStreamAction($qb);
@ -394,6 +397,7 @@ class StreamRequest extends StreamRequestBuilder {
$this->limitToRecipient($qb, $actor->getId(), true);
$this->filterRecipient($qb, ACore::CONTEXT_PUBLIC);
$this->filterRecipient($qb, $actor->getFollowers());
$this->filterType($qb, SocialAppNotification::TYPE);
// $this->filterHiddenOnTimeline($qb);
$this->leftJoinCacheActors($qb, 'attributed_to');

Wyświetl plik

@ -244,9 +244,7 @@ class StreamRequestBuilder extends CoreRequestBuilder {
// all possible follow, but linked by followers (actor_id) and accepted follow
$crossFollows = $expr->andX();
$crossFollows->add($recipientFields);
$crossFollows->add(
$this->exprLimitToDBField($qb, 'actor_id', $actor->getId(), true, false, 'f')
);
$crossFollows->add($this->exprLimitToDBField($qb, 'actor_id', $actor->getId(),true, false, 'f'));
$crossFollows->add($this->exprLimitToDBFieldInt($qb, 'accepted', 1, 'f'));
$on->add($crossFollows);

Wyświetl plik

@ -136,6 +136,16 @@ export default {
icon: 'icon-comment',
text: t('social', 'Direct messages')
},
{
id: 'social-notifications',
classes: [],
router: {
name: 'timeline',
params: { type: 'notifications' }
},
icon: 'icon-comment',
text: t('social', 'Notifications')
},
{
id: 'social-account',
classes: [],