@@ -24,6 +24,7 @@ import { checkAndUpdateRateLimit } from '../../cache/RateLimitCache';
2424import { ServerMemberCache } from '../../cache/ServerMemberCache' ;
2525import env from '../../common/env' ;
2626import { generateId } from '../../common/flakeId' ;
27+ import { nerimitySupporterCdnMessage } from '@src/common/nerimitySupporterCdnMessage' ;
2728
2829export function channelMessageCreate ( Router : Router ) {
2930 Router . post (
@@ -187,17 +188,19 @@ async function route(req: Request, res: Response) {
187188 return res . status ( 400 ) . json ( generateError ( 'You must confirm your email to send attachment messages.' ) ) ;
188189 }
189190
190- const isMod = hasBit ( req . userCache . badges , USER_BADGES . MOD . bit ) ;
191+ if ( body . nerimityCdnFileId ) {
192+ const isMod = hasBit ( req . userCache . badges , USER_BADGES . MOD . bit ) ;
191193
192- const isServerNotPublicAndNotSupporter = req . serverCache && ! isServerPublic ( req . serverCache ) && ! isSupporterOrModerator ( req . userCache ) ;
194+ const isServerNotPublicAndNotSupporter = req . serverCache && ! isServerPublic ( req . serverCache ) && ! isSupporterOrModerator ( req . userCache ) ;
193195
194- if ( ! isMod && isServerNotPublicAndNotSupporter ) {
195- return res . status ( 400 ) . json ( generateError ( 'You must be a Nerimity supporter to send attachment messages to a private server.' ) ) ;
196- }
197- const isPrivateChannelAndNotSupporter = req . channelCache . type === ChannelType . SERVER_TEXT && ! req . channelCache . canBePublic && ! isSupporterOrModerator ( req . userCache ) ;
196+ if ( ! isMod && isServerNotPublicAndNotSupporter ) {
197+ return res . status ( 400 ) . json ( generateError ( nerimitySupporterCdnMessage ) ) ;
198+ }
199+ const isPrivateChannelAndNotSupporter = req . channelCache . type === ChannelType . SERVER_TEXT && ! req . channelCache . canBePublic && ! isSupporterOrModerator ( req . userCache ) ;
198200
199- if ( ! isMod && isPrivateChannelAndNotSupporter ) {
200- return res . status ( 400 ) . json ( generateError ( 'You must be a Nerimity supporter to send attachment messages to a private channel.' ) ) ;
201+ if ( ! isMod && isPrivateChannelAndNotSupporter ) {
202+ return res . status ( 400 ) . json ( generateError ( nerimitySupporterCdnMessage ) ) ;
203+ }
201204 }
202205 }
203206
0 commit comments