Merge branch 'fix-twitterbridge' into 'nightly'
Fix TwitterBridge imported notices not displaying in timeline See merge request !130
This commit is contained in:
commit
24910f2363
@ -570,4 +570,28 @@ class TwitterBridgePlugin extends Plugin
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the object_type field of previously imported Twitter notices to
|
||||||
|
* ActivityObject::NOTE if they are unset. Null object_type caused a notice
|
||||||
|
* not to show on the timeline.
|
||||||
|
*/
|
||||||
|
public function onEndUpgrade()
|
||||||
|
{
|
||||||
|
printfnq("Ensuring all Twitter notices have an object_type...");
|
||||||
|
|
||||||
|
$notice = new Notice();
|
||||||
|
$notice->whereAdd("source='twitter'");
|
||||||
|
$notice->whereAdd('object_type IS NULL');
|
||||||
|
|
||||||
|
if ($notice->find()) {
|
||||||
|
while ($notice->fetch()) {
|
||||||
|
$orig = Notice::getKV('id', $notice->id);
|
||||||
|
$notice->object_type = ActivityObject::NOTE;
|
||||||
|
$notice->update($orig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printfnq("DONE.\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,10 @@ class TwitterImport
|
|||||||
'twitter',
|
'twitter',
|
||||||
array('repeat_of' => $original->id,
|
array('repeat_of' => $original->id,
|
||||||
'uri' => $statusUri,
|
'uri' => $statusUri,
|
||||||
'is_local' => Notice::GATEWAY));
|
'is_local' => Notice::GATEWAY,
|
||||||
|
'object_type' => ActivityObject::NOTE,
|
||||||
|
'verb' => ActivityVerb::POST
|
||||||
|
));
|
||||||
common_log(LOG_INFO, "Saved {$repeat->id} as a repeat of {$original->id}");
|
common_log(LOG_INFO, "Saved {$repeat->id} as a repeat of {$original->id}");
|
||||||
Notice_to_status::saveNew($repeat->id, $statusId);
|
Notice_to_status::saveNew($repeat->id, $statusId);
|
||||||
return $repeat;
|
return $repeat;
|
||||||
@ -146,18 +149,19 @@ class TwitterImport
|
|||||||
|
|
||||||
$notice = new Notice();
|
$notice = new Notice();
|
||||||
|
|
||||||
$notice->profile_id = $profile->id;
|
$notice->profile_id = $profile->id;
|
||||||
$notice->uri = $statusUri;
|
$notice->uri = $statusUri;
|
||||||
$notice->url = $statusUri;
|
$notice->url = $statusUri;
|
||||||
$notice->verb = ActivityVerb::POST;
|
$notice->verb = ActivityVerb::POST;
|
||||||
$notice->created = strftime(
|
$notice->object_type = ActivityObject::NOTE;
|
||||||
|
$notice->created = strftime(
|
||||||
'%Y-%m-%d %H:%M:%S',
|
'%Y-%m-%d %H:%M:%S',
|
||||||
strtotime($status->created_at)
|
strtotime($status->created_at)
|
||||||
);
|
);
|
||||||
|
|
||||||
$notice->source = 'twitter';
|
$notice->source = 'twitter';
|
||||||
|
|
||||||
$notice->reply_to = null;
|
$notice->reply_to = null;
|
||||||
|
|
||||||
$replyTo = twitter_id($status, 'in_reply_to_status_id');
|
$replyTo = twitter_id($status, 'in_reply_to_status_id');
|
||||||
if (!empty($replyTo)) {
|
if (!empty($replyTo)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user