Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge

This commit is contained in:
zotlabs 2018-01-28 21:43:50 -08:00
commit c1e44c0f54
10 changed files with 59 additions and 47 deletions

View File

@ -9,7 +9,7 @@ class Email_resend extends \Zotlabs\Web\Controller {
if($_POST['token']) { if($_POST['token']) {
if(! account_approve(trim($_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 {
} }
} }

View File

@ -29,6 +29,8 @@ class Hq extends \Zotlabs\Web\Controller {
); );
} }
killme();
} }
function get($update = 0, $load = false) { function get($update = 0, $load = false) {
@ -49,9 +51,11 @@ class Hq extends \Zotlabs\Web\Controller {
$item_normal = item_normal(); $item_normal = item_normal();
$item_normal_update = item_normal_update(); $item_normal_update = item_normal_update();
$use_index = db_use_index('created');
if(! $item_hash) { if(! $item_hash) {
$r = q("SELECT mid FROM item $r = q("SELECT mid FROM item $use_index
WHERE uid = %d WHERE uid = %d $item_normal
AND mid = parent_mid AND mid = parent_mid
ORDER BY created DESC LIMIT 1", ORDER BY created DESC LIMIT 1",
intval(local_channel()) intval(local_channel())

View File

@ -320,7 +320,9 @@ class Ping extends \Zotlabs\Web\Controller {
if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) { if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) {
$result = array(); $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 WHERE item_unseen = 1 and uid = %d $item_normal
AND author_xchan != '%s' AND author_xchan != '%s'
ORDER BY created DESC limit 300", ORDER BY created DESC limit 300",
@ -492,8 +494,10 @@ class Ping extends \Zotlabs\Web\Controller {
$t3 = dba_timer(); $t3 = dba_timer();
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { 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 WHERE item_unseen = 1 and uid = %d
$item_normal $item_normal
AND author_xchan != '%s'", AND author_xchan != '%s'",

View File

@ -145,7 +145,8 @@ class Notifications {
'$module' => \App::$module, '$module' => \App::$module,
'$notifications' => $notifications, '$notifications' => $notifications,
'$no_notifications' => t('Sorry, you have got no notifications at the moment'), '$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; return $o;

View File

@ -51,7 +51,7 @@ require_once('include/attach.php');
require_once('include/bbcode.php'); require_once('include/bbcode.php');
define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '3.1.4' ); define ( 'STD_VERSION', '3.1.5' );
define ( 'ZOT_REVISION', '1.3' ); define ( 'ZOT_REVISION', '1.3' );
define ( 'DB_UPDATE_VERSION', 1198 ); define ( 'DB_UPDATE_VERSION', 1198 );

View File

@ -321,6 +321,10 @@ function db_concat($fld, $sep) {
return \DBA::$dba->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. * @brief Execute a SQL query with printf style args.
* *

View File

@ -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) { function quote_interval($txt) {
if($this->driver_dbtype === 'pgsql') { if($this->driver_dbtype === 'pgsql') {
return "'$txt'"; return "'$txt'";

View File

@ -75,8 +75,6 @@ $(document).ready(function() {
else { else {
sessionStorage.removeItem('notification_open'); sessionStorage.removeItem('notification_open');
} }
$(this).data('clicked', true);
}); });
if(sessionStorage.getItem('notification_open') !== null) { if(sessionStorage.getItem('notification_open') !== null) {
@ -456,11 +454,7 @@ function handleNotificationsItems(notifyType, data) {
notify_menu.append(html); notify_menu.append(html);
}); });
$(".dropdown-menu img[data-src], .notification img[data-src]").each(function(i, el){ datasrc2src('#notifications .notification img[data-src]');
// Replace data-src attribute with src attribute for every image
$(el).attr('src', $(el).data("src"));
$(el).removeAttr("data-src");
});
if($('#tt-' + notifyType + '-only').hasClass('active')) if($('#tt-' + notifyType + '-only').hasClass('active'))
$('#nav-' + notifyType + '-menu [data-thread_top=false]').hide(); $('#nav-' + notifyType + '-menu [data-thread_top=false]').hide();
@ -834,7 +828,7 @@ function liveUpdate(notify_id) {
// else data was valid - reset the recursion counter // else data was valid - reset the recursion counter
liveRecurse = 0; liveRecurse = 0;
if(typeof notify_id !== 'undefined') { if(typeof notify_id !== 'undefined' && notify_id !== 'undefined') {
$.post( $.post(
"hq", "hq",
{ {
@ -942,9 +936,11 @@ function loadNotificationItems(notifyType) {
var pingExCmd = 'ping/' + notifyType + ((localUser != 0) ? '?f=&uid=' + localUser : ''); var pingExCmd = 'ping/' + notifyType + ((localUser != 0) ? '?f=&uid=' + localUser : '');
var clicked = $('[data-type=\'' + notifyType + '\']').data('clicked'); var clicked = $('[data-type=\'' + notifyType + '\']').data('clicked');
if((clicked === undefined) && (sessionStorage.getItem(notifyType + '_notifications_cache') !== null)) { if((clicked === undefined) && (sessionStorage.getItem(notifyType + '_notifications_cache') !== null)) {
var cached_data = JSON.parse(sessionStorage.getItem(notifyType + '_notifications_cache')); var cached_data = JSON.parse(sessionStorage.getItem(notifyType + '_notifications_cache'));
handleNotificationsItems(notifyType, cached_data); handleNotificationsItems(notifyType, cached_data);
$('[data-type=\'' + notifyType + '\']').data('clicked',true);
console.log('updating ' + notifyType + ' notifications from cache...'); console.log('updating ' + notifyType + ' notifications from cache...');
} }
else { else {

View File

@ -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"> <div id="jot-popup">
{{$editor}} {{$editor}}
</div> </div>

View File

@ -21,7 +21,7 @@
}; };
}); });
{{if $module == 'display' || $module == 'hq'}} {{if $module == 'display' || $module == 'hq' || $startpage == 'hq'}}
$(document).on('click', '.notification', function(e) { $(document).on('click', '.notification', function(e) {
var b64mid = $(this).data('b64mid'); var b64mid = $(this).data('b64mid');
var notify_id = $(this).data('notify_id'); var notify_id = $(this).data('notify_id');
@ -31,30 +31,34 @@
if(b64mid === 'undefined' && notify_id === 'undefined') if(b64mid === 'undefined' && notify_id === 'undefined')
return; return;
{{if $module == 'display'}} {{if $module != 'hq' && $startpage == 'hq'}}
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(); e.preventDefault();
window.location.href = 'hq/' + b64mid;
return;
{{else}}
{{if $module == 'display'}}
history.pushState(stateObj, '', 'display/' + b64mid);
{{/if}}
if(! page_load) { {{if $module == 'hq'}}
if($(this).parent().attr('id') !== 'nav-pubs-menu') history.pushState(stateObj, '', 'hq/' + b64mid);
$(this).fadeOut(); {{/if}}
getData(b64mid, notify_id); {{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}}
if($('#notifications_wrapper').hasClass('fs'))
$('#notifications_wrapper').prependTo('#' + notifications_parent).removeClass('fs');
}
}); });
{{/if}} {{/if}}