SyntaxGameServer/RCCService2018/content/internal/Chat/Modules/LuaChat/Components/GroupDetailDialogs/LeaveGroupDialog.lua

36 lines
1.1 KiB
Lua

local Players = game:GetService("Players")
local Modules = script.Parent.Parent.Parent
local Components = Modules.Components
local DialogComponents = require(Components.DialogComponents)
local ConversationActions = require(Modules.Actions.ConversationActions)
local LeaveGroupDialog = {}
function LeaveGroupDialog.new(appState, titleKey, messageKey, cancelTitleKey, confirmTitleKey, conversation)
local self = {}
setmetatable(self, {__index = LeaveGroupDialog})
self.dialog = DialogComponents.ConfirmationDialog.new(appState, titleKey, messageKey, cancelTitleKey, confirmTitleKey)
self.conversation = conversation
self.dialogConnection = self.dialog.saved:connect(function()
local userId = tostring(Players.LocalPlayer.UserId)
local convoId = self.conversation.id
local action = ConversationActions.RemoveUserFromConversation(userId, convoId)
appState.store:dispatch(action)
end)
return self
end
function LeaveGroupDialog:Destruct()
if self.dialogConnection then
self.dialogConnection:disconnect()
end
self.dialog:Destruct()
end
return LeaveGroupDialog