mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 13:20:41 +01:00
feat: #7550, show message if post is queued when js is disabled
This commit is contained in:
@@ -77,7 +77,7 @@ exports.post = async function (req, res) {
|
||||
throw new Error('[[error:invalid-data]]');
|
||||
}
|
||||
if (result.queued) {
|
||||
return res.redirect((nconf.get('relative_path') || '/'));
|
||||
return res.redirect((nconf.get('relative_path') || '/') + '?noScriptMessage=[[success:post-queued]]');
|
||||
}
|
||||
const uid = result.uid ? result.uid : result.topicData.uid;
|
||||
user.updateOnlineUsers(uid);
|
||||
|
||||
@@ -157,6 +157,9 @@ middleware.renderHeader = async function renderHeader(req, res, data) {
|
||||
templateValues.defaultLang = meta.config.defaultLang || 'en-GB';
|
||||
templateValues.userLang = res.locals.config.userLang;
|
||||
templateValues.languageDirection = results.languageDirection;
|
||||
if (req.query.noScriptMessage) {
|
||||
templateValues.noScriptMessage = validator.escape(String(req.query.noScriptMessage));
|
||||
}
|
||||
|
||||
templateValues.template = { name: res.locals.template };
|
||||
templateValues.template[res.locals.template] = true;
|
||||
|
||||
9
src/views/partials/noscript/message.tpl
Normal file
9
src/views/partials/noscript/message.tpl
Normal file
@@ -0,0 +1,9 @@
|
||||
{{{ if noScriptMessage }}}
|
||||
<noscript>
|
||||
<div class="alert alert-info">
|
||||
<p>
|
||||
{noScriptMessage}
|
||||
</p>
|
||||
</div>
|
||||
</noscript>
|
||||
{{{ end }}}
|
||||
10
src/views/partials/noscript/warning.tpl
Normal file
10
src/views/partials/noscript/warning.tpl
Normal file
@@ -0,0 +1,10 @@
|
||||
<noscript>
|
||||
<div class="alert alert-danger">
|
||||
<p>
|
||||
Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in <strong>read-only mode</strong>.
|
||||
</p>
|
||||
<p>
|
||||
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
|
||||
</p>
|
||||
</div>
|
||||
</noscript>
|
||||
Reference in New Issue
Block a user