diff --git a/.drone.yml b/.drone.yml index ab2875e980..4c4555a8a8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -410,6 +410,7 @@ steps: - # calculate SHA256 checksum - cd ./build - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256" + - chmod 664 ./* - ls -lh - # output the sha256 sum for checking - cat "$ARTIFACT.sum256" @@ -518,6 +519,7 @@ steps: - # calculate SHA256 checksum - cd ./build - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256" + - chmod 664 ./* - ls -lh - # output the sha256 sum for checking - cat "$ARTIFACT.sum256" diff --git a/doc/Addons.md b/doc/Addons.md index 4a32dc09f4..72adb0372b 100644 --- a/doc/Addons.md +++ b/doc/Addons.md @@ -479,6 +479,23 @@ Hook data: - **uid** (input): the user to return the contact data for (can be empty for public contacts). - **result** (output): Set by the hook function to indicate a successful detection. +### follow + +Called before adding a new contact for a user to handle non-native network remote contact (like Twitter). + +Hook data: + +- **url** (input): URL of the remote contact. +- **contact** (output): should be filled with the contact (with uid = user creating the contact) array if follow was successful. + +### unfollow + +Called when unfollowing a remote contact on a non-native network (like Twitter) + +Hook data: +- **contact** (input): the remote contact (uid = local unfollowing user id) array. +- **dissolve** (input): whether to stop sharing with the remote contact as well. + ## Complete list of hook callbacks Here is a complete list of all hook callbacks with file locations (as of 24-Sep-2018). Please see the source for details of any hooks not documented above. @@ -648,6 +665,7 @@ Here is a complete list of all hook callbacks with file locations (as of 24-Sep- Hook::callAll('contact_photo_menu', $args); Hook::callAll('follow', $arr); + Hook::callAll('unfollow', $hook_data); ### src/Model/Profile.php diff --git a/doc/de/Addons.md b/doc/de/Addons.md index 276f5ed1b6..fe27354822 100644 --- a/doc/de/Addons.md +++ b/doc/de/Addons.md @@ -356,6 +356,7 @@ Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 01-Ap Hook::callAll('contact_photo_menu', $args); Hook::callAll('follow', $arr); + Hook::callAll('unfollow', $hook_data); ### src/Model/Profile.php diff --git a/mod/unfollow.php b/mod/unfollow.php index f1117674df..2f92640886 100644 --- a/mod/unfollow.php +++ b/mod/unfollow.php @@ -144,7 +144,7 @@ function unfollow_process(string $url) Contact::terminateFriendship($owner, $contact, $dissolve); } - // Sharing-only contacts get deleted as there no relationship any more + // Sharing-only contacts get deleted as there no relationship anymore if ($dissolve) { Contact::remove($contact['id']); $return_path = $base_return_path; diff --git a/src/Model/Contact.php b/src/Model/Contact.php index cd56b672c1..6452101f4a 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -871,6 +871,12 @@ class Contact if ($dissolve) { ActivityPub\Transmitter::sendContactReject($contact['url'], $contact['hub-verify'], $user['uid']); } + } else { + $hook_data = [ + 'contact' => $contact, + 'dissolve' => $dissolve, + ]; + Hook::callAll('unfollow', $hook_data); } } diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 5db27c6bbc..a0252cd5f9 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2021.12-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-25 18:43+0000\n" +"POT-Creation-Date: 2021-09-26 03:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -184,32 +184,32 @@ msgstr "" msgid "Follow Thread" msgstr "" -#: include/conversation.php:854 src/Model/Contact.php:1076 +#: include/conversation.php:854 src/Model/Contact.php:1082 msgid "View Status" msgstr "" #: include/conversation.php:855 include/conversation.php:877 -#: src/Model/Contact.php:1002 src/Model/Contact.php:1068 -#: src/Model/Contact.php:1077 src/Module/Directory.php:160 +#: src/Model/Contact.php:1008 src/Model/Contact.php:1074 +#: src/Model/Contact.php:1083 src/Module/Directory.php:160 #: src/Module/Settings/Profile/Index.php:223 msgid "View Profile" msgstr "" -#: include/conversation.php:856 src/Model/Contact.php:1078 +#: include/conversation.php:856 src/Model/Contact.php:1084 msgid "View Photos" msgstr "" -#: include/conversation.php:857 src/Model/Contact.php:1069 -#: src/Model/Contact.php:1079 +#: include/conversation.php:857 src/Model/Contact.php:1075 +#: src/Model/Contact.php:1085 msgid "Network Posts" msgstr "" -#: include/conversation.php:858 src/Model/Contact.php:1070 -#: src/Model/Contact.php:1080 +#: include/conversation.php:858 src/Model/Contact.php:1076 +#: src/Model/Contact.php:1086 msgid "View Contact" msgstr "" -#: include/conversation.php:859 src/Model/Contact.php:1082 +#: include/conversation.php:859 src/Model/Contact.php:1088 msgid "Send PM" msgstr "" @@ -232,12 +232,12 @@ msgstr "" msgid "Languages" msgstr "" -#: include/conversation.php:869 src/Model/Contact.php:1083 +#: include/conversation.php:869 src/Model/Contact.php:1089 msgid "Poke" msgstr "" #: include/conversation.php:874 mod/follow.php:138 src/Content/Widget.php:76 -#: src/Model/Contact.php:1071 src/Model/Contact.php:1084 +#: src/Model/Contact.php:1077 src/Model/Contact.php:1090 #: view/theme/vier/theme.php:172 msgid "Connect/Follow" msgstr "" @@ -3498,7 +3498,7 @@ msgstr "" msgid "Organisations" msgstr "" -#: src/Content/Widget.php:529 src/Model/Contact.php:1499 +#: src/Content/Widget.php:529 src/Model/Contact.php:1505 msgid "News" msgstr "" @@ -4362,85 +4362,85 @@ msgstr "" msgid "Legacy module file not found: %s" msgstr "" -#: src/Model/Contact.php:1072 src/Model/Contact.php:1085 +#: src/Model/Contact.php:1078 src/Model/Contact.php:1091 msgid "UnFollow" msgstr "" -#: src/Model/Contact.php:1081 +#: src/Model/Contact.php:1087 msgid "Drop Contact" msgstr "" -#: src/Model/Contact.php:1091 src/Module/Admin/Users/Pending.php:107 +#: src/Model/Contact.php:1097 src/Module/Admin/Users/Pending.php:107 #: src/Module/Notifications/Introductions.php:111 #: src/Module/Notifications/Introductions.php:183 msgid "Approve" msgstr "" -#: src/Model/Contact.php:1495 +#: src/Model/Contact.php:1501 msgid "Organisation" msgstr "" -#: src/Model/Contact.php:1503 +#: src/Model/Contact.php:1509 msgid "Forum" msgstr "" -#: src/Model/Contact.php:2359 +#: src/Model/Contact.php:2365 msgid "Disallowed profile URL." msgstr "" -#: src/Model/Contact.php:2364 src/Module/Friendica.php:81 +#: src/Model/Contact.php:2370 src/Module/Friendica.php:81 msgid "Blocked domain" msgstr "" -#: src/Model/Contact.php:2369 +#: src/Model/Contact.php:2375 msgid "Connect URL missing." msgstr "" -#: src/Model/Contact.php:2378 +#: src/Model/Contact.php:2384 msgid "" "The contact could not be added. Please check the relevant network " "credentials in your Settings -> Social Networks page." msgstr "" -#: src/Model/Contact.php:2415 +#: src/Model/Contact.php:2421 msgid "The profile address specified does not provide adequate information." msgstr "" -#: src/Model/Contact.php:2417 +#: src/Model/Contact.php:2423 msgid "No compatible communication protocols or feeds were discovered." msgstr "" -#: src/Model/Contact.php:2420 +#: src/Model/Contact.php:2426 msgid "An author or name was not found." msgstr "" -#: src/Model/Contact.php:2423 +#: src/Model/Contact.php:2429 msgid "No browser URL could be matched to this address." msgstr "" -#: src/Model/Contact.php:2426 +#: src/Model/Contact.php:2432 msgid "" "Unable to match @-style Identity Address with a known protocol or email " "contact." msgstr "" -#: src/Model/Contact.php:2427 +#: src/Model/Contact.php:2433 msgid "Use mailto: in front of address to force email check." msgstr "" -#: src/Model/Contact.php:2433 +#: src/Model/Contact.php:2439 msgid "" "The profile address specified belongs to a network which has been disabled " "on this site." msgstr "" -#: src/Model/Contact.php:2438 +#: src/Model/Contact.php:2444 msgid "" "Limited profile. This person will be unable to receive direct/personal " "notifications from you." msgstr "" -#: src/Model/Contact.php:2497 +#: src/Model/Contact.php:2503 msgid "Unable to retrieve contact information." msgstr ""