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 0257ccbf9b..10949c2c43 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 257333b9cd..b242d13078 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 de1cb6cf7c..6ee45b17d8 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 5fee65546f..1375a8b3ef 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -845,6 +845,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 9f92d9f423..ac1984cef4 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:44+0000\n" +"POT-Creation-Date: 2021-09-26 03:57+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -717,7 +717,7 @@ msgid "OStatus support is disabled. Contact can't be added." msgstr "" #: mod/follow.php:138 src/Content/Item.php:463 src/Content/Widget.php:76 -#: src/Model/Contact.php:1045 src/Model/Contact.php:1058 +#: src/Model/Contact.php:1051 src/Model/Contact.php:1064 #: view/theme/vier/theme.php:172 msgid "Connect/Follow" msgstr "" @@ -3001,31 +3001,31 @@ msgstr "" msgid "Follow Thread" msgstr "" -#: src/Content/Item.php:443 src/Model/Contact.php:1050 +#: src/Content/Item.php:443 src/Model/Contact.php:1056 msgid "View Status" msgstr "" -#: src/Content/Item.php:444 src/Content/Item.php:466 src/Model/Contact.php:976 -#: src/Model/Contact.php:1042 src/Model/Contact.php:1051 +#: src/Content/Item.php:444 src/Content/Item.php:466 src/Model/Contact.php:982 +#: src/Model/Contact.php:1048 src/Model/Contact.php:1057 #: src/Module/Directory.php:160 src/Module/Settings/Profile/Index.php:223 msgid "View Profile" msgstr "" -#: src/Content/Item.php:445 src/Model/Contact.php:1052 +#: src/Content/Item.php:445 src/Model/Contact.php:1058 msgid "View Photos" msgstr "" -#: src/Content/Item.php:446 src/Model/Contact.php:1043 -#: src/Model/Contact.php:1053 +#: src/Content/Item.php:446 src/Model/Contact.php:1049 +#: src/Model/Contact.php:1059 msgid "Network Posts" msgstr "" -#: src/Content/Item.php:447 src/Model/Contact.php:1044 -#: src/Model/Contact.php:1054 +#: src/Content/Item.php:447 src/Model/Contact.php:1050 +#: src/Model/Contact.php:1060 msgid "View Contact" msgstr "" -#: src/Content/Item.php:448 src/Model/Contact.php:1056 +#: src/Content/Item.php:448 src/Model/Contact.php:1062 msgid "Send PM" msgstr "" @@ -3048,7 +3048,7 @@ msgstr "" msgid "Languages" msgstr "" -#: src/Content/Item.php:458 src/Model/Contact.php:1057 +#: src/Content/Item.php:458 src/Model/Contact.php:1063 msgid "Poke" msgstr "" @@ -3498,7 +3498,7 @@ msgstr "" msgid "Organisations" msgstr "" -#: src/Content/Widget.php:529 src/Model/Contact.php:1474 +#: src/Content/Widget.php:529 src/Model/Contact.php:1480 msgid "News" msgstr "" @@ -4362,85 +4362,85 @@ msgstr "" msgid "Legacy module file not found: %s" msgstr "" -#: src/Model/Contact.php:1046 src/Model/Contact.php:1059 +#: src/Model/Contact.php:1052 src/Model/Contact.php:1065 msgid "UnFollow" msgstr "" -#: src/Model/Contact.php:1055 +#: src/Model/Contact.php:1061 msgid "Drop Contact" msgstr "" -#: src/Model/Contact.php:1065 src/Module/Admin/Users/Pending.php:107 +#: src/Model/Contact.php:1071 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:1470 +#: src/Model/Contact.php:1476 msgid "Organisation" msgstr "" -#: src/Model/Contact.php:1478 +#: src/Model/Contact.php:1484 msgid "Forum" msgstr "" -#: src/Model/Contact.php:2334 +#: src/Model/Contact.php:2340 msgid "Disallowed profile URL." msgstr "" -#: src/Model/Contact.php:2339 src/Module/Friendica.php:81 +#: src/Model/Contact.php:2345 src/Module/Friendica.php:81 msgid "Blocked domain" msgstr "" -#: src/Model/Contact.php:2344 +#: src/Model/Contact.php:2350 msgid "Connect URL missing." msgstr "" -#: src/Model/Contact.php:2353 +#: src/Model/Contact.php:2359 msgid "" "The contact could not be added. Please check the relevant network " "credentials in your Settings -> Social Networks page." msgstr "" -#: src/Model/Contact.php:2390 +#: src/Model/Contact.php:2396 msgid "The profile address specified does not provide adequate information." msgstr "" -#: src/Model/Contact.php:2392 +#: src/Model/Contact.php:2398 msgid "No compatible communication protocols or feeds were discovered." msgstr "" -#: src/Model/Contact.php:2395 +#: src/Model/Contact.php:2401 msgid "An author or name was not found." msgstr "" -#: src/Model/Contact.php:2398 +#: src/Model/Contact.php:2404 msgid "No browser URL could be matched to this address." msgstr "" -#: src/Model/Contact.php:2401 +#: src/Model/Contact.php:2407 msgid "" "Unable to match @-style Identity Address with a known protocol or email " "contact." msgstr "" -#: src/Model/Contact.php:2402 +#: src/Model/Contact.php:2408 msgid "Use mailto: in front of address to force email check." msgstr "" -#: src/Model/Contact.php:2408 +#: src/Model/Contact.php:2414 msgid "" "The profile address specified belongs to a network which has been disabled " "on this site." msgstr "" -#: src/Model/Contact.php:2413 +#: src/Model/Contact.php:2419 msgid "" "Limited profile. This person will be unable to receive direct/personal " "notifications from you." msgstr "" -#: src/Model/Contact.php:2472 +#: src/Model/Contact.php:2478 msgid "Unable to retrieve contact information." msgstr ""