add toggle to choose sending "friends with" activity even if contact is not hidden
This commit is contained in:
parent
3d099bd99a
commit
76308eca67
2
boot.php
2
boot.php
|
@ -9,7 +9,7 @@ require_once('include/nav.php');
|
||||||
require_once('include/cache.php');
|
require_once('include/cache.php');
|
||||||
|
|
||||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_VERSION', '2.3.1243' );
|
define ( 'FRIENDICA_VERSION', '2.3.1244' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1120 );
|
define ( 'DB_UPDATE_VERSION', 1120 );
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
$intro_id = $handsfree['intro_id'];
|
$intro_id = $handsfree['intro_id'];
|
||||||
$duplex = $handsfree['duplex'];
|
$duplex = $handsfree['duplex'];
|
||||||
$hidden = ((array_key_exists('hidden',$handsfree)) ? intval($handsfree['hidden']) : 0 );
|
$hidden = ((array_key_exists('hidden',$handsfree)) ? intval($handsfree['hidden']) : 0 );
|
||||||
|
$activity = ((array_key_exists('activity',$handsfree)) ? intval($handsfree['activity']) : 0 );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$dfrn_id = ((x($_POST,'dfrn_id')) ? notags(trim($_POST['dfrn_id'])) : "");
|
$dfrn_id = ((x($_POST,'dfrn_id')) ? notags(trim($_POST['dfrn_id'])) : "");
|
||||||
|
@ -79,6 +80,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
$duplex = ((x($_POST,'duplex')) ? intval($_POST['duplex']) : 0 );
|
$duplex = ((x($_POST,'duplex')) ? intval($_POST['duplex']) : 0 );
|
||||||
$cid = ((x($_POST,'contact_id')) ? intval($_POST['contact_id']) : 0 );
|
$cid = ((x($_POST,'contact_id')) ? intval($_POST['contact_id']) : 0 );
|
||||||
$hidden = ((x($_POST,'hidden')) ? intval($_POST['hidden']) : 0 );
|
$hidden = ((x($_POST,'hidden')) ? intval($_POST['hidden']) : 0 );
|
||||||
|
$activity = ((x($_POST,'activity')) ? intval($_POST['activity']) : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -428,64 +430,65 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
|
||||||
else
|
else
|
||||||
$contact = null;
|
$contact = null;
|
||||||
|
|
||||||
// Send a new friend post if we are allowed to...
|
if(isset($new_relation) && $new_relation == CONTACT_IS_FRIEND) {
|
||||||
|
|
||||||
$r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
|
if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
|
||||||
intval($uid)
|
|
||||||
);
|
|
||||||
if((count($r)) && (! $hidden) && ($r[0]['hide-friends'] == 0) && (is_array($contact)) && isset($new_relation) && ($new_relation == CONTACT_IS_FRIEND)) {
|
|
||||||
|
|
||||||
if($r[0]['network'] === NETWORK_DIASPORA) {
|
|
||||||
require_once('include/diaspora.php');
|
require_once('include/diaspora.php');
|
||||||
$ret = diaspora_share($user[0],$r[0]);
|
$ret = diaspora_share($user[0],$r[0]);
|
||||||
logger('mod_follow: diaspora_share returns: ' . $ret);
|
logger('mod_follow: diaspora_share returns: ' . $ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once('include/items.php');
|
// Send a new friend post if we are allowed to...
|
||||||
|
|
||||||
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
$r = q("SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
if((count($r)) && ($activity) && (! $hidden)) {
|
||||||
|
|
||||||
if(count($self)) {
|
require_once('include/items.php');
|
||||||
|
|
||||||
$arr = array();
|
$self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||||
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid);
|
intval($uid)
|
||||||
$arr['uid'] = $uid;
|
);
|
||||||
$arr['contact-id'] = $self[0]['id'];
|
|
||||||
$arr['wall'] = 1;
|
if(count($self)) {
|
||||||
$arr['type'] = 'wall';
|
|
||||||
$arr['gravity'] = 0;
|
$arr = array();
|
||||||
$arr['origin'] = 1;
|
$arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid);
|
||||||
$arr['author-name'] = $arr['owner-name'] = $self[0]['name'];
|
$arr['uid'] = $uid;
|
||||||
$arr['author-link'] = $arr['owner-link'] = $self[0]['url'];
|
$arr['contact-id'] = $self[0]['id'];
|
||||||
$arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
|
$arr['wall'] = 1;
|
||||||
$arr['verb'] = ACTIVITY_FRIEND;
|
$arr['type'] = 'wall';
|
||||||
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
|
$arr['gravity'] = 0;
|
||||||
|
$arr['origin'] = 1;
|
||||||
|
$arr['author-name'] = $arr['owner-name'] = $self[0]['name'];
|
||||||
|
$arr['author-link'] = $arr['owner-link'] = $self[0]['url'];
|
||||||
|
$arr['author-avatar'] = $arr['owner-avatar'] = $self[0]['thumb'];
|
||||||
|
$arr['verb'] = ACTIVITY_FRIEND;
|
||||||
|
$arr['object-type'] = ACTIVITY_OBJ_PERSON;
|
||||||
|
|
||||||
$A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]';
|
$A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]';
|
||||||
$B = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
$B = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
|
||||||
$BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]';
|
$BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]';
|
||||||
$arr['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto;
|
$arr['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$BPhoto;
|
||||||
|
|
||||||
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'
|
$arr['object'] = '<object><type>' . ACTIVITY_OBJ_PERSON . '</type><title>' . $contact['name'] . '</title>'
|
||||||
. '<id>' . $contact['url'] . '/' . $contact['name'] . '</id>';
|
. '<id>' . $contact['url'] . '/' . $contact['name'] . '</id>';
|
||||||
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />' . "\n");
|
$arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $contact['url'] . '" />' . "\n");
|
||||||
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
|
$arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
|
||||||
$arr['object'] .= '</link></object>' . "\n";
|
$arr['object'] .= '</link></object>' . "\n";
|
||||||
$arr['last-child'] = 1;
|
$arr['last-child'] = 1;
|
||||||
|
|
||||||
$arr['allow_cid'] = $user[0]['allow_cid'];
|
$arr['allow_cid'] = $user[0]['allow_cid'];
|
||||||
$arr['allow_gid'] = $user[0]['allow_gid'];
|
$arr['allow_gid'] = $user[0]['allow_gid'];
|
||||||
$arr['deny_cid'] = $user[0]['deny_cid'];
|
$arr['deny_cid'] = $user[0]['deny_cid'];
|
||||||
$arr['deny_gid'] = $user[0]['deny_gid'];
|
$arr['deny_gid'] = $user[0]['deny_gid'];
|
||||||
|
|
||||||
$i = item_store($arr);
|
|
||||||
if($i)
|
|
||||||
proc_run('php',"include/notifier.php","activity","$i");
|
|
||||||
|
|
||||||
|
$i = item_store($arr);
|
||||||
|
if($i)
|
||||||
|
proc_run('php',"include/notifier.php","activity","$i");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Let's send our user to the contact editor in case they want to
|
// Let's send our user to the contact editor in case they want to
|
||||||
// do anything special with this new friend.
|
// do anything special with this new friend.
|
||||||
|
|
|
@ -142,6 +142,8 @@ function notifications_content(&$a) {
|
||||||
'$fullname' => $rr['fname'],
|
'$fullname' => $rr['fname'],
|
||||||
'$url' => $rr['furl'],
|
'$url' => $rr['furl'],
|
||||||
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
|
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
|
||||||
|
'$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')),
|
||||||
|
|
||||||
'$knowyou' => $knowyou,
|
'$knowyou' => $knowyou,
|
||||||
'$approve' => t('Approve'),
|
'$approve' => t('Approve'),
|
||||||
'$note' => $rr['note'],
|
'$note' => $rr['note'],
|
||||||
|
@ -187,6 +189,7 @@ function notifications_content(&$a) {
|
||||||
'$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
|
'$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
|
||||||
'$fullname' => $rr['name'],
|
'$fullname' => $rr['name'],
|
||||||
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
|
'$hidden' => array('hidden', t('Hide this contact from others'), ($rr['hidden'] == 1), ''),
|
||||||
|
'$activity' => array('activity', t('Post a new friend activity'), 1, t('if applicable')),
|
||||||
'$url' => $rr['url'],
|
'$url' => $rr['url'],
|
||||||
'$knowyou' => $knowyou,
|
'$knowyou' => $knowyou,
|
||||||
'$approve' => t('Approve'),
|
'$approve' => t('Approve'),
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
<form class="intro-approve-form" action="dfrn_confirm" method="post">
|
<form class="intro-approve-form" action="dfrn_confirm" method="post">
|
||||||
{{inc field_checkbox.tpl with $field=$hidden }}{{endinc}}
|
{{inc field_checkbox.tpl with $field=$hidden }}{{endinc}}
|
||||||
|
{{inc field_checkbox.tpl with $field=$activity }}{{endinc}}
|
||||||
<input type="hidden" name="dfrn_id" value="$dfrn_id" >
|
<input type="hidden" name="dfrn_id" value="$dfrn_id" >
|
||||||
<input type="hidden" name="intro_id" value="$intro_id" >
|
<input type="hidden" name="intro_id" value="$intro_id" >
|
||||||
<input type="hidden" name="contact_id" value="$contact_id" >
|
<input type="hidden" name="contact_id" value="$contact_id" >
|
||||||
|
|
Loading…
Reference in a new issue