Moderation delay WIP (#132):
* default channel value for moderation delay
This commit is contained in:
@ -36,6 +36,9 @@ async function sanitizeChannelConfigurationOptions (
|
||||
throw new Error('Invalid data.slowMode data type')
|
||||
}
|
||||
|
||||
const moderationData = data.moderation ?? {} // comes with livechat 10.3.0
|
||||
moderationData.delay ??= 0
|
||||
|
||||
// mute not present in livechat <= 10.2.0
|
||||
const mute = data.mute ?? {}
|
||||
mute.anonymous ??= false
|
||||
@ -68,6 +71,9 @@ async function sanitizeChannelConfigurationOptions (
|
||||
},
|
||||
mute: {
|
||||
anonymous: _readBoolean(mute, 'anonymous')
|
||||
},
|
||||
moderation: {
|
||||
delay: _readInteger(moderationData, 'delay', 0, 60)
|
||||
}
|
||||
}
|
||||
if (terms !== undefined) {
|
||||
|
@ -53,6 +53,9 @@ function getDefaultChannelConfigurationOptions (_options: RegisterServerOptions)
|
||||
mute: {
|
||||
anonymous: false
|
||||
},
|
||||
moderation: {
|
||||
delay: 0
|
||||
},
|
||||
terms: undefined
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ async function updateProsodyRoom (
|
||||
data: {
|
||||
name?: string
|
||||
slow_mode_duration?: number
|
||||
moderation_delay?: number
|
||||
livechat_muc_terms?: string
|
||||
addAffiliations?: Affiliations
|
||||
removeAffiliationsFor?: string[]
|
||||
@ -93,6 +94,9 @@ async function updateProsodyRoom (
|
||||
if (('slow_mode_duration' in data) && data.slow_mode_duration !== undefined) {
|
||||
apiData.slow_mode_duration = data.slow_mode_duration
|
||||
}
|
||||
if (('moderation_delay' in data) && data.moderation_delay !== undefined) {
|
||||
apiData.moderation_delay = data.moderation_delay
|
||||
}
|
||||
if ('livechat_muc_terms' in data) {
|
||||
apiData.livechat_muc_terms = data.livechat_muc_terms ?? ''
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ interface RoomDefaults {
|
||||
slow_mode_duration?: number
|
||||
mute_anonymous?: boolean
|
||||
livechat_muc_terms?: string
|
||||
moderation_delay?: number
|
||||
}
|
||||
affiliations?: Affiliations
|
||||
}
|
||||
@ -52,7 +53,8 @@ async function _getChannelSpecificOptions (
|
||||
return {
|
||||
slow_mode_duration: channelOptions.slowMode.duration,
|
||||
mute_anonymous: channelOptions.mute.anonymous,
|
||||
livechat_muc_terms: channelOptions.terms
|
||||
livechat_muc_terms: channelOptions.terms,
|
||||
moderation_delay: channelOptions.moderation.delay
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user