mirror of
https://github.com/spacebarchat/server.git
synced 2026-07-29 00:59:24 +00:00
Merge branch 'master' into fix/reaction-removing
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -39,8 +39,8 @@ router.get(
|
||||
const { primary_only } = req.query;
|
||||
|
||||
const out = primary_only
|
||||
? await Categories.find()
|
||||
: await Categories.find({ where: { is_primary: true } });
|
||||
? await Categories.find({ where: { is_primary: true } })
|
||||
: await Categories.find();
|
||||
|
||||
res.send(out);
|
||||
},
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -19,6 +19,8 @@
|
||||
import { route } from "@spacebar/api";
|
||||
import {
|
||||
Badge,
|
||||
Config,
|
||||
FieldErrors,
|
||||
Member,
|
||||
PrivateUserProjection,
|
||||
User,
|
||||
@@ -136,6 +138,18 @@ router.patch(
|
||||
select: [...PrivateUserProjection, "data"],
|
||||
});
|
||||
|
||||
if (body.bio) {
|
||||
const { maxBio } = Config.get().limits.user;
|
||||
if (body.bio.length > maxBio) {
|
||||
throw FieldErrors({
|
||||
bio: {
|
||||
code: "BIO_INVALID",
|
||||
message: `Bio must be less than ${maxBio} in length`,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
user.assign(body);
|
||||
await user.save();
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -189,6 +189,18 @@ router.patch(
|
||||
}
|
||||
}
|
||||
|
||||
if (body.bio) {
|
||||
const { maxBio } = Config.get().limits.user;
|
||||
if (body.bio.length > maxBio) {
|
||||
throw FieldErrors({
|
||||
bio: {
|
||||
code: "BIO_INVALID",
|
||||
message: `Bio must be less than ${maxBio} in length`,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
user.assign(body);
|
||||
user.validate();
|
||||
await user.save();
|
||||
|
||||
Reference in New Issue
Block a user