]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Contact/Profile.php
Merge pull request #13314 from MrPetovan/bug/13311-removeme-delegate
[friendica.git] / src / Module / Contact / Profile.php
index 51ab549e8398837b960fcc0b3cdf92469399db0e..04def1a4f96974651de2cf012126b4c80919f67a 100644 (file)
@@ -132,8 +132,8 @@ class Profile extends BaseModule
                        $fields['info'] = $_POST['info'];
                }
 
-               if (isset($_POST['channel_visibility'])) {
-                       Contact\User::setChannelVisibility($cdata['user'], $this->session->getLocalUserId(), $_POST['channel_visibility']);
+               if (isset($_POST['channel_frequency'])) {
+                       Contact\User::setChannelFrequency($cdata['user'], $this->session->getLocalUserId(), $_POST['channel_frequency']);
                }
 
                if (!Contact::update($fields, ['id' => $cdata['user'], 'uid' => $this->session->getLocalUserId()])) {
@@ -340,20 +340,7 @@ class Profile extends BaseModule
                        ];
                }
 
-               if (in_array($contact['network'], Protocol::FEDERATED)) {
-                       $channel_settings_label = $this->t('Channel Settings');
-                       $channel_visibility     = Contact\User::getChannelVisibility($contact['id'], $this->session->getLocalUserId());
-                       $channel_visibilities   = [
-                               Contact\User::VISIBILITY_DEFAULT => $this->t('Default visibility'),
-                               Contact\User::VISIBILITY_ALWAYS  => $this->t('Display all posts of this contact'),
-                               Contact\User::VISIBILITY_REDUCED => $this->t('Display only few posts'),
-                               Contact\User::VISIBILITY_NEVER   => $this->t('Never display posts from this contact'),
-                       ];
-               } else {
-                       $channel_settings_label = null;
-                       $channel_visibility     = null;
-                       $channel_visibilities   = null;
-               }
+               $channel_frequency     = Contact\User::getChannelFrequency($contact['id'], $this->session->getLocalUserId());
 
                $poll_interval = null;
                if ((($contact['network'] == Protocol::FEED) && !$this->config->get('system', 'adjust_poll_frequency')) || ($contact['network'] == Protocol::MAIL)) {
@@ -438,21 +425,14 @@ class Profile extends BaseModule
                                $this->t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'),
                                $remote_self_options
                        ],
-                       '$channel_settings_label' => $channel_settings_label,
-                       '$channel_visibility'     => [
-                               'channel_visibility',
-                               $this->t('Visibility of this contact in appropriate channels'),
-                               $channel_visibility,
-                               $this->t('Depending on the type of the channel not all posts from contacts are displayed by default. They for example need to have a certain amount of comments to be displayed. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don\'t want to see their content at all, but you don\'t want to block or hide the contact completely.'),
-                               $channel_visibilities
-                       ],
-                       '$visibility_label'       => $this->t('Frequency of this contact in relevant channels'),
-                       '$visibility_description' => $this->t("Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely."),
-                       '$visibility_default'     => ['channel_visibility', $this->t('Default frequency'), Contact\User::VISIBILITY_DEFAULT, $this->t('Posts by this contact are displayed in the "for you" channel if you interact often with this contact or if a post reached some level of interaction.'), $channel_visibility == Contact\User::VISIBILITY_DEFAULT],
-                       '$visibility_always'      => ['channel_visibility', $this->t('Display all posts of this contact'), Contact\User::VISIBILITY_ALWAYS, $this->t('If you follow this contact, all their posts will appear on the "for you" channel'), $channel_visibility == Contact\User::VISIBILITY_ALWAYS],
-                       '$visibility_reduced'     => ['channel_visibility', $this->t('Display only few posts'), Contact\User::VISIBILITY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_visibility == Contact\User::VISIBILITY_REDUCED],
-                       '$visibility_never'       => ['channel_visibility', $this->t('Never display posts'), Contact\User::VISIBILITY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_visibility == Contact\User::VISIBILITY_NEVER],
-       ]);
+                       '$channel_settings_label' => $this->t('Channel Settings'),
+                       '$frequency_label'        => $this->t('Frequency of this contact in relevant channels'),
+                       '$frequency_description'  => $this->t("Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely."),
+                       '$frequency_default'      => ['channel_frequency', $this->t('Default frequency'), Contact\User::FREQUENCY_DEFAULT, $this->t('Posts by this contact are displayed in the "for you" channel if you interact often with this contact or if a post reached some level of interaction.'), $channel_frequency == Contact\User::FREQUENCY_DEFAULT],
+                       '$frequency_always'       => ['channel_frequency', $this->t('Display all posts of this contact'), Contact\User::FREQUENCY_ALWAYS, $this->t('All posts from this contact will appear on the "for you" channel'), $channel_frequency == Contact\User::FREQUENCY_ALWAYS],
+                       '$frequency_reduced'      => ['channel_frequency', $this->t('Display only few posts'), Contact\User::FREQUENCY_REDUCED, $this->t('When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel.'), $channel_frequency == Contact\User::FREQUENCY_REDUCED],
+                       '$frequency_never'        => ['channel_frequency', $this->t('Never display posts'), Contact\User::FREQUENCY_NEVER, $this->t('Posts from this contact will never be displayed in any channel'), $channel_frequency == Contact\User::FREQUENCY_NEVER],
+               ]);
 
                $arr = ['contact' => $contact, 'output' => $o];