Skip to content

Update tweet message limit. Fixes #35214#35224

Closed
kumarharsh wants to merge 1 commit intomicrosoft:masterfrom
kumarharsh:patch-1
Closed

Update tweet message limit. Fixes #35214#35224
kumarharsh wants to merge 1 commit intomicrosoft:masterfrom
kumarharsh:patch-1

Conversation

@kumarharsh
Copy link
Contributor

Twitter has updated their message limit to 280 characters. This commit updates the message text size.

Twitter has updated their message limit to 280 characters. This commit updates the message text size.
class TwitterFeedbackService implements IFeedbackService {

private static TWITTER_URL: string = 'https://twitter.com/intent/tweet';
private static TWITTER_MESSAGE_SIZE: number = 280;
Copy link
Member

Choose a reason for hiding this comment

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

I think this limit is only 280 for languages other than Chinese, Japanese etc. So I am not sure how to best configure it, we should probably have to check for the language that is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would checking navigator.language be enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think what twitter is doing on their web UI is counting each CJK character as double. Also, they don't show a character limit usually, but rather a circular progress bar. Only when a user approaches the character limit do they start showing the actual characters left.

Copy link
Contributor Author

@kumarharsh kumarharsh Nov 8, 2017

Choose a reason for hiding this comment

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

So, what we can do is implement a counter which counts double for every CJK character (would need to lookup via code-points, maybe?). Your thoughts @bpasero .

Copy link
Member

Choose a reason for hiding this comment

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

@kumarharsh yes if that is what twitter does when they count it seems fine to do the same for us. I think checking for the code-point is a valid approach. Maybe check https://github.com/Microsoft/vscode/blob/master/src/vs/base/common/strings.ts#L574 as inspiration?

Copy link
Contributor Author

@kumarharsh kumarharsh Nov 15, 2017

Choose a reason for hiding this comment

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

@bpasero After digging some more, I think the solution is not so straightforward. I think with some of the new changes which twitter made (excluding urls, handles, etc from the message length), it might be better to use their own service for determining the message limit. The v2 version will support the 280 character limit.

Here is the issue tracking the release of v2 of twitter-text: twitter/twitter-text#196. Would it be ok to wait for it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants