Skip to content
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

Fix web notification icon not updated once you read all notifications #31447

Merged
merged 3 commits into from
Jun 23, 2024

Conversation

kiatt210
Copy link
Contributor

Fix #29065
Remove status filtering from GetUIDsAndNotificationCounts sql.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 21, 2024
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 21, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Jun 21, 2024
@wxiaoguang
Copy link
Contributor

Could you add some details about how it fixes the problem? TBH I haven't caught the point 🤣

@kiatt210
Copy link
Contributor Author

I'm sorry, of course 🙂

When the number of unread notifications becomes 0, the original SQL query does not return the user's row.
As a result, there will not be a new notification-count event to update the icon. With this modification, the user's row will be included in the result with 0 count, and the event will be triggered.

The event generation :

uidCounts, err := activities_model.GetUIDsAndNotificationCounts(ctx, then, now)
if err != nil {
	log.Error("Unable to get UIDcounts: %v", err)
}
for _, uidCount := range uidCounts {
	m.SendMessage(uidCount.UserID, &Event{
		Name: "notification-count",
		Data: uidCount,
	})
}

Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM

The details could be written into comments.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 22, 2024
wxiaoguang

This comment was marked as outdated.

@wxiaoguang wxiaoguang self-requested a review June 22, 2024 07:16
@GiteaBot GiteaBot added lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 22, 2024
@kiatt210
Copy link
Contributor Author

I need to find out how to get the missing UIDs, but I am going to try.

Thanks for the idea!

@wxiaoguang
Copy link
Contributor

Read the code again, it seems that it is impossible to figure out the non-existing IDs quickly.

So current method should be good enough. Let's try it.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 22, 2024
@wxiaoguang wxiaoguang added this to the 1.23.0 milestone Jun 22, 2024
@wxiaoguang wxiaoguang added type/bug backport/v1.22 This PR should be backported to Gitea 1.22 labels Jun 22, 2024
@wxiaoguang wxiaoguang changed the title Fix Web notification icon not updated once you read said notifications (go-gitea#29065) Fix web notification icon not updated once you read all notifications Jun 22, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 23, 2024
@wxiaoguang wxiaoguang merged commit 6a96deb into go-gitea:main Jun 23, 2024
26 checks passed
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Jun 23, 2024
…go-gitea#31447)

Fix go-gitea#29065
Remove status filtering from GetUIDsAndNotificationCounts sql.

---------

Co-authored-by: kiatt210 <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Jun 23, 2024
wxiaoguang added a commit that referenced this pull request Jun 23, 2024
…#31447) (#31466)

Backport #31447 by kiatt210

Fix #29065
Remove status filtering from GetUIDsAndNotificationCounts sql.

Co-authored-by: kiatt210 <[email protected]>
Co-authored-by: kiatt210 <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jun 24, 2024
* giteaofficial/main:
  Disable issue/PR comment button given empty input (go-gitea#31463)
  Simplify 404/500 page (go-gitea#31409)
  Fix web notification icon not updated once you read all notifications (go-gitea#31447)
  Switch to "Write" tab when edit comment again (go-gitea#31445)
  Add simple JS init performance trace (go-gitea#31459)
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created backport/v1.22 This PR should be backported to Gitea 1.22 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Web notification icon not updated once you read said notifications
4 participants