Don't do saveKnownReplies unless it's a verb=post

This commit is contained in:
Mikael Nordfeldth 2015-12-31 02:31:35 +01:00
parent 66289d3e76
commit 7cf6aaecd0

View File

@ -685,8 +685,10 @@ class Notice extends Managed_DataObject
// Clear the cache for subscribed users, so they'll update at next request // Clear the cache for subscribed users, so they'll update at next request
// XXX: someone clever could prepend instead of clearing the cache // XXX: someone clever could prepend instead of clearing the cache
// Save per-notice metadata... // Only save 'attention' and metadata stuff (URLs, tags...) stuff if
// the activityverb is a POST (since stuff like repeat, favorite etc.
// reasonably handle notifications themselves.
if (ActivityUtils::compareVerbs($stored->verb, array(ActivityVerb::POST))) {
if (isset($replies)) { if (isset($replies)) {
$notice->saveKnownReplies($replies); $notice->saveKnownReplies($replies);
} else { } else {
@ -710,6 +712,7 @@ class Notice extends Managed_DataObject
} else { } else {
$notice->saveUrls(); $notice->saveUrls();
} }
}
if ($distribute) { if ($distribute) {
// Prepare inbox delivery, may be queued to background. // Prepare inbox delivery, may be queued to background.
@ -965,6 +968,10 @@ class Notice extends Managed_DataObject
// Used primarily for OStatus (and if we don't federate, all attentions would be local anyway) // Used primarily for OStatus (and if we don't federate, all attentions would be local anyway)
Event::handle('GetLocalAttentions', array($actor, $act->context->attention, &$mentions, &$group_ids)); Event::handle('GetLocalAttentions', array($actor, $act->context->attention, &$mentions, &$group_ids));
// Only save 'attention' and metadata stuff (URLs, tags...) stuff if
// the activityverb is a POST (since stuff like repeat, favorite etc.
// reasonably handle notifications themselves.
if (ActivityUtils::compareVerbs($stored->verb, array(ActivityVerb::POST))) {
if (!empty($mentions)) { if (!empty($mentions)) {
$stored->saveKnownReplies($mentions); $stored->saveKnownReplies($mentions);
} else { } else {
@ -988,6 +995,7 @@ class Notice extends Managed_DataObject
} else { } else {
$stored->saveUrls(); $stored->saveUrls();
} }
}
if ($distribute) { if ($distribute) {
// Prepare inbox delivery, may be queued to background. // Prepare inbox delivery, may be queued to background.
@ -1615,12 +1623,6 @@ class Notice extends Managed_DataObject
function saveReplies() function saveReplies()
{ {
// Don't save reply data for repeats
if ($this->isRepeat()) {
return array();
}
$sender = $this->getProfile(); $sender = $this->getProfile();
$replied = array(); $replied = array();