Commit 8afd76e7 authored by GitLab Bot's avatar GitLab Bot

Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-07-19

parents 01851e66 91fcb311
# frozen_string_literal: true
module Prometheus module Prometheus
class AdapterService class AdapterService
def initialize(project, deployment_platform = nil) def initialize(project, deployment_platform = nil)
......
# frozen_string_literal: true
module ProtectedBranches module ProtectedBranches
class AccessLevelParams class AccessLevelParams
prepend EE::ProtectedBranches::AccessLevelParams prepend EE::ProtectedBranches::AccessLevelParams
......
# frozen_string_literal: true
module ProtectedBranches module ProtectedBranches
class ApiService < BaseService class ApiService < BaseService
prepend EE::ProtectedBranches::ApiService prepend EE::ProtectedBranches::ApiService
......
# frozen_string_literal: true
module ProtectedBranches module ProtectedBranches
class CreateService < BaseService class CreateService < BaseService
def execute(skip_authorization: false) def execute(skip_authorization: false)
......
# frozen_string_literal: true
module ProtectedBranches module ProtectedBranches
class DestroyService < BaseService class DestroyService < BaseService
def execute(protected_branch) def execute(protected_branch)
......
# frozen_string_literal: true
# The branches#protect API still uses the `developers_can_push` and `developers_can_merge` # The branches#protect API still uses the `developers_can_push` and `developers_can_merge`
# flags for backward compatibility, and so performs translation between that format and the # flags for backward compatibility, and so performs translation between that format and the
# internal data model (separate access levels). The translation code is non-trivial, and so # internal data model (separate access levels). The translation code is non-trivial, and so
......
# frozen_string_literal: true
# The branches#protect API still uses the `developers_can_push` and `developers_can_merge` # The branches#protect API still uses the `developers_can_push` and `developers_can_merge`
# flags for backward compatibility, and so performs translation between that format and the # flags for backward compatibility, and so performs translation between that format and the
# internal data model (separate access levels). The translation code is non-trivial, and so # internal data model (separate access levels). The translation code is non-trivial, and so
......
# frozen_string_literal: true
module ProtectedBranches module ProtectedBranches
class UpdateService < BaseService class UpdateService < BaseService
def execute(protected_branch) def execute(protected_branch)
......
# frozen_string_literal: true
module ProtectedTags module ProtectedTags
class CreateService < BaseService class CreateService < BaseService
attr_reader :protected_tag attr_reader :protected_tag
......
# frozen_string_literal: true
module ProtectedTags module ProtectedTags
class DestroyService < BaseService class DestroyService < BaseService
def execute(protected_tag) def execute(protected_tag)
......
# frozen_string_literal: true
module ProtectedTags module ProtectedTags
class UpdateService < BaseService class UpdateService < BaseService
def execute(protected_tag) def execute(protected_tag)
......
# frozen_string_literal: true
module QuickActions module QuickActions
class InterpretService < BaseService class InterpretService < BaseService
include Gitlab::QuickActions::Dsl include Gitlab::QuickActions::Dsl
......
# frozen_string_literal: true
module Search module Search
class GlobalService class GlobalService
attr_accessor :current_user, :params attr_accessor :current_user, :params
......
# frozen_string_literal: true
module Search module Search
class GroupService < Search::GlobalService class GroupService < Search::GlobalService
attr_accessor :group attr_accessor :group
......
# frozen_string_literal: true
module Search module Search
class ProjectService class ProjectService
attr_accessor :project, :current_user, :params attr_accessor :project, :current_user, :params
......
# frozen_string_literal: true
module Search module Search
class SnippetService class SnippetService
attr_accessor :current_user, :params attr_accessor :current_user, :params
......
# frozen_string_literal: true
module Tags module Tags
class CreateService < BaseService class CreateService < BaseService
def execute(tag_name, target, message, release_description = nil) def execute(tag_name, target, message, release_description = nil)
......
# frozen_string_literal: true
module Tags module Tags
class DestroyService < BaseService class DestroyService < BaseService
def execute(tag_name) def execute(tag_name)
......
# frozen_string_literal: true
module TestHooks module TestHooks
class BaseService class BaseService
attr_accessor :hook, :current_user, :trigger attr_accessor :hook, :current_user, :trigger
......
# frozen_string_literal: true
module TestHooks module TestHooks
class ProjectService < TestHooks::BaseService class ProjectService < TestHooks::BaseService
attr_writer :project attr_writer :project
......
# frozen_string_literal: true
module TestHooks module TestHooks
class SystemService < TestHooks::BaseService class SystemService < TestHooks::BaseService
private private
......
# frozen_string_literal: true
module Users module Users
class ActivityService class ActivityService
LEASE_TIMEOUT = 1.minute.to_i LEASE_TIMEOUT = 1.minute.to_i
......
# frozen_string_literal: true
module Users module Users
class BuildService < BaseService class BuildService < BaseService
prepend ::EE::Users::BuildService prepend ::EE::Users::BuildService
......
# frozen_string_literal: true
module Users module Users
class CreateService < BaseService class CreateService < BaseService
include NewUserNotifier include NewUserNotifier
......
# frozen_string_literal: true
module Users module Users
class DestroyService class DestroyService
prepend ::EE::Users::DestroyService prepend ::EE::Users::DestroyService
......
# frozen_string_literal: true
module Users module Users
# Service class for caching and retrieving the last push event of a user. # Service class for caching and retrieving the last push event of a user.
class LastPushEventService class LastPushEventService
......
# frozen_string_literal: true
# When a user is destroyed, some of their associated records are # When a user is destroyed, some of their associated records are
# moved to a "Ghost User", to prevent these associated records from # moved to a "Ghost User", to prevent these associated records from
# being destroyed. # being destroyed.
......
# frozen_string_literal: true
module Users module Users
# Service for refreshing the authorized projects of a user. # Service for refreshing the authorized projects of a user.
# #
......
# frozen_string_literal: true
module Users module Users
class RespondToTermsService class RespondToTermsService
def initialize(user, term) def initialize(user, term)
......
# frozen_string_literal: true
module Users module Users
class UpdateService < BaseService class UpdateService < BaseService
include NewUserNotifier include NewUserNotifier
......
# frozen_string_literal: true
module WikiPages module WikiPages
class BaseService < ::BaseService class BaseService < ::BaseService
prepend EE::WikiPages::BaseService prepend EE::WikiPages::BaseService
......
# frozen_string_literal: true
module WikiPages module WikiPages
class CreateService < WikiPages::BaseService class CreateService < WikiPages::BaseService
def execute def execute
......
# frozen_string_literal: true
module WikiPages module WikiPages
class DestroyService < WikiPages::BaseService class DestroyService < WikiPages::BaseService
def execute(page) def execute(page)
......
# frozen_string_literal: true
module WikiPages module WikiPages
class UpdateService < WikiPages::BaseService class UpdateService < WikiPages::BaseService
def execute(page) def execute(page)
......
---
title: Enable even more frozen string in app/services/**/*.rb
merge_request: 20702
author: gfyoung
type: performance
...@@ -84,14 +84,12 @@ export default ( ...@@ -84,14 +84,12 @@ export default (
done(); done();
}; };
return new Promise((resolve, reject) => {
try {
const result = action({ commit, state, dispatch, rootState: state }, payload); const result = action({ commit, state, dispatch, rootState: state }, payload);
resolve(result);
} catch (e) { return new Promise(resolve => {
reject(e); setImmediate(resolve);
}
}) })
.then(() => result)
.catch(error => { .catch(error => {
validateResults(); validateResults();
throw error; throw error;
......
...@@ -138,4 +138,29 @@ describe('VueX test helper (testAction)', () => { ...@@ -138,4 +138,29 @@ describe('VueX test helper (testAction)', () => {
}); });
}); });
}); });
it('should work with async actions not returning promises', done => {
const data = { FOO: 'BAR' };
const promiseAction = ({ commit, dispatch }) => {
dispatch('ACTION');
axios
.get(TEST_HOST)
.then(() => {
commit('SUCCESS');
return data;
})
.catch(error => {
commit('ERROR');
throw error;
});
};
mock.onGet(TEST_HOST).replyOnce(200, 42);
assertion = { mutations: [{ type: 'SUCCESS' }], actions: [{ type: 'ACTION' }] };
testAction(promiseAction, null, {}, assertion.mutations, assertion.actions, done);
});
}); });
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