diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-12 21:07:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-12 21:07:34 +0300 |
commit | 90859e80ca23b8709d56b60d2066b569053e7e02 (patch) | |
tree | 15d9ac5c194220fab358c42325645fdf2c6ead13 /app | |
parent | 7530cf5ad8dd86fbe19e129b6bb31b23849ed757 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/api.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/serverless/components/functions.vue | 15 | ||||
-rw-r--r-- | app/assets/javascripts/sidebar/components/assignees/assignee_title.vue | 3 | ||||
-rw-r--r-- | app/models/project_services/asana_service.rb | 6 | ||||
-rw-r--r-- | app/services/issues/zoom_link_service.rb | 50 |
5 files changed, 45 insertions, 31 deletions
diff --git a/app/assets/javascripts/api.js b/app/assets/javascripts/api.js index 6ec77186298..071ae8ca8cf 100644 --- a/app/assets/javascripts/api.js +++ b/app/assets/javascripts/api.js @@ -43,7 +43,7 @@ const Api = { releasesPath: '/api/:version/projects/:id/releases', releasePath: '/api/:version/projects/:id/releases/:tag_name', mergeRequestsPipeline: '/api/:version/projects/:id/merge_requests/:merge_request_iid/pipelines', - adminStatisticsPath: 'api/:version/application/statistics', + adminStatisticsPath: '/api/:version/application/statistics', group(groupId, callback) { const url = Api.buildUrl(Api.groupPath).replace(':id', groupId); diff --git a/app/assets/javascripts/serverless/components/functions.vue b/app/assets/javascripts/serverless/components/functions.vue index b5b1c004590..308bc4a2ddd 100644 --- a/app/assets/javascripts/serverless/components/functions.vue +++ b/app/assets/javascripts/serverless/components/functions.vue @@ -44,12 +44,14 @@ export default { 'Serverless|Your repository does not have a corresponding %{startTag}serverless.yml%{endTag} file.', ), { startTag: '<code>', endTag: '</code>' }, + false, ); }, noGitlabYamlConfigured() { return sprintf( s__('Serverless|Your %{startTag}.gitlab-ci.yml%{endTag} file is not properly configured.'), { startTag: '<code>', endTag: '</code>' }, + false, ); }, mismatchedServerlessFunctions() { @@ -58,6 +60,7 @@ export default { "Serverless|The functions listed in the %{startTag}serverless.yml%{endTag} file don't match the namespace of your cluster.", ), { startTag: '<code>', endTag: '</code>' }, + false, ); }, }, @@ -111,15 +114,9 @@ export default { }} </p> <ul> - <li> - {{ noServerlessConfigFile }} - </li> - <li> - {{ noGitlabYamlConfigured }} - </li> - <li> - {{ mismatchedServerlessFunctions }} - </li> + <li v-html="noServerlessConfigFile"></li> + <li v-html="noGitlabYamlConfigured"></li> + <li v-html="mismatchedServerlessFunctions"></li> <li>{{ s__('Serverless|The deploy job has not finished.') }}</li> </ul> diff --git a/app/assets/javascripts/sidebar/components/assignees/assignee_title.vue b/app/assets/javascripts/sidebar/components/assignees/assignee_title.vue index b107e9789a7..f4dac38b9e1 100644 --- a/app/assets/javascripts/sidebar/components/assignees/assignee_title.vue +++ b/app/assets/javascripts/sidebar/components/assignees/assignee_title.vue @@ -32,14 +32,13 @@ export default { }; </script> <template> - <div class="title hide-collapsed" data-qa-selector="assignee_title"> + <div class="title hide-collapsed"> {{ assigneeTitle }} <i v-if="loading" aria-hidden="true" class="fa fa-spinner fa-spin block-loading"></i> <a v-if="editable" class="js-sidebar-dropdown-toggle edit-link float-right" href="#" - data-qa-selector="assignee_edit_link" data-track-event="click_edit_button" data-track-label="right_sidebar" data-track-property="assignee" diff --git a/app/models/project_services/asana_service.rb b/app/models/project_services/asana_service.rb index 3e28dc23782..757b2f17fb9 100644 --- a/app/models/project_services/asana_service.rb +++ b/app/models/project_services/asana_service.rb @@ -81,12 +81,12 @@ http://app.asana.com/-/account_api' def check_commit(message, push_msg) # matches either: # - #1234 - # - https://app.asana.com/0/0/1234 + # - https://app.asana.com/0/{project_gid}/{task_gid} # optionally preceded with: # - fix/ed/es/ing # - close/s/d # - closing - issue_finder = %r{(fix\w*|clos[ei]\w*+)?\W*(?:https://app\.asana\.com/\d+/\d+/(\d+)|#(\d+))}i + issue_finder = %r{(fix\w*|clos[ei]\w*+)?\W*(?:https://app\.asana\.com/\d+/\w+/(\w+)|#(\w+))}i message.scan(issue_finder).each do |tuple| # tuple will be @@ -94,7 +94,7 @@ http://app.asana.com/-/account_api' taskid = tuple[2] || tuple[1] begin - task = Asana::Task.find_by_id(client, taskid) + task = Asana::Resources::Task.find_by_id(client, taskid) task.add_comment(text: "#{push_msg} #{message}") if tuple[0] diff --git a/app/services/issues/zoom_link_service.rb b/app/services/issues/zoom_link_service.rb index 023d7080e88..9572cf50564 100644 --- a/app/services/issues/zoom_link_service.rb +++ b/app/services/issues/zoom_link_service.rb @@ -13,30 +13,29 @@ module Issues if can_add_link? && (link = parse_link(link)) begin add_zoom_meeting(link) - success(_('Zoom meeting added')) rescue ActiveRecord::RecordNotUnique - error(_('Failed to add a Zoom meeting')) + error(message: _('Failed to add a Zoom meeting')) end else - error(_('Failed to add a Zoom meeting')) + error(message: _('Failed to add a Zoom meeting')) end end def remove_link if can_remove_link? remove_zoom_meeting - success(_('Zoom meeting removed')) + success(message: _('Zoom meeting removed')) else - error(_('Failed to remove a Zoom meeting')) + error(message: _('Failed to remove a Zoom meeting')) end end def can_add_link? - can_update_issue? && !@added_meeting + can_change_link? && !@added_meeting end def can_remove_link? - can_update_issue? && !!@added_meeting + can_change_link? && @issue.persisted? && !!@added_meeting end def parse_link(link) @@ -56,14 +55,29 @@ module Issues end def add_zoom_meeting(link) - ZoomMeeting.create( + zoom_meeting = new_zoom_meeting(link) + response = + if @issue.persisted? + # Save the meeting directly since we only want to update one meeting, not all + zoom_meeting.save + success(message: _('Zoom meeting added')) + else + success(message: _('Zoom meeting added'), payload: { zoom_meetings: [zoom_meeting] }) + end + + track_meeting_added_event + SystemNoteService.zoom_link_added(@issue, @project, current_user) + + response + end + + def new_zoom_meeting(link) + ZoomMeeting.new( issue: @issue, - project: @issue.project, + project: @project, issue_status: :added, url: link ) - track_meeting_added_event - SystemNoteService.zoom_link_added(@issue, @project, current_user) end def remove_zoom_meeting @@ -72,16 +86,20 @@ module Issues SystemNoteService.zoom_link_removed(@issue, @project, current_user) end - def success(message) - ServiceResponse.success(message: message) + def success(message:, payload: nil) + ServiceResponse.success(message: message, payload: payload) end - def error(message) + def error(message:) ServiceResponse.error(message: message) end - def can_update_issue? - can?(current_user, :update_issue, project) + def can_change_link? + if @issue.persisted? + can?(current_user, :update_issue, @project) + else + can?(current_user, :create_issue, @project) + end end end end |