BigW Consortium Gitlab

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
parent 07c984d8
...@@ -71,6 +71,11 @@ export default { ...@@ -71,6 +71,11 @@ export default {
titleComponent, titleComponent,
editedComponent, editedComponent,
}, },
computed: {
hasUpdated() {
return !!this.state.updatedAt;
},
},
created() { created() {
const resource = new Service(this.endpoint); const resource = new Service(this.endpoint);
const poll = new Poll({ const poll = new Poll({
...@@ -112,7 +117,7 @@ export default { ...@@ -112,7 +117,7 @@ export default {
:description-text="state.descriptionText" :description-text="state.descriptionText"
:task-status="state.taskStatus" /> :task-status="state.taskStatus" />
<edited-component <edited-component
v-if="!!state.updatedAt" v-if="hasUpdated"
:updated-at="state.updatedAt" :updated-at="state.updatedAt"
:updated-by-name="state.updatedByName" :updated-by-name="state.updatedByName"
:updated-by-path="state.updatedByPath" :updated-by-path="state.updatedByPath"
......
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
.issue-details.issuable-details .issue-details.issuable-details
.detail-page-description.content-block .detail-page-description.content-block
#js-issuable-app{ "data" => { "endpoint" => realtime_changes_namespace_project_issue_path(@project.namespace, @project, @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 }
"can-update" => can?(current_user, :update_issue, @issue).to_s, - updated_at_by = updated_at_by(@issue)
"issuable-ref" => @issue.to_reference, - issuable_app_data.merge(updated_at_by) if updated_at_by.present?
}.merge(updated_at_by(@issue)) } #js-issuable-app{ data: issuable_app_data }
%h2.title= markdown_field(@issue, :title) %h2.title= markdown_field(@issue, :title)
- if @issue.description.present? - if @issue.description.present?
.description{ class: can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '' } .description{ class: can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '' }
......
...@@ -15,8 +15,7 @@ describe EditableHelper do ...@@ -15,8 +15,7 @@ describe EditableHelper do
} }
end 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) } it { expect(helper.updated_at_by(edited_editable)).to eq(edited_updated_at_by) }
end end
end end
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