1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

Merge branch 'master' into remove-vanity-url

This commit is contained in:
Flam3rboy 2021-10-10 18:56:46 +02:00 committed by GitHub
commit 487e31b98c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -94,9 +94,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
// @ts-ignore
x.channel.recipients = x.channel.recipients?.map((x) => x.user);
//TODO is this needed? check if users in group dm that are not friends are sent in the READY event
users = users.concat(
x.channel.recipients?.map((x) => x.user) as User[]
);
users = users.concat(x.channel.recipients as unknown as User[]);
if (x.channel.isDm()) {
x.channel.recipients = x.channel.recipients!.filter(
(x) => x.id !== this.user_id

View File

@ -58,10 +58,14 @@ async function main() {
const oldDB = await initDatabase();
const type = process.env.TO.includes("://") ? process.env.TO.split(":")[0]?.replace("+srv", "") : "sqlite";
const isSqlite = type.includes("sqlite");
// @ts-ignore
const newDB = await createConnection({
type: process.env.TO.split(":")[0]?.replace("+srv", ""),
url: process.env.TO,
const oldDB = await createConnection({
type,
url: isSqlite ? undefined : process.env.TO,
database: isSqlite ? process.env.TO : undefined,
entities,
name: "old",
});
@ -71,7 +75,8 @@ async function main() {
for (const e of entities) {
const entity = e as EntityTarget<any>;
const entries = await oldDB.manager.find(entity);
//@ts-ignore
// @ts-ignore
console.log("migrating " + entries.length + " " + entity.name + " ...");
for (const entry of entries) {
@ -115,7 +120,7 @@ async function main() {
}
// @ts-ignore
console.log("migrating " + entries.length + " " + entity.name + " ...");
console.log("migrated " + entries.length + " " + entity.name);
}
} catch (error) {
console.error((error as any).message);