aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget
diff options
context:
space:
mode:
authornobody <nobody@zotlabs.com>2021-07-06 05:02:52 -0700
committernobody <nobody@zotlabs.com>2021-07-06 05:02:52 -0700
commit73b53675b1a339cfd950845279438e35b4e2dc7c (patch)
tree6b433b3f21585230bfbc71d955c8a8bcc82dd5e8 /Zotlabs/Widget
parentefda8aac1d7d90fd7eda4a449332eedf74342951 (diff)
parent9b9ac5054fcc424a556f366284501882b1e02e9e (diff)
downloadvolse-hubzilla-73b53675b1a339cfd950845279438e35b4e2dc7c.tar.gz
volse-hubzilla-73b53675b1a339cfd950845279438e35b4e2dc7c.tar.bz2
volse-hubzilla-73b53675b1a339cfd950845279438e35b4e2dc7c.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r--Zotlabs/Widget/Hq_controls.php9
-rw-r--r--Zotlabs/Widget/Messages.php17
2 files changed, 13 insertions, 13 deletions
diff --git a/Zotlabs/Widget/Hq_controls.php b/Zotlabs/Widget/Hq_controls.php
index 8b532defe..91335fd76 100644
--- a/Zotlabs/Widget/Hq_controls.php
+++ b/Zotlabs/Widget/Hq_controls.php
@@ -15,9 +15,8 @@ class Hq_controls {
$entries = [
'toggle_editor' => [
'label' => t('Toggle post editor'),
- 'id' => 'jot-toggle',
'href' => '#',
- 'class' => 'btn btn-outline-primary',
+ 'class' => 'btn jot-toggle',
'type' => 'button',
'icon' => 'pencil',
'extra' => 'data-toggle="button"'
@@ -27,9 +26,8 @@ class Hq_controls {
if(Apps::system_app_installed(local_channel(), 'Notes')) {
$entries['toggle_notes'] = [
'label' => t('Toggle personal notes'),
- 'id' => 'notes-toggle',
'href' => '#',
- 'class' => 'btn btn-outline-primary',
+ 'class' => 'btn notes-toggle',
'type' => 'button',
'icon' => 'sticky-note-o',
'extra' => 'data-toggle="button"'
@@ -39,7 +37,8 @@ class Hq_controls {
return replace_macros(get_markup_template('hq_controls.tpl'),
[
'$entries' => $entries,
- '$wrapper_class' => $options['class']
+ '$wrapper_class' => $options['wrapper_class'],
+ '$entry_class' => $options['entry_class']
]
);
}
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index a03238c9a..269d669dc 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -11,14 +11,10 @@ class Messages {
if (!local_channel())
return EMPTY_STR;
- $o = '';
$page = self::get_messages_page($options);
- if (!$page['entries'])
- return $o;
-
$tpl = get_markup_template('messages_widget.tpl');
- $o .= replace_macros($tpl, [
+ $o = replace_macros($tpl, [
'$entries' => $page['entries'],
'$offset' => $page['offset'],
'$feature_star' => feature_enabled(local_channel(), 'star_posts'),
@@ -26,7 +22,8 @@ class Messages {
'messages_title' => t('Public and restricted messages'),
'direct_messages_title' => t('Direct messages'),
'starred_messages_title' => t('Starred messages'),
- 'loading' => t('Loading')
+ 'loading' => t('Loading'),
+ 'empty' => t('No messages')
]
]);
@@ -45,6 +42,7 @@ class Messages {
$item_normal = item_normal();
$entries = [];
$limit = 30;
+ $dummy_order_sql = '';
$offset = 0;
if ($options['offset']) {
@@ -56,6 +54,9 @@ class Messages {
switch($options['type']) {
case 'direct':
$type_sql = ' AND item_private = 2 ';
+ // $dummy_order_sql has no other meaning but to trick
+ // some mysql backends into using the right index.
+ $dummy_order_sql = ', received DESC ';
break;
case 'starred':
$type_sql = ' AND item_starred = 1 ';
@@ -69,7 +70,7 @@ class Messages {
$type_sql
AND item_thread_top = 1
$item_normal
- ORDER BY created DESC
+ ORDER BY created DESC $dummy_order_sql
LIMIT $limit OFFSET $offset",
intval(local_channel()),
dbescdate($loadtime)
@@ -95,7 +96,7 @@ class Messages {
$summary = $item['summary'];
}
if (!$summary) {
- $summary = htmlentities(html2plain(bbcode($item['body']), 75, true), ENT_QUOTES, 'UTF-8', false);
+ $summary = htmlentities(html2plain(bbcode($item['body'], ['drop_media' => true]), 75, true), ENT_QUOTES, 'UTF-8', false);
}
if (!$summary) {
$summary = '...';