Merge branch 'friendica:develop' into show_image_upload_limit

This commit is contained in:
MarekBenjamin 2022-11-29 21:58:46 +01:00 committed by GitHub
commit 3cf0b9b9fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 99 additions and 45 deletions

View File

@ -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
--

View File

@ -7,9 +7,10 @@ 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 | |
| status | Status of the reported post | tinyint unsigned | YES | | NULL | |
Indexes
------------

View File

@ -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
------------

View File

@ -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;

View File

@ -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);
}

View File

@ -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"],

View File

@ -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"],

View File

@ -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

View File

@ -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,

View File

@ -1,15 +1,16 @@
<h1>{{$header}}</h1>
<div class="generic-page-wrapper contact-follow-wrapper">
<h2>{{$header}}</h2>
{{if !$myaddr}}
<p id="dfrn-request-intro">
<p id="dfrn-request-intro">
{{$page_desc nofilter}}
</p>
<p>
</p>
<p>
{{$invite_desc nofilter}}
</p>
</p>
{{/if}}
<form action="{{$action}}" method="post">
<form action="{{$action}}" method="post">
{{if $url}}
<dl>
<dt>{{$url_label}}</dt>
@ -40,4 +41,5 @@
{{/if}}
<input class="btn btn-default" type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel}}">
</div>
</form>
</form>
</div>