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) -- 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', `comment` text COMMENT 'Report',
`forward` boolean COMMENT 'Forward the report to the remote server', `forward` boolean COMMENT 'Forward the report to the remote server',
`created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '', `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
`status` tinyint unsigned COMMENT 'Status of the report',
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid` (`uid`), INDEX `uid` (`uid`),
INDEX `cid` (`cid`), INDEX `cid` (`cid`),
@ -1669,6 +1670,7 @@ CREATE TABLE IF NOT EXISTS `report` (
CREATE TABLE IF NOT EXISTS `report-post` ( CREATE TABLE IF NOT EXISTS `report-post` (
`rid` int unsigned NOT NULL COMMENT 'Report id', `rid` int unsigned NOT NULL COMMENT 'Report id',
`uri-id` int unsigned NOT NULL COMMENT 'Uri-id of the reported post', `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`), PRIMARY KEY(`rid`,`uri-id`),
INDEX `uri-id` (`uri-id`), INDEX `uri-id` (`uri-id`),
FOREIGN KEY (`rid`) REFERENCES `report` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE, 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` ON `post-collection`.`uri-id` = `post`.`uri-id`
INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-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 tag-view
-- --

View file

@ -6,10 +6,11 @@ Table report-post
Fields Fields
------ ------
| Field | Description | Type | Null | Key | Default | Extra | | Field | Description | Type | Null | Key | Default | Extra |
| ------ | --------------------------- | ------------ | ---- | --- | ------- | ----- | | ------ | --------------------------- | ---------------- | ---- | --- | ------- | ----- |
| rid | Report id | int unsigned | NO | PRI | NULL | | | rid | Report id | int unsigned | NO | PRI | NULL | |
| uri-id | Uri-id of the reported post | 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 Indexes
------------ ------------

View file

@ -14,6 +14,7 @@ Fields
| comment | Report | text | YES | | NULL | | | comment | Report | text | YES | | NULL | |
| forward | Forward the report to the remote server | boolean | YES | | NULL | | | forward | Forward the report to the remote server | boolean | YES | | NULL | |
| created | | datetime | NO | | 0001-01-01 00:00:00 | | | created | | datetime | NO | | 0001-01-01 00:00:00 | |
| status | Status of the report | tinyint unsigned | YES | | NULL | |
Indexes 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]; 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 // Implementation specific endpoints
// @todo Possibly add Lemmy detection via the endpoint /api/v3/site
const DETECT_FRIENDIKA = 10; const DETECT_FRIENDIKA = 10;
const DETECT_FRIENDICA = 11; const DETECT_FRIENDICA = 11;
const DETECT_STATUSNET = 12; const DETECT_STATUSNET = 12;

View file

