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

Update Message.js to catch hidden story share case #46

Merged
merged 2 commits into from
Jan 23, 2021

Conversation

dcts
Copy link
Contributor

@dcts dcts commented Jan 19, 2021

This pull request solves issue #45.

It catches the case of a story share that is hidden. The message data in this case looks like this:
Bildschirmfoto vom 2021-01-19 13-53-36

We could also extract the handle of the story that was hidden from the message string and save it in the this.storyShare.author variable. I am open for suggestions.

@Androz2091 Let me know what you think of this.

catch case when the story share is hidden because of a private account. When not catched it throws an error.
this.storyShareData = {
author: data.story_share.message === 'No longer available' ? null : this.client._patchOrCreateUser(data.story_share.media.user.pk, data.story_share.media.user),
sourceURL: data.story_share.message === 'No longer available' ? null : data.story_share.media.image_versions2.candidates[0].url
if (data.story_share.message === 'No longer available' || data.story_share.message.startsWith("This story is hidden because")) {
Copy link
Contributor Author

@dcts dcts Jan 19, 2021

Choose a reason for hiding this comment

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

that is the message data object that is causing the error (fixed with my code):
Bildschirmfoto vom 2021-01-19 13-53-15

fix bug preventing valid story to be sent
Copy link
Owner

@Androz2091 Androz2091 left a comment

Choose a reason for hiding this comment

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

Thank you! 👍

@Androz2091 Androz2091 merged commit 8933ffb into Androz2091:master Jan 23, 2021
@dcts dcts deleted the patch-2 branch January 23, 2021 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants