mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 04:57:36 -05:00
30 lines
No EOL
631 B
CoffeeScript
30 lines
No EOL
631 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.factory "projectMembers", ["ide", "$q", (ide, $q) ->
|
|
return {
|
|
removeMember: (member) ->
|
|
deferred = $q.defer()
|
|
|
|
ide.socket.emit "removeUserFromProject", member._id, (error) =>
|
|
if error?
|
|
return deferred.reject(error)
|
|
deferred.resolve()
|
|
|
|
return deferred.promise
|
|
|
|
addMember: (email, privileges) ->
|
|
deferred = $q.defer()
|
|
|
|
ide.socket.emit "addUserToProject", email, privileges, (error, user) =>
|
|
if error?
|
|
return deferred.reject(error)
|
|
|
|
if !user
|
|
deferred.reject()
|
|
else
|
|
deferred.resolve(user)
|
|
|
|
return deferred.promise
|
|
}
|
|
] |