@ -69,6 +69,8 @@ class Statuses extends BaseApi
if ($request['pinned']) { if ($request['pinned']) {
$condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], 'type' => Post\Collection::FEATURED]; $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) { } elseif (!$uid) {
$condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], $condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED],
'uid' => 0, 'network' => Protocol::FEDERATED]; '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]; $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` = ?))", $condition = DBA::mergeConditions($condition, ["(`gravity` IN (?, ?) OR (`gravity` = ? AND `vid` = ?))",
Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE)]); 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'])) { if (!empty($request['max_id'])) {
$condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]); $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]);
} }
@ -99,12 +96,16 @@ class Statuses extends BaseApi
$params['order'] = ['uri-id']; $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]); $condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]);
} }
if ($request['pinned']) { if ($request['pinned']) {
$items = DBA::select('collection-view', ['uri-id'], $condition, $params); $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 { } else {
$items = Post::selectForUser($uid, ['uri-id'], $condition, $params); $items = Post::selectForUser($uid, ['uri-id'], $condition, $params);
} }

View file

@ -55,7 +55,7 @@
use Friendica\Database\DBA; use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) { if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1493); define('DB_UPDATE_VERSION', 1495);
} }
return [ return [
@ -1658,6 +1658,7 @@ return [
"comment" => ["type" => "text", "comment" => "Report"], "comment" => ["type" => "text", "comment" => "Report"],
"forward" => ["type" => "boolean", "comment" => "Forward the report to the remote server"], "forward" => ["type" => "boolean", "comment" => "Forward the report to the remote server"],
"created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""], "created" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""],
"status" => ["type" => "tinyint unsigned", "comment" => "Status of the report"],
], ],
"indexes" => [ "indexes" => [
"PRIMARY" => ["id"], "PRIMARY" => ["id"],
@ -1670,6 +1671,7 @@ return [
"fields" => [ "fields" => [
"rid" => ["type" => "int unsigned", "not null" => "1", "primary" => "1", "foreign" => ["report" => "id"], "comment" => "Report id"], "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"], "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" => [ "indexes" => [
"PRIMARY" => ["rid", "uri-id"], "PRIMARY" => ["rid", "uri-id"],

View file

@ -723,6 +723,22 @@
INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id` INNER JOIN `post` ON `post-collection`.`uri-id` = `post`.`uri-id`
INNER JOIN `post-thread` ON `post-thread`.`uri-id` = `post`.`parent-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" => [ "tag-view" => [
"fields" => [ "fields" => [
"uri-id" => ["post-tag", "uri-id"], "uri-id" => ["post-tag", "uri-id"],

View file

@ -239,6 +239,8 @@ return [
'/followed_tags' => [Module\Api\Mastodon\FollowedTags::class, [R::GET ]], '/followed_tags' => [Module\Api\Mastodon\FollowedTags::class, [R::GET ]],
'/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]], '/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]],
'/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo '/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/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]],
'/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]], '/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]],
'/lists' => [Module\Api\Mastodon\Lists::class, [R::GET, R::POST]], '/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/statuses' => [Module\Api\Mastodon\Trends\Statuses::class, [R::GET ]],
'/trends/tags' => [Module\Api\Mastodon\Trends\Tags::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+}' => [ '/v{version:\d+}' => [
'/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported '/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/filters' => [Module\Api\Mastodon\Filters::class, [R::GET ]], // Dummy, 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; font-size: 13px;
} }
.generic-page-wrapper.contact-follow-wrapper {
min-height: auto;
}
/* Medium devices (desktops, 992px and up) */ /* Medium devices (desktops, 992px and up) */
@media (min-width: 992px) { @media (min-width: 992px) {
.mod-home.is-not-singleuser #content, .mod-home.is-not-singleuser #content,

View file

@ -1,43 +1,45 @@
<h1>{{$header}}</h1> <div class="generic-page-wrapper contact-follow-wrapper">
<h2>{{$header}}</h2>
{{if !$myaddr}} {{if !$myaddr}}
<p id="dfrn-request-intro"> <p id="dfrn-request-intro">
{{$page_desc nofilter}} {{$page_desc nofilter}}
</p> </p>
<p> <p>
{{$invite_desc nofilter}} {{$invite_desc nofilter}}
</p> </p>
{{/if}} {{/if}}
<form action="{{$action}}" method="post"> <form action="{{$action}}" method="post">
{{if $url}} {{if $url}}
<dl> <dl>
<dt>{{$url_label}}</dt> <dt>{{$url_label}}</dt>
<dd><a target="blank" href="{{$zrl}}">{{$url}}</a></dd> <dd><a target="blank" href="{{$zrl}}">{{$url}}</a></dd>
</dl> </dl>
{{/if}} {{/if}}
{{if $keywords}} {{if $keywords}}
<dl> <dl>
<dt>{{$keywords_label}}</dt> <dt>{{$keywords_label}}</dt>
<dd>{{$keywords}}</dd> <dd>{{$keywords}}</dd>
</dl> </dl>
{{/if}} {{/if}}
<div id="dfrn-request-url-wrapper"> <div id="dfrn-request-url-wrapper">
<label id="dfrn-url-label" for="dfrn-url">{{$your_address}}</label> <label id="dfrn-url-label" for="dfrn-url">{{$your_address}}</label>
{{if $myaddr}} {{if $myaddr}}
{{$myaddr}} {{$myaddr}}
<input type="hidden" name="dfrn_url" id="dfrn-url" value="{{$myaddr}}" /> <input type="hidden" name="dfrn_url" id="dfrn-url" value="{{$myaddr}}" />
{{else}} {{else}}
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}"> <input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}">
{{/if}} {{/if}}
<input type="hidden" name="url" id="url" value="{{$url}}"> <input type="hidden" name="url" id="url" value="{{$url}}">
<div id="dfrn-request-url-end"></div> <div id="dfrn-request-url-end"></div>
</div> </div>
<div id="dfrn-request-submit-wrapper"> <div id="dfrn-request-submit-wrapper">
{{if $submit}} {{if $submit}}
<input class="btn btn-primary" type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit}}"> <input class="btn btn-primary" type="submit" name="submit" id="dfrn-request-submit-button" value="{{$submit}}">
{{/if}} {{/if}}
<input class="btn btn-default" type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel}}"> <input class="btn btn-default" type="submit" name="cancel" id="dfrn-request-cancel-button" value="{{$cancel}}">
</div> </div>
</form> </form>
</div>