Merge remote-tracking branch 'upstream/develop' into api-edit

This commit is contained in:
Michael 2023-03-03 03:56:19 +00:00
commit 9e4753f440
5 changed files with 148 additions and 129 deletions

View file

@ -116,8 +116,8 @@ class Account extends BaseDataTransferObject
$this->following_count = $account['ap-following_count'] ?? $account['diaspora-interacting_count'] ?? 0;
$this->statuses_count = $account['ap-statuses_count'] ?? $account['diaspora-post_count'] ?? 0;
$lastItem = $account['last-item'] ?: DBA::NULL_DATETIME;
$this->last_status_at = $lastItem != DBA::NULL_DATETIME ? DateTimeFormat::utc($lastItem, 'Y-m-d') : null;
$lastItem = $account['last-item'] ? DateTimeFormat::utc($account['last-item'], 'Y-m-d') : DBA::NULL_DATETIME;
$this->last_status_at = $lastItem != DBA::NULL_DATETIME ? DateTimeFormat::utc($lastItem, DateTimeFormat::JSON) : null;
// No custom emojis per account in Friendica
$this->emojis = [];

View file

@ -110,8 +110,8 @@ class Status extends BaseDataTransferObject
public function __construct(array $item, Account $account, Counts $counts, UserAttributes $userAttributes, bool $sensitive, Application $application, array $mentions, array $tags, Card $card, array $attachments, array $in_reply, array $reblog, FriendicaExtension $friendica, array $quote = null, array $poll = null)
{
$this->id = (string)$item['uri-id'];
$this->created_at = $item['created'];
$this->edited_at = $item['edited'];
$this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::JSON);
$this->edited_at = DateTimeFormat::utc($item['edited'], DateTimeFormat::JSON);
if ($item['gravity'] == Item::GRAVITY_COMMENT) {
$this->in_reply_to_id = (string)$item['thr-parent-id'];

View file

@ -22,6 +22,7 @@
namespace Friendica\Object\Api\Mastodon\Status;
use Friendica\BaseDataTransferObject;
use Friendica\Util\DateTimeFormat;
/**
* Class FriendicaExtension
@ -70,9 +71,9 @@ class FriendicaExtension extends BaseDataTransferObject
FriendicaDeliveryData $delivery_data
) {
$this->title = $title;
$this->changed_at = $changed_at;
$this->commented_at = $commented_at;
$this->received_at = $received_at;
$this->changed_at = $changed_at ? DateTimeFormat::utc($changed_at, DateTimeFormat::JSON) : null;
$this->commented_at = $commented_at ? DateTimeFormat::utc($commented_at, DateTimeFormat::JSON) : null;
$this->received_at = $received_at ? DateTimeFormat::utc($received_at, DateTimeFormat::JSON) : null;
$this->delivery_data = $delivery_data;
$this->dislikes_count = $dislikes_count;
}

View file

@ -1994,6 +1994,18 @@ code > .hl-main {
.wall-item-actions-right {
display: flex;
}
.wall-item-actions-items {
flex-grow: 1;
}
.wall-item-actions-row {
display: flex;
}
.wall-item-actions-row .btn {
width: 100%;
}
.wall-item-actions-row > * {
flex: 1 1 0;
}
.wall-item-actions .checkbox {
margin: 0 0 0 15px;
}
@ -2001,14 +2013,17 @@ code > .hl-main {
.wall-item-actions .btn,
.wall-item-actions a,
.wall-item-actions button {
padding-right: 12px;
padding-left: 12px;
padding-right: 0;
padding-left: 0;
}
.wall-item-actions .checkbox {
margin-top: 8px;
flex: 0 1 auto;
}
.wall-item-actions .like-rotator {
padding-top: 8px;
position: absolute;
top: 8px;
right: 0;
}
}
.wall-item-actions button:hover {

View file

@ -436,146 +436,149 @@ as the value of $top_child_total (this is done at the end of this file)
</span>
</span>
<div class="btn-toolbar btn-group visible-xs" role="group">
{{* Buttons for like and dislike *}}
{{if $item.vote}}
{{if $item.vote.like}}
<button type="button" class="btn button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doActivityItemAction({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-up" aria-hidden="true"></i></button>
{{/if}}
{{if $item.vote.dislike}}
<button type="button" class="btn button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doActivityItemAction({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i></button>
{{/if}}
{{/if}}
{{* Button to open the comment text field *}}
{{if $item.comment_html}}
<button type="button" class="btn button-comments" id="comment-{{$item.id}}" title="{{$item.switchcomment}}" {{if $item.thread_level != 1}}onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});" {{else}} onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"{{/if}}><i class="fa fa-commenting" aria-hidden="true"></i></button>
{{/if}}
{{if $item.vote.announce OR $item.vote.share}}
<div class="share-links btn-group{{if $item.thread_level > 1}} dropup{{/if}}" role="group">
<button type="button" class="btn dropdown-toggle{{if $item.responses.announce.self}} active{{/if}}" data-toggle="dropdown" id="shareMenuOptions-{{$item.id}}" aria-haspopup="true" aria-expanded="false" title="{{$item.menu}}">
<i class="fa fa-share" aria-hidden="true"></i>
</button>
<ul class="dropdown-menu dropdown-menu-left" role="menu" aria-labelledby="shareMenuOptions-{{$item.id}}">
{{if $item.vote.announce}} {{* edit the posting *}}
<li role="menuitem">
{{if $item.responses.announce.self}}
<a class="btn-link" id="announce-{{$item.id}}" href="javascript:doActivityItemAction({{$item.id}}, 'announce', true);" title="{{$item.vote.unannounce.0}}">
<i class="fa fa-ban" aria-hidden="true"></i> {{$item.vote.unannounce.1}}
</a>
{{else}}
<a class="btn-link" id="announce-{{$item.id}}" href="javascript:doActivityItemAction({{$item.id}}, 'announce');" title="{{$item.vote.announce.0}}">
<i class="fa fa-retweet" aria-hidden="true"></i> {{$item.vote.announce.1}}
</a>
{{/if}}
</li>
<div class="wall-item-actions-items btn-toolbar btn-group visible-xs" role="group">
<div class="wall-item-actions-row">
{{* Buttons for like and dislike *}}
{{if $item.vote}}
{{if $item.vote.like}}
<button type="button" class="btn button-likes{{if $item.responses.like.self}} active" aria-pressed="true{{/if}}" id="like-{{$item.id}}" title="{{$item.vote.like.0}}" onclick="doActivityItemAction({{$item.id}}, 'like'{{if $item.responses.like.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-up" aria-hidden="true"></i></button>
{{/if}}
{{if $item.vote.share}}
<li role="menuitem">
<a class="btn-link" id="share-{{$item.id}}" href="javascript:jotShare({{$item.id}});" title="{{$item.vote.share.0}}">
<i class="fa fa-share" aria-hidden="true"></i> {{$item.vote.share.1}}
</a>
</li>
{{if $item.vote.dislike}}
<button type="button" class="btn button-likes{{if $item.responses.dislike.self}} active" aria-pressed="true{{/if}}" id="dislike-{{$item.id}}" title="{{$item.vote.dislike.0}}" onclick="doActivityItemAction({{$item.id}}, 'dislike'{{if $item.responses.dislike.self}}, true{{/if}});" data-toggle="button"><i class="fa fa-thumbs-down" aria-hidden="true"></i></button>
{{/if}}
</ul>
</div>
{{/if}}
{{/if}}
{{if $item.browsershare}}
<button type="button" class="btn button-browser-share" onclick="navigator.share({url: '{{$item.plink.orig}}'})" title="{{$item.browsershare.1}}"><i class="fa fa-share-alt"></i></button>
{{/if}}
{{* Button to open the comment text field *}}
{{if $item.comment_html}}
<button type="button" class="btn button-comments" id="comment-{{$item.id}}" title="{{$item.switchcomment}}" {{if $item.thread_level != 1}}onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});" {{else}} onclick="openClose('item-comments-{{$item.id}}'); commentExpand({{$item.id}});"{{/if}}><i class="fa fa-commenting" aria-hidden="true"></i></button>
{{/if}}
{{* Put additional actions in a dropdown menu *}}
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div>
{{if $item.vote.announce OR $item.vote.share}}
<div class="share-links btn-group{{if $item.thread_level > 1}} dropup{{/if}}" role="group">
<button type="button" class="btn dropdown-toggle{{if $item.responses.announce.self}} active{{/if}}" data-toggle="dropdown" id="shareMenuOptions-{{$item.id}}" aria-haspopup="true" aria-expanded="false" title="{{$item.menu}}">
<i class="fa fa-share" aria-hidden="true"></i>
</button>
<ul class="dropdown-menu dropdown-menu-left" role="menu" aria-labelledby="shareMenuOptions-{{$item.id}}">
{{if $item.vote.announce}} {{* edit the posting *}}
<li role="menuitem">
{{if $item.responses.announce.self}}
<a class="btn-link" id="announce-{{$item.id}}" href="javascript:doActivityItemAction({{$item.id}}, 'announce', true);" title="{{$item.vote.unannounce.0}}">
<i class="fa fa-ban" aria-hidden="true"></i> {{$item.vote.unannounce.1}}
</a>
{{else}}
<a class="btn-link" id="announce-{{$item.id}}" href="javascript:doActivityItemAction({{$item.id}}, 'announce');" title="{{$item.vote.announce.0}}">
<i class="fa fa-retweet" aria-hidden="true"></i> {{$item.vote.announce.1}}
</a>
{{/if}}
</li>
{{/if}}
{{if $item.vote.share}}
<li role="menuitem">
<a class="btn-link" id="share-{{$item.id}}" href="javascript:jotShare({{$item.id}});" title="{{$item.vote.share.0}}">
<i class="fa fa-share" aria-hidden="true"></i> {{$item.vote.share.1}}
</a>
</li>
{{/if}}
{{if $item.browsershare}}
<li role="menuitem">
<button type="button" class="btn-link button-browser-share" onclick="navigator.share({url: '{{$item.plink.orig}}'})" title="{{$item.browsershare.1}}">
<i class="fa fa-share-alt" aria-hidden="true"></i> {{$item.browsershare.0}}
</button>
</li>
{{/if}}
</ul>
</div>
{{/if}}
{{* Put additional actions in a dropdown menu *}}
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
<div class="wall-item-actions-right visible-xs">
{{* Event attendance buttons *}}
{{if $item.isevent}}
{{if $item.isevent}}
<div class="btn-group" role="group">
<button type="button" class="btn btn-default button-event{{if $item.responses.attendyes.self}} active" aria-pressed="true{{/if}}" id="attendyes-{{$item.id}}" title="{{$item.attend.0}}" onclick="doActivityItemAction({{$item.id}}, 'attendyes'{{if $item.responses.attendyes.self}}, true{{/if}});"><i class="fa fa-check" aria-hidden="true"><span class="sr-only">{{$item.attend.0}}</span></i></button>
<button type="button" class="btn btn-default button-event{{if $item.responses.attendno.self}} active" aria-pressed="true{{/if}}" id="attendno-{{$item.id}}" title="{{$item.attend.1}}" onclick="doActivityItemAction({{$item.id}}, 'attendno'{{if $item.responses.attendno.self}}, true{{/if}});"><i class="fa fa-times" aria-hidden="true"><span class="sr-only">{{$item.attend.1}}</span></i></button>
<button type="button" class="btn btn-default button-event{{if $item.responses.attendmaybe.self}} active" aria-pressed="true{{/if}}" id="attendmaybe-{{$item.id}}" title="{{$item.attend.2}}" onclick="doActivityItemAction({{$item.id}}, 'attendmaybe'{{if $item.responses.attendmaybe.self}}, true{{/if}});"><i class="fa fa-question" aria-hidden="true"><span class="sr-only">{{$item.attend.2}}</span></i></button>
</div>
{{/if}}
{{/if}}
{{if $item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.follow_thread || $item.ignore || ($item.drop && $item.drop.dropping)}}
<div class="more-links btn-group{{if $item.thread_level > 1}} dropup{{/if}}">
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" id="dropdownMenuOptions-{{$item.id}}" aria-haspopup="true" aria-expanded="false" title="{{$item.menu}}"><i class="fa fa-ellipsis-h" aria-hidden="true"></i></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="dropdownMenuOptions-{{$item.id}}">
{{if $item.edpost}} {{* edit the posting *}}
<li role="menuitem">
<a href="javascript:editpost('{{$item.edpost.0}}?mode=none');" title="{{$item.edpost.1}}" class="btn-link navicon pencil"><i class="fa fa-pencil" aria-hidden="true"></i> {{$item.edpost.1}}</a>
</li>
{{/if}}
{{if $item.tagger}} {{* tag the post *}}
{{if $item.edpost || $item.tagger || $item.filer || $item.pin || $item.star || $item.follow_thread || $item.ignore || ($item.drop && $item.drop.dropping)}}
<div class="more-links btn-group{{if $item.thread_level > 1}} dropup{{/if}}">
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" id="dropdownMenuOptions-{{$item.id}}" aria-haspopup="true" aria-expanded="false" title="{{$item.menu}}"><i class="fa fa-ellipsis-h" aria-hidden="true"></i></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="dropdownMenuOptions-{{$item.id}}">
{{if $item.edpost}} {{* edit the posting *}}
<li role="menuitem">
<a id="tagger-{{$item.id}}" href="javascript:itemTag({{$item.id}});" class="btn-link {{$item.tagger.class}}" title="{{$item.tagger.add}}"><i class="fa fa-tag" aria-hidden="true"></i> {{$item.tagger.add}}</a>
</li>
<a href="javascript:editpost('{{$item.edpost.0}}?mode=none');" title="{{$item.edpost.1}}" class="btn-link navicon pencil"><i class="fa fa-pencil" aria-hidden="true"></i> {{$item.edpost.1}}</a>
</li>
{{/if}}
{{if $item.filer}}
{{if $item.tagger}} {{* tag the post *}}
<li role="menuitem">
<a id="tagger-{{$item.id}}" href="javascript:itemTag({{$item.id}});" class="btn-link {{$item.tagger.class}}" title="{{$item.tagger.add}}"><i class="fa fa-tag" aria-hidden="true"></i> {{$item.tagger.add}}</a>
</li>
{{/if}}
{{if $item.filer}}
<li role="menuitem">
<a id="filer-{{$item.id}}" href="javascript:itemFiler({{$item.id}});" class="btn-link filer-item filer-icon" title="{{$item.filer}}"><i class="fa fa-folder" aria-hidden="true"></i>&nbsp;{{$item.filer}}</a>
</li>
{{/if}}
{{if $item.pin}}
<li role="menuitem">
<a id="pin-{{$item.id}}" href="javascript:doPin({{$item.id}});" class="btn-link {{$item.pin.classdo}}" title="{{$item.pin.do}}"><i class="fa fa-circle-o" aria-hidden="true"></i>&nbsp;{{$item.pin.do}}</a>
<a id="unpin-{{$item.id}}" href="javascript:doPin({{$item.id}});" class="btn-link {{$item.pin.classundo}}" title="{{$item.pin.undo}}"><i class="fa fa-dot-circle-o" aria-hidden="true"></i>&nbsp;{{$item.pin.undo}}</a>
</li>
{{/if}}
{{if $item.star}}
<li role="menuitem">
<a id="star-{{$item.id}}" href="javascript:doStar({{$item.id}});" class="btn-link {{$item.star.classdo}}" title="{{$item.star.do}}"><i class="fa fa-star-o" aria-hidden="true"></i>&nbsp;{{$item.star.do}}</a>
<a id="unstar-{{$item.id}}" href="javascript:doStar({{$item.id}});" class="btn-link {{$item.star.classundo}}" title="{{$item.star.undo}}"><i class="fa fa-star" aria-hidden="true"></i>&nbsp;{{$item.star.undo}}</a>
</li>
{{/if}}
{{if $item.follow_thread}}
<li role="menuitem">
<a id="follow_thread-{{$item.id}}" href="javascript:{{$item.follow_thread.action}}" class="btn-link" title="{{$item.follow_thread.title}}"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;{{$item.follow_thread.title}}</a>
</li>
{{/if}}
{{if $item.language}}
<li role="menuitem">
<a id="filer-{{$item.id}}" href="javascript:itemFiler({{$item.id}});" class="btn-link filer-item filer-icon" title="{{$item.filer}}"><i class="fa fa-folder" aria-hidden="true"></i>&nbsp;{{$item.filer}}</a>
</li>
{{/if}}
<a id="language-{{$item.id}}" href="javascript:alert('{{$item.language.1}}');" class="btn-link filer-item language-icon" title="{{$item.language.0}}"><i class="fa fa-language" aria-hidden="true"></i>&nbsp;{{$item.language.0}}</a>
</li>
{{/if}}
{{if $item.pin}}
<li role="menuitem">
<a id="pin-{{$item.id}}" href="javascript:doPin({{$item.id}});" class="btn-link {{$item.pin.classdo}}" title="{{$item.pin.do}}"><i class="fa fa-circle-o" aria-hidden="true"></i>&nbsp;{{$item.pin.do}}</a>
<a id="unpin-{{$item.id}}" href="javascript:doPin({{$item.id}});" class="btn-link {{$item.pin.classundo}}" title="{{$item.pin.undo}}"><i class="fa fa-dot-circle-o" aria-hidden="true"></i>&nbsp;{{$item.pin.undo}}</a>
</li>
{{/if}}
{{if $item.ignore || ($item.drop && $item.drop.dropping)}}
<li role="separator" class="divider"></li>
{{/if}}
{{if $item.star}}
<li role="menuitem">
<a id="star-{{$item.id}}" href="javascript:doStar({{$item.id}});" class="btn-link {{$item.star.classdo}}" title="{{$item.star.do}}"><i class="fa fa-star-o" aria-hidden="true"></i>&nbsp;{{$item.star.do}}</a>
<a id="unstar-{{$item.id}}" href="javascript:doStar({{$item.id}});" class="btn-link {{$item.star.classundo}}" title="{{$item.star.undo}}"><i class="fa fa-star" aria-hidden="true"></i>&nbsp;{{$item.star.undo}}</a>
</li>
{{/if}}
{{if $item.ignore}}
<li role="menuitem">
<a id="ignore-{{$item.id}}" href="javascript:doIgnoreThread({{$item.id}});" class="btn-link {{$item.ignore.classdo}}" title="{{$item.ignore.do}}"><i class="fa fa-eye-slash" aria-hidden="true"></i> {{$item.ignore.do}}</a>
</li>
<li role="menuitem">
<a id="unignore-{{$item.id}}" href="javascript:doIgnoreThread({{$item.id}});" class="btn-link {{$item.ignore.classundo}}" title="{{$item.ignore.undo}}"><i class="fa fa-eye" aria-hidden="true"></i> {{$item.ignore.undo}}</a>
</li>
{{/if}}
{{if $item.follow_thread}}
<li role="menuitem">
<a id="follow_thread-{{$item.id}}" href="javascript:{{$item.follow_thread.action}}" class="btn-link" title="{{$item.follow_thread.title}}"><i class="fa fa-plus" aria-hidden="true"></i>&nbsp;{{$item.follow_thread.title}}</a>
</li>
{{/if}}
{{if $item.language}}
<li role="menuitem">
<a id="language-{{$item.id}}" href="javascript:alert('{{$item.language.1}}');" class="btn-link filer-item language-icon" title="{{$item.language.0}}"><i class="fa fa-language" aria-hidden="true"></i>&nbsp;{{$item.language.0}}</a>
</li>
{{/if}}
{{if $item.ignore || ($item.drop && $item.drop.dropping)}}
<li role="separator" class="divider"></li>
{{/if}}
{{if $item.ignore}}
<li role="menuitem">
<a id="ignore-{{$item.id}}" href="javascript:doIgnoreThread({{$item.id}});" class="btn-link {{$item.ignore.classdo}}" title="{{$item.ignore.do}}"><i class="fa fa-eye-slash" aria-hidden="true"></i> {{$item.ignore.do}}</a>
</li>
<li role="menuitem">
<a id="unignore-{{$item.id}}" href="javascript:doIgnoreThread({{$item.id}});" class="btn-link {{$item.ignore.classundo}}" title="{{$item.ignore.undo}}"><i class="fa fa-eye" aria-hidden="true"></i> {{$item.ignore.undo}}</a>
</li>
{{/if}}
{{if $item.drop && $item.drop.dropping}}
<li role="menuitem">
<a class="btn-link navicon delete" href="javascript:dropItem('item/drop/{{$item.id}}/{{$item.return}}', 'item-{{$item.guid}}');" title="{{$item.drop.delete}}"><i class="fa fa-trash" aria-hidden="true"></i> {{$item.drop.delete}}</a>
</li>
{{/if}}
</ul>
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div>
{{/if}}
{{if $item.drop && $item.drop.dropping}}
<li role="menuitem">
<a class="btn-link navicon delete" href="javascript:dropItem('item/drop/{{$item.id}}/{{$item.return}}', 'item-{{$item.guid}}');" title="{{$item.drop.delete}}"><i class="fa fa-trash" aria-hidden="true"></i> {{$item.drop.delete}}</a>
</li>
{{/if}}
</ul>
<img id="like-rotator-{{$item.id}}" class="like-rotator" src="images/rotator.gif" alt="{{$item.wait}}" title="{{$item.wait}}" style="display: none;" />
</div>
{{/if}}
<span class="pull-right checkbox">
{{if $item.drop && $item.drop.pagedrop}}
<input type="checkbox" title="{{$item.drop.select}}" name="itemselected[]" id="checkbox-{{$item.id}}" class="item-select" value="{{$item.id}}" />
<label for="checkbox-{{$item.id}}"></label>
{{/if}}
{{if $item.drop && $item.drop.pagedrop}}
<input type="checkbox" title="{{$item.drop.select}}" name="itemselected[]" id="checkbox-{{$item.id}}" class="item-select" value="{{$item.id}}" />
<label for="checkbox-{{$item.id}}"></label>
{{/if}}
</span>
</div>
</div>
</div><!--./wall-item-actions-->