View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/929 Closes #977 Approved-by: dakkar <dakkar@thenautilus.net> Approved-by: Marie <github@yuugi.dev>
This commit is contained in:
commit
a90a8e9e68
7 changed files with 13 additions and 16 deletions
|
@ -42,13 +42,6 @@ export default [
|
|||
name: '__filename',
|
||||
message: 'Not in ESModule. Use `import.meta.url` instead.',
|
||||
}],
|
||||
// https://typescript-eslint.io/rules/prefer-nullish-coalescing/
|
||||
'@typescript-eslint/prefer-nullish-coalescing': ['warn', {
|
||||
ignorePrimitives: {
|
||||
// Without this, the rule breaks for nullable booleans
|
||||
boolean: true,
|
||||
},
|
||||
}],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ describe('api:notes/create', () => {
|
|||
|
||||
test('0 characters cw', () => {
|
||||
expect(v({ text: 'Body', cw: '' }))
|
||||
.toBe(INVALID);
|
||||
.toBe(VALID);
|
||||
});
|
||||
|
||||
test('reject only cw', () => {
|
||||
|
|
|
@ -159,7 +159,7 @@ export const paramDef = {
|
|||
visibleUserIds: { type: 'array', uniqueItems: true, items: {
|
||||
type: 'string', format: 'misskey:id',
|
||||
} },
|
||||
cw: { type: 'string', nullable: true, minLength: 1 },
|
||||
cw: { type: 'string', nullable: true },
|
||||
localOnly: { type: 'boolean', default: false },
|
||||
reactionAcceptance: { type: 'string', nullable: true, enum: [null, 'likeOnly', 'likeOnlyForRemote', 'nonSensitiveOnly', 'nonSensitiveOnlyForLocalLikeOnlyForRemote'], default: null },
|
||||
noExtractMentions: { type: 'boolean', default: false },
|
||||
|
@ -400,7 +400,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
text: ps.text ?? undefined,
|
||||
reply,
|
||||
renote,
|
||||
cw: ps.cw,
|
||||
cw: ps.cw || null,
|
||||
localOnly: ps.localOnly,
|
||||
reactionAcceptance: ps.reactionAcceptance,
|
||||
visibility: ps.visibility,
|
||||
|
|
|
@ -209,7 +209,7 @@ export const paramDef = {
|
|||
format: 'misskey:id',
|
||||
},
|
||||
},
|
||||
cw: { type: 'string', nullable: true, minLength: 1 },
|
||||
cw: { type: 'string', nullable: true },
|
||||
localOnly: { type: 'boolean', default: false },
|
||||
reactionAcceptance: { type: 'string', nullable: true, enum: [null, 'likeOnly', 'likeOnlyForRemote', 'nonSensitiveOnly', 'nonSensitiveOnlyForLocalLikeOnlyForRemote'], default: null },
|
||||
noExtractMentions: { type: 'boolean', default: false },
|
||||
|
@ -454,7 +454,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
text: ps.text ?? undefined,
|
||||
reply,
|
||||
renote,
|
||||
cw: ps.cw,
|
||||
cw: ps.cw || null,
|
||||
localOnly: ps.localOnly,
|
||||
reactionAcceptance: ps.reactionAcceptance,
|
||||
visibility: ps.visibility,
|
||||
|
|
|
@ -22,12 +22,12 @@ export interface TimelineArgs {
|
|||
|
||||
// Values taken from https://docs.joinmastodon.org/client/intro/#boolean
|
||||
export function toBoolean(value: string | undefined): boolean | undefined {
|
||||
if (value === undefined) return undefined;
|
||||
if (!value) return undefined;
|
||||
return !['0', 'f', 'F', 'false', 'FALSE', 'off', 'OFF'].includes(value);
|
||||
}
|
||||
|
||||
export function toInt(value: string | undefined): number | undefined {
|
||||
if (value === undefined) return undefined;
|
||||
if (!value) return undefined;
|
||||
return parseInt(value);
|
||||
}
|
||||
|
||||
|
|
|
@ -1119,7 +1119,7 @@ export default class Misskey implements MegalodonInterface {
|
|||
}
|
||||
if (options.sensitive) {
|
||||
params = Object.assign(params, {
|
||||
cw: ''
|
||||
cw: ' '
|
||||
})
|
||||
}
|
||||
if (options.spoiler_text) {
|
||||
|
@ -1198,7 +1198,7 @@ export default class Misskey implements MegalodonInterface {
|
|||
}
|
||||
if (_options.sensitive) {
|
||||
params = Object.assign(params, {
|
||||
cw: ''
|
||||
cw: ' '
|
||||
})
|
||||
}
|
||||
if (_options.spoiler_text) {
|
||||
|
|
|
@ -37,6 +37,10 @@ export default [
|
|||
'no-restricted-imports': ['error', {
|
||||
paths: [{ name: 'punycode' }],
|
||||
}],
|
||||
// https://typescript-eslint.io/rules/prefer-nullish-coalescing/
|
||||
'@typescript-eslint/prefer-nullish-coalescing': ['warn', {
|
||||
ignorePrimitives: true,
|
||||
}],
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue