Remove settting/getting a 'verb' for Facebook stream entries / status

updates. Facebook has disabled the ability to store user preferences
via their old REST API, causing our application to break. Also, verbs
in status updates seem to be deprecated, and stream posts don't seem
to have a verb.
This commit is contained in:
Zach Copley 2010-05-26 20:31:36 +00:00
parent e913d157d2
commit 3e9b356777
2 changed files with 2 additions and 58 deletions

View File

@ -54,22 +54,11 @@ class FacebooksettingsAction extends FacebookAction
$noticesync = $this->boolean('noticesync'); $noticesync = $this->boolean('noticesync');
$replysync = $this->boolean('replysync'); $replysync = $this->boolean('replysync');
$prefix = $this->trimmed('prefix');
$original = clone($this->flink); $original = clone($this->flink);
$this->flink->set_flags($noticesync, false, $replysync, false); $this->flink->set_flags($noticesync, false, $replysync, false);
$result = $this->flink->update($original); $result = $this->flink->update($original);
if ($prefix == '' || $prefix == '0') {
// Facebook bug: saving empty strings to prefs now fails
// http://bugs.developers.facebook.com/show_bug.cgi?id=7110
$trimmed = $prefix . ' ';
} else {
$trimmed = substr($prefix, 0, 128);
}
$this->facebook->api_client->data_setUserPreference(FACEBOOK_NOTICE_PREFIX,
$trimmed);
if ($result === false) { if ($result === false) {
$this->showForm(_m('There was a problem saving your sync preferences!')); $this->showForm(_m('There was a problem saving your sync preferences!'));
} else { } else {
@ -110,16 +99,6 @@ class FacebooksettingsAction extends FacebookAction
$this->elementStart('li'); $this->elementStart('li');
$prefix = trim($this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX));
$this->input('prefix', _m('Prefix'),
($prefix) ? $prefix : null,
_m('A string to prefix notices with.'));
$this->elementEnd('li');
$this->elementStart('li');
$this->submit('save', _m('Save')); $this->submit('save', _m('Save'));
$this->elementEnd('li'); $this->elementEnd('li');

View File

@ -256,11 +256,9 @@ function statusUpdate($notice, $user, $fbuid)
. "Facebook UID: $fbuid" . "Facebook UID: $fbuid"
); );
$text = formatNotice($notice, $user, $fbuid);
$facebook = getFacebook(); $facebook = getFacebook();
$result = $facebook->api_client->users_setStatus( $result = $facebook->api_client->users_setStatus(
$text, $notice->content,
$fbuid, $fbuid,
false, false,
true true
@ -284,12 +282,11 @@ function publishStream($notice, $user, $fbuid)
. "Facebook UID: $fbuid" . "Facebook UID: $fbuid"
); );
$text = formatNotice($notice, $user, $fbuid);
$fbattachment = format_attachments($notice->attachments()); $fbattachment = format_attachments($notice->attachments());
$facebook = getFacebook(); $facebook = getFacebook();
$facebook->api_client->stream_publish( $facebook->api_client->stream_publish(
$text, $notice->content,
$fbattachment, $fbattachment,
null, null,
null, null,
@ -304,38 +301,6 @@ function publishStream($notice, $user, $fbuid)
); );
} }
function formatNotice($notice, $user, $fbuid)
{
// Get the status 'verb' the user has set, if any
common_debug(
"FacebookPlugin - Looking to see if $user->nickname ($user->id), "
. "Facebook UID: $fbuid has set a verb for Facebook posting..."
);
$facebook = getFacebook();
$verb = trim(
$facebook->api_client->data_getUserPreference(
FACEBOOK_NOTICE_PREFIX,
$fbuid
)
);
common_debug("Facebook returned " . var_export($verb, true));
$text = null;
if (!empty($verb)) {
common_debug("FacebookPlugin - found a verb: $verb");
$text = trim($verb) . ' ' . $notice->content;
} else {
common_debug("FacebookPlugin - no verb found.");
$text = $notice->content;
}
return $text;
}
function updateProfileBox($facebook, $flink, $notice, $user) { function updateProfileBox($facebook, $flink, $notice, $user) {
$facebook = getFacebook(); $facebook = getFacebook();