forked from GNUsocial/gnu-social
Conversation ID now gets set from initial notice.
This will work without much extra effort because there will always be more notices (higher value) than conversations (so no collisions). But please run upgrade.php to avoid having an autoincrement id on conversation table. Installations using code after 2014-03-01 will have identical conversation IDs to the initial (conversation root) notice IDs. This will not affect older installations, which will have very different values.
This commit is contained in:
@@ -165,12 +165,6 @@ class TwitterImport
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($notice->conversation)) {
|
||||
$conv = Conversation::create();
|
||||
$notice->conversation = $conv->id;
|
||||
common_log(LOG_INFO, "No known conversation for status {$statusId} so making a new one {$conv->id}.");
|
||||
}
|
||||
|
||||
$notice->is_local = Notice::GATEWAY;
|
||||
|
||||
$notice->content = html_entity_decode($this->linkify($status, FALSE), ENT_QUOTES, 'UTF-8');
|
||||
@@ -180,11 +174,19 @@ class TwitterImport
|
||||
|
||||
$id = $notice->insert();
|
||||
|
||||
if (!$id) {
|
||||
if ($id === false) {
|
||||
common_log_db_error($notice, 'INSERT', __FILE__);
|
||||
common_log(LOG_ERR, __METHOD__ . ' - Problem saving notice.');
|
||||
}
|
||||
|
||||
if (empty($notice->conversation)) {
|
||||
$orig = clone($notice);
|
||||
$conv = Conversation::create($notice);
|
||||
common_log(LOG_INFO, "No known conversation for status {$statusId} so a new one ({$conv->id}) was created.");
|
||||
$notice->conversation = $conv->id;
|
||||
$notice->update($orig);
|
||||
}
|
||||
|
||||
Event::handle('EndNoticeSave', array($notice));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user