We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit e0620285 authored by Evan Prodromou's avatar Evan Prodromou

Make sure reshare notices get the right object_type and verb

parent f77c850b
...@@ -44,6 +44,7 @@ function main() ...@@ -44,6 +44,7 @@ function main()
initInbox(); initInbox();
fixupGroupURI(); fixupGroupURI();
initLocalGroup(); initLocalGroup();
initNoticeReshare();
} }
function tableDefs() function tableDefs()
...@@ -258,4 +259,28 @@ function initLocalGroup() ...@@ -258,4 +259,28 @@ function initLocalGroup()
printfnq("DONE.\n"); printfnq("DONE.\n");
} }
function initNoticeReshare()
{
printfnq("Ensuring all reshares have the correct verb and object-type...");
$notice = new Notice();
$notice->whereAdd('repeat_of is not null');
$notice->whereAdd('(verb != "'.ActivityVerb::SHARE.'" OR object_type != "'.ActivityObject::ACTIVITY.'")');
if ($notice->find()) {
while ($notice->fetch()) {
try {
$orig = Notice::staticGet('id', $notice->id);
$notice->verb = ActivityVerb::SHARE;
$notice->object_type = ActivityObject::ACTIVITY;
$notice->update($orig);
} catch (Exception $e) {
printfv("Error updating verb and object_type for {$notice->id}:" . $e->getMessage());
}
}
}
printfnq("DONE.\n");
}
main(); main();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment