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

Update thread fields in utils.formatThread #488

Merged
merged 6 commits into from
Jun 12, 2017

Conversation

kieferlam
Copy link
Contributor

@kieferlam kieferlam commented Jun 12, 2017

This PR changes some of the properties in formatThread. I removed some deprecated fields and added the missing fields that were available in the payload but not to the user.

This also somewhat resolves #485 by removing the field from the DOCS and formatThread

Notable changes:

  • muteSettings -> muteUntil: is the timestamp for which the thread is muted until. -1 is forever.
  • -canonicalFbid
  • +lastMessageTimestamp + lastReadTimestamp
  • +adminIDs
  • +threadType

@Schmavery
Copy link
Owner

Thanks for updating this, @mangopearapples
As always when we're updating the public interface like this, is it possible to get any more info about what is in these new fields? It would be amazing if we could update the docs to have this information too, but that might be out of scope for this change (I would give lots of emoji hearts to whoever takes on that task).
If facebook has stopped serving some of this data, I'm ok to remove it, but we should try to be at least a little careful not to add more data people won't know how to use?

@kieferlam
Copy link
Contributor Author

You're right about adding data people won't know how to use. Should I remove them? I had somewhat considered this and ignored some properties like ephemeral_ttl_mode but I though fields like adminIDs and lastMessageTimestamp were self explanatory.

Are there any particular fields you should not be added?

I will update docs to include description.

@Schmavery
Copy link
Owner

isPinProtected/adminIDs/threadType/reactionsMuteMode/mentionsMuteMode
Maybe these correspond to thread features I'm unaware of?

@Schmavery
Copy link
Owner

Also, searching through the repo, it looks like formatThread is used by 3 functions: getThreadList, getThreadInfo, and searchForThread. Which of these were you able to test with the changes? Do we receive all the values in all these cases?

@kieferlam
Copy link
Contributor Author

@Schmavery Are doc formats like this okay?

Also from what's available to me, adminIDs are members that are admins in groups in chats belonging to a Facebook group. E.g. .

threadType seems to be '1' for normal user chats and '2' for group chats and maybe different values for chats from pages. More testing is needed for this but I think it is useful data for the user.

I was assuming mentions and reactions can be muted in the settings but maybe not. I will remove isPinProtected, reactionsMuteMode, and mentionsMuteMode. Is this okay?

I have tested with getThreadList and getThreadInfo which give identical values (apart from getThreadList being an array of course). I was unaware of searchForThread so more testing on that needs to be done.

@kieferlam
Copy link
Contributor Author

After a bit of research, doesn't look like Facebook uses search_threads.php anymore. Instead, it uses GraphQL. Issue #396 seems to correspond with this too. I can't get searchForThread to give me any thread data so I can't know if a successful call will give me appropriate values.

@Schmavery
Copy link
Owner

Great, thanks a lot for following up on this. Threadtype looks very interesting, we were using getUserInfo in a hacky way to get this info, but maybe we can switch over now. I wonder how much this overlaps with isCanonical (I never knew what a canonical thread was until now).
Thanks for trying out getThreadList and getThreadInfo. The doc changes are great.

DOCS.md Outdated
| mentionsMuteMode | |
| isCanonicalUser | True if the other user in a canonical thread is a user, false if the other user is a page or group. |
| isCanonical | True if the thread is a private chat to a single user, false for group chats. |
| isPinProtected | |
Copy link
Owner

@Schmavery Schmavery Jun 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be removed now? (same comment for the mutemodes)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep forgot about that one. Done

@Schmavery Schmavery merged commit 3873c71 into Schmavery:master Jun 12, 2017
@Schmavery
Copy link
Owner

Thanks!

@kieferlam kieferlam deleted the hotfix/formatThread-fields-fix branch June 12, 2017 19:39
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getThreadInfo formerParticipants is null
2 participants