Merge pull request #1089 from annando/master
Remote-Self is now working fine/contact page instead of remote profile when contact is added
This commit is contained in:
commit
d376e3d545
4 changed files with 73 additions and 23 deletions
|
@ -983,7 +983,16 @@ function encode_rel_links($links) {
|
|||
|
||||
|
||||
|
||||
function item_store($arr,$force_parent = false) {
|
||||
function item_store($arr,$force_parent = false, $notify = false) {
|
||||
|
||||
// If it is a posting where users should get notifications, then define it as wall posting
|
||||
if ($notify) {
|
||||
$arr['wall'] = 1;
|
||||
$arr['type'] = 'wall';
|
||||
$arr['origin'] = 1;
|
||||
$arr['last-child'] = 1;
|
||||
$arr['network'] = NETWORK_DFRN;
|
||||
}
|
||||
|
||||
// If a Diaspora signature structure was passed in, pull it out of the
|
||||
// item array and set it aside for later storage.
|
||||
|
@ -1144,6 +1153,7 @@ function item_store($arr,$force_parent = false) {
|
|||
$allow_gid = $arr['allow_gid'];
|
||||
$deny_cid = $arr['deny_cid'];
|
||||
$deny_gid = $arr['deny_gid'];
|
||||
$notify_type = 'wall-new';
|
||||
}
|
||||
else {
|
||||
|
||||
|
@ -1180,6 +1190,7 @@ function item_store($arr,$force_parent = false) {
|
|||
$deny_cid = $r[0]['deny_cid'];
|
||||
$deny_gid = $r[0]['deny_gid'];
|
||||
$arr['wall'] = $r[0]['wall'];
|
||||
$notify_type = 'comment-new';
|
||||
|
||||
// if the parent is private, force privacy for the entire conversation
|
||||
// This differs from the above settings as it subtly allows comments from
|
||||
|
@ -1417,6 +1428,9 @@ function item_store($arr,$force_parent = false) {
|
|||
create_tags_from_item($current_post);
|
||||
create_files_from_item($current_post);
|
||||
|
||||
if ($notify)
|
||||
proc_run('php', "include/notifier.php", $notify_type, $current_post);
|
||||
|
||||
return $current_post;
|
||||
}
|
||||
|
||||
|
@ -2532,16 +2546,6 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
if($contact['network'] === NETWORK_FEED)
|
||||
$datarray['private'] = 2;
|
||||
|
||||
// This is my contact on another system, but it's really me.
|
||||
// Turn this into a wall post.
|
||||
|
||||
if($contact['remote_self']) {
|
||||
$datarray['wall'] = 1;
|
||||
if($contact['network'] === NETWORK_FEED) {
|
||||
$datarray['private'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$datarray['parent-uri'] = $item_id;
|
||||
$datarray['uid'] = $importer['uid'];
|
||||
$datarray['contact-id'] = $contact['id'];
|
||||
|
@ -2564,8 +2568,33 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
if(($contact['rel'] == CONTACT_IS_FOLLOWER) && (! tgroup_check($importer['uid'],$datarray)))
|
||||
continue;
|
||||
|
||||
// This is my contact on another system, but it's really me.
|
||||
// Turn this into a wall post.
|
||||
|
||||
$r = item_store($datarray);
|
||||
if($contact['remote_self']) {
|
||||
if ($contact['remote_self'] == 2) {
|
||||
$r = q("SELECT `id`,`url`,`name`,`photo`,`network` FROM `contact` WHERE `uid` = %d AND `self`", intval($importer['uid']));
|
||||
if (count($r)) {
|
||||
$datarray['contact-id'] = $r[0]["id"];
|
||||
|
||||
$datarray['owner-name'] = $r[0]["name"];
|
||||
$datarray['owner-link'] = $r[0]["url"];
|
||||
$datarray['owner-avatar'] = $r[0]["photo"];
|
||||
|
||||
$datarray['author-name'] = $datarray['owner-name'];
|
||||
$datarray['author-link'] = $datarray['owner-link'];
|
||||
$datarray['author-avatar'] = $datarray['owner-avatar'];
|
||||
}
|
||||
}
|
||||
|
||||
$notify = true;
|
||||
if($contact['network'] === NETWORK_FEED) {
|
||||
$datarray['private'] = 0;
|
||||
}
|
||||
} else
|
||||
$notify = false;
|
||||
|
||||
$r = item_store($datarray, false, $notify);
|
||||
continue;
|
||||
|
||||
}
|
||||
|
@ -3633,12 +3662,6 @@ function local_delivery($importer,$data) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// This is my contact on another system, but it's really me.
|
||||
// Turn this into a wall post.
|
||||
|
||||
if($importer['remote_self'])
|
||||
$datarray['wall'] = 1;
|
||||
|
||||
$datarray['parent-uri'] = $item_id;
|
||||
$datarray['uid'] = $importer['importer_uid'];
|
||||
$datarray['contact-id'] = $importer['id'];
|
||||
|
@ -3658,7 +3681,31 @@ function local_delivery($importer,$data) {
|
|||
if(($importer['rel'] == CONTACT_IS_FOLLOWER) && (! tgroup_check($importer['importer_uid'],$datarray)))
|
||||
continue;
|
||||
|
||||
$posted_id = item_store($datarray);
|
||||
// This is my contact on another system, but it's really me.
|
||||
// Turn this into a wall post.
|
||||
|
||||
if($importer['remote_self']) {
|
||||
if ($importer['remote_self'] == 2) {
|
||||
$r = q("SELECT `id`,`url`,`name`,`photo`,`network` FROM `contact` WHERE `uid` = %d AND `self`",
|
||||
intval($importer['importer_uid']));
|
||||
if (count($r)) {
|
||||
$datarray['contact-id'] = $r[0]["id"];
|
||||
|
||||
$datarray['owner-name'] = $r[0]["name"];
|
||||
$datarray['owner-link'] = $r[0]["url"];
|
||||
$datarray['owner-avatar'] = $r[0]["photo"];
|
||||
|
||||
$datarray['author-name'] = $datarray['owner-name'];
|
||||
$datarray['author-link'] = $datarray['owner-link'];
|
||||
$datarray['author-avatar'] = $datarray['owner-avatar'];
|
||||
}
|
||||
}
|
||||
|
||||
$notify = true;
|
||||
} else
|
||||
$notify = false;
|
||||
|
||||
$posted_id = item_store($datarray, false, $notify);
|
||||
|
||||
if(stristr($datarray['verb'],ACTIVITY_POKE)) {
|
||||
$verb = urldecode(substr($datarray['verb'],strpos($datarray['verb'],'#')+1));
|
||||
|
|
|
@ -158,7 +158,7 @@ function crepair_content(&$a) {
|
|||
'$label_photo' => t('New photo from this URL'),
|
||||
'$label_remote_self' => t('Remote Self'),
|
||||
'$allow_remote_self' => get_config('system','allow_users_remote_self'),
|
||||
'$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.')),
|
||||
'$remote_self' => array('remote_self', t('Mirror postings from this contact'), $contact['remote_self'], t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'), array('0'=>t('No mirroring'), '1'=>t('Mirror as forwarded posting'), '2'=>t('Mirror as my own posting'))),
|
||||
'$contact_name' => $contact['name'],
|
||||
'$contact_nick' => $contact['nick'],
|
||||
'$contact_id' => $contact['id'],
|
||||
|
|
|
@ -183,7 +183,9 @@ function dfrn_request_post(&$a) {
|
|||
require_once('include/group.php');
|
||||
group_add_member(local_user(),'',$r[0]['id'],$g[0]['def_gid']);
|
||||
}
|
||||
}
|
||||
$forwardurl = $a->get_baseurl()."/contacts/".$r[0]['id'];
|
||||
} else
|
||||
$forwardurl = $a->get_baseurl()."/contacts";
|
||||
|
||||
/**
|
||||
* Allow the blocked remote notification to complete
|
||||
|
@ -197,7 +199,8 @@ function dfrn_request_post(&$a) {
|
|||
|
||||
// (ignore reply, nothing we can do it failed)
|
||||
|
||||
goaway(zrl($dfrn_url));
|
||||
// Old: goaway(zrl($dfrn_url));
|
||||
goaway($forwardurl);
|
||||
return; // NOTREACHED
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<div class="clear"></div>
|
||||
{{if $allow_remote_self eq 1}}
|
||||
<h4>{{$label_remote_self}}</h4>
|
||||
{{include file="field_checkbox.tpl" field=$remote_self}}
|
||||
{{include file="field_select.tpl" field=$remote_self}}
|
||||
{{/if}}
|
||||
|
||||
<input type="submit" name="submit" value="{{$lbl_submit}}" />
|
||||
|
|
Loading…
Reference in a new issue