]> git.mxchange.org Git - friendica.git/commitdiff
Visiblity is now frequency
authorMichael <heluecht@pirati.ca>
Sat, 16 Sep 2023 04:20:38 +0000 (04:20 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 16 Sep 2023 04:20:38 +0000 (04:20 +0000)
database.sql
doc/database/db_user-contact.md
src/Model/Contact/User.php
src/Module/Contact/Profile.php
src/Module/Conversation/Channel.php
view/templates/contact_edit.tpl
view/theme/frio/templates/contact_edit.tpl

index 131942c1f849c294dcf1001caf75978af03b2e06..32fb258314e68199d7bfec7c54e6943f6c3c8c16 100644 (file)
@@ -1572,6 +1572,9 @@ CREATE TABLE IF NOT EXISTS `post-thread-user` (
         INDEX `psid` (`psid`),
         INDEX `post-user-id` (`post-user-id`),
         INDEX `commented` (`commented`),
+        INDEX `received` (`received`),
+        INDEX `wall` (`wall`),
+        INDEX `origin` (`origin`),
         INDEX `uid_received` (`uid`,`received`),
         INDEX `uid_wall_received` (`uid`,`wall`,`received`),
         INDEX `uid_commented` (`uid`,`commented`),
@@ -1733,14 +1736,14 @@ CREATE TABLE IF NOT EXISTS `report` (
        `cid` int unsigned NOT NULL COMMENT 'Reported contact',
        `gsid` int unsigned COMMENT 'Reported contact server',
        `comment` text COMMENT 'Report',
-       `category-id` int unsigned NOT NULL DEFAULT 1 COMMENT 'Report category, one of Entity\Report::CATEGORY_*',
+       `category-id` int unsigned NOT NULL DEFAULT 1 COMMENT 'Report category, one of Entity Report::CATEGORY_*',
        `forward` boolean COMMENT 'Forward the report to the remote server',
        `public-remarks` text COMMENT 'Remarks shared with the reporter',
        `private-remarks` text COMMENT 'Remarks shared with the moderation team',
        `last-editor-uid` mediumint unsigned COMMENT 'Last editor user',
        `assigned-uid` mediumint unsigned COMMENT 'Assigned moderator user',
-       `status` tinyint unsigned NOT NULL COMMENT 'Status of the report, one of Entity\Report::STATUS_*',
-       `resolution` tinyint unsigned COMMENT 'Resolution of the report, one of Entity\Report::RESOLUTION_*',
+       `status` tinyint unsigned NOT NULL COMMENT 'Status of the report, one of Entity Report::STATUS_*',
+       `resolution` tinyint unsigned COMMENT 'Resolution of the report, one of Entity Report::RESOLUTION_*',
        `created` datetime(6) NOT NULL DEFAULT '0001-01-01 00:00:00.000000' COMMENT '',
        `edited` datetime(6) COMMENT 'Last time the report has been edited',
         PRIMARY KEY(`id`),
@@ -1866,7 +1869,7 @@ CREATE TABLE IF NOT EXISTS `user-contact` (
        `collapsed` boolean COMMENT 'Posts from this contact are collapsed',
        `hidden` boolean COMMENT 'This contact is hidden from the others',
        `is-blocked` boolean COMMENT 'User is blocked by this contact',
-       `channel-visibility` tinyint unsigned COMMENT 'Controls the visibility in channels',
+       `channel-frequency` tinyint unsigned COMMENT 'Controls the frequency of the appearance of this contact in channels',
        `pending` boolean COMMENT '',
        `rel` tinyint unsigned COMMENT 'The kind of the relation between the user and the contact',
        `info` mediumtext COMMENT '',
index 60b3c44b014013676bc38c8a34101b29c7bc50d5..bfba9cb6512d8a8cc5e668ea9e734fd9aa3a4e3d 100644 (file)
@@ -16,7 +16,7 @@ Fields
 | collapsed                 | Posts from this contact are collapsed                                   | boolean            | YES  |     | NULL    |       |
 | hidden                    | This contact is hidden from the others                                  | boolean            | YES  |     | NULL    |       |
 | is-blocked                | User is blocked by this contact                                         | boolean            | YES  |     | NULL    |       |
-| channel-visibility        | Controls the visibility in channels                                     | tinyint unsigned   | YES  |     | NULL    |       |
+| channel-frequency         | Controls the frequency of the appearance of this contact in channels    | tinyint unsigned   | YES  |     | NULL    |       |
 | pending                   |                                                                         | boolean            | YES  |     | NULL    |       |
 | rel                       | The kind of the relation between the user and the contact               | tinyint unsigned   | YES  |     | NULL    |       |
 | info                      |                                                                         | mediumtext         | YES  |     | NULL    |       |
index ff2f093cf4b30a99d448dcf2824b83aa1c004ca0..da53aba7b74051795670773c09e56d7a9eb8c9c9 100644 (file)
@@ -37,10 +37,10 @@ use PDOException;
  */
 class User
 {
-       const VISIBILITY_DEFAULT = 0;
-       const VISIBILITY_NEVER   = 1;
-       const VISIBILITY_ALWAYS  = 2;
-       const VISIBILITY_REDUCED = 3;
+       const FREQUENCY_DEFAULT = 0;
+       const FREQUENCY_NEVER   = 1;
+       const FREQUENCY_ALWAYS  = 2;
+       const FREQUENCY_REDUCED = 3;
        /**
         * Insert a user-contact for a given contact array
         *
@@ -327,14 +327,14 @@ class User
         * @return void
         * @throws \Exception
         */
-       public static function setChannelVisibility(int $cid, int $uid, int $visibility)
+       public static function setChannelFrequency(int $cid, int $uid, int $visibility)
        {
                $cdata = Contact::getPublicAndUserContactID($cid, $uid);
                if (empty($cdata)) {
                        return;
                }
 
-               DBA::update('user-contact', ['channel-visibility' => $visibility], ['cid' => $cdata['public'], 'uid' => $uid], true);
+               DBA::update('user-contact', ['channel-frequency' => $visibility], ['cid' => $cdata['public'], 'uid' => $uid], true);
        }
 
        /**
@@ -346,19 +346,19 @@ class User
         * @throws HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       public static function getChannelVisibility(int $cid, int $uid): int
+       public static function getChannelFrequency(int $cid, int $uid): int
        {
                $cdata = Contact::getPublicAndUserContactID($cid, $uid);
                if (empty($cdata)) {
                        return false;
                }
 
-               $visibility = self::VISIBILITY_DEFAULT;
+               $visibility = self::FREQUENCY_DEFAULT;
 
                if (!empty($cdata['public'])) {
-                       $public_contact = DBA::selectFirst('user-contact', ['channel-visibility'], ['cid' => $cdata['public'], 'uid' => $uid]);
+                       $public_contact = DBA::selectFirst('user-contact', ['channel-frequency'], ['cid' => $cdata['public'], 'uid' => $uid]);
                        if (DBA::isResult($public_contact)) {
-                               $visibility = $public_contact['channel-visibility'] ?? self::VISIBILITY_DEFAULT;
+                               $visibility = $public_contact['channel-frequency'] ?? self::FREQUENCY_DEFAULT;
                        }
                }
 
index c28d48c92ea30484af15e6943120ca2b83925e21..0fa39ed74eda3d1768e1c4f12962239a9c859de1 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()])) {
@@ -342,10 +342,10 @@ 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_frequency     = Contact\User::getChannelFrequency($contact['id'], $this->session->getLocalUserId());
                } else {
                        $channel_settings_label = null;
-                       $channel_visibility     = null;
+                       $channel_frequency     = null;
                }
 
                $poll_interval = null;
@@ -432,12 +432,12 @@ class Profile extends BaseModule
                                $remote_self_options
                        ],
                        '$channel_settings_label' => $channel_settings_label,
-                       '$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],
+                       '$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('If you follow this contact, all their posts 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];
index 83ea662fd2eb219000406bc66b850163807ab40f..35c988ce7c81a81c6f7e4278e4cc07cdcd753828 100644 (file)
@@ -160,5 +160,6 @@ class Channel extends Timeline
                }
 
                $this->maxId = $request['last_created'] ?? $this->maxId;
+               $this->minId = $request['first_created'] ?? $this->minId;
        }
 }
index f17743f7652ca92b67618330971e553bde18d159..38414fabe9e93f965477b62ae632de3af8851a20 100644 (file)
                        {{/if}}
                        {{if $channel_settings_label}}
                                <h4>{{$channel_settings_label}}</h4>
-                               <label>{{$visibility_label}}</label>
-                               {{include file="field_radio.tpl" field=$visibility_default}}
-                               {{include file="field_radio.tpl" field=$visibility_always}}
-                               {{include file="field_radio.tpl" field=$visibility_reduced}}
-                               {{include file="field_radio.tpl" field=$visibility_never}}
-                               <p>{{$visibility_description}}</p>
+                               <label>{{$frequency_label}}</label>
+                               {{include file="field_radio.tpl" field=$frequency_default}}
+                               {{include file="field_radio.tpl" field=$frequency_always}}
+                               {{include file="field_radio.tpl" field=$frequency_reduced}}
+                               {{include file="field_radio.tpl" field=$frequency_never}}
+                               <p>{{$frequency_description}}</p>
                        {{/if}}
 
                        </div>
index c9f8423602f8c707d06e33a75f636c94cf84a4d6..237c4f4345f19bd537e68b7eb72b23ba9346c104 100644 (file)
                                                        <div id="contact-edit-channel-collapse" class="panel-body panel-collapse collapse" role="tabpanel" aria-labelledby="contact-edit-channel">
                                                                <div class="section-content-tools-wrapper">
        
-                                                                       <label>{{$visibility_label}}</label>
-                                                                       {{include file="field_radio.tpl" field=$visibility_default}}
-                                                                       {{include file="field_radio.tpl" field=$visibility_always}}
-                                                                       {{include file="field_radio.tpl" field=$visibility_reduced}}
-                                                                       {{include file="field_radio.tpl" field=$visibility_never}}
-                                                                       <p>{{$visibility_description}}</p>
+                                                                       <label>{{$frequency_label}}</label>
+                                                                       {{include file="field_radio.tpl" field=$frequency_default}}
+                                                                       {{include file="field_radio.tpl" field=$frequency_always}}
+                                                                       {{include file="field_radio.tpl" field=$frequency_reduced}}
+                                                                       {{include file="field_radio.tpl" field=$frequency_never}}
+                                                                       <p>{{$frequency_description}}</p>
 
                                                                        <div class="pull-right settings-submit-wrapper">
                                                                                <button type="submit" name="submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>