aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-01-28 21:43:50 -0800
committerzotlabs <mike@macgirvin.com>2018-01-28 21:43:50 -0800
commitc1e44c0f54e2dc9a340f0d619fa8082ec12947c1 (patch)
tree3bb0deca1c350445bcc8935afa2536bd842007e7
parent5cf2bf6b29fde04ddc791af8ce21731818bedb7a (diff)
parentedf6ad9eda323f6e04823b8c110d21d82d519d32 (diff)
downloadvolse-hubzilla-c1e44c0f54e2dc9a340f0d619fa8082ec12947c1.tar.gz
volse-hubzilla-c1e44c0f54e2dc9a340f0d619fa8082ec12947c1.tar.bz2
volse-hubzilla-c1e44c0f54e2dc9a340f0d619fa8082ec12947c1.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge
-rw-r--r--Zotlabs/Module/Email_resend.php4
-rw-r--r--Zotlabs/Module/Hq.php8
-rw-r--r--Zotlabs/Module/Ping.php8
-rw-r--r--Zotlabs/Widget/Notifications.php3
-rwxr-xr-xboot.php2
-rwxr-xr-xinclude/dba/dba_driver.php4
-rwxr-xr-xinclude/dba/dba_pdo.php9
-rw-r--r--view/js/main.js12
-rwxr-xr-xview/tpl/hq.tpl10
-rw-r--r--view/tpl/notifications_widget.tpl50
10 files changed, 61 insertions, 49 deletions
diff --git a/Zotlabs/Module/Email_resend.php b/Zotlabs/Module/Email_resend.php
index 921d2819a..f8a336be0 100644
--- a/Zotlabs/Module/Email_resend.php
+++ b/Zotlabs/Module/Email_resend.php
@@ -9,7 +9,7 @@ class Email_resend extends \Zotlabs\Web\Controller {
if($_POST['token']) {
if(! account_approve(trim($_POST['token']))) {
- notice('Token verification failed.');
+ notice(t('Token verification failed.'));
}
}
@@ -43,4 +43,4 @@ class Email_resend extends \Zotlabs\Web\Controller {
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index a9c3bb8e2..c46695b65 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -29,6 +29,8 @@ class Hq extends \Zotlabs\Web\Controller {
);
}
+ killme();
+
}
function get($update = 0, $load = false) {
@@ -49,9 +51,11 @@ class Hq extends \Zotlabs\Web\Controller {
$item_normal = item_normal();
$item_normal_update = item_normal_update();
+ $use_index = db_use_index('created');
+
if(! $item_hash) {
- $r = q("SELECT mid FROM item
- WHERE uid = %d
+ $r = q("SELECT mid FROM item $use_index
+ WHERE uid = %d $item_normal
AND mid = parent_mid
ORDER BY created DESC LIMIT 1",
intval(local_channel())
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index a3f6cdfec..f8399d871 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -320,7 +320,9 @@ class Ping extends \Zotlabs\Web\Controller {
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
$result = array();
- $r = q("SELECT * FROM item
+ $use_index = db_use_index('uid_item_unseen');
+
+ $r = q("SELECT * FROM item $use_index
WHERE item_unseen = 1 and uid = %d $item_normal
AND author_xchan != '%s'
ORDER BY created DESC limit 300",
@@ -492,8 +494,10 @@ class Ping extends \Zotlabs\Web\Controller {
$t3 = dba_timer();
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
+
+ $use_index = db_use_index('uid_item_unseen');
- $r = q("SELECT id, item_wall FROM item
+ $r = q("SELECT id, item_wall FROM item $use_index
WHERE item_unseen = 1 and uid = %d
$item_normal
AND author_xchan != '%s'",
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index 5a0c1f3d5..322a7b60a 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -145,7 +145,8 @@ class Notifications {
'$module' => \App::$module,
'$notifications' => $notifications,
'$no_notifications' => t('Sorry, you have got no notifications at the moment'),
- '$loading' => t('Loading')
+ '$loading' => t('Loading'),
+ '$startpage' => get_pconfig(local_channel(), 'system', 'startpage')
));
return $o;
diff --git a/boot.php b/boot.php
index cb682de31..c4c4dbc5b 100755
--- a/boot.php
+++ b/boot.php
@@ -51,7 +51,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' );
-define ( 'STD_VERSION', '3.1.4' );
+define ( 'STD_VERSION', '3.1.5' );
define ( 'ZOT_REVISION', '1.3' );
define ( 'DB_UPDATE_VERSION', 1198 );
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index 7e925a106..deec9adfd 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -321,6 +321,10 @@ function db_concat($fld, $sep) {
return \DBA::$dba->concat($fld, $sep);
}
+function db_use_index($str) {
+ return \DBA::$dba->use_index($str);
+}
+
/**
* @brief Execute a SQL query with printf style args.
*
diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php
index 7b58561a7..a9d824a50 100755
--- a/include/dba/dba_pdo.php
+++ b/include/dba/dba_pdo.php
@@ -111,6 +111,15 @@ class dba_pdo extends dba_driver {
}
}
+ function use_index($str) {
+ if($this->driver_dbtype === 'pgsql') {
+ return '';
+ }
+ else {
+ return 'USE INDEX( ' . $str . ')';
+ }
+ }
+
function quote_interval($txt) {
if($this->driver_dbtype === 'pgsql') {
return "'$txt'";
diff --git a/view/js/main.js b/view/js/main.js
index 13d002968..02b0f125c 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -75,8 +75,6 @@ $(document).ready(function() {
else {
sessionStorage.removeItem('notification_open');
}
-
- $(this).data('clicked', true);
});
if(sessionStorage.getItem('notification_open') !== null) {
@@ -456,11 +454,7 @@ function handleNotificationsItems(notifyType, data) {
notify_menu.append(html);
});
- $(".dropdown-menu img[data-src], .notification img[data-src]").each(function(i, el){
- // Replace data-src attribute with src attribute for every image
- $(el).attr('src', $(el).data("src"));
- $(el).removeAttr("data-src");
- });
+ datasrc2src('#notifications .notification img[data-src]');
if($('#tt-' + notifyType + '-only').hasClass('active'))
$('#nav-' + notifyType + '-menu [data-thread_top=false]').hide();
@@ -834,7 +828,7 @@ function liveUpdate(notify_id) {
// else data was valid - reset the recursion counter
liveRecurse = 0;
- if(typeof notify_id !== 'undefined') {
+ if(typeof notify_id !== 'undefined' && notify_id !== 'undefined') {
$.post(
"hq",
{
@@ -942,9 +936,11 @@ function loadNotificationItems(notifyType) {
var pingExCmd = 'ping/' + notifyType + ((localUser != 0) ? '?f=&uid=' + localUser : '');
var clicked = $('[data-type=\'' + notifyType + '\']').data('clicked');
+
if((clicked === undefined) && (sessionStorage.getItem(notifyType + '_notifications_cache') !== null)) {
var cached_data = JSON.parse(sessionStorage.getItem(notifyType + '_notifications_cache'));
handleNotificationsItems(notifyType, cached_data);
+ $('[data-type=\'' + notifyType + '\']').data('clicked',true);
console.log('updating ' + notifyType + ' notifications from cache...');
}
else {
diff --git a/view/tpl/hq.tpl b/view/tpl/hq.tpl
index fce11ff83..099d892bb 100755
--- a/view/tpl/hq.tpl
+++ b/view/tpl/hq.tpl
@@ -1,13 +1,3 @@
-{{if $no_messages}}
-<div class="alert alert-warning alert-dismissible fade show" role="alert">
- <button type="button" class="close" data-dismiss="alert" aria-label="Close">
- <span aria-hidden="true">&times;</span>
- </button>
- <h3>{{$no_messages_label.0}}</h3>
- <br>
- {{$no_messages_label.1}}
-</div>
-{{/if}}
<div id="jot-popup">
{{$editor}}
</div>
diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl
index 69e5e15bc..0f27b1a47 100644
--- a/view/tpl/notifications_widget.tpl
+++ b/view/tpl/notifications_widget.tpl
@@ -21,7 +21,7 @@
};
});
- {{if $module == 'display' || $module == 'hq'}}
+ {{if $module == 'display' || $module == 'hq' || $startpage == 'hq'}}
$(document).on('click', '.notification', function(e) {
var b64mid = $(this).data('b64mid');
var notify_id = $(this).data('notify_id');
@@ -31,30 +31,34 @@
if(b64mid === 'undefined' && notify_id === 'undefined')
return;
- {{if $module == 'display'}}
- history.pushState(stateObj, '', 'display/' + b64mid);
- {{/if}}
- {{if $module == 'hq'}}
- history.pushState(stateObj, '', 'hq/' + b64mid);
- {{/if}}
-
- {{if $module == 'hq'}}
- if(b64mid !== 'undefined') {
- {{else}}
- if(path === 'display' && b64mid) {
- {{/if}}
+ {{if $module != 'hq' && $startpage == 'hq'}}
e.preventDefault();
-
- if(! page_load) {
- if($(this).parent().attr('id') !== 'nav-pubs-menu')
- $(this).fadeOut();
-
- getData(b64mid, notify_id);
+ window.location.href = 'hq/' + b64mid;
+ return;
+ {{else}}
+ {{if $module == 'display'}}
+ history.pushState(stateObj, '', 'display/' + b64mid);
+ {{/if}}
+
+ {{if $module == 'hq'}}
+ history.pushState(stateObj, '', 'hq/' + b64mid);
+ {{/if}}
+
+ {{if $module == 'hq'}}
+ if(b64mid !== 'undefined') {
+ {{else}}
+ if(path === 'display' && b64mid) {
+ {{/if}}
+ e.preventDefault();
+
+ if(! page_load) {
+ getData(b64mid, notify_id);
+ }
+
+ if($('#notifications_wrapper').hasClass('fs'))
+ $('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs');
}
-
- if($('#notifications_wrapper').hasClass('fs'))
- $('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs');
- }
+ {{/if}}
});
{{/if}}