*
* @see SettingsAction
*/
-
class TwittersettingsAction extends ConnectSettingsAction
{
/**
*
* @return void
*/
-
function showContent()
{
if (!$user->password) {
$this->elementStart('p', array('class' => 'form_guide'));
+ // @todo FIXME: Bad i18n (patchwork in three parts).
$this->text(_m('Disconnecting your Twitter ' .
'could make it impossible to log in! Please '));
$this->element('a',
$this->text(_m(' first.'));
$this->elementEnd('p');
} else {
-
+ // TRANS: %1$s is the current website name.
$note = _m('Keep your %1$s account but disconnect from Twitter. ' .
'You can use your %1$s password to log in.');
if (common_config('twitterimport','enabled')) {
$this->elementStart('li');
$this->checkbox('noticerecv',
- _m('Import my Friends Timeline.'),
+ _m('Import my friends timeline.'),
($flink) ?
($flink->noticesync & FOREIGN_NOTICE_RECV) :
false);
*
* @return void
*/
-
function handlePost()
{
// CSRF protection
*
* @return void
*/
-
function removeTwitterAccount()
{
$user = common_current_user();
$flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
- $result = $flink->delete();
+ if (empty($flink)) {
+ $this->clientError(_m('No Twitter connection to remove.'));
+ return;
+ }
+
+ $result = $flink->safeDelete();
if (empty($result)) {
common_log_db_error($flink, 'DELETE', __FILE__);
*
* @return void
*/
-
function savePreferences()
{
$noticesend = $this->boolean('noticesend');
}
$original = clone($flink);
+ $wasReceiving = (bool)($original->noticesync & FOREIGN_NOTICE_RECV);
$flink->set_flags($noticesend, $noticerecv, $replysync, $friendsync);
$result = $flink->update($original);
return;
}
+ if ($wasReceiving xor $noticerecv) {
+ $this->notifyDaemon($flink->foreign_id, $noticerecv);
+ }
+
$this->showForm(_m('Twitter preferences saved.'), true);
}
+ /**
+ * Tell the import daemon that we've updated a user's receive status.
+ */
+ function notifyDaemon($twitterUserId, $receiving)
+ {
+ // todo... should use control signals rather than queues
+ }
+
}