From c70ebadd7d66a6a7b135e1197bae70c78972ea2a Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 19 May 2018 19:34:51 +0000 Subject: [PATCH] Issue-3412 related: Don't send connection posts anymore --- mod/dfrn_confirm.php | 89 ------------------ mod/dfrn_request.php | 1 - mod/notifications.php | 2 - mod/profiles.php | 93 ------------------- mod/settings.php | 13 --- src/Protocol/Diaspora.php | 72 -------------- view/templates/intros.tpl | 1 - view/templates/settings/settings.tpl | 7 -- view/theme/frio/templates/intros.tpl | 1 - .../frio/templates/settings/settings.tpl | 9 -- .../templates/settings/settings.tpl | 7 -- view/theme/smoothly/style.css | 3 - 12 files changed, 298 deletions(-) diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 857f6c82d..0bcf13785 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -83,14 +83,12 @@ function dfrn_confirm_post(App $a, $handsfree = null) $duplex = $handsfree['duplex']; $cid = 0; $hidden = intval(defaults($handsfree, 'hidden' , 0)); - $activity = intval(defaults($handsfree, 'activity', 0)); } else { $dfrn_id = notags(trim(defaults($_POST, 'dfrn_id' , ''))); $intro_id = intval(defaults($_POST, 'intro_id' , 0)); $duplex = intval(defaults($_POST, 'duplex' , 0)); $cid = intval(defaults($_POST, 'contact_id', 0)); $hidden = intval(defaults($_POST, 'hidden' , 0)); - $activity = intval(defaults($_POST, 'activity' , 0)); } /* @@ -401,50 +399,6 @@ function dfrn_confirm_post(App $a, $handsfree = null) $ret = Diaspora::sendShare($user, $contact); logger('share returns: ' . $ret); } - - // Send a new friend post if we are allowed to... - $profile = dba::selectFirst('profile', ['hide-friends'], ['is-default' => true, 'uid' => $uid]); - if (x($profile, 'hide-friends') === 0 && $activity && !$hidden) { - $self = dba::selectFirst('contact', [], ['self' => true, 'uid' => $uid]); - if (DBM::is_result($self)) { - $arr = []; - $arr['guid'] = get_guid(32); - $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $uid); - $arr['uid'] = $uid; - $arr['contact-id'] = $self['id']; - $arr['wall'] = 1; - $arr['type'] = 'wall'; - $arr['gravity'] = 0; - $arr['origin'] = 1; - $arr['author-name'] = $arr['owner-name'] = $self['name']; - $arr['author-link'] = $arr['owner-link'] = $self['url']; - $arr['author-avatar'] = $arr['owner-avatar'] = $self['thumb']; - - $A = '[url=' . $self['url'] . ']' . $self['name'] . '[/url]'; - $B = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; - $BPhoto = '[url=' . $contact['url'] . ']' . '[img]' . $contact['thumb'] . '[/img][/url]'; - - $arr['verb'] = ACTIVITY_FRIEND; - $arr['object-type'] = ACTIVITY_OBJ_PERSON; - $arr['body'] = L10n::t('%1$s is now friends with %2$s', $A, $B) . "\n\n\n" . $BPhoto; - - $arr['object'] = '' . ACTIVITY_OBJ_PERSON . '' . $contact['name'] . '' - . '' . $contact['url'] . '/' . $contact['name'] . ''; - $arr['object'] .= '' . xmlify('' . "\n"); - $arr['object'] .= xmlify('' . "\n"); - $arr['object'] .= '' . "\n"; - - $arr['allow_cid'] = $user['allow_cid']; - $arr['allow_gid'] = $user['allow_gid']; - $arr['deny_cid'] = $user['deny_cid']; - $arr['deny_gid'] = $user['deny_gid']; - - $i = Item::insert($arr); - if ($i) { - Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); - } - } - } } Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']); @@ -665,49 +619,6 @@ function dfrn_confirm_post(App $a, $handsfree = null) } } - // Send a new friend post if we are allowed to... - if ($page && intval(PConfig::get($local_uid, 'system', 'post_joingroup'))) { - $profile = dba::selectFirst('profile', ['hide-friends'], ['is-default' => true, 'uid' => $local_uid]); - if (x($profile, 'hide-friends') === 0) { - $self = dba::selectFirst('contact', [], ['self' => true, 'uid' => $local_uid]); - if (DBM::is_result($self)) { - $arr = []; - $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), $local_uid); - $arr['uid'] = $local_uid; - $arr['contact-id'] = $self['id']; - $arr['wall'] = 1; - $arr['type'] = 'wall'; - $arr['gravity'] = 0; - $arr['origin'] = 1; - $arr['author-name'] = $arr['owner-name'] = $self['name']; - $arr['author-link'] = $arr['owner-link'] = $self['url']; - $arr['author-avatar'] = $arr['owner-avatar'] = $self['thumb']; - - $A = '[url=' . $self['url'] . ']' . $self['name'] . '[/url]'; - $B = '[url=' . $combined['url'] . ']' . $combined['name'] . '[/url]'; - $BPhoto = '[url=' . $combined['url'] . ']' . '[img]' . $combined['thumb'] . '[/img][/url]'; - - $arr['verb'] = ACTIVITY_JOIN; - $arr['object-type'] = ACTIVITY_OBJ_GROUP; - $arr['body'] = L10n::t('%1$s has joined %2$s', $A, $B) . "\n\n\n" . $BPhoto; - $arr['object'] = '' . ACTIVITY_OBJ_GROUP . '' . $combined['name'] . '' - . '' . $combined['url'] . '/' . $combined['name'] . ''; - $arr['object'] .= '' . xmlify('' . "\n"); - $arr['object'] .= xmlify('' . "\n"); - $arr['object'] .= '' . "\n"; - - $arr['allow_cid'] = $user['allow_cid']; - $arr['allow_gid'] = $user['allow_gid']; - $arr['deny_cid'] = $user['deny_cid']; - $arr['deny_gid'] = $user['deny_gid']; - - $i = Item::insert($arr); - if ($i) { - Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); - } - } - } - } System::xmlExit(0); // Success return; // NOTREACHED ////////////////////// End of this scenario /////////////////////////////////////////////// diff --git a/mod/dfrn_request.php b/mod/dfrn_request.php index dae2d8852..ae6017d14 100644 --- a/mod/dfrn_request.php +++ b/mod/dfrn_request.php @@ -577,7 +577,6 @@ function dfrn_request_content(App $a) 'dfrn_id' => $r[0]['issued-id'], 'intro_id' => $intro[0]['id'], 'duplex' => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0), - 'activity' => intval(PConfig::get($r[0]['uid'], 'system', 'post_newfriend')) ]; dfrn_confirm_post($a, $handsfree); } diff --git a/mod/notifications.php b/mod/notifications.php index 46519075b..f7f40d1d2 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -173,7 +173,6 @@ function notifications_content(App $a) { '$fullname' => $it['name'], '$url' => $it['url'], '$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''], - '$activity' => ['activity', L10n::t('Post a new friend activity'), $it['post_newfriend'], L10n::t('if applicable')], '$knowyou' => $it['knowyou'], '$approve' => L10n::t('Approve'), @@ -252,7 +251,6 @@ function notifications_content(App $a) { '$gender' => $it['gender'], '$lbl_gender' => L10n::t('Gender:'), '$hidden' => ['hidden', L10n::t('Hide this contact from others'), ($it['hidden'] == 1), ''], - '$activity' => ['activity', L10n::t('Post a new friend activity'), $it['post_newfriend'], L10n::t('if applicable')], '$url' => $it['url'], '$zrl' => $it['zrl'], '$lbl_url' => L10n::t('Profile URL'), diff --git a/mod/profiles.php b/mod/profiles.php index 8bb09aa6d..9c925924f 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -403,9 +403,6 @@ function profiles_post(App $a) { $comma2 = (($region && $country_name) ? ', ' : ''); $value = $locality . $comma1 . $region . $comma2 . $country_name; } - - profile_activity($changes,$value); - } $r = q("UPDATE `profile` @@ -510,96 +507,6 @@ function profiles_post(App $a) { } } - -function profile_activity($changed, $value) { - $a = get_app(); - - if (! local_user() || ! is_array($changed) || ! count($changed)) { - return; - } - - if ($a->user['hidewall'] || Config::get('system', 'block_public')) { - return; - } - - if (! PConfig::get(local_user(), 'system', 'post_profilechange')) { - return; - } - - require_once 'include/items.php'; - - $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1", - intval(local_user()) - ); - - if (! DBM::is_result($self)) { - return; - } - - $arr = []; - - $arr['guid'] = get_guid(32); - $arr['uri'] = $arr['parent-uri'] = item_new_uri($a->get_hostname(), local_user()); - $arr['uid'] = local_user(); - $arr['contact-id'] = $self[0]['id']; - $arr['wall'] = 1; - $arr['type'] = 'wall'; - $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_UPDATE; - $arr['object-type'] = ACTIVITY_OBJ_PROFILE; - - $A = '[url=' . $self[0]['url'] . ']' . $self[0]['name'] . '[/url]'; - - - $changes = ''; - $t = count($changed); - $z = 0; - foreach ($changed as $ch) { - if (strlen($changes)) { - if ($z == ($t - 1)) { - $changes .= L10n::t(' and '); - } else { - $changes .= ', '; - } - } - $z ++; - $changes .= $ch; - } - - $prof = '[url=' . $self[0]['url'] . '?tab=profile' . ']' . L10n::t('public profile') . '[/url]'; - - if ($t == 1 && strlen($value)) { - $message = L10n::t('%1$s changed %2$s to “%3$s”', $A, $changes, $value); - $message .= "\n\n" . L10n::t(' - Visit %1$s\'s %2$s', $A, $prof); - } else { - $message = L10n::t('%1$s has an updated %2$s, changing %3$s.', $A, $prof, $changes); - } - - - $arr['body'] = $message; - - $arr['object'] = '' . ACTIVITY_OBJ_PROFILE . '' . $self[0]['name'] . '' - . '' . $self[0]['url'] . '/' . $self[0]['name'] . ''; - $arr['object'] .= '' . xmlify('' . "\n"); - $arr['object'] .= xmlify('' . "\n"); - $arr['object'] .= '' . "\n"; - - $arr['allow_cid'] = $a->user['allow_cid']; - $arr['allow_gid'] = $a->user['allow_gid']; - $arr['deny_cid'] = $a->user['deny_cid']; - $arr['deny_gid'] = $a->user['deny_gid']; - - $i = Item::insert($arr); - if ($i) { - Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); - } -} - - function profiles_content(App $a) { if (! local_user()) { diff --git a/mod/settings.php b/mod/settings.php index 23869913a..48c217bc4 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -442,9 +442,6 @@ function settings_post(App $a) $suggestme = ((x($_POST, 'suggestme')) ? intval($_POST['suggestme']) : 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); - $post_newfriend = (($_POST['post_newfriend'] == 1) ? 1: 0); - $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0); - $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0); $email_textonly = (($_POST['email_textonly'] == 1) ? 1 : 0); $detailed_notif = (($_POST['detailed_notif'] == 1) ? 1 : 0); @@ -558,9 +555,6 @@ function settings_post(App $a) PConfig::set(local_user(), 'expire', 'network_only', $expire_network_only); PConfig::set(local_user(), 'system', 'suggestme', $suggestme); - PConfig::set(local_user(), 'system', 'post_newfriend', $post_newfriend); - PConfig::set(local_user(), 'system', 'post_joingroup', $post_joingroup); - PConfig::set(local_user(), 'system', 'post_profilechange', $post_profilechange); PConfig::set(local_user(), 'system', 'email_textonly', $email_textonly); PConfig::set(local_user(), 'system', 'detailed_notif', $detailed_notif); @@ -1020,9 +1014,6 @@ function settings_content(App $a) $expire_photos = PConfig::get(local_user(), 'expire', 'photos', false); $expire_network_only = PConfig::get(local_user(), 'expire', 'network_only', false); $suggestme = PConfig::get(local_user(), 'system', 'suggestme', false); - $post_newfriend = PConfig::get(local_user(), 'system', 'post_newfriend', false); - $post_joingroup = PConfig::get(local_user(), 'system', 'post_joingroup', false); - $post_profilechange = PConfig::get(local_user(), 'system', 'post_profilechange', false); // nowarn_insecure @@ -1247,10 +1238,6 @@ function settings_content(App $a) '$h_not' => L10n::t('Notification Settings'), - '$activity_options' => L10n::t('By default post a status message when:'), - '$post_newfriend' => ['post_newfriend', L10n::t('accepting a friend request'), $post_newfriend, ''], - '$post_joingroup' => ['post_joingroup', L10n::t('joining a forum/community'), $post_joingroup, ''], - '$post_profilechange' => ['post_profilechange', L10n::t('making an interesting profile change'), $post_profilechange, ''], '$lbl_not' => L10n::t('Send a notification email when:'), '$notify1' => ['notify1', L10n::t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''], '$notify2' => ['notify2', L10n::t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''], diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index bae2eb6a2..d2a7995d8 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -2386,78 +2386,6 @@ class Diaspora ['id' => $contact["id"], 'uid' => $importer["uid"]] ); } - // send notification - - $r = q( - "SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1", - intval($importer["uid"]) - ); - - if ($r && !$r[0]["hide-friends"] && !$contact["hidden"] && intval(PConfig::get($importer["uid"], "system", "post_newfriend"))) { - $self = q( - "SELECT * FROM `contact` WHERE `self` AND `uid` = %d LIMIT 1", - intval($importer["uid"]) - ); - - // they are not CONTACT_IS_FOLLOWER anymore but that's what we have in the array - - if ($self && $contact["rel"] == CONTACT_IS_FOLLOWER) { - $arr = []; - $arr["protocol"] = PROTOCOL_DIASPORA; - $arr["uri"] = $arr["parent-uri"] = item_new_uri($a->get_hostname(), $importer["uid"]); - $arr["uid"] = $importer["uid"]; - $arr["contact-id"] = $self[0]["id"]; - $arr["wall"] = 1; - $arr["type"] = 'wall'; - $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]"; - $B = "[url=".$contact["url"]."]".$contact["name"]."[/url]"; - $BPhoto = "[url=".$contact["url"]."][img]".$contact["thumb"]."[/img][/url]"; - $arr["body"] = L10n::t('%1$s is now friends with %2$s', $A, $B)."\n\n\n".$BPhoto; - - $arr["object"] = self::constructNewFriendObject($contact); - - $user = dba::selectFirst('user', ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'], ['uid' => $importer["uid"]]); - - $arr["allow_cid"] = $user["allow_cid"]; - $arr["allow_gid"] = $user["allow_gid"]; - $arr["deny_cid"] = $user["deny_cid"]; - $arr["deny_gid"] = $user["deny_gid"]; - - $i = Item::insert($arr); - if ($i) { - Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i); - } - } - } - } - - /** - * @brief Creates a XML object for a "new friend" message - * - * @param array $contact Array of the contact - * - * @return string The XML - */ - private static function constructNewFriendObject($contact) - { - $objtype = ACTIVITY_OBJ_PERSON; - $link = ''."\n". - ''."\n"; - - $xmldata = ["object" => ["type" => $objtype, - "title" => $contact["name"], - "id" => $contact["url"]."/".$contact["name"], - "link" => $link]]; - - return XML::fromArray($xmldata, $xml, true); } /** diff --git a/view/templates/intros.tpl b/view/templates/intros.tpl index 2d0bf9bd0..9ebd256db 100644 --- a/view/templates/intros.tpl +++ b/view/templates/intros.tpl @@ -20,7 +20,6 @@
{{include file="field_checkbox.tpl" field=$hidden}} -{{include file="field_checkbox.tpl" field=$activity}} diff --git a/view/templates/settings/settings.tpl b/view/templates/settings/settings.tpl index 099014f13..d017367fe 100644 --- a/view/templates/settings/settings.tpl +++ b/view/templates/settings/settings.tpl @@ -114,13 +114,6 @@
-
{{$activity_options}}
- -{{include file="field_checkbox.tpl" field=$post_newfriend}} -{{include file="field_checkbox.tpl" field=$post_joingroup}} -{{include file="field_checkbox.tpl" field=$post_profilechange}} - -
{{$lbl_not}}
diff --git a/view/theme/frio/templates/intros.tpl b/view/theme/frio/templates/intros.tpl index 5bf3950f1..c153fcd9f 100644 --- a/view/theme/frio/templates/intros.tpl +++ b/view/theme/frio/templates/intros.tpl @@ -50,7 +50,6 @@

