summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-25 18:06:04 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-25 18:06:04 +0000
commit801ced25ff0540b096c395f9ac8d2d9e005878e8 (patch)
tree4f3ee19fd0facc1bcda8b93881981ab3315b9658 /app
parented9c54b56af280cc552aaac1cfa55533c900c1be (diff)
downloadgitlab-ce-801ced25ff0540b096c395f9ac8d2d9e005878e8.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/repository/components/breadcrumbs.vue2
-rw-r--r--app/assets/javascripts/repository/index.js8
-rw-r--r--app/assets/javascripts/repository/utils/dom.js9
-rw-r--r--app/graphql/mutations/issues/base.rb34
-rw-r--r--app/graphql/mutations/issues/set_due_date.rb27
-rw-r--r--app/graphql/types/mutation_type.rb1
-rw-r--r--app/helpers/tree_helper.rb4
7 files changed, 82 insertions, 3 deletions
diff --git a/app/assets/javascripts/repository/components/breadcrumbs.vue b/app/assets/javascripts/repository/components/breadcrumbs.vue
index afb58a60155..f6b9ea5d30d 100644
--- a/app/assets/javascripts/repository/components/breadcrumbs.vue
+++ b/app/assets/javascripts/repository/components/breadcrumbs.vue
@@ -124,7 +124,7 @@ export default {
},
{
attrs: {
- href: this.newBlobPath,
+ href: `${this.newBlobPath}${this.currentPath}`,
class: 'qa-new-file-option',
},
text: __('New file'),
diff --git a/app/assets/javascripts/repository/index.js b/app/assets/javascripts/repository/index.js
index d826f209815..ae6409a0ac9 100644
--- a/app/assets/javascripts/repository/index.js
+++ b/app/assets/javascripts/repository/index.js
@@ -7,6 +7,7 @@ import TreeActionLink from './components/tree_action_link.vue';
import DirectoryDownloadLinks from './components/directory_download_links.vue';
import apolloProvider from './graphql';
import { setTitle } from './utils/title';
+import { updateFormAction } from './utils/dom';
import { parseBoolean } from '../lib/utils/common_utils';
import { webIDEUrl } from '../lib/utils/url_utility';
import { __ } from '../locale';
@@ -42,8 +43,15 @@ export default function setupVueRepositoryList() {
forkNewBlobPath,
forkNewDirectoryPath,
forkUploadBlobPath,
+ uploadPath,
+ newDirPath,
} = breadcrumbEl.dataset;
+ router.afterEach(({ params: { pathMatch = '/' } }) => {
+ updateFormAction('.js-upload-blob-form', uploadPath, pathMatch);
+ updateFormAction('.js-create-dir-form', newDirPath, pathMatch);
+ });
+
// eslint-disable-next-line no-new
new Vue({
el: breadcrumbEl,
diff --git a/app/assets/javascripts/repository/utils/dom.js b/app/assets/javascripts/repository/utils/dom.js
index 963e6fc0bc4..81565a00d82 100644
--- a/app/assets/javascripts/repository/utils/dom.js
+++ b/app/assets/javascripts/repository/utils/dom.js
@@ -1,4 +1,11 @@
-// eslint-disable-next-line import/prefer-default-export
export const updateElementsVisibility = (selector, isVisible) => {
document.querySelectorAll(selector).forEach(elem => elem.classList.toggle('hidden', !isVisible));
};
+
+export const updateFormAction = (selector, basePath, path) => {
+ const form = document.querySelector(selector);
+
+ if (form) {
+ form.action = `${basePath}${path}`;
+ }
+};
diff --git a/app/graphql/mutations/issues/base.rb b/app/graphql/mutations/issues/base.rb
new file mode 100644
index 00000000000..b7fa234a50b
--- /dev/null
+++ b/app/graphql/mutations/issues/base.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+module Mutations
+ module Issues
+ class Base < BaseMutation
+ include Mutations::ResolvesProject
+
+ argument :project_path, GraphQL::ID_TYPE,
+ required: true,
+ description: "The project the issue to mutate is in"
+
+ argument :iid, GraphQL::STRING_TYPE,
+ required: true,
+ description: "The iid of the issue to mutate"
+
+ field :issue,
+ Types::IssueType,
+ null: true,
+ description: "The issue after mutation"
+
+ authorize :update_issue
+
+ private
+
+ def find_object(project_path:, iid:)
+ project = resolve_project(full_path: project_path)
+ resolver = Resolvers::IssuesResolver
+ .single.new(object: project, context: context)
+
+ resolver.resolve(iid: iid)
+ end
+ end
+ end
+end
diff --git a/app/graphql/mutations/issues/set_due_date.rb b/app/graphql/mutations/issues/set_due_date.rb
new file mode 100644
index 00000000000..1855c6f053b
--- /dev/null
+++ b/app/graphql/mutations/issues/set_due_date.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+module Mutations
+ module Issues
+ class SetDueDate < Base
+ graphql_name 'IssueSetDueDate'
+
+ argument :due_date,
+ Types::TimeType,
+ required: true,
+ description: 'The desired due date for the issue'
+
+ def resolve(project_path:, iid:, due_date:)
+ issue = authorized_find!(project_path: project_path, iid: iid)
+ project = issue.project
+
+ ::Issues::UpdateService.new(project, current_user, due_date: due_date)
+ .execute(issue)
+
+ {
+ issue: issue,
+ errors: issue.errors.full_messages
+ }
+ end
+ end
+ end
+end
diff --git a/app/graphql/types/mutation_type.rb b/app/graphql/types/mutation_type.rb
index 2408dc7fd1b..ecdbba477d7 100644
--- a/app/graphql/types/mutation_type.rb
+++ b/app/graphql/types/mutation_type.rb
@@ -9,6 +9,7 @@ module Types
mount_mutation Mutations::AwardEmojis::Add
mount_mutation Mutations::AwardEmojis::Remove
mount_mutation Mutations::AwardEmojis::Toggle
+ mount_mutation Mutations::Issues::SetDueDate
mount_mutation Mutations::MergeRequests::SetLabels
mount_mutation Mutations::MergeRequests::SetLocked
mount_mutation Mutations::MergeRequests::SetMilestone
diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb
index fc25b78da93..af1919eeb40 100644
--- a/app/helpers/tree_helper.rb
+++ b/app/helpers/tree_helper.rb
@@ -158,7 +158,9 @@ module TreeHelper
def breadcrumb_data_attributes
attrs = {
can_collaborate: can_collaborate_with_project?(@project).to_s,
- new_blob_path: project_new_blob_path(@project, @id),
+ new_blob_path: project_new_blob_path(@project, @ref),
+ upload_path: project_create_blob_path(@project, @ref),
+ new_dir_path: project_create_dir_path(@project, @ref),
new_branch_path: new_project_branch_path(@project),
new_tag_path: new_project_tag_path(@project),
can_edit_tree: can_edit_tree?.to_s