mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 20:21:38 +00:00
Fix editing permissions to use new request api
This commit is contained in:
parent
dcfdf7fabd
commit
a0b99317bc
2 changed files with 8 additions and 5 deletions
|
|
@ -100,7 +100,7 @@ function PermissionsPage:render()
|
||||||
),
|
),
|
||||||
|
|
||||||
onClick = function()
|
onClick = function()
|
||||||
self.props.onEdit(source, meta, self.props.headlessAPI._permissions[source] or {})
|
self.props.onEdit(self.props.headlessAPI._sourceToPlugin[source], source, meta, self.props.headlessAPI._permissions[source] or {})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -319,10 +319,10 @@ function App:requestPermission(plugin: Plugin, source: string, name: string, api
|
||||||
|
|
||||||
Log.info("The third-party plugin '{}' is requesting permission to use the API!", name)
|
Log.info("The third-party plugin '{}' is requesting permission to use the API!", name)
|
||||||
|
|
||||||
local unloadProtection = plugin.Unloading:Connect(function()
|
local unloadProtection = if plugin then plugin.Unloading:Connect(function()
|
||||||
Log.warn("Cancelling API permission request for '{}' because the third-party plugin has been removed.", name)
|
Log.warn("Cancelling API permission request for '{}' because the third-party plugin has been removed.", name)
|
||||||
responseEvent:Fire(initialState)
|
responseEvent:Fire(initialState)
|
||||||
end)
|
end) else nil
|
||||||
|
|
||||||
self:setState(function(state)
|
self:setState(function(state)
|
||||||
state.popups[source .. " Permissions"] = {
|
state.popups[source .. " Permissions"] = {
|
||||||
|
|
@ -345,7 +345,9 @@ function App:requestPermission(plugin: Plugin, source: string, name: string, api
|
||||||
|
|
||||||
local response = responseEvent.Event:Wait()
|
local response = responseEvent.Event:Wait()
|
||||||
responseEvent:Destroy()
|
responseEvent:Destroy()
|
||||||
|
if unloadProtection then
|
||||||
unloadProtection:Disconnect()
|
unloadProtection:Disconnect()
|
||||||
|
end
|
||||||
|
|
||||||
self:setState(function(state)
|
self:setState(function(state)
|
||||||
state.popups[source .. " Permissions"] = nil
|
state.popups[source .. " Permissions"] = nil
|
||||||
|
|
@ -687,12 +689,13 @@ function App:render()
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|
||||||
onEdit = function(source, meta, apiMap)
|
onEdit = function(plugin, source, meta, apiMap)
|
||||||
local apiList = {}
|
local apiList = {}
|
||||||
for api in apiMap do
|
for api in apiMap do
|
||||||
table.insert(apiList, api)
|
table.insert(apiList, api)
|
||||||
end
|
end
|
||||||
self:requestPermission(
|
self:requestPermission(
|
||||||
|
plugin,
|
||||||
source,
|
source,
|
||||||
meta.Name .. if meta.Creator then " by " .. meta.Creator else "",
|
meta.Name .. if meta.Creator then " by " .. meta.Creator else "",
|
||||||
apiList,
|
apiList,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue