fosscord-server/pulls/858

This commit is contained in:
Madeline
2022-08-21 17:35:04 +10:00
parent 3b16a496d4
commit 7ce8543510
25 changed files with 411 additions and 223 deletions
+3 -2
View File
@@ -108,8 +108,8 @@ export class Channel extends BaseClass {
@Column({ nullable: true })
user_limit?: number;
@Column({ nullable: true })
nsfw?: boolean;
@Column()
nsfw: boolean = false;
@Column({ nullable: true })
rate_limit_per_user?: number;
@@ -291,6 +291,7 @@ export class Channel extends BaseClass {
(x) =>
new Recipient({ user_id: x, closed: !(type === ChannelType.GROUP_DM || x === creator_user_id) })
),
nsfw: false,
}).save();
}
+1 -35
View File
@@ -444,38 +444,4 @@ export const DefaultConfigOptions: ConfigValue = {
traceSampleRate: 1.0,
environment: hostname()
}
};
console.log((
Rights.FLAGS.MANAGE_GUILDS +
Rights.FLAGS.MANAGE_MESSAGES +
Rights.FLAGS.MANAGE_TICKETS +
Rights.FLAGS.MANAGE_USERS +
Rights.FLAGS.CREATE_CHANNELS +
Rights.FLAGS.CREATE_DMS +
Rights.FLAGS.CREATE_DM_GROUPS +
Rights.FLAGS.CREATE_GUILDS +
Rights.FLAGS.CREATE_INVITES +
Rights.FLAGS.CREATE_ROLES +
Rights.FLAGS.CREATE_TEMPLATES +
Rights.FLAGS.CREATE_WEBHOOKS +
Rights.FLAGS.JOIN_GUILDS +
Rights.FLAGS.PIN_MESSAGES +
Rights.FLAGS.SELF_ADD_REACTIONS +
Rights.FLAGS.SELF_DELETE_MESSAGES +
Rights.FLAGS.SELF_EDIT_MESSAGES +
Rights.FLAGS.SELF_EDIT_NAME +
Rights.FLAGS.SEND_MESSAGES +
Rights.FLAGS.USE_ACTIVITIES +
Rights.FLAGS.USE_VIDEO +
Rights.FLAGS.USE_VOICE +
Rights.FLAGS.INVITE_USERS +
Rights.FLAGS.SELF_DELETE_DISABLE +
Rights.FLAGS.DEBTABLE +
Rights.FLAGS.KICK_BAN_MEMBERS +
Rights.FLAGS.SELF_LEAVE_GROUPS +
Rights.FLAGS.SELF_ADD_DISCOVERABLE +
Rights.FLAGS.USE_ACHIEVEMENTS +
Rights.FLAGS.USE_MASS_INVITES
).toString())
};
+3 -3
View File
@@ -267,8 +267,8 @@ export class Guild extends BaseClass {
@Column({ nullable: true })
nsfw_level?: number;
@Column({ nullable: true })
nsfw?: boolean;
@Column()
nsfw: boolean;
// TODO: nested guilds
@Column({ nullable: true })
@@ -335,7 +335,7 @@ export class Guild extends BaseClass {
unicode_emoji: null
}).save();
if (!body.channels || !body.channels.length) body.channels = [{ id: "01", type: 0, name: "general" }];
if (!body.channels || !body.channels.length) body.channels = [{ id: "01", type: 0, name: "general", nsfw: false }];
const ids = new Map();
+1 -1
View File
@@ -122,7 +122,7 @@ export class Message extends BaseClass {
timestamp: Date;
@Column({ nullable: true })
edited_timestamp?: Date;
edited_timestamp: Date;
@Column({ nullable: true })
tts?: boolean;
+19 -2
View File
@@ -30,6 +30,8 @@ export enum PrivateUserEnum {
nsfw_allowed,
premium,
premium_type,
purchased_flags,
premium_usage_flags,
disabled,
settings,
// locale
@@ -53,8 +55,6 @@ export interface UserPrivate extends Pick<User, PrivateUserKeys> {
locale: string;
}
// TODO: add purchased_flags, premium_usage_flags
@Entity("users")
export class User extends BaseClass {
@Column()
@@ -139,6 +139,12 @@ export class User extends BaseClass {
@Column()
public_flags: number;
@Column()
purchased_flags: number;
@Column()
premium_usage_flags: number;
@Column({ type: "bigint" })
rights: string; // Rights
@@ -281,6 +287,8 @@ export class User extends BaseClass {
valid_tokens_since: new Date(),
},
settings: { ...defaultSettings, locale: language },
purchased_flags: 5, // TODO: idk what the values for this are
premium_usage_flags: 2, // TODO: idk what the values for this are
extended_settings: {},
fingerprints: [],
notes: {},
@@ -332,6 +340,11 @@ export const defaultSettings: UserSettings = {
stream_notifications_enabled: false,
theme: "dark",
timezone_offset: 0, // TODO: timezone from request
banner_color: null,
friend_discovery_flags: 0,
view_nsfw_guilds: true,
passwordless: false,
};
export interface UserSettings {
@@ -377,6 +390,10 @@ export interface UserSettings {
stream_notifications_enabled: boolean;
theme: "dark" | "white"; // dark
timezone_offset: number; // e.g -60
banner_color: string | null;
friend_discovery_flags: number;
view_nsfw_guilds: boolean;
passwordless: boolean;
}
export const CUSTOM_USER_FLAG_OFFSET = BigInt(1) << BigInt(32);