refactoring: replace callback functions with promises in api/cla.js
This commit is contained in:
Родитель
c178d7be55
Коммит
e22947494f
|
@ -30,7 +30,6 @@ module.exports = {
|
|||
"func-call-spacing": "error",
|
||||
"func-name-matching": "error",
|
||||
"handle-callback-err": "warn",
|
||||
"newline-before-return": "warn",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-div-regex": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
|
@ -40,7 +39,7 @@ module.exports = {
|
|||
"no-native-reassign": "error",
|
||||
"no-path-concat": "warn",
|
||||
"no-trailing-spaces": "warn",
|
||||
"no-undef": "warn",
|
||||
"no-undef": "error",
|
||||
"no-unused-expressions": "warn",
|
||||
"no-unused-vars": "warn",
|
||||
"no-use-before-define": [
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = function (grunt) {
|
|||
mochaTest: {
|
||||
server: {
|
||||
options: {
|
||||
timeout: 4000
|
||||
timeout: 1000
|
||||
},
|
||||
src: ['src/tests/server/**/*.js']
|
||||
},
|
||||
|
|
|
@ -121,7 +121,7 @@ module.controller('ClaController', ['$rootScope', '$log', '$window', '$scope', '
|
|||
|
||||
$scope.user = res;
|
||||
$scope.user.value.admin = false;
|
||||
if (res.meta && res.meta.scopes && res.meta.scopes.indexOf('write:repo_hook') > -1) {
|
||||
if (res.meta && res.meta['x-oauth-scopes'] && res.meta['x-oauth-scopes'].indexOf('write:repo_hook') > -1) {
|
||||
$scope.user.value.admin = true;
|
||||
}
|
||||
$rootScope.user = $scope.user;
|
||||
|
|
|
@ -24,8 +24,8 @@ var deleteFromArray = function (item, array) {
|
|||
}
|
||||
};
|
||||
|
||||
module.controller('HomeCtrl', ['$rootScope', '$scope', '$document', '$HUB', '$RPC', '$RPCService', '$RAW', '$HUBService', '$window', '$modal', '$timeout', '$q', '$location', '$state', 'utils', 'linkItemService',
|
||||
function ($rootScope, $scope, $document, $HUB, $RPC, $RPCService, $RAW, $HUBService, $window, $modal, $timeout, $q, $location, $state, utils, linkItemService) {
|
||||
module.controller('HomeCtrl', ['$rootScope', '$scope', '$RPCService', '$RAW', '$HUBService', '$window', '$modal', '$timeout', '$q', '$location', '$state', 'utils', 'linkItemService',
|
||||
function ($rootScope, $scope, $RPCService, $RAW, $HUBService, $window, $modal, $timeout, $q, $location, $state, utils, linkItemService) {
|
||||
|
||||
$scope.active = 0;
|
||||
$scope.claRepos = [];
|
||||
|
@ -118,8 +118,8 @@ module.controller('HomeCtrl', ['$rootScope', '$scope', '$document', '$HUB', '$RP
|
|||
}
|
||||
|
||||
$scope.user = res;
|
||||
$scope.user.value.admin = res.meta.scopes && res.meta.scopes.indexOf('write:repo_hook') > -1 ? true : false;
|
||||
$scope.user.value.org_admin = res.meta.scopes && res.meta.scopes.indexOf('admin:org_hook') > -1 ? true : false;
|
||||
$scope.user.value.admin = res.meta['x-oauth-scopes'] && res.meta['x-oauth-scopes'].indexOf('write:repo_hook') > -1 ? true : false;
|
||||
$scope.user.value.org_admin = res.meta['x-oauth-scopes'] && res.meta['x-oauth-scopes'].indexOf('admin:org_hook') > -1 ? true : false;
|
||||
$rootScope.user = $scope.user;
|
||||
$rootScope.$broadcast('user');
|
||||
});
|
||||
|
@ -127,7 +127,7 @@ module.controller('HomeCtrl', ['$rootScope', '$scope', '$document', '$HUB', '$RP
|
|||
|
||||
var getRepos = function () {
|
||||
if ($scope.user && $scope.user.value && $scope.user.value.admin) {
|
||||
return $HUBService.call('repos', 'getAll', {
|
||||
return $HUBService.call('repos', 'list', {
|
||||
per_page: 100,
|
||||
affiliation: 'owner,organization_member'
|
||||
}).then(function (data) {
|
||||
|
@ -152,7 +152,7 @@ module.controller('HomeCtrl', ['$rootScope', '$scope', '$document', '$HUB', '$RP
|
|||
}
|
||||
$scope.gists = $scope.defaultClas.concat([]);
|
||||
|
||||
$HUBService.call('gists', 'getAll').then(function (data) {
|
||||
$HUBService.call('gists', 'list').then(function (data) {
|
||||
if (data && data.value) {
|
||||
data.value.forEach(function (gist) {
|
||||
var gistFile = {};
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче