allow to show role/capcode without typing role name, and update FAQ to reflect the change

merge-requests/208/head
fatchan 5 years ago
parent f7efa9f34f
commit dcd05afd08
  1. 10
      models/forms/makepost.js
  2. 13
      views/custompages/faq.pug

@ -12,7 +12,7 @@ const path = require('path')
, { markdown } = require(__dirname+'/../../helpers/posting/markdown.js')
, sanitizeOptions = require(__dirname+'/../../helpers/posting/sanitizeoptions.js')
, sanitize = require('sanitize-html')
, nameRegex = /^(?<name>[^\s#]+)?(?:##(?<tripcode>[^ ]{1}[^\s#]+))?(?:## (?<capcode>[^#]+))?$/
, nameRegex = /^(?<name>[^\s#]+)?(?:##(?<tripcode>[^ ]{1}[^\s#]+))?(?<capcode>##(?<capcodetext> [^#]+)?)?$/
, imageUpload = require(__dirname+'/../../helpers/files/imageupload.js')
, videoUpload = require(__dirname+'/../../helpers/files/videoupload.js')
, fileCheckMimeType = require(__dirname+'/../../helpers/files/mimetypes.js')
@ -283,7 +283,6 @@ module.exports = async (req, res, next) => {
}
//capcode
if (res.locals.permLevel < 4 && groups.capcode) {
groups.capcode = groups.capcode.trim();
let type = '';
switch (res.locals.permLevel) {
case 3://board mod
@ -299,10 +298,9 @@ module.exports = async (req, res, next) => {
type = 'Admin';
break;
}
if (type.toLowerCase() !== groups.capcode.toLowerCase()) {
capcode = `##${type} ${groups.capcode}`;
} else {
capcode = `##${type}`;
capcode = groups.capcodetext ? groups.capcodetext.trim() : type;
if (type.toLowerCase() !== capcode.toLowerCase()) {
capcode = `##${type} ${capcode}`;
}
}
}

@ -59,11 +59,12 @@ block content
ol.mv-0
li Name
li Name##tripcode
li Name## Board Owner
li Name##tripcode## Board Owner
li ##tripcode## Board Owner
li Name## capcode
li Name##tripcode## capcode
li ##tripcode## capcode
li ##tripcode
li ## Board owner
li ## capcode
p The capcode can also be left blank to display just your role.
p From the examples, you can see that all components can be used in combination or independently. In a post number 4 would look like:
-
const examplePost = {
@ -71,7 +72,7 @@ block content
"name" : "Name",
"board" : "example",
"tripcode" : "!!X8NXmAS44=",
"capcode" : "##Board Owner",
"capcode" : "##Board Owner capcode",
"message" : "Hello, world!",
"nomarkup" : "Hello, world!",
"thread" : 1,
@ -96,7 +97,7 @@ block content
p A tripcode is a password of sorts, which users can provide in the tripcode component of their name. This tripcode is used in conjunction with a server-known secret to generate a unique* tripcode portion of the name. Long, unique tripcodes can be used as a form of identity. It is important that you keep tripcodes secret if you use them for some form of identity. A compromised tripcode can be used for impersonation and cannot be revoked in any way.
b Capcode
p A capcode is a component of the name field only available to authenticated users. This includes admins, global staff, board owners and board moderators. The capcoded string will be prefixed with the users role so board staff can make an authoritative post and prove their staff status.
p A capcode is a component of the name field only available to authenticated users. This includes admins, global staff, board owners and board moderators. If there is no text after the ##, the role will be displayed alone. Leaving a space and putting custom text will be prefixed by the role name. This way, the role is always shown to prevent role impersonation.
.table-container.flex-center.mv-5
.anchor#post-styling
table

Loading…
Cancel
Save