{{$fullname}}{{if $addr}} ({{$addr}}){{/if}}

{{include file="field_checkbox.tpl" field=$hidden}} - {{include file="field_checkbox.tpl" field=$activity}} diff --git a/view/theme/frio/templates/settings/settings.tpl b/view/theme/frio/templates/settings/settings.tpl index f197eb5e5..40b0497a0 100644 --- a/view/theme/frio/templates/settings/settings.tpl +++ b/view/theme/frio/templates/settings/settings.tpl @@ -171,15 +171,6 @@
-

{{$activity_options}}

- -
- {{include file="field_checkbox.tpl" field=$post_newfriend}} - {{include file="field_checkbox.tpl" field=$post_joingroup}} - {{include file="field_checkbox.tpl" field=$post_profilechange}} -
- -

{{$lbl_not}}

diff --git a/view/theme/frost-mobile/templates/settings/settings.tpl b/view/theme/frost-mobile/templates/settings/settings.tpl index ccca7eaab..5715e1712 100644 --- a/view/theme/frost-mobile/templates/settings/settings.tpl +++ b/view/theme/frost-mobile/templates/settings/settings.tpl @@ -110,13 +110,6 @@

{{$h_not}}

-
{{$activity_options}}
- -{{include file="field_checkbox.tpl" field=$post_newfriend}} -{{include file="field_checkbox.tpl" field=$post_joingroup}} -{{include file="field_checkbox.tpl" field=$post_profilechange}} - -
{{$lbl_not}}
diff --git a/view/theme/smoothly/style.css b/view/theme/smoothly/style.css index 8d84e1b03..399f12e55 100644 --- a/view/theme/smoothly/style.css +++ b/view/theme/smoothly/style.css @@ -4677,9 +4677,6 @@ div #datebrowse-sidebar.widget { width: 75px; } -#id_post_newfriend, -#id_post_joingroup, -#id_post_profilechange, #id_notify1, #id_notify2, #id_notify3,