Commit 11b40ddb authored by Brion Vibber's avatar Brion Vibber

work in progress...

parent 4eb02c62
......@@ -139,8 +139,8 @@ class SubscribeAction extends Action
{
// Throws exception on error
Subscription::start($this->user->getProfile(),
$this->other);
$sub = Subscription::start($this->user->getProfile(),
$this->other);
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
......@@ -149,8 +149,12 @@ class SubscribeAction extends Action
$this->element('title', null, _('Subscribed'));
$this->elementEnd('head');
$this->elementStart('body');
$unsubscribe = new UnsubscribeForm($this, $this->other);
$unsubscribe->show();
if ($sub instanceof Subscription) {
$form = new UnsubscribeForm($this, $this->other);
} else {
$form = new CancelSubscriptionForm($this, $this->other);
}
$form->show();
$this->elementEnd('body');
$this->elementEnd('html');
} else {
......
......@@ -363,6 +363,47 @@ class Profile extends Memcached_DataObject
}
}
/**
* Request a subscription to another local or remote profile.
* This will result in either the subscription going through
* immediately, being queued for approval, or being rejected
* immediately.
*
* @param Profile $profile
* @return mixed: Subscription or Subscription_queue object on success
* @throws Exception of various types on invalid state
*/
function subscribe($profile)
{
//
}
/**
* Cancel an outstanding subscription request to the other profile.
*
* @param Profile $profile
*/
function cancelSubscribe($profile)
{
$request = Subscribe_join_queue::pkeyGet(array('subscriber' => $this->id,
'subscribed' => $profile->id));
if ($request) {
if (Event::handle('StartCancelSubscription', array($this, $profile))) {
$request->delete();
Event::handle('EndCancelSubscription', array($this, $profile));
}
}
}
/**
*
* @param <type> $profile
*/
function completeSubscribe($profile)
{
}
function getSubscriptions($offset=0, $limit=null)
{
$subs = Subscription::bySubscriber($this->id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment