Add a url test in Notice::saveActivity

This commit is contained in:
Mikael Nordfeldth 2015-10-13 23:37:26 +02:00
parent 65adefe170
commit 5b307c0417

View File

@ -784,6 +784,26 @@ class Notice extends Managed_DataObject
}
}
$autosource = common_config('public', 'autosource');
// Sandboxed are non-false, but not 1, either
if (!$actor->hasRight(Right::PUBLICNOTICE) ||
($source && $autosource && in_array($source, $autosource))) {
$stored->is_local = Notice::LOCAL_NONPUBLIC;
} else {
$stored->is_local = $is_local;
}
if (!$stored->isLocal()) {
// Only do these checks for non-local notices. Local notices will generate these values later.
if (!common_valid_http_url($url)) {
common_debug('Bad notice URL: ['.$url.'], URI: ['.$uri.']. Cannot link back to original! This is normal for shared notices etc.');
}
if (empty($uri)) {
throw new ServerException('No URI for remote notice. Cannot accept that.');
}
}
$stored->profile_id = $actor->id;
$stored->source = $source;
$stored->uri = $uri;
@ -796,16 +816,6 @@ class Notice extends Managed_DataObject
: $act->content;
$stored->content = common_strip_html($stored->rendered);
$autosource = common_config('public', 'autosource');
// Sandboxed are non-false, but not 1, either
if (!$actor->hasRight(Right::PUBLICNOTICE) ||
($source && $autosource && in_array($source, $autosource))) {
$stored->is_local = Notice::LOCAL_NONPUBLIC;
} else {
$stored->is_local = $is_local;
}
// Maybe a missing act-time should be fatal if the actor is not local?
if (!empty($act->time)) {
$stored->created = common_sql_date($act->time);