diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-06-16 11:54:21 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-06-16 11:54:21 +0300 |
commit | b541adc561b453cdf4aafb6c89fddbfa8c19a6f1 (patch) | |
tree | 7e3fd0545f57b0522dcbfbe17a5e1fad8a97a0e5 | |
parent | 459d8d65ad41ef3533ea5946c6c5bf38010856f3 (diff) | |
parent | a0f13d2f5269b4899e510414d321ad879f2ee27a (diff) |
Merge branch 'fix-group-url' into 'master'
Expose correct path to group
See merge request !12176
-rw-r--r-- | app/assets/javascripts/groups/components/group_item.vue | 6 | ||||
-rw-r--r-- | app/assets/javascripts/groups/stores/groups_store.js | 1 | ||||
-rw-r--r-- | app/serializers/group_entity.rb | 6 | ||||
-rw-r--r-- | spec/javascripts/groups/mock_data.js | 4 |
4 files changed, 13 insertions, 4 deletions
diff --git a/app/assets/javascripts/groups/components/group_item.vue b/app/assets/javascripts/groups/components/group_item.vue index 32815b9f73e..b1db34b9c50 100644 --- a/app/assets/javascripts/groups/components/group_item.vue +++ b/app/assets/javascripts/groups/components/group_item.vue @@ -27,7 +27,7 @@ export default { if (this.group.hasSubgroups) { eventHub.$emit('toggleSubGroups', this.group); } else { - window.location.href = this.group.webUrl; + window.location.href = this.group.groupPath; } } }, @@ -192,7 +192,7 @@ export default { <div class="avatar-container s40 hidden-xs"> <a - :href="group.webUrl"> + :href="group.groupPath"> <img class="avatar s40" :src="group.avatarUrl" @@ -202,7 +202,7 @@ export default { <div class="title"> <a - :href="group.webUrl">{{fullPath}}</a> + :href="group.groupPath">{{fullPath}}</a> <template v-if="group.permissions.humanGroupAccess"> as <span class="access-type">{{group.permissions.humanGroupAccess}}</span> diff --git a/app/assets/javascripts/groups/stores/groups_store.js b/app/assets/javascripts/groups/stores/groups_store.js index 67ee7d140ce..f6dc4290fd5 100644 --- a/app/assets/javascripts/groups/stores/groups_store.js +++ b/app/assets/javascripts/groups/stores/groups_store.js @@ -122,6 +122,7 @@ export default class GroupsStore { canEdit: rawGroup.can_edit, description: rawGroup.description, webUrl: rawGroup.web_url, + groupPath: rawGroup.group_path, parentId: rawGroup.parent_id, visibility: rawGroup.visibility, leavePath: rawGroup.leave_path, diff --git a/app/serializers/group_entity.rb b/app/serializers/group_entity.rb index 4f506f7e745..7c872a3e986 100644 --- a/app/serializers/group_entity.rb +++ b/app/serializers/group_entity.rb @@ -5,11 +5,15 @@ class GroupEntity < Grape::Entity include GroupsHelper expose :id, :name, :path, :description, :visibility - expose :web_url expose :full_name, :full_path + expose :web_url expose :parent_id expose :created_at, :updated_at + expose :group_path do |group| + group_path(group) + end + expose :permissions do expose :human_group_access do |group, options| group.group_members.find_by(user_id: request.current_user)&.human_access diff --git a/spec/javascripts/groups/mock_data.js b/spec/javascripts/groups/mock_data.js index 1c0ec7a97d0..b3f5d791b89 100644 --- a/spec/javascripts/groups/mock_data.js +++ b/spec/javascripts/groups/mock_data.js @@ -6,6 +6,7 @@ const group1 = { visibility: 'public', avatar_url: null, web_url: 'http://localhost:3000/groups/level1', + group_path: '/level1', full_name: 'level1', full_path: 'level1', parent_id: null, @@ -28,6 +29,7 @@ const group14 = { visibility: 'public', avatar_url: null, web_url: 'http://localhost:3000/groups/level1/level2/level3/level4', + group_path: '/level1/level2/level3/level4', full_name: 'level1 / level2 / level3 / level4', full_path: 'level1/level2/level3/level4', parent_id: 1127, @@ -49,6 +51,7 @@ const group2 = { visibility: 'public', avatar_url: null, web_url: 'http://localhost:3000/groups/devops', + group_path: '/devops', full_name: 'devops', full_path: 'devops', parent_id: null, @@ -70,6 +73,7 @@ const group21 = { visibility: 'public', avatar_url: null, web_url: 'http://localhost:3000/groups/devops/chef', + group_path: '/devops/chef', full_name: 'devops / chef', full_path: 'devops/chef', parent_id: 1119, |