mirror of
https://github.com/friendica/friendica
synced 2024-12-22 07:20:16 +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)
|
||||
-- DB_UPDATE_VERSION 1571
|
||||
-- DB_UPDATE_VERSION 1572
|
||||
-- ------------------------------------------
|
||||
|
||||
|
||||
|
@ -373,6 +373,7 @@ CREATE TABLE IF NOT EXISTS `apcontact` (
|
|||
`manually-approve` boolean COMMENT '',
|
||||
`discoverable` boolean COMMENT 'Mastodon extension: true if profile is published in their directory',
|
||||
`suspended` boolean COMMENT 'Mastodon extension: true if profile is suspended',
|
||||
`posting-restricted` boolean COMMENT 'lemmy:postingRestrictedToMods',
|
||||
`nick` varchar(255) NOT NULL DEFAULT '' COMMENT '',
|
||||
`name` varchar(255) COMMENT '',
|
||||
`about` text COMMENT '',
|
||||
|
@ -3673,6 +3674,7 @@ CREATE VIEW `account-view` AS SELECT
|
|||
`apcontact`.`outbox` AS `ap-outbox`,
|
||||
`apcontact`.`sharedinbox` AS `ap-sharedinbox`,
|
||||
`apcontact`.`generator` AS `ap-generator`,
|
||||
`apcontact`.`posting-restricted` AS `ap-posting-restricted`,
|
||||
`apcontact`.`following_count` AS `ap-following_count`,
|
||||
`apcontact`.`followers_count` AS `ap-followers_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`.`sharedinbox` AS `ap-sharedinbox`,
|
||||
`apcontact`.`generator` AS `ap-generator`,
|
||||
`apcontact`.`posting-restricted` AS `ap-posting-restricted`,
|
||||
`apcontact`.`following_count` AS `ap-following_count`,
|
||||
`apcontact`.`followers_count` AS `ap-followers_count`,
|
||||
`apcontact`.`statuses_count` AS `ap-statuses_count`,
|
||||
|
|
|
@ -6,40 +6,41 @@ ActivityPub compatible contacts - used in the ActivityPub implementation
|
|||
Fields
|
||||
------
|
||||
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| ---------------- | ------------------------------------------------------------------- | -------------- | ---- | --- | ------------------- | ----- |
|
||||
| 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 | |
|
||||
| uuid | | varbinary(255) | YES | | NULL | |
|
||||
| type | | varchar(20) | NO | | NULL | |
|
||||
| following | | varbinary(383) | YES | | NULL | |
|
||||
| followers | | varbinary(383) | YES | | NULL | |
|
||||
| inbox | | varbinary(383) | NO | | NULL | |
|
||||
| outbox | | varbinary(383) | YES | | NULL | |
|
||||
| sharedinbox | | varbinary(383) | YES | | NULL | |
|
||||
| featured | Address for the collection of featured posts | varbinary(383) | YES | | NULL | |
|
||||
| featured-tags | Address for the collection of featured tags | varbinary(383) | YES | | NULL | |
|
||||
| manually-approve | | 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 | |
|
||||
| nick | | varchar(255) | NO | | | |
|
||||
| name | | varchar(255) | YES | | NULL | |
|
||||
| about | | text | YES | | NULL | |
|
||||
| xmpp | XMPP address | varchar(255) | YES | | NULL | |
|
||||
| matrix | Matrix address | varchar(255) | YES | | NULL | |
|
||||
| photo | | varbinary(383) | YES | | NULL | |
|
||||
| header | Header picture | varbinary(383) | YES | | NULL | |
|
||||
| addr | | varchar(255) | YES | | NULL | |
|
||||
| alias | | varbinary(383) | YES | | NULL | |
|
||||
| pubkey | | text | YES | | NULL | |
|
||||
| subscribe | | varbinary(383) | YES | | NULL | |
|
||||
| baseurl | baseurl of the ap contact | varbinary(383) | YES | | NULL | |
|
||||
| gsid | Global Server ID | int unsigned | YES | | NULL | |
|
||||
| generator | Name of the contact's system | varchar(255) | YES | | NULL | |
|
||||
| following_count | Number of following contacts | int unsigned | YES | | 0 | |
|
||||
| followers_count | Number of followers | int unsigned | YES | | 0 | |
|
||||
| statuses_count | Number of posts | int unsigned | YES | | 0 | |
|
||||
| updated | | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
| Field | Description | Type | Null | Key | Default | Extra |
|
||||
| ------------------ | ------------------------------------------------------------------- | -------------- | ---- | --- | ------------------- | ----- |
|
||||
| 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 | |
|
||||
| uuid | | varbinary(255) | YES | | NULL | |
|
||||
| type | | varchar(20) | NO | | NULL | |
|
||||
| following | | varbinary(383) | YES | | NULL | |
|
||||
| followers | | varbinary(383) | YES | | NULL | |
|
||||
| inbox | | varbinary(383) | NO | | NULL | |
|
||||
| outbox | | varbinary(383) | YES | | NULL | |
|
||||
| sharedinbox | | varbinary(383) | YES | | NULL | |
|
||||
| featured | Address for the collection of featured posts | varbinary(383) | YES | | NULL | |
|
||||
| featured-tags | Address for the collection of featured tags | varbinary(383) | YES | | NULL | |
|
||||
| manually-approve | | 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 | |
|
||||
| posting-restricted | lemmy:postingRestrictedToMods | boolean | YES | | NULL | |
|
||||
| nick | | varchar(255) | NO | | | |
|
||||
| name | | varchar(255) | YES | | NULL | |
|
||||
| about | | text | YES | | NULL | |
|
||||
| xmpp | XMPP address | varchar(255) | YES | | NULL | |
|
||||
| matrix | Matrix address | varchar(255) | YES | | NULL | |
|
||||
| photo | | varbinary(383) | YES | | NULL | |
|
||||
| header | Header picture | varbinary(383) | YES | | NULL | |
|
||||
| addr | | varchar(255) | YES | | NULL | |
|
||||
| alias | | varbinary(383) | YES | | NULL | |
|
||||
| pubkey | | text | YES | | NULL | |
|
||||
| subscribe | | varbinary(383) | YES | | NULL | |
|
||||
| baseurl | baseurl of the ap contact | varbinary(383) | YES | | NULL | |
|
||||
| gsid | Global Server ID | int unsigned | YES | | NULL | |
|
||||
| generator | Name of the contact's system | varchar(255) | YES | | NULL | |
|
||||
| following_count | Number of following contacts | int unsigned | YES | | 0 | |
|
||||
| followers_count | Number of followers | int unsigned | YES | | 0 | |
|
||||
| statuses_count | Number of posts | int unsigned | YES | | 0 | |
|
||||
| updated | | datetime | NO | | 0001-01-01 00:00:00 | |
|
||||
|
||||
Indexes
|
||||
------------
|
||||
|
|
|
@ -295,6 +295,10 @@ class APContact
|
|||
return $fetched_contact;
|
||||
}
|
||||
|
||||
if (!empty($compacted['https://webfinger.net/#'])) {
|
||||
$apcontact['addr'] = JsonLD::fetchElement($compacted, 'https://webfinger.net/#');
|
||||
}
|
||||
|
||||
if (empty($apcontact['addr']) && ($apcontact['type'] != 'Tombstone')) {
|
||||
try {
|
||||
$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['posting-restricted'] = (int)JsonLD::fetchElement($compacted, 'lemmy:postingRestrictedToMods');
|
||||
$apcontact['suspended'] = (int)JsonLD::fetchElement($compacted, 'toot:suspended');
|
||||
|
||||
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'];
|
||||
|
||||
if (!empty($activity['latitude']) && !empty($activity['longitude'])) {
|
||||
|
|
|
@ -605,6 +605,8 @@ class Receiver
|
|||
* @param boolean $trust_source Do we trust the source?
|
||||
* @param boolean $push Message had been pushed to our system
|
||||
* @param array $signer The signer of the post
|
||||
* @param string $http_signer
|
||||
* @param int $completion
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
|
|
|
@ -176,6 +176,7 @@ class JsonLD
|
|||
'fedibird' => (object)['@id' => 'http://fedibird.com/ns#', '@type' => '@id'],
|
||||
'misskey' => (object)['@id' => 'https://misskey-hub.net/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;
|
||||
|
|
|
@ -56,7 +56,7 @@ use Friendica\Database\DBA;
|
|||
|
||||
// This file is required several times during the test in DbaDefinition which justifies this condition
|
||||
if (!defined('DB_UPDATE_VERSION')) {
|
||||
define('DB_UPDATE_VERSION', 1571);
|
||||
define('DB_UPDATE_VERSION', 1572);
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -432,6 +432,7 @@ return [
|
|||
"manually-approve" => ["type" => "boolean", "comment" => ""],
|
||||
"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"],
|
||||
"posting-restricted" => ["type" => "boolean", "comment" => "lemmy:postingRestrictedToMods"],
|
||||
"nick" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
||||
"name" => ["type" => "varchar(255)", "comment" => ""],
|
||||
"about" => ["type" => "text", "comment" => ""],
|
||||
|
|
|
@ -1621,6 +1621,7 @@
|
|||
"ap-outbox" => ["apcontact", "outbox"],
|
||||
"ap-sharedinbox" => ["apcontact", "sharedinbox"],
|
||||
"ap-generator" => ["apcontact", "generator"],
|
||||
"ap-posting-restricted" => ["apcontact", "posting-restricted"],
|
||||
"ap-following_count" => ["apcontact", "following_count"],
|
||||
"ap-followers_count" => ["apcontact", "followers_count"],
|
||||
"ap-statuses_count" => ["apcontact", "statuses_count"],
|
||||
|
@ -1725,6 +1726,7 @@
|
|||
"ap-outbox" => ["apcontact", "outbox"],
|
||||
"ap-sharedinbox" => ["apcontact", "sharedinbox"],
|
||||
"ap-generator" => ["apcontact", "generator"],
|
||||
"ap-posting-restricted" => ["apcontact", "posting-restricted"],
|
||||
"ap-following_count" => ["apcontact", "following_count"],
|
||||
"ap-followers_count" => ["apcontact", "followers_count"],
|
||||
"ap-statuses_count" => ["apcontact", "statuses_count"],
|
||||
|
|
Loading…
Reference in a new issue