-- ------------------------------------------
-- Friendica 2023.09-dev (Giant Rhubarb)
--- DB_UPDATE_VERSION 1523
+-- DB_UPDATE_VERSION 1524
-- ------------------------------------------
`rel` tinyint unsigned COMMENT 'The kind of the relation between the user and the contact',
`info` mediumtext COMMENT '',
`notify_new_posts` boolean COMMENT '',
- `remote_self` boolean COMMENT '',
+ `remote_self` tinyint unsigned COMMENT '0 => No mirroring, 1-2 => Mirror as own post, 3 => Mirror as reshare',
`fetch_further_information` tinyint unsigned COMMENT '0 => None, 1 => Fetch information, 3 => Fetch keywords, 2 => Fetch both',
`ffi_keyword_denylist` text COMMENT '',
`subhub` boolean COMMENT '',
* @property-read int $rel
* @property-read string $info
* @property-read bool $notifyNewPosts
- * @property-read bool $isRemoteSelf
+ * @property-read int $remoteSelf
* @property-read int $fetchFurtherInformation
* @property-read string $ffiKeywordDenylist
* @property-read bool $subhub
const FFI_KEYWORD = 3;
const FFI_BOTH = 2;
+ const MIRROR_DEACTIVATED = 0;
+ const MIRROR_OWN_POST = 2;
+ const MIRROR_NATIVE_RESHARE = 3;
+
/** @var int */
protected $userId;
/** @var int */
protected $info;
/** @var bool */
protected $notifyNewPosts;
- /** @var bool */
- protected $isRemoteSelf;
- /** @var int */
+ /** @var int One of MIRROR_* */
+ protected $remoteSelf;
/** @var int One of FFI_* */
protected $fetchFurtherInformation;
/** @var string */
/** @var int */
protected $priority;
- public function __construct(int $userId, int $contactId, bool $blocked = false, bool $ignored = false, bool $collapsed = false, bool $hidden = false, bool $pending = false, int $rel = Contact::NOTHING, string $info = '', bool $notifyNewPosts = false, bool $isRemoteSelf = false, int $fetchFurtherInformation = self::FFI_NONE, string $ffiKeywordDenylist = '', bool $subhub = false, string $hubVerify = '', string $protocol = Protocol::PHANTOM, ?int $rating = null, ?int $priority = null)
+ public function __construct(int $userId, int $contactId, bool $blocked = false, bool $ignored = false, bool $collapsed = false, bool $hidden = false, bool $pending = false, int $rel = Contact::NOTHING, string $info = '', bool $notifyNewPosts = false, int $remoteSelf = self::MIRROR_DEACTIVATED, int $fetchFurtherInformation = self::FFI_NONE, string $ffiKeywordDenylist = '', bool $subhub = false, string $hubVerify = '', string $protocol = Protocol::PHANTOM, ?int $rating = null, ?int $priority = null)
{
$this->userId = $userId;
$this->contactId = $contactId;
$this->rel = $rel;
$this->info = $info;
$this->notifyNewPosts = $notifyNewPosts;
- $this->isRemoteSelf = $isRemoteSelf;
+ $this->remoteSelf = $remoteSelf;
$this->fetchFurtherInformation = $fetchFurtherInformation;
$this->ffiKeywordDenylist = $ffiKeywordDenylist;
$this->subhub = $subhub;
$row['rel'] ?? Contact::NOTHING,
$row['info'] ?? '',
$row['notify_new_posts'] ?? false,
- $row['remote_self'] ?? false,
+ $row['remote_self'] ?? Entity\LocalRelationship::MIRROR_DEACTIVATED,
$row['fetch_further_information'] ?? Entity\LocalRelationship::FFI_NONE,
$row['ffi_keyword_denylist'] ?? '',
$row['subhub'] ?? false,
'rel' => $localRelationship->rel,
'info' => $localRelationship->info,
'notify_new_posts' => $localRelationship->notifyNewPosts,
- 'remote_self' => $localRelationship->isRemoteSelf,
+ 'remote_self' => $localRelationship->remoteSelf,
'fetch_further_information' => $localRelationship->fetchFurtherInformation,
'ffi_keyword_denylist' => $localRelationship->ffiKeywordDenylist,
'subhub' => $localRelationship->subhub,
use Friendica\Contact\Avatar;
use Friendica\Contact\Introduction\Exception\IntroductionNotFoundException;
+use Friendica\Contact\LocalRelationship\Entity\LocalRelationship;
use Friendica\Content\Conversation as ConversationContent;
use Friendica\Content\Pager;
use Friendica\Content\Text\HTML;
* @}
*/
- const MIRROR_DEACTIVATED = 0;
- const MIRROR_FORWARDED = 1; // Deprecated, now does the same like MIRROR_OWN_POST
- const MIRROR_OWN_POST = 2;
- const MIRROR_NATIVE_RESHARE = 3;
+ /** @deprecated Use Entity\LocalRelationship::MIRROR_DEACTIVATED instead */
+ const MIRROR_DEACTIVATED = LocalRelationship::MIRROR_DEACTIVATED;
+ /** @deprecated Now does the same as MIRROR_OWN_POST */
+ const MIRROR_FORWARDED = 1;
+ /** @deprecated Use Entity\LocalRelationship::MIRROR_OWN_POST instead */
+ const MIRROR_OWN_POST = LocalRelationship::MIRROR_OWN_POST;
+ /** @deprecated Use Entity\LocalRelationship::MIRROR_NATIVE_RESHARE instead */
+ const MIRROR_NATIVE_RESHARE = LocalRelationship::MIRROR_NATIVE_RESHARE;
/**
* @param array $fields Array of selected fields, empty for all
'$remote_self' => [
'remote_self',
$this->t('Mirror postings from this contact'),
- $localRelationship->isRemoteSelf,
+ $localRelationship->remoteSelf,
$this->t('Mark this contact as remote_self, this will cause friendica to repost new entries from this contact.'),
$remote_self_options
],
// This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) {
- define('DB_UPDATE_VERSION', 1523);
+ define('DB_UPDATE_VERSION', 1524);
}
return [
"rel" => ["type" => "tinyint unsigned", "comment" => "The kind of the relation between the user and the contact"],
"info" => ["type" => "mediumtext", "comment" => ""],
"notify_new_posts" => ["type" => "boolean", "comment" => ""],
- "remote_self" => ["type" => "boolean", "comment" => ""],
+ "remote_self" => ["type" => "tinyint unsigned", "comment" => "0 => No mirroring, 1-2 => Mirror as own post, 3 => Mirror as reshare"],
"fetch_further_information" => ["type" => "tinyint unsigned", "comment" => "0 => None, 1 => Fetch information, 3 => Fetch keywords, 2 => Fetch both"],
"ffi_keyword_denylist" => ["type" => "text", "comment" => ""],
"subhub" => ["type" => "boolean", "comment" => ""],
return Update::SUCCESS;
}
+
+/**
+ * user-contact.remote_self was wrongly declared as boolean, possibly truncating integer values from contact.remote_self
+ *
+ * @return int
+ * @throws Exception
+ */
+function update_1524(): int
+{
+ $contacts = DBA::select('contact', ['uid', 'uri-id', 'remote_self'], ["`uid` != ?", 0]);
+ while ($contact = DBA::fetch($contacts)) {
+ Contact\User::insertForContactArray($contact);
+ }
+
+ return Update::SUCCESS;
+}