GitHost.io will be shut down on June 1, 2019. At that point this instance will be unreachable and all data will be irrevocably deleted. More details at https://about.gitlab.com/gitlab-hosted/#githost-is-shutting-down-on-june-1st-2019

Commit 5af96d3e authored by vinz's avatar vinz

fixed hard coded twitter char limit

parent 250221ff
......@@ -401,11 +401,11 @@ function format_status($notice)
$statusWithoutLinks = preg_replace('`((http|https|ftp)://[^\s<]+[^\s<\.)])`i', '', $statustxt);
$statusLength = mb_strlen($statusWithoutLinks) + $numberOfLinks * 23;
// Twitter still has a 140-char hardcoded max.
if ($statusLength > 140) {
// Twitter raised it but still has a 280-char hardcoded max.
if ($statusLength > 280) {
$noticeUrl = common_shorten_url($notice->getUrl());
// each link uses 23 chars on twitter + 3 for the ' … ' => 26
$statustxt = mb_substr($statustxt, 0, 140 - 26) . ' … ' . $noticeUrl;
$statustxt = mb_substr($statustxt, 0, 280 - 26) . ' … ' . $noticeUrl;
}
return $statustxt;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment