Various last fixes to RSVP I think

This commit is contained in:
Mikael Nordfeldth 2016-01-21 02:20:50 +01:00
parent f74d2d555c
commit 81bf0fd261
3 changed files with 12 additions and 5 deletions

View File

@ -74,6 +74,9 @@ class RsvpAction extends FormAction
} catch (NoResultException $e) { } catch (NoResultException $e) {
// Notice already gone // Notice already gone
$rsvp->delete(); $rsvp->delete();
} catch (Exception $e) {
// emergency cleanup in case database is screwed up
$rsvp->delete();
} }
return _m('Cancelled RSVP'); return _m('Cancelled RSVP');
} }

View File

@ -249,9 +249,13 @@ class Happening extends Managed_DataObject
$actobj->extra[] = array('location', $actobj->extra[] = array('location',
array('xmlns' => 'urn:ietf:params:xml:ns:xcal'), array('xmlns' => 'urn:ietf:params:xml:ns:xcal'),
$this->location); $this->location);
$actobj->extra[] = array('url', try {
array('xmlns' => 'urn:ietf:params:xml:ns:xcal'), $actobj->extra[] = array('url',
$this->getUrl()); 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 */ /* We don't use these ourselves, but we add them to be nice RSS/XML citizens */
$actobj->extra[] = array('startdate', $actobj->extra[] = array('startdate',

View File

@ -128,7 +128,7 @@ class RSVP extends Managed_DataObject
static function saveActivityObject(Activity $act, Notice $stored) static function saveActivityObject(Activity $act, Notice $stored)
{ {
$target = Notice::getByKeys(array('uri'=>$act->target->id)); $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 ])) { if (!ActivityUtils::compareTypes($target->getObjectType(), [ Happening::OBJECT_TYPE ])) {
throw new ClientException('RSVP not aimed at a Happening'); throw new ClientException('RSVP not aimed at a Happening');
} }
@ -170,7 +170,7 @@ class RSVP extends Managed_DataObject
$happening = $this->getEvent(); $happening = $this->getEvent();
$actobj = new ActivityObject(); $actobj = new ActivityObject();
$actobj->id = $rsvp->getUri(); $actobj->id = $this->getUri();
$actobj->type = self::getObjectType(); $actobj->type = self::getObjectType();
$actobj->title = $this->asString(); $actobj->title = $this->asString();
$actobj->content = $this->asString(); $actobj->content = $this->asString();