-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #2311. #2333
Fixes #2311. #2333
Conversation
group-income Run #3037
Run Properties:
|
Project |
group-income
|
Branch Review |
refs/pull/2333/merge
|
Run status |
Passed #3037
|
Run duration | 10m 55s |
Commit |
f36f7519e4 ℹ️: Merge 329e2c73cb1f60f9ce3afb22c8d97e85cc02c9e0 into 41ff6b74ffb8755e5dce8c254226...
|
Committer | Ricardo Iván Vieitez Parra |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
10
|
Skipped |
0
|
Passing |
111
|
View all changes introduced in this branch ↗︎ |
@@ -107,6 +110,7 @@ export function compareOnPriority (notificationA: Notification, notificationB: N | |||
} | |||
|
|||
export function isExpired (notification: Notification): boolean { | |||
console.error('@@@isExpired', notification, age(notification) > maxAge(notification), age(notification), maxAge(notification), 'read', notification.read) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stray debug logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Questions
// Notifications older than MAX_AGE_UNREAD are discarded | ||
if (age(notification) > MAX_AGE_UNREAD) { | ||
return null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, they are discarded in the getter, but where are they discarded from the state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're discarded from the state when the state is saved (see state/vuex/save
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I genuinely do not see where that happens. Can you point it out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line is literally part of this commit (although the change in question is related but actually a bugfix for a different issue).
As you can see, each time the state is saved, the notifications are filtered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then my logic comprehension might be broken. I saw that line and that line doesn't appear to do be related to these changes here as it is accessing the notifications through the state
(which is unfiltered) unlike this getter. What am I missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What am I missing?
You're missing it here:
(which is unfiltered)
The call to applyStorageRules
does the filtering. Hence, the only the getter
needs to be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks, I think I see what you mean, it's this line:
let items = notifications.filter(item => !isExpired({ ...item, ...status[item.hash] }))
And then the status[item.hash]
supposedly has the correct value to get maxAge
to return MAX_AGE_UNREAD
, is my guess. Although per my other question I'm not super clear on how that would have the correct value, but in my tests this seemed to work so I'll go ahead and approve once the stray debug logging is removed. If there are problems we can return to this later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I'm not sure what's confusing to you, but I can comment on what was somewhat confusing to me.
There are two different things going on: saving or mutating the UI and display concerns. In addition, there notification state is split up into the items
and status
properties. items
is generated when a notification happens, and status
mostly (only?) holds the read / unread status.
The 'saving' part is mostly addressed in this PR by adjusting the constants. That was mostly already working (the change I pointed out in state.js
didn't entirely work because it looks at the read
property, but it wasn't gonna find it because it's usually undefined in items
; the change makes it also look into status
). In short, saving already filters things out based on age.
This PR addresses the UI part. This has two goals:
- Since the
read
state for notifications that are too old (i.e., between the two windows) will not be saved, it setsread
to true for display purposes. - It also filters out notifications that are too old. This is for consistency, but it's not that important since saving the state takes care of removing these old notifications.
This implements the following changes: * Increase KV notification status memory to 2 months * Set Vuex notification memory to 6 months * Automatically mark notifications as read after the notification status memory window (e.g. after 2 months) * Purge notifications from Vuex store that are older than 6 months
8e6bce1
to
329e2c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @corrideat !
This implements the following changes: