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: Expedite scheduled push notifications when user switches from online to away/offline #19104

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ceefour
Copy link
Contributor

@ceefour ceefour commented Oct 1, 2020

Proposed changes

Expedite scheduled push notifications when user switches from online to away/offline

Issue(s)

Fixes #19097

How to test or reproduce

  1. Android app is online/foreground
  2. Kill the app or switch to another app
  3. Make sure that user's statusConnection is still online (this is another issue probably for Rocket.Chat.ReactNative how this sometimes can happen, but it does happen and quite easy to reproduce by just using the phone's task killer)
    • Reproducible easily using Samsung A50
    • I also tried using Realme X2 Pro and it's very hard to kill the app without making the app's status go offline. But this works: open Rocket.Chat for Android, turn on airplane mode, kill the app, turn off airplane mode, now Rocket.Chat server user's statusConnection is still online.
  4. Server has a posted message, and since user statusConnection is online according to server, meaning push is scheduled in 120 seconds
  5. Before message is received by app, and before 120 seconds timed out, user statusConnection is now either offline or away.

New behavior:

  1. For documents in NotifcationQueue, will set schedule to now = new Date(), meaning push will be sent soon by worker

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Hotfix (a major bugfix that has to be merged asap)
  • Documentation Update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable) -- inline in all 3 changed source files
  • Any dependent changes have been merged and published in downstream modules

Changelog

Expedite scheduled push notifications when user switches from online to away/offline

Further comments

Improves upon #17357, #17907, RocketChat/Rocket.Chat.ReactNative#2507, and #19061

@CLAassistant
Copy link

CLAassistant commented Dec 17, 2021

CLA assistant check
All committers have signed the CLA.

@ceefour
Copy link
Contributor Author

ceefour commented Dec 19, 2021

I tried to resolve conflict but it seems the API has changed in the latest develop ?

import { UserStatus } from '../../../definition/UserStatus';
import { api } from '../../../server/sdk/api';

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

Successfully merging this pull request may close these issues.

Scheduled push notification is not sent immediately when user switches from online to away/offline
3 participants