From 81bf0fd26102ae7a23c894c24b15b6954ee679de Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 21 Jan 2016 02:20:50 +0100 Subject: [PATCH] Various last fixes to RSVP I think --- plugins/Event/actions/rsvp.php | 3 +++ plugins/Event/classes/Happening.php | 10 +++++++--- plugins/Event/classes/RSVP.php | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/Event/actions/rsvp.php b/plugins/Event/actions/rsvp.php index 59cc070278..124094c291 100644 --- a/plugins/Event/actions/rsvp.php +++ b/plugins/Event/actions/rsvp.php @@ -74,6 +74,9 @@ class RsvpAction extends FormAction } catch (NoResultException $e) { // Notice already gone $rsvp->delete(); + } catch (Exception $e) { + // emergency cleanup in case database is screwed up + $rsvp->delete(); } return _m('Cancelled RSVP'); } diff --git a/plugins/Event/classes/Happening.php b/plugins/Event/classes/Happening.php index d74ae081b4..d7f296f647 100644 --- a/plugins/Event/classes/Happening.php +++ b/plugins/Event/classes/Happening.php @@ -249,9 +249,13 @@ class Happening extends Managed_DataObject $actobj->extra[] = array('location', array('xmlns' => 'urn:ietf:params:xml:ns:xcal'), $this->location); - $actobj->extra[] = array('url', - array('xmlns' => 'urn:ietf:params:xml:ns:xcal'), - $this->getUrl()); + try { + $actobj->extra[] = array('url', + array('xmlns' => 'urn:ietf:params:xml:ns:xcal'), + $this->getUrl()); + } catch (InvalidUrlException $e) { + // oh well, no URL for you! + } /* We don't use these ourselves, but we add them to be nice RSS/XML citizens */ $actobj->extra[] = array('startdate', diff --git a/plugins/Event/classes/RSVP.php b/plugins/Event/classes/RSVP.php index 3eba0e95be..1fec6c33a2 100644 --- a/plugins/Event/classes/RSVP.php +++ b/plugins/Event/classes/RSVP.php @@ -128,7 +128,7 @@ class RSVP extends Managed_DataObject static function saveActivityObject(Activity $act, Notice $stored) { $target = Notice::getByKeys(array('uri'=>$act->target->id)); - common_debug(_ve('TARGET: '.$target)); + common_debug('TARGET:'._ve($target)); if (!ActivityUtils::compareTypes($target->getObjectType(), [ Happening::OBJECT_TYPE ])) { throw new ClientException('RSVP not aimed at a Happening'); } @@ -170,7 +170,7 @@ class RSVP extends Managed_DataObject $happening = $this->getEvent(); $actobj = new ActivityObject(); - $actobj->id = $rsvp->getUri(); + $actobj->id = $this->getUri(); $actobj->type = self::getObjectType(); $actobj->title = $this->asString(); $actobj->content = $this->asString(); -- 2.39.5