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

通知ベル上の未読通知数のカウントが、未読通知が「100件以上」存在している場合でも「99」になってしまう #7467

Closed
junohm410 opened this issue Feb 29, 2024 · 1 comment

Comments

@junohm410
Copy link
Contributor

概要

画面右上の通知ベル上の未読通知数の表示について、未読通知が「100件以上」存在している場合でも、カウントは「99」となってしまいます。

詳細

実装では、未読通知が100件以上存在している場合は「99+」と表示されることが意図されています。

const unreadNotificationCount = () => {
if (isLoading) return
const count = notifications.length
return count > 99 ? '99+' : String(count)
}

未読の通知を取得するAPIで使用されるNotifcationモデルのスコープby_read_statusにおいて、未読通知の最大取得数が99になっていることが原因と思われます。

scope :by_read_status, ->(status) { status == 'unread' ? unreads.with_avatar.limit(99) : with_avatar }

再現手順

  1. 特定のユーザーが、未読の通知を100件以上持つ状態を作る。
  2. Railsコンソールで、{1のユーザーオブジェクト}.notifications.unreads.countの戻り値が100以上であることを確認する。
  3. サーバーを立ち上げ、1のユーザーでログインする。
  4. 画面右上の通知ベル上のカウント表示が、99であることを確認する。

期待される振る舞い

  • 未読通知が1〜99件存在している場合のあるべき姿は、その数字(199
  • 未読通知が100件以上の場合のあるべき姿は、99+

スクリーンショット

hatsunoに未読通知が215件(100件以上)ある状態を用意。

irb(main):023:0> hatsuno = User.where(login_name: 'hatsuno').first
irb(main):023:0> hatsuno.notifications.unreads.count
   (0.7ms)  SELECT COUNT(*) FROM "notifications" WHERE "notifications"."user_id" = $1 AND "notifications"."read" = $2  [["user_id", 655153192], ["read", false]]
=> 215     

hatsunoでログインすると、通知ベル上のカウントが99になっている。
image

環境

  • OS: MacOS Ventura 13.0
  • ブラウザ: chrome 122.0.6261.69

関連Issue

@masyuko0222
Copy link
Contributor

@komagata @machida
#7539 (comment)
こちらを基にCloseさせて頂きますー

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants