Make Profile::fromUri use UnknownUriException

This commit is contained in:
Mikael Nordfeldth
2014-05-26 15:05:14 +02:00
parent 89e817e5b0
commit 49fa34e234
7 changed files with 50 additions and 37 deletions

View File

@@ -387,16 +387,15 @@ class BookmarkPlugin extends MicroAppPlugin
$options['replies'] = array(); // TODO: context->attention
foreach ($activity->context->attention as $attnUrl=>$type) {
$other = Profile::fromURI($attnUrl);
if ($other instanceof Profile) {
$options['replies'][] = $attnUrl;
} else {
// Maybe we can get rid of this since every User_group got a Profile?
// TODO: Make sure the above replies get sorted properly for groups (or handled afterwards)
$group = User_group::getKV('uri', $attnUrl);
if ($group instanceof User_group) {
$options['groups'][] = $attnUrl;
try {
$other = Profile::fromUri($attnUrl);
if ($other->isGroup()) {
$options['groups'][] = $other->id;
} else {
$options['replies'][] = $attnUrl;
}
} catch (UnknownUriException $e) {
// We simply don't know this URI, despite lookup attempts.
}
}