Enable the chat by default when a live is created:
So that lives created by the Android Peertube Live app will have chat by default. Fix #400.
This commit is contained in:
parent
6e35c243c8
commit
ae2d45b007
@ -16,6 +16,7 @@ TODO: tag conversejs livechat branch, and replace commit ID in build-converse.js
|
||||
* #416: Deregister prosodyctl interval callback when spawn.stdin disappears.
|
||||
* #423: Merging video-watch scope into common scope.
|
||||
* Rewriting the share chat dialog with more modern code.
|
||||
* #400: Enable the chat by default when a live is created. So that lives created by the Android Peertube Live app will have chat by default.
|
||||
|
||||
## 10.0.2
|
||||
|
||||
|
@ -11,6 +11,22 @@ async function initCustomFields (options: RegisterServerOptions): Promise<void>
|
||||
const storageManager = options.storageManager
|
||||
const logger = options.peertubeHelpers.logger
|
||||
|
||||
registerHook({
|
||||
target: 'action:api.live-video.created',
|
||||
handler: async ({ video }: { video: Video | undefined }) => {
|
||||
if (!video?.id) { return }
|
||||
// When creating a new live, if the chat is an option 'per video', we enable the chat by default.
|
||||
// This is done for the Peertube live Android app, which does not update the video after creation.
|
||||
// See: https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/400
|
||||
const setting = await options.settingsManager.getSetting('chat-per-live-video')
|
||||
if (setting !== true) { return }
|
||||
logger.info(
|
||||
`New live created, enabling chat by default by setting livechat-active=true for video ${video.id.toString()}.`
|
||||
)
|
||||
await storageManager.storeData(`livechat-active-${video.id.toString()}`, true)
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'action:api.video.updated',
|
||||
handler: async (params: any) => {
|
||||
|
Loading…
Reference in New Issue
Block a user