summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-05-18 16:37:57 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-05-31 11:35:05 +0100
commitab0374f4d6e2bb72ee3040b9b906c2be23519cd7 (patch)
treed4becd22b82539d752b66295e1010e1e2ba7a149
parent07c984d81cd7985d4ab7597cbb21b5f623b438e9 (diff)
downloadgitlab-ce-ab0374f4d6e2bb72ee3040b9b906c2be23519cd7.tar.gz
Review changes, improve editable helper spec and add hasUpdated computer to issue_show app
Fix builds by only merge when updated_at_by is presnse Fix issue_show app.vue hasUpdated reference to state Fix missing bracket
-rw-r--r--app/assets/javascripts/issue_show/components/app.vue7
-rw-r--r--app/views/projects/issues/show.html.haml8
-rw-r--r--spec/helpers/editable_helper_spec.rb3
3 files changed, 11 insertions, 7 deletions
diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue
index aa2b8961f50..638708da100 100644
--- a/app/assets/javascripts/issue_show/components/app.vue
+++ b/app/assets/javascripts/issue_show/components/app.vue
@@ -71,6 +71,11 @@ export default {
titleComponent,
editedComponent,
},
+ computed: {
+ hasUpdated() {
+ return !!this.state.updatedAt;
+ },
+ },
created() {
const resource = new Service(this.endpoint);
const poll = new Poll({
@@ -112,7 +117,7 @@ export default {
:description-text="state.descriptionText"
:task-status="state.taskStatus" />
<edited-component
- v-if="!!state.updatedAt"
+ v-if="hasUpdated"
:updated-at="state.updatedAt"
:updated-by-name="state.updatedByName"
:updated-by-path="state.updatedByPath"
diff --git a/app/views/projects/issues/show.html.haml b/app/views/projects/issues/show.html.haml
index 8227d977da9..f81a68744c0 100644
--- a/app/views/projects/issues/show.html.haml
+++ b/app/views/projects/issues/show.html.haml
@@ -55,10 +55,10 @@
.issue-details.issuable-details
.detail-page-description.content-block
- #js-issuable-app{ "data" => { "endpoint" => realtime_changes_namespace_project_issue_path(@project.namespace, @project, @issue),
- "can-update" => can?(current_user, :update_issue, @issue).to_s,
- "issuable-ref" => @issue.to_reference,
- }.merge(updated_at_by(@issue)) }
+ - issuable_app_data = { "endpoint" => realtime_changes_namespace_project_issue_path(@project.namespace, @project, @issue), "can-update" => can?(current_user, :update_issue, @issue).to_s, "issuable-ref" => @issue.to_reference }
+ - updated_at_by = updated_at_by(@issue)
+ - issuable_app_data.merge(updated_at_by) if updated_at_by.present?
+ #js-issuable-app{ data: issuable_app_data }
%h2.title= markdown_field(@issue, :title)
- if @issue.description.present?
.description{ class: can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '' }
diff --git a/spec/helpers/editable_helper_spec.rb b/spec/helpers/editable_helper_spec.rb
index 81d2c33ccca..dc72819c1cc 100644
--- a/spec/helpers/editable_helper_spec.rb
+++ b/spec/helpers/editable_helper_spec.rb
@@ -15,8 +15,7 @@ describe EditableHelper do
}
end
- it { expect(helper.updated_at_by(unedited_editable)).to eq(nil) }
-
+ it { expect(helper.updated_at_by(unedited_editable)).to be_nil }
it { expect(helper.updated_at_by(edited_editable)).to eq(edited_updated_at_by) }
end
end