[skip ci] feat: prepare for public release
This commit is contained in:
@@ -174,6 +174,11 @@ export abstract class BaseChannelAuthService {
|
||||
async validateDMSendPermissions({channelId, userId}: {channelId: ChannelID; userId: UserID}): Promise<void> {
|
||||
const channel = await this.channelRepository.channelData.findUnique(channelId);
|
||||
if (!channel) throw new UnknownChannelError();
|
||||
|
||||
if (channel.type === ChannelTypes.GROUP_DM || channel.type === ChannelTypes.DM_PERSONAL_NOTES) {
|
||||
return;
|
||||
}
|
||||
|
||||
const recipients = await this.userRepository.listUsers(Array.from(channel.recipientIds));
|
||||
await this.dmPermissionValidator.validate({recipients, userId});
|
||||
}
|
||||
|
||||
@@ -72,6 +72,12 @@ export class CallService {
|
||||
throw new InvalidChannelTypeForCallError();
|
||||
}
|
||||
|
||||
const caller = await this.userRepository.findUnique(userId);
|
||||
const isUnclaimedCaller = caller != null && !caller.passwordHash && !caller.isBot;
|
||||
if (isUnclaimedCaller && channel.type === ChannelTypes.DM) {
|
||||
return {ringable: false};
|
||||
}
|
||||
|
||||
const call = await this.gatewayService.getCall(channelId);
|
||||
const alreadyInCall = call ? call.voice_states.some((vs) => vs.user_id === userId.toString()) : false;
|
||||
if (alreadyInCall) {
|
||||
|
||||
Reference in New Issue
Block a user