forked from cadence/out-of-your-element
Add include_user_id_in_mxid setting
This commit is contained in:
parent
eb98af0ac3
commit
541c5e1eb5
4 changed files with 15 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
// @ts-check
|
||||
|
||||
const assert = require("assert")
|
||||
const registration = require("../../matrix/read-registration")
|
||||
|
||||
const passthrough = require("../../passthrough")
|
||||
const {select} = passthrough
|
||||
|
@ -24,6 +25,10 @@ function downcaseUsername(user) {
|
|||
.replace(/[^a-z0-9._=/-]*/g, "")
|
||||
// remove leading and trailing dashes and underscores...
|
||||
.replace(/(?:^[_-]*|[_-]*$)/g, "")
|
||||
// If requested, also make the Discord user ID part of the username
|
||||
if (registration.ooye.include_user_id_in_mxid) {
|
||||
downcased = user.id + "_" + downcased
|
||||
}
|
||||
// The new length must be at least 2 characters (in other words, it should have some content)
|
||||
if (downcased.length < 2) {
|
||||
downcased = user.id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue