diff options
author | zotlabs <mike@macgirvin.com> | 2018-03-02 01:01:30 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-03-02 01:03:14 -0800 |
commit | dcfe9bc64f822af02021767bf8c70fbe9d847bda (patch) | |
tree | 04e29f46f64965ab8b822745e4ed2262ab0921db /Zotlabs | |
parent | 8fd619da7178fa87352bb6f917aa569a96e323d2 (diff) | |
download | volse-hubzilla-dcfe9bc64f822af02021767bf8c70fbe9d847bda.tar.gz volse-hubzilla-dcfe9bc64f822af02021767bf8c70fbe9d847bda.tar.bz2 volse-hubzilla-dcfe9bc64f822af02021767bf8c70fbe9d847bda.zip |
background work for caldav integration continued, modify mod_follow to allow it to be called from ajax without redirecting.
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Module/Follow.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Zotlabs/Module/Follow.php b/Zotlabs/Module/Follow.php index d8a86d0ce..04ac746cb 100644 --- a/Zotlabs/Module/Follow.php +++ b/Zotlabs/Module/Follow.php @@ -17,15 +17,20 @@ class Follow extends \Zotlabs\Web\Controller { $url = notags(trim($_REQUEST['url'])); $return_url = $_SESSION['return_url']; $confirm = intval($_REQUEST['confirm']); - + $interactive = (($_REQUEST['interactive']) ? intval($_REQUEST['interactive']) : 1); $channel = \App::get_channel(); - $result = new_contact($uid,$url,$channel,true,$confirm); + $result = new_contact($uid,$url,$channel,$interactive,$confirm); if($result['success'] == false) { if($result['message']) notice($result['message']); - goaway($return_url); + if($interactive) { + goaway($return_url); + } + else { + json_return_and_die($result); + } } info( t('Channel added.') . EOL); @@ -53,7 +58,12 @@ class Follow extends \Zotlabs\Web\Controller { if(($can_view_stream) || ($result['abook']['xchan_network'] === 'rss')) \Zotlabs\Daemon\Master::Summon(array('Onepoll',$result['abook']['abook_id'])); - goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1'); + if($interactive) { + goaway(z_root() . '/connedit/' . $result['abook']['abook_id'] . '?f=&follow=1'); + } + else { + json_return_and_die([ 'success' => true ]); + } } |