merge: Increase character hard limits (resolves #686 and #696) (!647)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/647

Closes #686 and #696

Approved-by: Marie <github@yuugi.dev>
Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
Hazelnoot 2024-10-07 23:20:14 +00:00
commit a90b4d487a
11 changed files with 57 additions and 10 deletions

View file

@ -252,7 +252,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private noteCreateService: NoteCreateService,
) {
super(meta, paramDef, async (ps, me) => {
if (ps.text && (ps.text.length > this.config.maxNoteLength)) {
const contentLength = (ps.text?.length ?? 0) + (ps.cw?.length ?? 0);
if (contentLength > this.config.maxNoteLength) {
throw new ApiError(meta.errors.maxLength);
}

View file

@ -297,9 +297,11 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
private noteEditService: NoteEditService,
) {
super(meta, paramDef, async (ps, me) => {
if (ps.text && (ps.text.length > this.config.maxNoteLength)) {
const contentLength = (ps.text?.length ?? 0) + (ps.cw?.length ?? 0);
if (contentLength > this.config.maxNoteLength) {
throw new ApiError(meta.errors.maxLength);
}
let visibleUsers: MiUser[] = [];
if (ps.visibleUserIds) {
visibleUsers = await this.usersRepository.findBy({