From aaf5df14e1523ef70fcb9aa5ff9fc0b73ff42fee Mon Sep 17 00:00:00 2001 From: Chris Chrome Date: Wed, 5 Jan 2022 05:44:14 -0500 Subject: Add Role Icons (#574) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Role Icons Co-authored-by: Erkin Alp Güney * Cache coherency rules Co-authored-by: MANIKILLER Co-authored-by: ImAaronFR <96433859+ImAaronFR@users.noreply.github.com> --- util/src/entities/Guild.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util/src/entities/Guild.ts') diff --git a/util/src/entities/Guild.ts b/util/src/entities/Guild.ts index 157f0921..f4c94a64 100644 --- a/util/src/entities/Guild.ts +++ b/util/src/entities/Guild.ts @@ -340,6 +340,8 @@ export class Guild extends BaseClass { name: "@everyone", permissions: String("2251804225"), position: 0, + icon: null, + unicode_emoji: null }).save(); if (!body.channels || !body.channels.length) body.channels = [{ id: "01", type: 0, name: "general" }]; -- cgit 1.5.1 From 26781e736c5877d31f7a1fbde3bebe188caa008a Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Wed, 12 Jan 2022 10:19:05 +0300 Subject: Update Guild.ts --- util/src/entities/Guild.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'util/src/entities/Guild.ts') diff --git a/util/src/entities/Guild.ts b/util/src/entities/Guild.ts index f4c94a64..00f92679 100644 --- a/util/src/entities/Guild.ts +++ b/util/src/entities/Guild.ts @@ -330,6 +330,7 @@ export class Guild extends BaseClass { }).save(); // we have to create the role _after_ the guild because else we would get a "SQLITE_CONSTRAINT: FOREIGN KEY constraint failed" error + // TODO: make the @everyone a pseudorole that is dynamically generated at runtime so we can save storage await new Role({ id: guild_id, guild_id: guild_id, -- cgit 1.5.1 From cc698225a0e6cab61363b3585bbab30d022c0207 Mon Sep 17 00:00:00 2001 From: Erkin Alp Güney Date: Wed, 12 Jan 2022 16:13:13 +0300 Subject: update defaults --- util/src/entities/Guild.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'util/src/entities/Guild.ts') diff --git a/util/src/entities/Guild.ts b/util/src/entities/Guild.ts index 00f92679..6a1df4d6 100644 --- a/util/src/entities/Guild.ts +++ b/util/src/entities/Guild.ts @@ -213,7 +213,7 @@ export class Guild extends BaseClass { owner: User; @Column({ nullable: true }) - preferred_locale?: string; // only community guilds can choose this + preferred_locale?: string; @Column({ nullable: true }) premium_subscription_count?: number; @@ -301,22 +301,22 @@ export class Guild extends BaseClass { name: body.name || "Fosscord", icon: await handleFile(`/icons/${guild_id}`, body.icon as string), region: Config.get().regions.default, - owner_id: body.owner_id, + owner_id: body.owner_id, // TODO: need to figure out a way for ownerless guilds and multiply-owned guilds afk_timeout: 300, - default_message_notifications: 0, + default_message_notifications: 1, // defaults effect: setting the push default at mentions-only will save a lot explicit_content_filter: 0, features: [], id: guild_id, max_members: 250000, max_presences: 250000, - max_video_channel_users: 25, + max_video_channel_users: 200, presence_count: 0, member_count: 0, // will automatically be increased by addMember() mfa_level: 0, preferred_locale: "en-US", premium_subscription_count: 0, premium_tier: 0, - system_channel_flags: 0, + system_channel_flags: 4, // defaults effect: suppress the setup tips to save performance unavailable: false, nsfw: false, nsfw_level: 0, @@ -326,7 +326,7 @@ export class Guild extends BaseClass { description: "No description", welcome_channels: [], }, - widget_enabled: false, + widget_enabled: true, // NB: don't set it as false to prevent artificial restrictions }).save(); // we have to create the role _after_ the guild because else we would get a "SQLITE_CONSTRAINT: FOREIGN KEY constraint failed" error @@ -337,6 +337,7 @@ export class Guild extends BaseClass { color: 0, hoist: false, managed: false, + // NB: in Fosscord, every role will be non-managed, as we use user-groups instead of roles for managed groups mentionable: false, name: "@everyone", permissions: String("2251804225"), @@ -358,7 +359,6 @@ export class Guild extends BaseClass { for (const channel of body.channels?.sort((a, b) => (a.parent_id ? 1 : -1))) { var id = ids.get(channel.id) || Snowflake.generate(); - // TODO: should we abort if parent_id is a category? (to disallow sub category channels) var parent_id = ids.get(channel.parent_id); await Channel.createChannel({ ...channel, guild_id, id, parent_id }, body.owner_id, { -- cgit 1.5.1