habitica-android icon indicating copy to clipboard operation
habitica-android copied to clipboard

Liking messages in party chat doesn't always update like count as expected

Open jsoberg opened this issue 1 year ago • 0 comments

Describe the bug I was fixing the issue in #1861 and noticed that while the click callback was being called and we were contacting server to update the message likes, the like count does not always react to these changes in the list. I'm separating this out into its own bug report since it doesn't involve the touch target issue from #1861.

To Reproduce Steps to reproduce the behavior:

  1. Open a party chat.
  2. Like or unlike someone else's message.
  3. Repeat until like count does not update as expected.

Expected behavior The like count should update each time that you like and unlike the message.

Screenshots (clicking on an emulator often through this recording, some updates show and some don't). studio64_6nvwlvRCZf

Smartphone (please complete the following information):

  • Device: Pixel 7 emulator
  • OS: API 33
  • App Version: develop, cc5cd88
  • Habitica Username: jsoberg

Additional context

There appear to be a few issues here that I can see at an initial glance:

  1. SocialRepositoryImpl.likeMessage always returns null, and therefore we never submit an update for that message in GroupViewModel.likeMessage.
  2. RealmSocialLocalRepository.likeMessage doesn't update when the message is already liked, so when we go from liked to unliked we don't make any local changes.

After addressing these issues locally and doing a little debugging, it seems like the message returned from apiClient.likeMessage still ends up not being changed on some calls, so I'm wondering if this could also potentially be an issue on the server and/or an issue with submitting the change within a certain time interval and being ignored.

jsoberg avatar Dec 17 '23 19:12 jsoberg