Commit ca58ffae authored by Chad Woolley's avatar Chad Woolley Committed by Brandon Labuschagne

Remove CAPTCHA support from issue description.vue component

- This is no longer needed, because spam checking for
  issue task updates was disabled here:
  - Issue: https://gitlab.com/gitlab-org/gitlab-foss/-/issues/64021
  - MR: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/30279
- This code should have been removed in that MR, as it is now unused.
parent 46527a69
......@@ -4,7 +4,6 @@ import $ from 'jquery';
import { deprecatedCreateFlash as createFlash } from '~/flash';
import { s__, sprintf } from '~/locale';
import TaskList from '../../task_list';
import recaptchaModalImplementor from '../../vue_shared/mixins/recaptcha_modal_implementor';
import animateMixin from '../mixins/animate';
export default {
......@@ -12,7 +11,7 @@ export default {
SafeHtml,
},
mixins: [animateMixin, recaptchaModalImplementor],
mixins: [animateMixin],
props: {
canUpdate: {
......@@ -87,21 +86,11 @@ export default {
fieldName: 'description',
lockVersion: this.lockVersion,
selector: '.detail-page-description',
onSuccess: this.taskListUpdateSuccess.bind(this),
onError: this.taskListUpdateError.bind(this),
});
}
},
taskListUpdateSuccess(data) {
try {
this.checkForSpam(data);
this.closeRecaptcha();
} catch (error) {
if (error && error.name === 'SpamError') this.openRecaptcha();
}
},
taskListUpdateError() {
createFlash(
sprintf(
......@@ -165,7 +154,5 @@ export default {
>
</textarea>
<!-- eslint-enable vue/no-mutating-props -->
<recaptcha-modal v-show="showRecaptcha" :html="recaptchaHTML" @close="closeRecaptcha" />
</div>
</template>
......@@ -70,36 +70,6 @@ describe('Description component', () => {
});
});
it('opens reCAPTCHA dialog if update rejected as spam', () => {
let modal;
const recaptchaChild = vm.$children.find(
// eslint-disable-next-line no-underscore-dangle
(child) => child.$options._componentTag === 'recaptcha-modal',
);
recaptchaChild.scriptSrc = '//scriptsrc';
vm.taskListUpdateSuccess({
recaptcha_html: '<div class="g-recaptcha">recaptcha_html</div>',
});
return vm
.$nextTick()
.then(() => {
modal = vm.$el.querySelector('.js-recaptcha-modal');
expect(modal.style.display).not.toEqual('none');
expect(modal.querySelector('.g-recaptcha').textContent).toEqual('recaptcha_html');
expect(document.body.querySelector('.js-recaptcha-script').src).toMatch('//scriptsrc');
})
.then(() => modal.querySelector('.close').click())
.then(() => vm.$nextTick())
.then(() => {
expect(modal.style.display).toEqual('none');
expect(document.body.querySelector('.js-recaptcha-script')).toBeNull();
});
});
it('applies syntax highlighting and math when description changed', () => {
const vmSpy = jest.spyOn(vm, 'renderGFM');
const prototypeSpy = jest.spyOn($.prototype, 'renderGFM');
......@@ -144,7 +114,6 @@ describe('Description component', () => {
dataType: 'issuableType',
fieldName: 'description',
selector: '.detail-page-description',
onSuccess: expect.any(Function),
onError: expect.any(Function),
lockVersion: 0,
});
......
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