mirror of https://github.com/friendica/friendica
The "summary" has now a dedicated field when creating and editing posts
This commit is contained in:
parent
0ccb3e7efe
commit
93c2e08194
32
mod/item.php
32
mod/item.php
|
@ -110,14 +110,15 @@ function item_edit(int $uid, array $request, bool $preview, string $return_path)
|
|||
$post = item_process($post, $request, $preview, $return_path);
|
||||
|
||||
$fields = [
|
||||
'title' => $post['title'],
|
||||
'body' => $post['body'],
|
||||
'attach' => $post['attach'],
|
||||
'file' => $post['file'],
|
||||
'location' => $post['location'],
|
||||
'coord' => $post['coord'],
|
||||
'edited' => DateTimeFormat::utcNow(),
|
||||
'changed' => DateTimeFormat::utcNow()
|
||||
'title' => $post['title'],
|
||||
'content-warning' => $post['content-warning'],
|
||||
'body' => $post['body'],
|
||||
'attach' => $post['attach'],
|
||||
'file' => $post['file'],
|
||||
'location' => $post['location'],
|
||||
'coord' => $post['coord'],
|
||||
'edited' => DateTimeFormat::utcNow(),
|
||||
'changed' => DateTimeFormat::utcNow()
|
||||
];
|
||||
|
||||
$fields['body'] = Item::setHashtags($fields['body']);
|
||||
|
@ -233,13 +234,14 @@ function item_insert(int $uid, array $request, bool $preview, string $return_pat
|
|||
|
||||
function item_process(array $post, array $request, bool $preview, string $return_path): array
|
||||
{
|
||||
$post['self'] = true;
|
||||
$post['api_source'] = false;
|
||||
$post['attach'] = '';
|
||||
$post['title'] = trim($request['title'] ?? '');
|
||||
$post['body'] = $request['body'] ?? '';
|
||||
$post['location'] = trim($request['location'] ?? '');
|
||||
$post['coord'] = trim($request['coord'] ?? '');
|
||||
$post['self'] = true;
|
||||
$post['api_source'] = false;
|
||||
$post['attach'] = '';
|
||||
$post['title'] = trim($request['title'] ?? '');
|
||||
$post['content-warning'] = trim($request['summary'] ?? '');
|
||||
$post['body'] = $request['body'] ?? '';
|
||||
$post['location'] = trim($request['location'] ?? '');
|
||||
$post['coord'] = trim($request['coord'] ?? '');
|
||||
|
||||
$post = DI::contentItem()->addCategories($post, $request['category'] ?? '');
|
||||
|
||||
|
|
|
@ -388,6 +388,8 @@ class Conversation
|
|||
'$shortnoloc' => $this->l10n->t('clear location'),
|
||||
'$title' => $x['title'] ?? '',
|
||||
'$placeholdertitle' => $this->l10n->t('Set title'),
|
||||
'$summary' => $x['summary'] ?? '',
|
||||
'$placeholdersummary' => Feature::isEnabled($this->session->getLocalUserId(), 'summary') ? $this->l10n->t('Set summary, abstract or spoiler text') : '',
|
||||
'$category' => $x['category'] ?? '',
|
||||
'$placeholdercategory' => Feature::isEnabled($this->session->getLocalUserId(), 'categories') ? $this->l10n->t("Categories \x28comma-separated list\x29") : '',
|
||||
'$scheduled_at' => Temporal::getDateTimeField(
|
||||
|
|
|
@ -110,7 +110,8 @@ class Feature
|
|||
// Item tools
|
||||
'tools' => [
|
||||
DI::l10n()->t('Post/Comment Tools'),
|
||||
['categories', DI::l10n()->t('Post Categories'), DI::l10n()->t('Add categories to your posts'), false, DI::config()->get('feature_lock', 'categories', false)],
|
||||
['categories', DI::l10n()->t('Post Categories'), DI::l10n()->t('Add categories to your posts'), false, DI::config()->get('feature_lock', 'categories', false)],
|
||||
['summary', DI::l10n()->t('Summary'), DI::l10n()->t('Add a summary, abstract or spoiler text to your posts'), false, DI::config()->get('feature_lock', 'summary', false)],
|
||||
],
|
||||
|
||||
// Advanced Profile Settings
|
||||
|
|
|
@ -121,7 +121,7 @@ class Item
|
|||
const DELIVER_FIELDLIST = [
|
||||
'uid', 'id', 'parent', 'uri-id', 'uri', 'thr-parent', 'parent-uri', 'guid',
|
||||
'parent-guid', 'conversation', 'received', 'created', 'edited', 'verb', 'object-type', 'object', 'target',
|
||||
'private', 'title', 'body', 'raw-body', 'language', 'location', 'coord', 'app', 'sensitive',
|
||||
'private', 'title', 'content-warning', 'body', 'raw-body', 'language', 'location', 'coord', 'app', 'sensitive',
|
||||
'inform', 'deleted', 'extid', 'post-type', 'post-reason', 'gravity',
|
||||
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
|
||||
'author-id', 'author-addr', 'author-link', 'author-name', 'author-avatar', 'owner-id', 'owner-link', 'contact-uid',
|
||||
|
|
|
@ -152,6 +152,7 @@ class Compose extends BaseModule
|
|||
}
|
||||
|
||||
$title = $_REQUEST['title'] ?? '';
|
||||
$summary = $_REQUEST['summary'] ?? '';
|
||||
$category = $_REQUEST['category'] ?? '';
|
||||
$body = $_REQUEST['body'] ?? '';
|
||||
$location = $_REQUEST['location'] ?? $user['default-location'];
|
||||
|
@ -184,6 +185,7 @@ class Compose extends BaseModule
|
|||
'$l10n' => [
|
||||
'compose_title' => $compose_title,
|
||||
'default' => '',
|
||||
'summary' => $this->l10n->t('Summary'),
|
||||
'visibility_title' => $this->l10n->t('Visibility'),
|
||||
'mytitle' => $this->l10n->t('This is you'),
|
||||
'submit' => $this->l10n->t('Submit'),
|
||||
|
@ -205,6 +207,7 @@ class Compose extends BaseModule
|
|||
'location_disabled' => $this->l10n->t('Location services are disabled. Please check the website\'s permissions on your device'),
|
||||
'wait' => $this->l10n->t('Please wait'),
|
||||
'placeholdertitle' => $this->l10n->t('Set title'),
|
||||
'placeholdersummary' => Feature::isEnabled(DI::userSession()->getLocalUserId(), 'summary') ? $this->l10n->t('Set summary, abstract or spoiler text') : '',
|
||||
'placeholdercategory' => Feature::isEnabled(DI::userSession()->getLocalUserId(),'categories') ? $this->l10n->t('Categories (comma-separated list)') : '',
|
||||
'always_open_compose' => $this->pConfig->get(DI::userSession()->getLocalUserId(), 'frio', 'always_open_compose',
|
||||
$this->config->get('frio', 'always_open_compose', false)) ? '' :
|
||||
|
@ -226,6 +229,7 @@ class Compose extends BaseModule
|
|||
),
|
||||
'$created_at' => $created_at,
|
||||
'$title' => $title,
|
||||
'$summary' => $summary,
|
||||
'$category' => $category,
|
||||
'$body' => $body,
|
||||
'$location' => $location,
|
||||
|
|
|
@ -84,7 +84,7 @@ class Edit extends BaseModule
|
|||
|
||||
$fields = [
|
||||
'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', 'gravity',
|
||||
'body', 'title', 'uri-id', 'wall', 'post-type', 'guid'
|
||||
'body', 'title', 'content-warning', 'uri-id', 'wall', 'post-type', 'guid'
|
||||
];
|
||||
|
||||
$item = Post::selectFirstForUser($this->session->getLocalUserId(), $fields, [
|
||||
|
@ -155,6 +155,8 @@ class Edit extends BaseModule
|
|||
'$public' => $this->t('Public post'),
|
||||
'$title' => $item['title'],
|
||||
'$placeholdertitle' => $this->t('Set title'),
|
||||
'$summary' => $item['content-warning'],
|
||||
'$placeholdersummary' => (Feature::isEnabled($this->session->getLocalUserId(), 'summary') ? $this->t('Set summary, abstract or spoiler text') : ''),
|
||||
'$category' => Post\Category::getCSVByURIId($item['uri-id'], $this->session->getLocalUserId(), Post\Category::CATEGORY),
|
||||
'$placeholdercategory' => (Feature::isEnabled($this->session->getLocalUserId(), 'categories') ? $this->t("Categories \x28comma-separated list\x29") : ''),
|
||||
'$emtitle' => $this->t('Example: bob@example.com, mary@example.com'),
|
||||
|
|
|
@ -1780,7 +1780,7 @@ class Transmitter
|
|||
return $data;
|
||||
}
|
||||
|
||||
$data['summary'] = BBCode::toPlaintext(BBCode::getAbstract($item['body'], Protocol::ACTIVITYPUB));
|
||||
$data['summary'] = $item['content-warning'] ?: BBCode::toPlaintext(BBCode::getAbstract($item['body'], Protocol::ACTIVITYPUB));
|
||||
|
||||
if ($item['uri'] != $item['thr-parent']) {
|
||||
$data['inReplyTo'] = $item['thr-parent'];
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,6 +13,11 @@
|
|||
<div id="jot-title-wrap">
|
||||
<input type="text" name="title" id="jot-title" class="jothidden jotforms form-control" placeholder="{{$l10n.placeholdertitle}}" title="{{$l10n.placeholdertitle}}" value="{{$title}}" tabindex="1" dir="auto" />
|
||||
</div>
|
||||
{{if $l10n.placeholdersummary}}
|
||||
<div id="jot-summary-wrap">
|
||||
<input type="text" name="summary" id="jot-summary" class="jothidden jotforms form-control" placeholder="{{$l10n.placeholdersummary}}" title="{{$l10n.placeholdersummary}}" value="{{$summary}}" tabindex="1" dir="auto" />
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if $l10n.placeholdercategory}}
|
||||
<div id="jot-category-wrap">
|
||||
<input name="category" id="jot-category" class="jothidden jotforms form-control" type="text" placeholder="{{$l10n.placeholdercategory}}" title="{{$l10n.placeholdercategory}}" value="{{$category}}" tabindex="2" dir="auto" />
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
<input type="hidden" name="contact_allow[]" value="<{{$notes_cid}}>" />
|
||||
{{/if}}
|
||||
<div id="jot-title-wrap"><input name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" value="{{$title}}" class="jothidden" style="display:none" dir="auto"></div>
|
||||
{{if $placeholdersummary}}
|
||||
<div id="jot-summary-wrap"><input name="summary" id="jot-summary" type="text" placeholder="{{$placeholdersummary}}" value="{{$summary}}" class="jothidden" style="display:none" dir="auto"></div>
|
||||
{{/if}}
|
||||
{{if $placeholdercategory}}
|
||||
<div id="jot-category-wrap"><input name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" value="{{$category}}" class="jothidden" style="display:none" dir="auto"></div>
|
||||
{{/if}}
|
||||
|
|
|
@ -1444,6 +1444,7 @@ section #jotOpen {
|
|||
margin-right: 20px;
|
||||
}
|
||||
#jot-title-wrap,
|
||||
#jot-summary-wrap,
|
||||
#jot-category-wrap {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,9 @@
|
|||
<input type="hidden" name="contact_allow[]" value="<{{$notes_cid}}>" />
|
||||
{{/if}}
|
||||
<div id="jot-title-wrap"><input name="title" id="jot-title" class="jothidden jotforms form-control" type="text" placeholder="{{$placeholdertitle}}" title="{{$placeholdertitle}}" value="{{$title}}" style="display:block;" dir="auto" /></div>
|
||||
{{if $placeholdersummary}}
|
||||
<div id="jot-summary-wrap"><input name="summary" id="jot-summary" class="jothidden jotforms form-control" type="text" placeholder="{{$placeholdersummary}}" title="{{$placeholdersummary}}" value="{{$summary}}" style="display:block;" dir="auto" /></div>
|
||||
{{/if}}
|
||||
{{if $placeholdercategory}}
|
||||
<div id="jot-category-wrap"><input name="category" id="jot-category" class="jothidden jotforms form-control" type="text" placeholder="{{$placeholdercategory}}" title="{{$placeholdercategory}}" value="{{$category}}" dir="auto" /></div>
|
||||
{{/if}}
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
<div id="jot">
|
||||
<div id="profile-jot-desc" class="jothidden"> </div>
|
||||
<input name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" title="{{$placeholdertitle}}" value="{{$title}}" class="jothidden" style="display:none" dir="auto" />
|
||||
{{if $placeholdersummary}}
|
||||
<input name="summary" id="jot-summary" type="text" placeholder="{{$placeholdersummary}}" title="{{$placeholdersummary}}" value="{{$summary}}" class="jothidden" style="display:none" dir="auto" />
|
||||
{{/if}}
|
||||
{{if $placeholdercategory}}
|
||||
<input name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" title="{{$placeholdercategory}}" value="{{$category}}" class="jothidden" style="display:none" dir="auto" />
|
||||
{{/if}}
|
||||
|
|
|
@ -1414,6 +1414,7 @@ ul .sidebar-circle-li .icon {
|
|||
#jot-coord,
|
||||
#jot-preview,
|
||||
#jot-title-wrap,
|
||||
#jot-summary-wrap,
|
||||
#jot-category-wrap,
|
||||
#jot-text-wrap,
|
||||
#profile-jot-text-loading,
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
<div id="jot-title-wrap">
|
||||
<input name="title" id="jot-title" type="text" placeholder="{{$placeholdertitle}}" value="{{$title}}" class="jothidden" style="display:none" dir="auto">
|
||||
</div>
|
||||
{{if $placeholdersummary}}
|
||||
<div id="jot-summary-wrap">
|
||||
<input name="summary" id="jot-summary" type="text" placeholder="{{$placeholdersummary}}" value="{{$summary}}" class="jothidden" style="display:none" dir="auto">
|
||||
</div>
|
||||
{{/if}}
|
||||
{{if $placeholdercategory}}
|
||||
<div id="jot-category-wrap">
|
||||
<input name="category" id="jot-category" type="text" placeholder="{{$placeholdercategory}}" value="{{$category}}" class="jothidden" style="display:none" dir="auto" />
|
||||
|
|
Loading…
Reference in New Issue