settings_bots: Explicitly ignore delete event from live updates.

This commit is contained in:
Rohitt Vashishtha 2020-05-29 01:59:52 +05:30 committed by Steve Howell
parent 58b612a4f0
commit fba2708bbc
2 changed files with 5 additions and 12 deletions

View File

@ -74,6 +74,7 @@ set_global('current_msg_list', {rerender: noop});
// We use blueslip to print the traceback
set_global('blueslip', {
info: noop,
error: function (msg, more_info, stack) {
console.log("\nFailed to process an event:\n", more_info.event, "\n");
const error = new Error();
@ -1067,17 +1068,8 @@ with_overrides(function (override) {
});
event = event_fixtures.realm_bot__delete;
global.with_stub(function (bot_stub) {
global.with_stub(function (admin_stub) {
override('bot_data.del', bot_stub.f);
override('settings_users.update_bot_data', admin_stub.f);
// We don't handle live updates for delete events, this is a noop.
dispatch(event);
const args = bot_stub.get_args('bot_id');
assert_same(args.bot_id, event.bot.user_id);
admin_stub.get_args('update_user_id', 'update_bot_data');
});
});
event = event_fixtures.realm_bot__update;
global.with_stub(function (bot_stub) {

View File

@ -191,7 +191,8 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {
bot_data.deactivate(event.bot.user_id);
event.bot.is_active = false;
} else if (event.op === 'delete') {
bot_data.del(event.bot.user_id);
blueslip.info("ignoring bot deletion for live UI update");
break;
} else if (event.op === 'update') {
bot_data.update(event.bot.user_id, event.bot);
}