Reworked contact relations between Friendica and Diaspora
This commit is contained in:
parent
ab0fbc3a65
commit
efbdb57f92
5 changed files with 15 additions and 11 deletions
|
@ -897,7 +897,8 @@ function item_photo_menu($item){
|
||||||
if ($a->contacts[$clean_url]['network'] === NETWORK_DFRN)
|
if ($a->contacts[$clean_url]['network'] === NETWORK_DFRN)
|
||||||
$menu[t("Poke")] = $poke_link;
|
$menu[t("Poke")] = $poke_link;
|
||||||
|
|
||||||
if (($cid == 0) AND in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)))
|
if (($cid == 0) AND
|
||||||
|
in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)))
|
||||||
$menu[t("Connect/Follow")] = $a->get_baseurl($ssl_state)."/follow?url=".urlencode($item['author-link']);
|
$menu[t("Connect/Follow")] = $a->get_baseurl($ssl_state)."/follow?url=".urlencode($item['author-link']);
|
||||||
|
|
||||||
$args = array('item' => $item, 'menu' => $menu);
|
$args = array('item' => $item, 'menu' => $menu);
|
||||||
|
|
|
@ -592,7 +592,7 @@ function diaspora_request($importer,$xml) {
|
||||||
// perhaps we were already sharing with this person. Now they're sharing with us.
|
// perhaps we were already sharing with this person. Now they're sharing with us.
|
||||||
// That makes us friends.
|
// That makes us friends.
|
||||||
|
|
||||||
if($contact['rel'] == CONTACT_IS_FOLLOWER && !in_array($importer['page-flags'], array(PAGE_COMMUNITY, PAGE_SOAPBOX))) {
|
if($contact['rel'] == CONTACT_IS_FOLLOWER && in_array($importer['page-flags'], array(PAGE_FREELOVE))) {
|
||||||
q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d",
|
q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d",
|
||||||
intval(CONTACT_IS_FRIEND),
|
intval(CONTACT_IS_FRIEND),
|
||||||
intval($contact['id']),
|
intval($contact['id']),
|
||||||
|
@ -774,7 +774,7 @@ function diaspora_post_allow($importer,$contact, $is_comment = false) {
|
||||||
// perhaps we were already sharing with this person. Now they're sharing with us.
|
// perhaps we were already sharing with this person. Now they're sharing with us.
|
||||||
// That makes us friends.
|
// That makes us friends.
|
||||||
// Normally this should have handled by getting a request - but this could get lost
|
// Normally this should have handled by getting a request - but this could get lost
|
||||||
if($contact['rel'] == CONTACT_IS_FOLLOWER && !in_array($importer['page-flags'], array(PAGE_COMMUNITY, PAGE_SOAPBOX))) {
|
if($contact['rel'] == CONTACT_IS_FOLLOWER && in_array($importer['page-flags'], array(PAGE_FREELOVE))) {
|
||||||
q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d",
|
q("UPDATE `contact` SET `rel` = %d, `writable` = 1 WHERE `id` = %d AND `uid` = %d",
|
||||||
intval(CONTACT_IS_FRIEND),
|
intval(CONTACT_IS_FRIEND),
|
||||||
intval($contact['id']),
|
intval($contact['id']),
|
||||||
|
|
|
@ -154,11 +154,7 @@ function new_contact($uid,$url,$interactive = false) {
|
||||||
|
|
||||||
$hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
|
$hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
|
||||||
|
|
||||||
if($ret['network'] === NETWORK_MAIL) {
|
if(in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA)))
|
||||||
$writeable = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
if($ret['network'] === NETWORK_DIASPORA)
|
|
||||||
$writeable = 1;
|
$writeable = 1;
|
||||||
|
|
||||||
// check if we already have a contact
|
// check if we already have a contact
|
||||||
|
@ -215,9 +211,7 @@ function new_contact($uid,$url,$interactive = false) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_relation = (($ret['network'] === NETWORK_MAIL) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
|
$new_relation = ((in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) ? CONTACT_IS_FRIEND : CONTACT_IS_SHARING);
|
||||||
if($ret['network'] === NETWORK_DIASPORA)
|
|
||||||
$new_relation = CONTACT_IS_FOLLOWER;
|
|
||||||
|
|
||||||
// create contact record
|
// create contact record
|
||||||
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `network`, `pubkey`, `rel`, `priority`,
|
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `alias`, `batch`, `notify`, `poll`, `poco`, `name`, `nick`, `network`, `pubkey`, `rel`, `priority`,
|
||||||
|
|
|
@ -590,6 +590,10 @@ function contacts_content(&$a) {
|
||||||
if ($contact['network'] == NETWORK_DFRN)
|
if ($contact['network'] == NETWORK_DFRN)
|
||||||
$profile_select = contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false));
|
$profile_select = contact_profile_assign($contact['profile-id'],(($contact['network'] !== NETWORK_DFRN) ? true : false));
|
||||||
|
|
||||||
|
if (in_array($contact['network'], array(NETWORK_DIASPORA, NETWORK_OSTATUS)) AND
|
||||||
|
($contact['rel'] == CONTACT_IS_FOLLOWER))
|
||||||
|
$follow = $a->get_baseurl(true)."/follow?url=".urlencode($contact["url"]);
|
||||||
|
|
||||||
$o .= replace_macros($tpl, array(
|
$o .= replace_macros($tpl, array(
|
||||||
'$header' => t('Contact Editor'),
|
'$header' => t('Contact Editor'),
|
||||||
'$tab_str' => $tab_str,
|
'$tab_str' => $tab_str,
|
||||||
|
@ -617,6 +621,8 @@ function contacts_content(&$a) {
|
||||||
'$updpub' => t('Update public posts'),
|
'$updpub' => t('Update public posts'),
|
||||||
'$last_update' => $last_update,
|
'$last_update' => $last_update,
|
||||||
'$udnow' => t('Update now'),
|
'$udnow' => t('Update now'),
|
||||||
|
'$follow' => $follow,
|
||||||
|
'$follow_text' => t("Connect/Follow"),
|
||||||
'$profile_select' => $profile_select,
|
'$profile_select' => $profile_select,
|
||||||
'$contact_id' => $contact['id'],
|
'$contact_id' => $contact['id'],
|
||||||
'$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
|
'$block_text' => (($contact['blocked']) ? t('Unblock') : t('Block') ),
|
||||||
|
|
|
@ -51,6 +51,9 @@
|
||||||
{{if $lblsuggest}}
|
{{if $lblsuggest}}
|
||||||
<li><a href="fsuggest/{{$contact_id}}" id="contact-edit-suggest">{{$lblsuggest}}</a></li>
|
<li><a href="fsuggest/{{$contact_id}}" id="contact-edit-suggest">{{$lblsuggest}}</a></li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $follow}}
|
||||||
|
<li><div id="contact-edit-follow"><a href="{{$follow}}">{{$follow_text}}</a></div></li>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue