Improve logic for unsharing shared task [SCI-10097] (#7026)

This commit is contained in:
wandji 2024-02-05 10:18:56 +01:00 committed by GitHub
parent e85f48d51f
commit 5bdfc41f94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,8 +34,8 @@
class="sci-toggle-checkbox" class="sci-toggle-checkbox"
:disabled="!canShare" :disabled="!canShare"
tabindex="0" tabindex="0"
@change="checkboxChange" @click.prevent="checkboxChange"
@keyup.enter="handleCheckboxEnter"/> @keyup.enter="checkboxChange"/>
<span class="sci-toggle-checkbox-label"></span> <span class="sci-toggle-checkbox-label"></span>
</span> </span>
</div> </div>
@ -199,12 +199,8 @@ export default {
this.characterCount = this.$refs.textarea.value.length; this.characterCount = this.$refs.textarea.value.length;
}); });
}, },
handleCheckboxEnter() {
this.sharedEnabled = !this.sharedEnabled;
this.checkboxChange();
},
checkboxChange() { checkboxChange() {
if (this.sharedEnabled) { if (!this.sharedEnabled) {
$.post(this.shareableLinkUrl, { description: this.description }, (result) => { $.post(this.shareableLinkUrl, { description: this.description }, (result) => {
this.shareableData = result.data; this.shareableData = result.data;
this.$emit('enable'); this.$emit('enable');
@ -224,6 +220,7 @@ export default {
this.shareableData = {}; this.shareableData = {};
this.description = ''; this.description = '';
this.dirty = false; this.dirty = false;
this.sharedEnabled = false;
this.$emit('disable'); this.$emit('disable');
this.$emit('close'); this.$emit('close');