kopia lustrzana https://github.com/nextcloud/social
new notification timeline
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>pull/531/head
rodzic
04ca8b54f4
commit
6d820876ab
|
@ -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';
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
10
src/App.vue
10
src/App.vue
|
@ -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: [],
|
||||
|
|
Ładowanie…
Reference in New Issue