Review changes

This commit is contained in:
Luke "Jared" Bennett 2017-09-15 10:19:43 +01:00
parent e0e153d2d7
commit 6d59795ebb
No known key found for this signature in database
GPG Key ID: 402ED51FB5D306C2
8 changed files with 24 additions and 27 deletions

View File

@ -18,7 +18,7 @@ class Diff {
});
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));

View File

@ -38,25 +38,23 @@ export default {
<template>
<div class="dropdown open">
<div class="dropdown-menu sidebar-item-warning-message">
<div>
<p v-if="isLocked">
{{ __(`Unlock this ${issuableDisplayName(issuableType)}?`) }}
<strong>{{ __('Everyone') }}</strong>
{{ __('will be able to comment.') }}
</p>
<p class="text" v-if="isLocked">
{{ __(`Unlock this ${issuableDisplayName(issuableType)}?`) }}
<strong>{{ __('Everyone') }}</strong>
{{ __('will be able to comment.') }}
</p>
<p v-else>
{{ __(`Lock this ${issuableDisplayName(issuableType)}? Only`) }}
<strong>{{ __('project members') }}</strong>
{{ __('will be able to comment.') }}
</p>
<p class="text" v-else>
{{ __(`Lock this ${issuableDisplayName(issuableType)}? Only`) }}
<strong>{{ __('project members') }}</strong>
{{ __('will be able to comment.') }}
</p>
<edit-form-buttons
:is-locked="isLocked"
:toggle-form="toggleForm"
:update-locked-attribute="updateLockedAttribute"
/>
</div>
<edit-form-buttons
:is-locked="isLocked"
:toggle-form="toggleForm"
:update-locked-attribute="updateLockedAttribute"
/>
</div>
</div>
</template>

View File

@ -22,7 +22,7 @@ export default {
return this.isLocked ? this.__('Unlock') : this.__('Lock');
},
updateLockedBool() {
toggleLock() {
return !this.isLocked;
},
},
@ -42,7 +42,7 @@ export default {
<button
type="button"
class="btn btn-close"
@click.prevent="updateLockedAttribute(updateLockedBool)"
@click.prevent="updateLockedAttribute(toggleLock)"
>
{{ buttonText }}
</button>

View File

@ -122,14 +122,14 @@
line-height: 1.5;
padding: 16px;
p {
.text {
color: $text-color;
}
.sidebar-item-warning-message-actions {
display: flex;
button {
.btn {
flex-grow: 1;
}
}

View File

@ -80,7 +80,7 @@
#pipelines.pipelines.tab-pane
- if @pipelines.any?
= 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
.mr-loading-status

View File

@ -1,5 +1,5 @@
---
title: Create system notes for MR too, improve doc + clean up code
title: Add lock feature to issue and merge request sidebar
merge_request:
author:
type: added

View File

@ -10,9 +10,7 @@ describe('LockIssueSidebar', () => {
const mediator = {
service: {
update: () => new Promise((resolve) => {
resolve(true);
}),
update: Promise.resolve(true),
},
store: {

View File

@ -5,6 +5,7 @@ import mountComponent from '../../../helpers/vue_mount_component_helper';
const IssueWarning = Vue.extend(issueWarning);
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, ' ');
}