mirror of
https://github.com/friendica/friendica
synced 2024-11-09 22:22:53 +00:00
Merge pull request #14380 from annando/issue-14377
Issue 14377: Support for "postingRestrictedToMods" added
This commit is contained in:
commit
4ac29047dc
8 changed files with 56 additions and 37 deletions
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 2024.09-dev (Yellow Archangel)
|
-- Friendica 2024.09-dev (Yellow Archangel)
|
||||||
-- DB_UPDATE_VERSION 1571
|
-- DB_UPDATE_VERSION 1572
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,6 +373,7 @@ CREATE TABLE IF NOT EXISTS `apcontact` (
|
||||||
`manually-approve` boolean COMMENT '',
|
`manually-approve` boolean COMMENT '',
|
||||||
`discoverable` boolean COMMENT 'Mastodon extension: true if profile is published in their directory',
|
`discoverable` boolean COMMENT 'Mastodon extension: true if profile is published in their directory',
|
||||||
`suspended` boolean COMMENT 'Mastodon extension: true if profile is suspended',
|
`suspended` boolean COMMENT 'Mastodon extension: true if profile is suspended',
|
||||||
|
`posting-restricted` boolean COMMENT 'lemmy:postingRestrictedToMods',
|
||||||
`nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
`nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||||
`name` varchar(255) COMMENT '',
|
`name` varchar(255) COMMENT '',
|
||||||
`about` text COMMENT '',
|
`about` text COMMENT '',
|
||||||
|
@ -3673,6 +3674,7 @@ CREATE VIEW `account-view` AS SELECT
|
||||||
`apcontact`.`outbox` AS `ap-outbox`,
|
`apcontact`.`outbox` AS `ap-outbox`,
|
||||||
`apcontact`.`sharedinbox` AS `ap-sharedinbox`,
|
`apcontact`.`sharedinbox` AS `ap-sharedinbox`,
|
||||||
`apcontact`.`generator` AS `ap-generator`,
|
`apcontact`.`generator` AS `ap-generator`,
|
||||||
|
`apcontact`.`posting-restricted` AS `ap-posting-restricted`,
|
||||||
`apcontact`.`following_count` AS `ap-following_count`,
|
`apcontact`.`following_count` AS `ap-following_count`,
|
||||||
`apcontact`.`followers_count` AS `ap-followers_count`,
|
`apcontact`.`followers_count` AS `ap-followers_count`,
|
||||||
`apcontact`.`statuses_count` AS `ap-statuses_count`,
|
`apcontact`.`statuses_count` AS `ap-statuses_count`,
|
||||||
|
@ -3779,6 +3781,7 @@ CREATE VIEW `account-user-view` AS SELECT
|
||||||
`apcontact`.`outbox` AS `ap-outbox`,
|
`apcontact`.`outbox` AS `ap-outbox`,
|
||||||
`apcontact`.`sharedinbox` AS `ap-sharedinbox`,
|
`apcontact`.`sharedinbox` AS `ap-sharedinbox`,
|
||||||
`apcontact`.`generator` AS `ap-generator`,
|
`apcontact`.`generator` AS `ap-generator`,
|
||||||
|
`apcontact`.`posting-restricted` AS `ap-posting-restricted`,
|
||||||
`apcontact`.`following_count` AS `ap-following_count`,
|
`apcontact`.`following_count` AS `ap-following_count`,
|
||||||
`apcontact`.`followers_count` AS `ap-followers_count`,
|
`apcontact`.`followers_count` AS `ap-followers_count`,
|
||||||
`apcontact`.`statuses_count` AS `ap-statuses_count`,
|
`apcontact`.`statuses_count` AS `ap-statuses_count`,
|
||||||
|
|
|
@ -7,7 +7,7 @@ Fields
|
||||||
------
|
------
|
||||||
|
|
||||||
| Field | Description | Type | Null | Key | Default | Extra |
|
| Field | Description | Type | Null | Key | Default | Extra |
|
||||||
| ---------------- | ------------------------------------------------------------------- | -------------- | ---- | --- | ------------------- | ----- |
|
| ------------------ | ------------------------------------------------------------------- | -------------- | ---- | --- | ------------------- | ----- |
|
||||||
| url | URL of the contact | varbinary(383) | NO | PRI | NULL | |
|
| url | URL of the contact | varbinary(383) | NO | PRI | NULL | |
|
||||||
| uri-id | Id of the item-uri table entry that contains the apcontact url | int unsigned | YES | | NULL | |
|
| uri-id | Id of the item-uri table entry that contains the apcontact url | int unsigned | YES | | NULL | |
|
||||||
| uuid | | varbinary(255) | YES | | NULL | |
|
| uuid | | varbinary(255) | YES | | NULL | |
|
||||||
|
@ -22,6 +22,7 @@ Fields
|
||||||
| manually-approve | | boolean | YES | | NULL | |
|
| manually-approve | | boolean | YES | | NULL | |
|
||||||
| discoverable | Mastodon extension: true if profile is published in their directory | boolean | YES | | NULL | |
|
| discoverable | Mastodon extension: true if profile is published in their directory | boolean | YES | | NULL | |
|
||||||
| suspended | Mastodon extension: true if profile is suspended | boolean | YES | | NULL | |
|
| suspended | Mastodon extension: true if profile is suspended | boolean | YES | | NULL | |
|
||||||
|
| posting-restricted | lemmy:postingRestrictedToMods | boolean | YES | | NULL | |
|
||||||
| nick | | varchar(255) | NO | | | |
|
| nick | | varchar(255) | NO | | | |
|
||||||
| name | | varchar(255) | YES | | NULL | |
|
| name | | varchar(255) | YES | | NULL | |
|
||||||
| about | | text | YES | | NULL | |
|
| about | | text | YES | | NULL | |
|
||||||
|
|
|
@ -295,6 +295,10 @@ class APContact
|
||||||
return $fetched_contact;
|
return $fetched_contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($compacted['https://webfinger.net/#'])) {
|
||||||
|
$apcontact['addr'] = JsonLD::fetchElement($compacted, 'https://webfinger.net/#');
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($apcontact['addr']) && ($apcontact['type'] != 'Tombstone')) {
|
if (empty($apcontact['addr']) && ($apcontact['type'] != 'Tombstone')) {
|
||||||
try {
|
try {
|
||||||
$apcontact['addr'] = $apcontact['nick'] . '@' . (new Uri($apcontact['url']))->getAuthority();
|
$apcontact['addr'] = $apcontact['nick'] . '@' . (new Uri($apcontact['url']))->getAuthority();
|
||||||
|
@ -313,7 +317,7 @@ class APContact
|
||||||
}
|
}
|
||||||
|
|
||||||
$apcontact['manually-approve'] = (int)JsonLD::fetchElement($compacted, 'as:manuallyApprovesFollowers');
|
$apcontact['manually-approve'] = (int)JsonLD::fetchElement($compacted, 'as:manuallyApprovesFollowers');
|
||||||
|
$apcontact['posting-restricted'] = (int)JsonLD::fetchElement($compacted, 'lemmy:postingRestrictedToMods');
|
||||||
$apcontact['suspended'] = (int)JsonLD::fetchElement($compacted, 'toot:suspended');
|
$apcontact['suspended'] = (int)JsonLD::fetchElement($compacted, 'toot:suspended');
|
||||||
|
|
||||||
if (!empty($compacted['as:generator'])) {
|
if (!empty($compacted['as:generator'])) {
|
||||||
|
|
|
@ -993,6 +993,11 @@ class Processor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$author = Contact::selectFirstAccount(['ap-posting-restricted'], ['id' => $item['author-id']]);
|
||||||
|
if (!empty($author['ap-posting-restricted'])) {
|
||||||
|
$item['restrictions'] = $item['restrictions'] | Item::CANT_REPLY;
|
||||||
|
}
|
||||||
|
|
||||||
$item['location'] = $activity['location'];
|
$item['location'] = $activity['location'];
|
||||||
|
|
||||||
if (!empty($activity['latitude']) && !empty($activity['longitude'])) {
|
if (!empty($activity['latitude']) && !empty($activity['longitude'])) {
|
||||||
|
|
|
@ -605,6 +605,8 @@ class Receiver
|
||||||
* @param boolean $trust_source Do we trust the source?
|
* @param boolean $trust_source Do we trust the source?
|
||||||
* @param boolean $push Message had been pushed to our system
|
* @param boolean $push Message had been pushed to our system
|
||||||
* @param array $signer The signer of the post
|
* @param array $signer The signer of the post
|
||||||
|
* @param string $http_signer
|
||||||
|
* @param int $completion
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
|
|
|
@ -176,6 +176,7 @@ class JsonLD
|
||||||
'fedibird' => (object)['@id' => 'http://fedibird.com/ns#', '@type' => '@id'],
|
'fedibird' => (object)['@id' => 'http://fedibird.com/ns#', '@type' => '@id'],
|
||||||
'misskey' => (object)['@id' => 'https://misskey-hub.net/ns#', '@type' => '@id'],
|
'misskey' => (object)['@id' => 'https://misskey-hub.net/ns#', '@type' => '@id'],
|
||||||
'pixelfed' => (object)['@id' => 'http://pixelfed.org/ns#', '@type' => '@id'],
|
'pixelfed' => (object)['@id' => 'http://pixelfed.org/ns#', '@type' => '@id'],
|
||||||
|
'lemmy' => (object)['@id' => 'https://join-lemmy.org/ns#', '@type' => '@id'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$orig_json = $json;
|
$orig_json = $json;
|
||||||
|
|
|
@ -56,7 +56,7 @@ use Friendica\Database\DBA;
|
||||||
|
|
||||||
// This file is required several times during the test in DbaDefinition which justifies this condition
|
// This file is required several times during the test in DbaDefinition which justifies this condition
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1571);
|
define('DB_UPDATE_VERSION', 1572);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -432,6 +432,7 @@ return [
|
||||||
"manually-approve" => ["type" => "boolean", "comment" => ""],
|
"manually-approve" => ["type" => "boolean", "comment" => ""],
|
||||||
"discoverable" => ["type" => "boolean", "comment" => "Mastodon extension: true if profile is published in their directory"],
|
"discoverable" => ["type" => "boolean", "comment" => "Mastodon extension: true if profile is published in their directory"],
|
||||||
"suspended" => ["type" => "boolean", "comment" => "Mastodon extension: true if profile is suspended"],
|
"suspended" => ["type" => "boolean", "comment" => "Mastodon extension: true if profile is suspended"],
|
||||||
|
"posting-restricted" => ["type" => "boolean", "comment" => "lemmy:postingRestrictedToMods"],
|
||||||
"nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
"nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||||
"name" => ["type" => "varchar(255)", "comment" => ""],
|
"name" => ["type" => "varchar(255)", "comment" => ""],
|
||||||
"about" => ["type" => "text", "comment" => ""],
|
"about" => ["type" => "text", "comment" => ""],
|
||||||
|
|
|
@ -1621,6 +1621,7 @@
|
||||||
"ap-outbox" => ["apcontact", "outbox"],
|
"ap-outbox" => ["apcontact", "outbox"],
|
||||||
"ap-sharedinbox" => ["apcontact", "sharedinbox"],
|
"ap-sharedinbox" => ["apcontact", "sharedinbox"],
|
||||||
"ap-generator" => ["apcontact", "generator"],
|
"ap-generator" => ["apcontact", "generator"],
|
||||||
|
"ap-posting-restricted" => ["apcontact", "posting-restricted"],
|
||||||
"ap-following_count" => ["apcontact", "following_count"],
|
"ap-following_count" => ["apcontact", "following_count"],
|
||||||
"ap-followers_count" => ["apcontact", "followers_count"],
|
"ap-followers_count" => ["apcontact", "followers_count"],
|
||||||
"ap-statuses_count" => ["apcontact", "statuses_count"],
|
"ap-statuses_count" => ["apcontact", "statuses_count"],
|
||||||
|
@ -1725,6 +1726,7 @@
|
||||||
"ap-outbox" => ["apcontact", "outbox"],
|
"ap-outbox" => ["apcontact", "outbox"],
|
||||||
"ap-sharedinbox" => ["apcontact", "sharedinbox"],
|
"ap-sharedinbox" => ["apcontact", "sharedinbox"],
|
||||||
"ap-generator" => ["apcontact", "generator"],
|
"ap-generator" => ["apcontact", "generator"],
|
||||||
|
"ap-posting-restricted" => ["apcontact", "posting-restricted"],
|
||||||
"ap-following_count" => ["apcontact", "following_count"],
|
"ap-following_count" => ["apcontact", "following_count"],
|
||||||
"ap-followers_count" => ["apcontact", "followers_count"],
|
"ap-followers_count" => ["apcontact", "followers_count"],
|
||||||
"ap-statuses_count" => ["apcontact", "statuses_count"],
|
"ap-statuses_count" => ["apcontact", "statuses_count"],
|
||||||
|
|
Loading…
Reference in a new issue