Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

mentions not working when tag is at offset 0 #857

Open
shellmage opened this issue Jan 1, 2021 · 5 comments
Open

mentions not working when tag is at offset 0 #857

shellmage opened this issue Jan 1, 2021 · 5 comments

Comments

@shellmage
Copy link

this doesn't work

        var msg = {
                body: 'user',
                mentions:
                [{
                        tag: 'user',
                        id: 0000000000,
                }]
        }

while this works just fine

        var msg = {
                body: 'Xuser',
                mentions:
                [{
                        tag: 'user',
                        id: 0000000000,
                }]
        }
@shellmage
Copy link
Author

a found that a work-around is to add an empty character like so

        emptyChar = '\u200e'
        var msg = {
                body: emptyChar + 'user',
                mentions:
                [{
                        tag: 'user',
                        id: 0000000000,
                }]
        }

I don't think this is a bug in the API, I checked the handleMentions i couldn't find anything wrong
if someone can confirm this is a server-side bug and not and API bug, just add this note to the docs and close the issue.

shellmage added a commit to shellmage/facebook-chat-api that referenced this issue Jan 3, 2021
@shellmage shellmage changed the title mentions doesn't work when the tag is the first word or the message body (at index 0) mentions not working when tag is at offset 0 Jan 3, 2021
@Schmavery
Copy link
Owner

What does the browser client do in this case? or is it impossible to send such a message without the API?

@shellmage
Copy link
Author

it works fine on the browser, this edge-case only happens when using the api
when the tag is at offset 0, it doesn't get highlighted as if there was no mentions at all

@BadAimWeeb
Copy link
Contributor

BadAimWeeb commented Jan 6, 2021

this is a server-side bug, because the endpoint that this api used is not being used anymore AFAIK (debugging on both latest Chrome and Firefox version), instead everything was moved to MQTT.

btw facebook is using some weird things called LS (send data in /ls_req, receive data & messages (encrypted inside a F***ING FUNCTION) in /ls_resp)

@shellmage
Copy link
Author

yeah, this (PR #858 ) is basically a work-around for this server-side bug, so that the developers can use this API
without thinking about it (I personally wasted quite some time trying to figure out what's the problem
and how to work-around it while trying to implement an @‎everyone group-chat feature

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

No branches or pull requests

3 participants