mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
partial fix to #2509
This commit is contained in:
@@ -33,6 +33,7 @@ $(document).ready(function() {
|
|||||||
return renderTemplate(url, data.status.toString(), data.responseJSON, (new Date()).getTime(), callback);
|
return renderTemplate(url, data.status.toString(), data.responseJSON, (new Date()).getTime(), callback);
|
||||||
} else if (data.status === 401) {
|
} else if (data.status === 401) {
|
||||||
app.alertError('[[global:please_log_in]]');
|
app.alertError('[[global:please_log_in]]');
|
||||||
|
app.previousUrl = url;
|
||||||
return ajaxify.go('login');
|
return ajaxify.go('login');
|
||||||
} else if (data.status === 302) {
|
} else if (data.status === 302) {
|
||||||
return ajaxify.go(data.responseJSON.slice(1), callback, quiet);
|
return ajaxify.go(data.responseJSON.slice(1), callback, quiet);
|
||||||
|
|||||||
@@ -558,6 +558,18 @@ middleware.maintenanceMode = function(req, res, next) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
middleware.publicTagListing = function(req, res, next) {
|
||||||
|
if ((!meta.config.hasOwnProperty('publicTagListing') || parseInt(meta.config.publicTagListing, 10) === 1)) {
|
||||||
|
next();
|
||||||
|
} else {
|
||||||
|
if (res.locals.isAPI) {
|
||||||
|
res.sendStatus(401);
|
||||||
|
} else {
|
||||||
|
middleware.ensureLoggedIn(req, res, next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = function(webserver) {
|
module.exports = function(webserver) {
|
||||||
app = webserver;
|
app = webserver;
|
||||||
middleware.admin = require('./admin')(webserver);
|
middleware.admin = require('./admin')(webserver);
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ function topicRoutes(app, middleware, controllers) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function tagRoutes(app, middleware, controllers) {
|
function tagRoutes(app, middleware, controllers) {
|
||||||
setupPageRoute(app, '/tags/:tag', middleware, [], controllers.tags.getTag);
|
setupPageRoute(app, '/tags/:tag', middleware, [middleware.publicTagListing], controllers.tags.getTag);
|
||||||
setupPageRoute(app, '/tags', middleware, [], controllers.tags.getTags);
|
setupPageRoute(app, '/tags', middleware, [middleware.publicTagListing], controllers.tags.getTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
function categoryRoutes(app, middleware, controllers) {
|
function categoryRoutes(app, middleware, controllers) {
|
||||||
|
|||||||
@@ -4,9 +4,23 @@
|
|||||||
<div class="panel-heading">Tag Settings</div>
|
<div class="panel-heading">Tag Settings</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<form>
|
<form>
|
||||||
<strong>Tags per Topic</strong><br /> <input type="text" class="form-control" value="5" data-field="tagsPerTopic"><br />
|
<div class="checkbox">
|
||||||
<strong>Minimum Tag Length</strong><br /> <input type="text" class="form-control" value="3" data-field="minimumTagLength"><br />
|
<label>
|
||||||
<strong>Maximum Tag Length</strong><br /> <input type="text" class="form-control" value="15" data-field="maximumTagLength"><br />
|
<input type="checkbox" data-field="publicTagListing"> Make the tags list publically viewable
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="tagsPerTopics">Tags per Topic</label>
|
||||||
|
<input id="tagsPerTopics" type="text" class="form-control" value="5" data-field="tagsPerTopic">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="minimumTagLength">Minimum Tag Length</label>
|
||||||
|
<input id="minimumTagLength" type="text" class="form-control" value="3" data-field="minimumTagLength">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="maximumTagLength">Maximum Tag Length</label>
|
||||||
|
<input id="maximumTagLength" type="text" class="form-control" value="15" data-field="maximumTagLength">
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user