openimsdk / open-im-server

IM Chat
https://openim.io
Apache License 2.0
13.61k stars 2.4k forks source link

[BUG] offlinePush of notification config didn't work #2390

Closed onenameneo closed 3 weeks ago

onenameneo commented 1 month ago

OpenIM Server Version

3.7

Operating System and CPU Architecture

Linux (AMD)

Deployment Method

Docker Deployment

Bug Description and Steps to Reproduce

目前在项目中我们使用FCM的离线推送,当用户离线时,对用户进行的群操作,比如 邀请进群,openIM会推送离线消息, 截屏 2024-07-03 17 33 30 这个 [NEWMSG] 应该时调用firebase推送入参的 title、desc 都未设置 我们尝试修改了notification的配置 举例:

memberInvited:
  isSendMsg: true
  reliabilityLevel: 1
  unreadCount: false
  offlinePush:
    enable: false
    title: "memberInvited title"
    desc: "memberInvited desc"
    ext: "memberInvited ext"

offlinePush中的配置并未生效,enable 无论 true 或者 false 都是都会推送离线消息。 如果修改 isSendMsg 为 false,那么这个memberInvited操作在线消息和离线消息都不会发送。

kubbot commented 1 month ago

Hello! Thank you for filing an issue.

If this is a bug report, please include relevant logs to help us debug the problem.

Join slack 🤖 to connect and communicate with our developers.

printlin commented 1 month ago

Hi, I have thoroughly reviewed the memberInvited handling logic regarding notifications. I can confirm that the offlinePush configuration item in the notification configuration file only uses the enable parameter, and this parameter is loaded but not used. I have replicated your issue and have also fixed it locally; this solution is feasible. I believe there is a design conflict in OpenIM, or the functionality is not fully implemented. It appears that the offline push notifications for system notifications have not been implemented. I am attempting to implement this functionality, which involves a significant amount of work and changes to other projects, so it will take some time.

printlin commented 1 month ago

After careful inspection, I found that only minor changes are needed to fix this bug. I have submitted a PR.

onenameneo commented 2 weeks ago

@printlin Hello, we have deployed using the latest version of Docker and tested the offline push configurations for 'memberInvited' and 'memberKicked'. The issue has not been resolved; the offlinePush still do not take effect.

case 1

memberInvited:
  isSendMsg: true
  reliabilityLevel: 1
  unreadCount: false
  offlinePush:
    enable: false
    title: "memberInvited title"
    desc: "memberInvited desc"
    ext: "memberInvited ext"

offlinePush.enable = false , still get [NEWMSG] offline message

case 2

memberInvited:
  isSendMsg: true
  reliabilityLevel: 1
  unreadCount: false
  offlinePush:
    enable: true
    title: "Hi.test title"
    desc: "Hi.test desx"
    ext: "test"

still get [NEWMSG] offline message

case 3

memberInvited:
  isSendMsg: false
  reliabilityLevel: 1
  unreadCount: false
  offlinePush:
    enable: true
    title: "Hi.test title"
    desc: "Hi.test desx"
    ext: "test"

change isSendMsg to false, the message will not be pushed, 'isSendMsg' is worked.

printlin commented 2 weeks ago

Okay, I will follow up

printlin commented 2 weeks ago

I was unable to reproduce your issue. I deployed using the source code on the release-v3.8 branch, and all configurations match my expectations. To verify, I also printed the title and content at the Push source code, and everything appears normal. Perhaps you could double-check if you are using the latest code. I have done all the verification methods I can think of and there have been no issues. If you have any questions, tell me