Commit 82007ecf authored by Randall Leeds's avatar Randall Leeds

Simplify plugin resets on persona change

parent b4ddbd64
...@@ -41,15 +41,12 @@ class App ...@@ -41,15 +41,12 @@ class App
$scope.auth.persona = oldValue $scope.auth.persona = oldValue
return return
if plugins.Auth? plugins.Auth?.element.removeData('annotator:headers')
plugins.Auth.token = null
plugins.Auth.updateHeaders()
delete plugins.Auth delete plugins.Auth
if plugins.Permissions? plugins.Permissions?.setUser(null)
plugins.Permissions.setUser(null)
# XXX: Temporary workaround until Annotator v2.0 or v1.2.10 # XXX: Temporary workaround until Annotator v2.0 or v1.2.10
plugins.Permissions.options.permissions = plugins.Permissions?.options.permissions =
read: [] read: []
update: [] update: []
delete: [] delete: []
...@@ -57,8 +54,7 @@ class App ...@@ -57,8 +54,7 @@ class App
if newValue? if newValue?
acct = "acct:#{newValue.username}@#{newValue.provider}" acct = "acct:#{newValue.username}@#{newValue.provider}"
annotator.addPlugin 'Auth', annotator.addPlugin 'Auth', tokenUrl: "/api/token?persona=#{acct}"
tokenUrl: "/api/token?persona=#{acct}"
plugins.Auth.withToken (token) => plugins.Auth.withToken (token) =>
plugins.Permissions._setAuthFromToken token plugins.Permissions._setAuthFromToken token
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment