mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
Fix various JSHint warnings in client-side code.
This commit is contained in:
@@ -1,42 +1,39 @@
|
||||
var _ = require('lodash')
|
||||
|
||||
module.exports = function GroupServiceFactory(socket, UserService, TransactionService) {
|
||||
module.exports = function GroupServiceFactory(
|
||||
socket
|
||||
, TransactionService
|
||||
) {
|
||||
var groupService = {
|
||||
}
|
||||
|
||||
groupService.invite = function (device) {
|
||||
return UserService.user().then(function (user) {
|
||||
var tx = TransactionService.create([device])
|
||||
socket.emit('group.invite', device.channel, tx.channel, {
|
||||
serial: {
|
||||
value: device.serial
|
||||
, match: 'exact'
|
||||
}
|
||||
})
|
||||
return tx.promise.then(function(results) {
|
||||
if (!results[0].success) {
|
||||
throw new Error('Device refused to join the group')
|
||||
}
|
||||
return results[0].device
|
||||
})
|
||||
var tx = TransactionService.create([device])
|
||||
socket.emit('group.invite', device.channel, tx.channel, {
|
||||
serial: {
|
||||
value: device.serial
|
||||
, match: 'exact'
|
||||
}
|
||||
})
|
||||
return tx.promise.then(function(results) {
|
||||
if (!results[0].success) {
|
||||
throw new Error('Device refused to join the group')
|
||||
}
|
||||
return results[0].device
|
||||
})
|
||||
}
|
||||
|
||||
groupService.kick = function (device) {
|
||||
return UserService.user().then(function (user) {
|
||||
var tx = TransactionService.create([device])
|
||||
socket.emit('group.kick', device.channel, tx.channel, {
|
||||
serial: {
|
||||
value: device.serial
|
||||
, match: 'exact'
|
||||
}
|
||||
})
|
||||
return tx.promise.then(function(results) {
|
||||
if (!results[0].success) {
|
||||
throw new Error('Device refused to be kicked from the group')
|
||||
}
|
||||
return results[0].device
|
||||
})
|
||||
var tx = TransactionService.create([device])
|
||||
socket.emit('group.kick', device.channel, tx.channel, {
|
||||
serial: {
|
||||
value: device.serial
|
||||
, match: 'exact'
|
||||
}
|
||||
})
|
||||
return tx.promise.then(function(results) {
|
||||
if (!results[0].success) {
|
||||
throw new Error('Device refused to be kicked from the group')
|
||||
}
|
||||
return results[0].device
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user