Commit 6d59795e authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Review changes

parent e0e153d2
...@@ -18,7 +18,7 @@ class Diff { ...@@ -18,7 +18,7 @@ class Diff {
}); });
const tab = document.getElementById('diffs'); const tab = document.getElementById('diffs');
if (tab && tab.dataset.isLocked === 'false') FilesCommentButton.init($diffFile); if (tab && !Object.hasOwnProperty.call(tab.dataset, 'isLocked')) FilesCommentButton.init($diffFile);
$diffFile.each((index, file) => new gl.ImageFile(file)); $diffFile.each((index, file) => new gl.ImageFile(file));
......
...@@ -38,25 +38,23 @@ export default { ...@@ -38,25 +38,23 @@ export default {
<template> <template>
<div class="dropdown open"> <div class="dropdown open">
<div class="dropdown-menu sidebar-item-warning-message"> <div class="dropdown-menu sidebar-item-warning-message">
<div> <p class="text" v-if="isLocked">
<p v-if="isLocked"> {{ __(`Unlock this ${issuableDisplayName(issuableType)}?`) }}
{{ __(`Unlock this ${issuableDisplayName(issuableType)}?`) }} <strong>{{ __('Everyone') }}</strong>
<strong>{{ __('Everyone') }}</strong> {{ __('will be able to comment.') }}
{{ __('will be able to comment.') }} </p>
</p>
<p class="text" v-else>
<p v-else> {{ __(`Lock this ${issuableDisplayName(issuableType)}? Only`) }}
{{ __(`Lock this ${issuableDisplayName(issuableType)}? Only`) }} <strong>{{ __('project members') }}</strong>
<strong>{{ __('project members') }}</strong> {{ __('will be able to comment.') }}
{{ __('will be able to comment.') }} </p>
</p>
<edit-form-buttons
<edit-form-buttons :is-locked="isLocked"
:is-locked="isLocked" :toggle-form="toggleForm"
:toggle-form="toggleForm" :update-locked-attribute="updateLockedAttribute"
:update-locked-attribute="updateLockedAttribute" />
/>
</div>
</div> </div>
</div> </div>
</template> </template>
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
return this.isLocked ? this.__('Unlock') : this.__('Lock'); return this.isLocked ? this.__('Unlock') : this.__('Lock');
}, },
updateLockedBool() { toggleLock() {
return !this.isLocked; return !this.isLocked;
}, },
}, },
...@@ -42,7 +42,7 @@ export default { ...@@ -42,7 +42,7 @@ export default {
<button <button
type="button" type="button"
class="btn btn-close" class="btn btn-close"
@click.prevent="updateLockedAttribute(updateLockedBool)" @click.prevent="updateLockedAttribute(toggleLock)"
> >
{{ buttonText }} {{ buttonText }}
</button> </button>
......
...@@ -122,14 +122,14 @@ ...@@ -122,14 +122,14 @@
line-height: 1.5; line-height: 1.5;
padding: 16px; padding: 16px;
p { .text {
color: $text-color; color: $text-color;
} }
.sidebar-item-warning-message-actions { .sidebar-item-warning-message-actions {
display: flex; display: flex;
button { .btn {
flex-grow: 1; flex-grow: 1;
} }
} }
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
#pipelines.pipelines.tab-pane #pipelines.pipelines.tab-pane
- if @pipelines.any? - if @pipelines.any?
= render 'projects/commit/pipelines_list', disable_initialization: true, endpoint: pipelines_project_merge_request_path(@project, @merge_request) = render 'projects/commit/pipelines_list', disable_initialization: true, endpoint: pipelines_project_merge_request_path(@project, @merge_request)
#diffs.diffs.tab-pane{ data: { "is-locked" => @merge_request.discussion_locked?.to_s } } #diffs.diffs.tab-pane{ data: { "is-locked" => @merge_request.discussion_locked? } }
-# This tab is always loaded via AJAX -# This tab is always loaded via AJAX
.mr-loading-status .mr-loading-status
......
--- ---
title: Create system notes for MR too, improve doc + clean up code title: Add lock feature to issue and merge request sidebar
merge_request: merge_request:
author: author:
type: added type: added
...@@ -10,9 +10,7 @@ describe('LockIssueSidebar', () => { ...@@ -10,9 +10,7 @@ describe('LockIssueSidebar', () => {
const mediator = { const mediator = {
service: { service: {
update: () => new Promise((resolve) => { update: Promise.resolve(true),
resolve(true);
}),
}, },
store: { store: {
......
...@@ -5,6 +5,7 @@ import mountComponent from '../../../helpers/vue_mount_component_helper'; ...@@ -5,6 +5,7 @@ import mountComponent from '../../../helpers/vue_mount_component_helper';
const IssueWarning = Vue.extend(issueWarning); const IssueWarning = Vue.extend(issueWarning);
function formatWarning(string) { function formatWarning(string) {
// Replace newlines with a space then replace multiple spaces with one space
return string.trim().replace(/\n/g, ' ').replace(/\s\s+/g, ' '); return string.trim().replace(/\n/g, ' ').replace(/\s\s+/g, ' ');
} }
......
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