use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
+use Friendica\Model\Post as PostModel;
use Friendica\Model\Tag;
use Friendica\Model\User;
use Friendica\Protocol\Activity;
}
$sparkle = '';
$buttons = [
- 'like' => null,
- 'dislike' => null,
- 'share' => null,
+ 'like' => null,
+ 'dislike' => null,
+ 'share' => null,
+ 'announce' => null,
];
$dropping = false;
$pinned = '';
: false);
$shareable = in_array($conv->getProfileOwner(), [0, local_user()]) && $item['private'] != Item::PRIVATE;
+ $announceable = $shareable && in_array($item['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::TWITTER]);
+
+ // On Diaspora only toplevel posts can be reshared
+ if ($announceable && ($item['network'] == Protocol::DIASPORA) && ($item['gravity'] != GRAVITY_PARENT)) {
+ $announceable = false;
+ }
$edpost = false;
if (!$origin) {
/// @todo This shouldn't be done as query here, but better during the data creation.
// it is now done here, since during the RC phase we shouldn't make to intense changes.
- $parent = Item::selectFirst(['origin'], ['id' => $item['parent']]);
+ $parent = PostModel::selectFirst(['origin'], ['id' => $item['parent']]);
if (DBA::isResult($parent)) {
$origin = $parent['origin'];
}
}
$drop = false;
+ $block = false;
if (local_user()) {
$drop = [
'dropping' => $dropping,
'select' => DI::l10n()->t('Select'),
'delete' => $delete,
];
+ $block = [
+ 'blocking' => true,
+ 'block' => DI::l10n()->t('Block %s', $item['author-name']),
+ 'author_id' => $item['author-id'],
+ ];
}
$filer = (($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) ? DI::l10n()->t("save to folder") : false);
$responses = [];
foreach ($response_verbs as $value => $verb) {
$responses[$verb] = [
- 'self' => $conv_responses[$verb][$item['uri'] . '-self'] ?? 0,
- 'output' => !empty($conv_responses[$verb][$item['uri']]) ? format_like($conv_responses[$verb][$item['uri']], $conv_responses[$verb][$item['uri'] . '-l'], $verb, $item['uri']) : '',
+ 'self' => $conv_responses[$verb][$item['uri-id']]['self'] ?? 0,
+ 'output' => !empty($conv_responses[$verb][$item['uri-id']]) ? format_activity($conv_responses[$verb][$item['uri-id']]['links'], $verb, $item['uri-id']) : '',
];
}
if ($this->isToplevel()) {
if(local_user()) {
- $thread = Item::selectFirstThreadForUser(local_user(), ['ignored'], ['iid' => $item['id']]);
- if (DBA::isResult($thread)) {
- $ignore = [
- 'do' => DI::l10n()->t("ignore thread"),
- 'undo' => DI::l10n()->t("unignore thread"),
- 'toggle' => DI::l10n()->t("toggle ignore status"),
- 'classdo' => $thread['ignored'] ? "hidden" : "",
- 'classundo' => $thread['ignored'] ? "" : "hidden",
- 'ignored' => DI::l10n()->t('ignored'),
- ];
- }
+ $ignored = PostModel\ThreadUser::getIgnored($item['uri-id'], local_user());
+ $ignore = [
+ 'do' => DI::l10n()->t("ignore thread"),
+ 'undo' => DI::l10n()->t("unignore thread"),
+ 'toggle' => DI::l10n()->t("toggle ignore status"),
+ 'classdo' => $ignored ? "hidden" : "",
+ 'classundo' => $ignored ? "" : "hidden",
+ 'ignored' => DI::l10n()->t('ignored'),
+ ];
if ($conv->getProfileOwner() == local_user() && ($item['uid'] != 0)) {
if ($origin) {
$buttons['like'] = [DI::l10n()->t("I like this \x28toggle\x29") , DI::l10n()->t("like")];
$buttons['dislike'] = [DI::l10n()->t("I don't like this \x28toggle\x29"), DI::l10n()->t("dislike")];
if ($shareable) {
- $buttons['share'] = [DI::l10n()->t('Share this'), DI::l10n()->t('share')];
+ $buttons['share'] = [DI::l10n()->t('Quote share this'), DI::l10n()->t('Quote Share')];
+ }
+ if ($announceable) {
+ $buttons['announce'] = [DI::l10n()->t('Reshare this'), DI::l10n()->t('Reshare')];
+ $buttons['unannounce'] = [DI::l10n()->t('Cancel your Reshare'), DI::l10n()->t('Unshare')];
}
}
'filer' => $filer,
'language' => $languages,
'drop' => $drop,
+ 'block' => $block,
'vote' => $buttons,
'like_html' => $responses['like']['output'],
'dislike_html' => $responses['dislike']['output'],
return '';
}
- $item = Item::selectFirst(['author-addr', 'uri-id'], ['id' => $this->getId()]);
+ $item = PostModel::selectFirst(['author-addr', 'uri-id'], ['id' => $this->getId()]);
if (!DBA::isResult($item) || empty($item['author-addr'])) {
// Should not happen
return '';