hippware / rn-chat

MIT License
5 stars 0 forks source link

User's location as shown on map is incorrect #4881

Open bengtan opened 4 years ago

bengtan commented 4 years ago

Reported at https://hippware.slack.com/archives/C2V6L53TQ/p1583441178063700 and spun out from https://github.com/hippware/rn-chat/issues/3802#issuecomment-595443051

Staging Version: 4.40.2 User Scurry was sharing live location (When Nearby) with user Pixel. User Pixel was on the HS when scurry switched the setting from When Nearby to Always. The avatar Pixel was currently viewing changed to scurry's avatar and also noting that the card displayed scurry was in Mooreland. This did not correct itself during the user session and remains an issue after multiple kill/reloads. Also noting that I was seeing this across clients on 2 different devices/accounts. I'm not sure what remedied this but at some point after the bugsnag #4877 was generated everything was back to normal.

image

bengtan commented 4 years ago

Ugh, it looks like scurry's phone uploaded a location data point which had the coordinates of the the place in Mooreland.

But it's not an RNBGL upload. It's an embedded location data point (ie. embedded within some other operation like subscribing to a bot or something). So I guess app got it's wires crossed and embedded the wrong data point somehow.

This is a preliminary finding. I'll continue to dig further.

bengtan commented 4 years ago

Alright, found it.

  1. User scurry issued a friendShareUpdate operation (I guess by switching live location share between Always and Nearby?) to user pixel.
  2. The friendShareUpdate operation allows a location data point to be embedded. This data point refreshes, on the server side, the location of the issuer. In this case, the issuer is the location sharer. In this case, scurry.
  3. There is a bug, whereby, instead of embedding the location of the location sharer, the app is embedding the location of the location sharee/sharedWith/watcher (ie. pixel)

Specifically, in this code in Profile.ts:

        shareLocationUpdate: flow(function*(
          shareType?: FriendShareTypeEnum,
          shareConfig?: IFriendShareConfig
        ) {
          yield self.transport.friendShareUpdate(self.id, self.location, shareType, shareConfig)
          self.shareType = shareType
          self.shareConfig = shareConfig
        }),

self.location should be replaced by something like self.service.profile.location.

bengtan commented 4 years ago

Notes to self:

  1. There is also an embedded location data point in updateBot

  2. If in hidden/invisible mode, ensure no location data points are embedded.

If not done as part of this ticket, should be it's own separate ticket.

mstidham commented 4 years ago

Verified on Staging Version: 4.41.0