mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-29 03:18:40 +00:00
rename pomeloEnabled to uniqueUsernames
This commit is contained in:
@@ -29,5 +29,5 @@ export class GeneralConfiguration {
|
||||
image: string | null = null;
|
||||
instanceId: string = Snowflake.generate();
|
||||
autoCreateBotUsers: boolean = false;
|
||||
pomeloEnabled: boolean = false;
|
||||
uniqueUsernames: boolean = false;
|
||||
}
|
||||
|
||||
@@ -92,10 +92,10 @@ export class User extends BaseClass {
|
||||
username: string; // username max length 32, min 2 (should be configurable)
|
||||
|
||||
@Column({ nullable: true })
|
||||
global_name?: string; // puyo: pomelo
|
||||
global_name?: string; // puyo: uniqueUsernames
|
||||
|
||||
@Column()
|
||||
discriminator: string; // opaque string: 4 digits on discord.com, 0 for pomelo
|
||||
discriminator: string; // opaque string: 4 digits on discord.com, 0 for uniqueUsernames
|
||||
|
||||
@Column({ nullable: true })
|
||||
avatar?: string; // hash of the user avatar
|
||||
@@ -328,10 +328,10 @@ export class User extends BaseClass {
|
||||
}
|
||||
|
||||
public get tag(): string {
|
||||
const { pomeloEnabled } = Config.get().general;
|
||||
const { uniqueUsernames } = Config.get().general;
|
||||
|
||||
// if pomelo is enabled, global_name should be set
|
||||
return pomeloEnabled
|
||||
// if uniqueUsernames is enabled, global_name should be set
|
||||
return uniqueUsernames
|
||||
? (this.global_name as string)
|
||||
: `${this.username}#${this.discriminator}`;
|
||||
}
|
||||
@@ -350,13 +350,13 @@ export class User extends BaseClass {
|
||||
id?: string;
|
||||
req?: Request;
|
||||
}) {
|
||||
const { pomeloEnabled } = Config.get().general;
|
||||
const { uniqueUsernames } = Config.get().general;
|
||||
|
||||
// trim special uf8 control characters -> Backspace, Newline, ...
|
||||
username = trimSpecial(username);
|
||||
|
||||
let discriminator: string | undefined;
|
||||
if (pomeloEnabled) discriminator = "0";
|
||||
if (uniqueUsernames) discriminator = "0";
|
||||
else {
|
||||
discriminator = await User.generateDiscriminator(username);
|
||||
if (!discriminator) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// TODO: pomelo?
|
||||
// TODO: uniqueUsernames?
|
||||
export interface RelationshipPostSchema {
|
||||
discriminator: string;
|
||||
username: string;
|
||||
|
||||
Reference in New Issue
Block a user