aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Regate.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-10-25 08:03:12 +0000
committerMario <mario@mariovavti.com>2021-10-25 08:03:12 +0000
commit65acdd7b1587b0537cfe4084bbfd18436cc754b1 (patch)
tree88c7d66d1974ff4f8ed66d4cdfb99ebb90ae47f1 /Zotlabs/Module/Regate.php
parenta209374cbd04f10408c0b834eaab203e0c745902 (diff)
downloadvolse-hubzilla-65acdd7b1587b0537cfe4084bbfd18436cc754b1.tar.gz
volse-hubzilla-65acdd7b1587b0537cfe4084bbfd18436cc754b1.tar.bz2
volse-hubzilla-65acdd7b1587b0537cfe4084bbfd18436cc754b1.zip
mod regate: auto-connect the invitee with the inviter if auto channel create is enabled (default). fix issue where the default group was not set in the return array of create_identity()
Diffstat (limited to 'Zotlabs/Module/Regate.php')
-rw-r--r--Zotlabs/Module/Regate.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php
index 379195461..462c997ff 100644
--- a/Zotlabs/Module/Regate.php
+++ b/Zotlabs/Module/Regate.php
@@ -2,6 +2,9 @@
namespace Zotlabs\Module;
+use Zotlabs\Lib\Connect;
+use Zotlabs\Daemon\Master;
+
require_once('include/security.php');
/**
@@ -184,7 +187,24 @@ class Regate extends \Zotlabs\Web\Controller {
$new_channel = auto_channel_create($cra['account']['account_id']);
if($new_channel['success']) {
+
$channel_id = $new_channel['channel']['channel_id'];
+
+ // If we have an inviter, connect.
+ if ($didx === 'i' && intval($r['reg_byc'])) {
+ $invite_channel = channelx_by_n($r['reg_byc']);
+ if ($invite_channel) {
+ $f = Connect::connect($new_channel['channel'], $invite_channel['xchan_addr']);
+ if ($f['success']) {
+ $can_view_stream = their_perms_contains($channel_id, $f['abook']['abook_xchan'], 'view_stream');
+ // If we can view their stream, pull in some posts
+ if ($can_view_stream) {
+ Master::Summon(['Onepoll', $f['abook']['abook_id']]);
+ }
+ }
+ }
+ }
+
change_channel($channel_id);
$nextpage = 'profiles/' . $channel_id;
$msg_code = 'ZAR1239I';