FIX: Remove use of InputValidation library (#92)

This was deprecated in e39d89ecd9, and stopped working following the move to Ember CLI
This commit is contained in:
David Taylor 2021-11-09 14:45:50 +00:00 committed by GitHub
parent 8ade892b38
commit 08dd442c1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import I18n from "I18n"; import I18n from "I18n";
import ModalFunctionality from "discourse/mixins/modal-functionality"; import ModalFunctionality from "discourse/mixins/modal-functionality";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import InputValidation from "discourse/models/input-validation"; import EmberObject from "@ember/object";
import { import {
default as computed, default as computed,
observes, observes,
@ -49,17 +49,17 @@ export default Ember.Controller.extend(ModalFunctionality, {
if (val === "") { if (val === "") {
// Fail silently if field blank // Fail silently if field blank
return InputValidation.create({ return EmberObject.create({
failed: true, failed: true,
}); });
} else if (!regString) { } else if (!regString) {
// Pass silently if no regex available for provider // Pass silently if no regex available for provider
return InputValidation.create({ return EmberObject.create({
ok: true, ok: true,
}); });
} else if (regex.test(val)) { } else if (regex.test(val)) {
// Test against regex // Test against regex
return InputValidation.create({ return EmberObject.create({
ok: true, ok: true,
reason: I18n.t( reason: I18n.t(
"chat_integration.edit_channel_modal.channel_validation.ok" "chat_integration.edit_channel_modal.channel_validation.ok"
@ -67,7 +67,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
}); });
} else { } else {
// Failed regex // Failed regex
return InputValidation.create({ return EmberObject.create({
failed: true, failed: true,
reason: I18n.t( reason: I18n.t(
"chat_integration.edit_channel_modal.channel_validation.fail" "chat_integration.edit_channel_modal.channel_validation.fail"