mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 00:15:46 +01:00
Merge branch 'master' of https://github.com/akhoury/NodeBB into akhoury-master
This commit is contained in:
@@ -80,7 +80,7 @@ var socket,
|
|||||||
socket.emit('reconnected');
|
socket.emit('reconnected');
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
reconnectEl.removeClass('active');
|
reconnectEl.removeClass('active').addClass("hide");
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ var socket,
|
|||||||
reconnecting = true;
|
reconnecting = true;
|
||||||
|
|
||||||
if (!reconnectEl.hasClass('active')) reconnectEl.html('<i class="fa fa-spinner fa-spin"></i>');
|
if (!reconnectEl.hasClass('active')) reconnectEl.html('<i class="fa fa-spinner fa-spin"></i>');
|
||||||
reconnectEl.addClass('active');
|
reconnectEl.addClass('active').removeClass("hide");
|
||||||
|
|
||||||
reconnectEl.tooltip({
|
reconnectEl.tooltip({
|
||||||
placement: 'bottom'
|
placement: 'bottom'
|
||||||
|
|||||||
@@ -5,14 +5,15 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('api:updateHeader', function(data) {
|
socket.on('api:updateHeader', function(data) {
|
||||||
jQuery('#search-button').on('click', function() {
|
|
||||||
jQuery('#search-fields').removeClass('hide').show();
|
|
||||||
jQuery(this).hide();
|
|
||||||
jQuery('#search-fields input').focus()
|
|
||||||
|
|
||||||
jQuery('#search-form').on('submit', function() {
|
$('#search-button').on('click', function() {
|
||||||
jQuery('#search-fields').hide();
|
$('#search-fields').removeClass('hide').show();
|
||||||
jQuery('#search-button').show();
|
$(this).hide();
|
||||||
|
$('#search-fields input').focus();
|
||||||
|
|
||||||
|
$('#search-form').on('submit', function() {
|
||||||
|
$('#search-fields').hide();
|
||||||
|
$('#search-button').show();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#search-fields input').on('blur', function() {
|
$('#search-fields input').on('blur', function() {
|
||||||
@@ -22,16 +23,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
var loggedInMenu = $('#logged-in-menu'),
|
var loggedInMenu = $('#logged-in-menu'),
|
||||||
isLoggedIn = data.uid > 0;
|
isLoggedIn = data.uid > 0,
|
||||||
|
allowGuestSearching = (data.config || {}).allowGuestSearching === '1';
|
||||||
|
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
jQuery('.nodebb-loggedin').show();
|
$('.nodebb-loggedin').show();
|
||||||
jQuery('.nodebb-loggedout').hide();
|
$('.nodebb-loggedout').hide();
|
||||||
|
|
||||||
$('#logged-out-menu').addClass('hide');
|
$('#logged-out-menu').addClass('hide');
|
||||||
$('#logged-in-menu').removeClass('hide');
|
$('#logged-in-menu').removeClass('hide');
|
||||||
|
|
||||||
$('#search-button').show();
|
$('#search-button').removeClass("hide").show();
|
||||||
|
|
||||||
var userLabel = loggedInMenu.find('#user_label');
|
var userLabel = loggedInMenu.find('#user_label');
|
||||||
|
|
||||||
@@ -46,10 +48,14 @@
|
|||||||
$('#logout-link').on('click', app.logout);
|
$('#logout-link').on('click', app.logout);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#search-button').hide();
|
if (allowGuestSearching) {
|
||||||
|
$('#search-button').removeClass("hide").show();
|
||||||
|
} else {
|
||||||
|
$('#search-button').addClass("hide").hide();
|
||||||
|
}
|
||||||
|
|
||||||
jQuery('.nodebb-loggedin').hide();
|
$('.nodebb-loggedin').hide();
|
||||||
jQuery('.nodebb-loggedout').show();
|
$('.nodebb-loggedout').show();
|
||||||
|
|
||||||
$('#logged-out-menu').removeClass('hide');
|
$('#logged-out-menu').removeClass('hide');
|
||||||
$('#logged-in-menu').addClass('hide');
|
$('#logged-in-menu').addClass('hide');
|
||||||
|
|||||||
@@ -99,6 +99,11 @@
|
|||||||
<input type="checkbox" data-field="allowGuestPosting"> <strong>Allow guests to post without logging in</strong>
|
<input type="checkbox" data-field="allowGuestPosting"> <strong>Allow guests to post without logging in</strong>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" data-field="allowGuestSearching"> <strong>Allow guests to search without logging in</strong>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" data-field="useOutgoingLinksPage"> <strong>Use Outgoing Links Warning Page</strong>
|
<input type="checkbox" data-field="useOutgoingLinksPage"> <strong>Use Outgoing Links Warning Page</strong>
|
||||||
|
|||||||
@@ -74,19 +74,7 @@
|
|||||||
|
|
||||||
<ul id="logged-in-menu" class="nav navbar-nav navbar-right hide">
|
<ul id="logged-in-menu" class="nav navbar-nav navbar-right hide">
|
||||||
<li>
|
<li>
|
||||||
<a href="#" id="reconnect" title="Connection to {title} has been lost, attempting to reconnect..."><i class="fa fa-check"></i></a>
|
<a href="#" id="reconnect" class="hide" title="Connection to {title} has been lost, attempting to reconnect..."><i class="fa fa-check"></i></a>
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<form id="search-form" class="navbar-form navbar-right hidden-xs" role="search" method="GET" action="">
|
|
||||||
<div class="hide" id="search-fields">
|
|
||||||
<div class="form-group">
|
|
||||||
<input type="text" class="form-control" placeholder="Search" name="query" value="">
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-default hide">[[global:search]]</button>
|
|
||||||
</div>
|
|
||||||
<button id="search-button" type="button" class="btn btn-link"><i class="fa fa-search"></i></button>
|
|
||||||
</form>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="notifications dropdown text-center hidden-xs">
|
<li class="notifications dropdown text-center hidden-xs">
|
||||||
@@ -143,6 +131,20 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<ul id="logged-conditional-menu" class="nav navbar-nav navbar-right">
|
||||||
|
<li>
|
||||||
|
<form id="search-form" class="navbar-form navbar-right hidden-xs" role="search" method="GET" action="">
|
||||||
|
<div class="hide" id="search-fields">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" class="form-control" placeholder="Search" name="query" value="">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-default hide">[[global:search]]</button>
|
||||||
|
</div>
|
||||||
|
<button id="search-button" type="button" class="btn btn-link hide"><i class="fa fa-search"></i></button>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<ul class="nav navbar-nav navbar-right pagination-block">
|
<ul class="nav navbar-nav navbar-right pagination-block">
|
||||||
<li class="active">
|
<li class="active">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
|
|||||||
@@ -205,6 +205,9 @@ var async = require('async'),
|
|||||||
}, {
|
}, {
|
||||||
field: 'allowGuestPosting',
|
field: 'allowGuestPosting',
|
||||||
value: 0
|
value: 0
|
||||||
|
}, {
|
||||||
|
field: 'allowGuestSearching',
|
||||||
|
value: 0
|
||||||
}, {
|
}, {
|
||||||
field: 'minimumTitleLength',
|
field: 'minimumTitleLength',
|
||||||
value: 3
|
value: 3
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ var path = require('path'),
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.get('/search', function (req, res) {
|
app.get('/search', function (req, res) {
|
||||||
if (req.user && req.user.uid) {
|
if ((req.user && req.user.uid) || meta.config.allowGuestSearching === '1') {
|
||||||
return res.json({
|
return res.json({
|
||||||
show_no_topics: 'hide',
|
show_no_topics: 'hide',
|
||||||
show_no_posts: 'hide',
|
show_no_posts: 'hide',
|
||||||
@@ -275,7 +275,7 @@ var path = require('path'),
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.user && req.user.uid) {
|
if ((req.user && req.user.uid) || meta.config.allowGuestSearching === '1') {
|
||||||
async.parallel([searchPosts, searchTopics], function (err, results) {
|
async.parallel([searchPosts, searchTopics], function (err, results) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next();
|
return next();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ var db = require('./database'),
|
|||||||
|
|
||||||
Upgrade.check = function(callback) {
|
Upgrade.check = function(callback) {
|
||||||
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema
|
||||||
var latestSchema = new Date(2013, 11, 2).getTime();
|
var latestSchema = new Date(2013, 11, 11).getTime();
|
||||||
|
|
||||||
db.get('schemaDate', function(err, value) {
|
db.get('schemaDate', function(err, value) {
|
||||||
if (parseInt(value, 10) >= latestSchema) {
|
if (parseInt(value, 10) >= latestSchema) {
|
||||||
@@ -303,6 +303,23 @@ Upgrade.upgradeRedis = function(callback) {
|
|||||||
winston.info('[2013/12/2] Update to global keys skipped');
|
winston.info('[2013/12/2] Update to global keys skipped');
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
function(next) {
|
||||||
|
thisSchemaDate = new Date(2013, 11, 11).getTime();
|
||||||
|
if (schemaDate < thisSchemaDate) {
|
||||||
|
updatesMade = true;
|
||||||
|
|
||||||
|
RDB.hset('config', 'allowGuestSearching', '0', function(err){
|
||||||
|
if (err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
winston.info('[2013/12/11] Updated guest search config.');
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
winston.info('[2013/12/11] Update to guest search skipped');
|
||||||
|
next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Add new schema updates here
|
// Add new schema updates here
|
||||||
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 12!!!
|
// IMPORTANT: REMEMBER TO UPDATE VALUE OF latestSchema IN LINE 12!!!
|
||||||
@@ -333,7 +350,9 @@ Upgrade.upgradeRedis = function(callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Upgrade.upgradeMongo = function(callback) {
|
Upgrade.upgradeMongo = function(callback) {
|
||||||
var MDB = db.client;
|
// why can't we just use the abstracted db module here? and in upgradeRedis()?
|
||||||
|
var MDB = db.client,
|
||||||
|
updatesMade = false;
|
||||||
|
|
||||||
winston.info('Beginning Mongo database schema update');
|
winston.info('Beginning Mongo database schema update');
|
||||||
|
|
||||||
@@ -344,6 +363,24 @@ Upgrade.upgradeMongo = function(callback) {
|
|||||||
thisSchemaDate = new Date(2013, 11, 6).getTime();
|
thisSchemaDate = new Date(2013, 11, 6).getTime();
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
function(next) {
|
||||||
|
|
||||||
|
thisSchemaDate = new Date(2013, 11, 11).getTime();
|
||||||
|
if (schemaDate < thisSchemaDate) {
|
||||||
|
updatesMade = true;
|
||||||
|
|
||||||
|
db.setObjectField('config', 'allowGuestSearching', '0', function(err){
|
||||||
|
if (err) {
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
winston.info('[2013/12/11] Updated guest search config.');
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
winston.info('[2013/12/11] Update to guest search skipped');
|
||||||
|
next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Add new schema updates here
|
// Add new schema updates here
|
||||||
|
|
||||||
@@ -351,7 +388,11 @@ Upgrade.upgradeMongo = function(callback) {
|
|||||||
if (!err) {
|
if (!err) {
|
||||||
db.set('schemaDate', thisSchemaDate, function(err) {
|
db.set('schemaDate', thisSchemaDate, function(err) {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
winston.info('[upgrade] Mongo schema update complete!');
|
if(updatesMade) {
|
||||||
|
winston.info('[upgrade] Mongo schema update complete!');
|
||||||
|
} else {
|
||||||
|
winston.info('[upgrade] Mongo schema already up to date!');
|
||||||
|
}
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback(err);
|
callback(err);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ var path = require('path'),
|
|||||||
// Basic Routes (entirely client-side parsed, goal is to move the rest of the crap in this file into this one section)
|
// Basic Routes (entirely client-side parsed, goal is to move the rest of the crap in this file into this one section)
|
||||||
(function () {
|
(function () {
|
||||||
var routes = ['login', 'register', 'account', 'recent', '403', '404', '500'],
|
var routes = ['login', 'register', 'account', 'recent', '403', '404', '500'],
|
||||||
loginRequired = ['unread', 'search', 'notifications'];
|
loginRequired = ['unread', 'notifications'];
|
||||||
|
|
||||||
async.each(routes.concat(loginRequired), function(route, next) {
|
async.each(routes.concat(loginRequired), function(route, next) {
|
||||||
app.get('/' + route, function (req, res) {
|
app.get('/' + route, function (req, res) {
|
||||||
@@ -741,7 +741,7 @@ var path = require('path'),
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.get('/search/:term', function (req, res) {
|
app.get('/search/:term', function (req, res) {
|
||||||
if (!req.user) {
|
if (!req.user && meta.config.allowGuestSearching !== '1') {
|
||||||
return res.redirect('/403');
|
return res.redirect('/403');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -236,7 +236,10 @@ websockets.init = function(io) {
|
|||||||
email: '',
|
email: '',
|
||||||
picture: gravatar.url('', {
|
picture: gravatar.url('', {
|
||||||
s: '24'
|
s: '24'
|
||||||
}, nconf.get('https'))
|
}, nconf.get('https')),
|
||||||
|
config: {
|
||||||
|
allowGuestSearching: meta.config.allowGuestSearching
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user