From e48efd322279fd67168957635fa30cf4cb46f81b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 12 Oct 2009 22:36:17 +0000 Subject: Workaround for Facebook data store API behavior regression, fixes saving of empty notice prefix text in facebook settings. Filed bug upstream at http://bugs.developers.facebook.com/show_bug.cgi?id=7110 Per documentation, saving a pref value of "" or "0" will delete the pref key: http://wiki.developers.facebook.com/index.php/Data.setUserPreference which used to do what we want... Now Facebook throws back an error "Parameter value is required" when we do this. Workaround appends a space to empty string or "0" at save time, then trims the string when we load it. The input string was already trimmed at pref save time, so this won't alter any user-visible behavior. Thanks to ^demon in #mediawiki for pointing out the behavior regression after testing the identi.ca Facebook app! --- lib/facebookutil.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/facebookutil.php') diff --git a/lib/facebookutil.php b/lib/facebookutil.php index f5121609d..c991c5439 100644 --- a/lib/facebookutil.php +++ b/lib/facebookutil.php @@ -99,8 +99,8 @@ function facebookBroadcastNotice($notice) // XXX: Does this call count against our per user FB request limit? // If so we should consider storing verb elsewhere or not storing - $prefix = $facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX, - $fbuid); + $prefix = trim($facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX, + $fbuid)); $status = "$prefix $notice->content"; -- cgit v1.2.3-54-g00ecf