如何在检索通知时过滤掉以前看到和阅读的活动? [英] How to filter out previously seen and read activities while retrieving notifications?

查看:59
本文介绍了如何在检索通知时过滤掉以前看到和阅读的活动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我们为用户提供了通知提要,并带有分组公式

In my app We have notification feed for users, with grouping formula

{{ verb }}_{{ time.strftime('%Y-%m-%d') }}

当检索到 User1 通知时,它有 1 个喜欢"操作的通知.赞"通知有 3 个活动,表示三个用户赞了 user1 的帖子.所以显示的通知文本是:

When User1 notifications are retrieved, it is having 1 notification for a "like" action. "Like" notification is having 3 activities, means three users have liked user1’s post. So Notification text displayed is:

3 位用户喜欢您的帖子

3 users likes your post

User1 的通知被标记为已读和看到,之后又有 2 个用户喜欢 user1 的帖子.现在,当 user1 检索通知时,他将收到 1 个通知,并且该组中有 5 个活动.团体演员人数为 5 人.

User1 notification are marked read and seen, After that 2 more users like user1’s post. Now when user1 retrieve notifications, He will get 1 notification and there are 5 activities in the group. Actor count for group is 5.

所以显示的通知文本是:

So Notification text displayed is:

5 位用户喜欢您的帖子

5 users likes your post

由于用户 1 已经看过前 3 个活动并且已经阅读了这些通知,所以这些通知会再次重复.只有两个活动是新的,但 User1 仍在获取所有 5 个活动.因为活动不知道它们之前被看到/阅读过.

As User1 have already seen previous 3 activities and already read those notifications, those are get repeated again. Only two activities are new but User1 is still getting all the 5 activities. Because activities do not know they are seen/read before.

它仍在计算群组中较早的看过和阅读过的活动.我们可以在检索通知时跳过这些以前看到和阅读的活动吗?

It is still counting older seen and read activities in the group. Can we skip these previously seen and read activities while retrieving notifications ?

推荐答案

读取状态保持在活动组级别,每次更新组时(添加新活动时),它都会从已读重置为未读.因此,对您所问的直接回答是否定的,不可能只检索组中的新活动.

Read state is kept at the activity group level and it resets from read to unread each time the group is updated (when a new activity is added). So a straight answer to what you are asking would be no, it's not possible to only retrieve the new activities in a group.

从您的描述来看,您似乎并不真正关心分组,而只想通知新事件.如果是这种情况,您可以尝试按 {{ id }} 分组,以便每个活动组始终有 1 个活动.

From how you describe things, it sounds like you don't really care about grouping and only want to notify about new events. If that's the case you can try to group by {{ id }} so that each activity group will always have 1 activity.

这篇关于如何在检索通知时过滤掉以前看到和阅读的活动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