mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Do not show an empty modal when an IP address is allowed or blocked. (#6265)
This commit is contained in:
committed by
Régis Hanol
parent
860c1c3dcd
commit
dc5fddbfe6
@@ -59,18 +59,14 @@ export default Ember.Component.extend({
|
|||||||
screenedIpAddress
|
screenedIpAddress
|
||||||
.save()
|
.save()
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result.success) {
|
this.setProperties({ ip_address: "", formSubmitted: false });
|
||||||
this.setProperties({ ip_address: "", formSubmitted: false });
|
this.sendAction(
|
||||||
this.sendAction(
|
"action",
|
||||||
"action",
|
ScreenedIpAddress.create(result.screened_ip_address)
|
||||||
ScreenedIpAddress.create(result.screened_ip_address)
|
);
|
||||||
);
|
Ember.run.schedule("afterRender", () =>
|
||||||
Ember.run.schedule("afterRender", () =>
|
this.$(".ip-address-input").focus()
|
||||||
this.$(".ip-address-input").focus()
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
bootbox.alert(result.errors);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
this.set("formSubmitted", false);
|
this.set("formSubmitted", false);
|
||||||
|
|||||||
@@ -46,19 +46,14 @@ export default Ember.Controller.extend({
|
|||||||
record.set("editing", false);
|
record.set("editing", false);
|
||||||
record
|
record
|
||||||
.save()
|
.save()
|
||||||
.then(saved => {
|
.then(() => {
|
||||||
if (saved.success) {
|
this.set("savedIpAddress", null);
|
||||||
this.set("savedIpAddress", null);
|
|
||||||
} else {
|
|
||||||
bootbox.alert(saved.errors);
|
|
||||||
if (wasEditing) record.set("editing", true);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
if (e.responseJSON && e.responseJSON.errors) {
|
if (e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors) {
|
||||||
bootbox.alert(
|
bootbox.alert(
|
||||||
I18n.t("generic_error_with_reason", {
|
I18n.t("generic_error_with_reason", {
|
||||||
error: e.responseJSON.errors.join(". ")
|
error: e.jqXHR.responseJSON.errors.join(". ")
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Admin::ScreenedIpAddressesController < Admin::AdminController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @screened_ip_address.update_attributes(allowed_params)
|
if @screened_ip_address.update_attributes(allowed_params)
|
||||||
render json: success_json
|
render_serialized(@screened_ip_address, ScreenedIpAddressSerializer)
|
||||||
else
|
else
|
||||||
render_json_error(@screened_ip_address)
|
render_json_error(@screened_ip_address)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user