-
Notifications
You must be signed in to change notification settings - Fork 6
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
Make notifications permanently dismissed #283
Conversation
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 think this is going in the direction we need. However, there are some changes in the logic we should make here.
From @agjohnson's comment in #46 (comment)
Implement cookie/local storage tracking of per-build notification dismissal. Subsequent page loads don't show the notification at all.
I understand we shouldn't dismiss this notification for all the PRs just by closing the notification, but only on this particular build. So, we should save the build.pk
in the storage so we know on which build we shouldn't show.
That is, closing the notification on the first page, won't show it on any of the following page from the same build. Then, if the PR is rebuilt, it will show the notification again.
Besides, if the user opens a different PR preview the notification will be shown again.
Also, note that this addons shows a notification for PR builder and for stable/latest versions so the storage will affect those as well. We may want to split this notification addon (see #201) before moving forward with this or consider this scenario here.
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.
This approach looks good to me! 👍🏼
Is it ready to merge? I'm asking because it's in Draft and I'm not sure if you are still working on it or not, @zanderle
No, I just need to use these new functions in the search addon as well. Also are we ok with the behaviour implemented here (in terms of permanently dismissing the notification), or does that require further testing/discussion? |
I think this approach is fine. I understand the local storage is based on the domain, right? In that case, dismissing a notification on a pull request won't affect latest/stable notifications, which is great. However, dismissing a latest notification on Am I correct? |
We also serve multiple projects under the same domain, when they are subprojects. So, I think we should save the |
Tracking this per subproject could be too granular, and tracking per version feels really granular. There is a good chance that if a user dismisses this once they will want it dismissed everywhere. If a user has to dismiss notifications for each version, it will feel like dismissal isn't working correctly. For me, this keeps coming back to prompting the user for what they want -- dismiss for now, for this project, for all projects of parent project, etc. For that, tracking the subproject is okay, as long as our plan for storage/data allow these patterns later. |
If the user see a notification "this is an old version" for a project and dismiss it, and then open an old version of a subproject, I think we should show the notification again. They are different projects and different versions, so the user should be warned about reading an outdated version of the subproject to avoid confusions. That's the v1 of the implementation. In a next iteration we can work on the granularity and configuration/prompting, but we are not there yet. |
That is fine for the latest/stable build warning, but the PR build warning is still fairly different. As a user, I understand what I'm seeing is a PR build after clicking through from the PR once or twice. Reminding me every time, and requiring me to close the notification every PR, is what feels redundant. This notification is in a different class as it's not for reader users but for the maintainer, who interacts with the notification frequently. |
Yes, PR notification and stable/latest should behave differently. In fact, I want to split this addon into different ones because we've reach this differences in behavior multiple times already and having only 1 addon for all of them makes everything harder and more confusing. |
@zanderle can you implement the initial version of the dismiss that consider domain, project, version and language slug? Behavior:
In the next iteration we will split the notification addon and consider the user configuration (e.g. dismiss all PR notifications always for all the domains, etc) |
@humitos I think I can. Let me dig in, and I'll let you know in case I run into any complications. |
3a649cf
to
acdfec8
Compare
@humitos Ok, so project is covered by the domain name, and I can add Is it ok to rely on the domain name to consider project, or should that be a separate thing as well? |
If we want to give users notifications for each subproject, we will need to use the project slug. I'd like to see this merged soon so we can fix this UX bug with notifications. I feel we're maybe getting deep into optimizing this up front for use cases. We instead could start with something simple, what's here now, and make dismissals more granular as we continue working on this. This PR has felt like it was really close, what is left to be able to merge a fix for dismissing PR build notifications? Reworking methods the search addon uses, maybe tests? |
@agjohnson yeah, at this point what's left is changing the local storage key and some tests (although I'll have to check if cookies complicate things at all). I was going to also rework the search addon to use the same util functions, but that could also be a separate PR, if you wanted to expedite this one? |
@zanderle yes, we should use those three variables for the local storage key:
|
4fe12db
to
458b35b
Compare
to make it easier for future changes
458b35b
to
fae02e2
Compare
fae02e2
to
cb9a62e
Compare
@humitos this should be ready for review, except for tests. I'm trying to figure out what would be the best way to test the behaviour |
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.
It looks good to me 👍🏼 . I left some comments with suggestions. Let me know.
edb1a9a
to
52ea194
Compare
tests/notification.test.html
Outdated
}; | ||
const localStorageString = JSON.stringify(addonInformation); | ||
getLocalStorageStub | ||
.withArgs("readthedocs-Notification-storage-key") |
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.
Does it make sense to use addon.getLocalStorageKeyFromConfig(config)
here (and other places) instead of hardcoding it?
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 think it's better to hardcode it, because this way we also test that we don't get some accidental readthedocs-undefined-storage-key
or something like that.
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 did some small tests locally and it works fine to me 💯 . Thanks @zanderle for working on this feature with all the back and forth we had 😄 . I really appreciate it 🙏🏼
Of course, my pleasure. I hope we got it right in the end 😅👍🏻
…On 20 Jun 2024 at 17:56 +0200, Manuel Kaufmann ***@***.***>, wrote:
@humitos approved this pull request.
I did some small tests locally and it works fine to me 💯 . Thanks @zanderle for working on this feature with all the back and forth we had 😄 . I really appreciate it 🙏🏼
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
…#353) Fixes #296 A few considerations here: - I used the new localStorage code that we added in #283 . This means the key for localStorage will change once this is deployed, meaning that previous recent searches won't show up anymore (and there will be an unused object in localStorage lying around). Are we ok with that, or do we want to make it backward compatible? - I didn't add any logic for removing recent searches from previous versions. If we don't add anything, this object will grow and grow and it will store recent searches of versions that might become very old. Do we want to add some kind of logic in this PR or should we do it in a separate PR? - Besides project and version, I also added language to the key (the same way we do it for notifications). Is that ok? --------- Co-authored-by: Manuel Kaufmann <humitos@gmail.com>
POC for now
Closes #46