diff --git a/database.sql b/database.sql index 04401f4c0d..4e940b3197 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2022.12-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1493 +-- DB_UPDATE_VERSION 1495 -- ------------------------------------------ @@ -1656,6 +1656,7 @@ CREATE TABLE IF NOT EXISTS `report` ( `comment` text COMMENT 'Report', `forward` boolean COMMENT 'Forward the report to the remote server', `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '', + `status` tinyint unsigned COMMENT 'Status of the report', PRIMARY KEY(`id`), INDEX `uid` (`uid`), INDEX `cid` (`cid`), @@ -1669,6 +1670,7 @@ CREATE TABLE IF NOT EXISTS `report` ( CREATE TABLE IF NOT EXISTS `report-post` ( `rid` int unsigned NOT NULL COMMENT 'Report id', `uri-id` int unsigned NOT NULL COMMENT 'Uri-id of the reported post', + `status` tinyint unsigned COMMENT 'Status of the reported post', PRIMARY KEY(`rid`,`uri-id`), INDEX `uri-id` (`uri-id`), FOREIGN KEY (`rid`) REFERENCES `report` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, @@ -2499,6 +2501,24 @@ CREATE VIEW `collection-view` AS SELECT INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id` INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`; +-- +-- VIEW media-view +-- +DROP VIEW IF EXISTS `media-view`; +CREATE VIEW `media-view` AS SELECT + `post-media`.`uri-id` AS `uri-id`, + `post-media`.`type` AS `type`, + `post`.`received` AS `received`, + `post`.`created` AS `created`, + `post`.`private` AS `private`, + `post`.`visible` AS `visible`, + `post`.`deleted` AS `deleted`, + `post`.`thr-parent-id` AS `thr-parent-id`, + `post`.`author-id` AS `author-id`, + `post`.`gravity` AS `gravity` + FROM `post-media` + INNER JOIN `post` ON `post-media`.`uri-id` = `post`.`uri-id`; + -- -- VIEW tag-view -- diff --git a/doc/database/db_report-post.md b/doc/database/db_report-post.md index 303aa3256f..fcaff6c2e4 100644 --- a/doc/database/db_report-post.md +++ b/doc/database/db_report-post.md @@ -6,10 +6,11 @@ Table report-post Fields ------ -| Field | Description | Type | Null | Key | Default | Extra | -| ------ | --------------------------- | ------------ | ---- | --- | ------- | ----- | -| rid | Report id | int unsigned | NO | PRI | NULL | | -| uri-id | Uri-id of the reported post | int unsigned | NO | PRI | NULL | | +| Field | Description | Type | Null | Key | Default | Extra | +| ------ | --------------------------- | ---------------- | ---- | --- | ------- | ----- | +| rid | Report id | int unsigned | NO | PRI | NULL | | +| uri-id | Uri-id of the reported post | int unsigned | NO | PRI | NULL | | +| status | Status of the reported post | tinyint unsigned | YES | | NULL | | Indexes ------------ diff --git a/doc/database/db_report.md b/doc/database/db_report.md index ababf6472f..9a87abe1f4 100644 --- a/doc/database/db_report.md +++ b/doc/database/db_report.md @@ -14,6 +14,7 @@ Fields | comment | Report | text | YES | | NULL | | | forward | Forward the report to the remote server | boolean | YES | | NULL | | | created | | datetime | NO | | 0001-01-01 00:00:00 | | +| status | Status of the report | tinyint unsigned | YES | | NULL | | Indexes ------------ diff --git a/src/Model/GServer.php b/src/Model/GServer.php index 03e42c62b4..a128060f4c 100644 --- a/src/Model/GServer.php +++ b/src/Model/GServer.php @@ -70,6 +70,7 @@ class GServer const DETECT_UNSPECIFIC = [self::DETECT_MANUAL, self::DETECT_HEADER, self::DETECT_BODY, self::DETECT_HOST_META, self::DETECT_CONTACTS, self::DETECT_AP_ACTOR]; // Implementation specific endpoints + // @todo Possibly add Lemmy detection via the endpoint /api/v3/site const DETECT_FRIENDIKA = 10; const DETECT_FRIENDICA = 11; const DETECT_STATUSNET = 12; diff --git a/src/Module/Api/Mastodon/Accounts/Statuses.php b/src/Module/Api/Mastodon/Accounts/Statuses.php index 9481172129..b244c56fb2 100644 --- a/src/Module/Api/Mastodon/Accounts/Statuses.php +++ b/src/Module/Api/Mastodon/Accounts/Statuses.php @@ -69,6 +69,8 @@ class Statuses extends BaseApi if ($request['pinned']) { $condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], 'type' => Post\Collection::FEATURED]; + } elseif ($request['only_media']) { + $condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], 'type' => [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]]; } elseif (!$uid) { $condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], 'uid' => 0, 'network' => Protocol::FEDERATED]; @@ -76,16 +78,11 @@ class Statuses extends BaseApi $condition = ["`author-id` = ? AND (`uid` = 0 OR (`uid` = ? AND NOT `global`))", $id, $uid]; } - if (!$request['pinned']) { + if (!$request['pinned'] && !$request['only_media']) { $condition = DBA::mergeConditions($condition, ["(`gravity` IN (?, ?) OR (`gravity` = ? AND `vid` = ?))", Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE)]); } - if ($request['only_media']) { - $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))", - Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]); - } - if (!empty($request['max_id'])) { $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]); } @@ -99,12 +96,16 @@ class Statuses extends BaseApi $params['order'] = ['uri-id']; } - if ($request['exclude_replies']) { + if (($request['pinned'] || $request['only_media']) && $request['exclude_replies']) { $condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]); } if ($request['pinned']) { $items = DBA::select('collection-view', ['uri-id'], $condition, $params); + } elseif ($request['only_media']) { + $items = DBA::select('media-view', ['uri-id'], $condition, $params); + } elseif ($request['exclude_replies']) { + $items = Post::selectThreadForUser($uid, ['uri-id'], $condition, $params); } else { $items = Post::selectForUser($uid, ['uri-id'], $condition, $params); } diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 4f231b4c32..9ec2ae52ed 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -55,7 +55,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1493); + define('DB_UPDATE_VERSION', 1495); } return [ @@ -1658,6 +1658,7 @@ return [ "comment" => ["type" => "text", "comment" => "Report"], "forward" => ["type" => "boolean", "comment" => "Forward the report to the remote server"], "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""], + "status" => ["type" => "tinyint unsigned", "comment" => "Status of the report"], ], "indexes" => [ "PRIMARY" => ["id"], @@ -1670,6 +1671,7 @@ return [ "fields" => [ "rid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["report" => "id"], "comment" => "Report id"], "uri-id" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["item-uri" => "id"], "comment" => "Uri-id of the reported post"], + "status" => ["type" => "tinyint unsigned", "comment" => "Status of the reported post"], ], "indexes" => [ "PRIMARY" => ["rid", "uri-id"], diff --git a/static/dbview.config.php b/static/dbview.config.php index d06904a91f..a2e3e1b45f 100644 --- a/static/dbview.config.php +++ b/static/dbview.config.php @@ -723,6 +723,22 @@ INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id` INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-uri-id`" ], + "media-view" => [ + "fields" => [ + "uri-id" => ["post-media", "uri-id"], + "type" => ["post-media", "type"], + "received" => ["post", "received"], + "created" => ["post", "created"], + "private" => ["post", "private"], + "visible" => ["post", "visible"], + "deleted" => ["post", "deleted"], + "thr-parent-id" => ["post", "thr-parent-id"], + "author-id" => ["post", "author-id"], + "gravity" => ["post", "gravity"], + ], + "query" => "FROM `post-media` + INNER JOIN `post` ON `post-media`.`uri-id` = `post`.`uri-id`" + ], "tag-view" => [ "fields" => [ "uri-id" => ["post-tag", "uri-id"], diff --git a/static/routes.config.php b/static/routes.config.php index da5dda0278..8d1fec6f0e 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -239,6 +239,8 @@ return [ '/followed_tags' => [Module\Api\Mastodon\FollowedTags::class, [R::GET ]], '/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]], '/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo + '/instance/domain_blocks' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo + '/instance/extended_description' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo '/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]], '/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]], '/lists' => [Module\Api\Mastodon\Lists::class, [R::GET, R::POST]], @@ -300,6 +302,9 @@ return [ '/trends/statuses' => [Module\Api\Mastodon\Trends\Statuses::class, [R::GET ]], '/trends/tags' => [Module\Api\Mastodon\Trends\Tags::class, [R::GET ]], ], + '/v2' => [ + '/instance' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported + ], '/v{version:\d+}' => [ '/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported '/filters' => [Module\Api\Mastodon\Filters::class, [R::GET ]], // Dummy, not supported diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index eecb0b242d..9c8c74eb2a 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -3605,6 +3605,11 @@ section .profile-match-wrapper { font-size: 13px; } + +.generic-page-wrapper.contact-follow-wrapper { + min-height: auto; +} + /* Medium devices (desktops, 992px and up) */ @media (min-width: 992px) { .mod-home.is-not-singleuser #content, diff --git a/view/theme/frio/templates/auto_request.tpl b/view/theme/frio/templates/auto_request.tpl index 2d1861389c..659dc644f3 100644 --- a/view/theme/frio/templates/auto_request.tpl +++ b/view/theme/frio/templates/auto_request.tpl @@ -1,43 +1,45 @@ -

{{$header}}

+
+

{{$header}}

{{if !$myaddr}} -

- {{$page_desc nofilter}} -

-

- {{$invite_desc nofilter}} -

+

+ {{$page_desc nofilter}} +

+

+ {{$invite_desc nofilter}} +

{{/if}} -
+ {{if $url}} -
-
{{$url_label}}
-
{{$url}}
-
+
+
{{$url_label}}
+
{{$url}}
+
{{/if}} {{if $keywords}} -
-
{{$keywords_label}}
-
{{$keywords}}
-
+
+
{{$keywords_label}}
+
{{$keywords}}
+
{{/if}} -
- - {{if $myaddr}} - {{$myaddr}} - - {{else}} - - {{/if}} - -
-
+
+ + {{if $myaddr}} + {{$myaddr}} + + {{else}} + + {{/if}} + +
+
-
+
{{if $submit}} - + {{/if}} - -
- + +
+ +
\ No newline at end of file