From aa96c3c1d9823382e9e6de0da5084fcc111f2ee5 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 2 Dec 2010 10:56:44 -0800 Subject: Fix for tickets #2917, #2262: user URL shortening options not being applied in non-web channels common_shorten_links() can only access the web session's logged-in user, so never properly took user options into effect for posting via XMPP, API, mail, etc. Adds an optional $user parameter on common_shorten_links(), and a $user->shortenLinks() as a clearer interface for that. Tweaked some lower-level functions so $user gets passed down -- making the $notice_id param previously there for saving URLs at notice save time generalized a little. Note also ticket #2919: there's a lot of duplicate code calling the shortening, checking the length, and reporting near-identical error messages. These should be consolidated to aid in code and translation maintenance. --- actions/newnotice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actions/newnotice.php') diff --git a/actions/newnotice.php b/actions/newnotice.php index 0d4dcfccd..faafd9551 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -154,7 +154,7 @@ class NewnoticeAction extends Action return; } - $content_shortened = common_shorten_links($content); + $content_shortened = $user->shortenLinks($content); if (Notice::contentTooLong($content_shortened)) { // TRANS: Client error displayed when the parameter "status" is missing. // TRANS: %d is the maximum number of character for a notice. -- cgit v1.2.3-54-g00ecf