HomeDevCentral

Compute Twitter text of status update length with t.co link wrapping

Authored by dereckson on Jan 13 2017, 09:44.

Description

Compute Twitter text of status update length with t.co link wrapping

Summary:
Twitter replaces links by t.co links.

As such, links are currently counted as 23 characters.
This link size is dynamic and we fetch it from configuraiton

New commands:
'.twitter reconfigure' refreshes the link size

New behavior:
Commands like !pub !idée counts links size correctly

New registry variables:

  • twitter.short_url_length: the cached link length
  • twitter.default_account: the account used for /help/configuration API calls

Reference:

Test Plan:
Unit tests have been added for the URL links count.

.twitter reconfigure has been tested on Dæghrefn:

.tcl registry set twitter.short_url_length 1000
Tcl:
.tcl twitter_get_short_url_length
Tcl: 1000
.twitter reconfigure
[09:49:16] #Dereckson# twitter reconfigure
.tcl twitter_get_short_url_length
Tcl: 23

Reviewers: dereckson

Reviewed By: dereckson

Differential Revision: https://devcentral.nasqueron.org/D829