add separate limits for CW length

This commit is contained in:
Hazelnoot 2024-10-26 10:04:23 -04:00
parent 10d3d9f382
commit 01e98c75ab
10 changed files with 91 additions and 9 deletions

View file

@ -350,9 +350,13 @@ export class NoteCreateService implements OnApplicationShutdown {
data.text = null;
}
const maxCwLength = user.host == null
? this.config.maxCwLength
: this.config.maxRemoteCwLength;
if (data.cw) {
if (data.cw.length > maxTextLength) {
data.cw = data.cw.slice(0, maxTextLength);
if (data.cw.length > maxCwLength) {
data.cw = data.cw.slice(0, maxCwLength);
}
data.cw = data.cw.trim();
if (data.cw === '') {

View file

@ -380,9 +380,13 @@ export class NoteEditService implements OnApplicationShutdown {
data.text = null;
}
const maxCwLength = user.host == null
? this.config.maxCwLength
: this.config.maxRemoteCwLength;
if (data.cw) {
if (data.cw.length > maxTextLength) {
data.cw = data.cw.slice(0, maxTextLength);
if (data.cw.length > maxCwLength) {
data.cw = data.cw.slice(0, maxCwLength);
}
data.cw = data.cw.trim();
if (data.cw === '') {