diff --git a/static/js/ui.js b/static/js/ui.js index ce4ccdd91e..df2083b798 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -46,6 +46,20 @@ function update_message_in_all_views(message_id, callback) { }); } +exports.show_error_for_unsupported_platform = function () { + if (/ZulipDesktop/.test(navigator.userAgent)) { + // We don't internationalize this string because it is long, + // and few users will have both the old desktop app and an + // internationalized version of Zulip anyway. + var error = "Hello! You're using the unsupported old Zulip desktop app," + + " which is no longer developed. We recommend switching to the new, " + + "modern desktop app, which you can download at " + + "zulipchat.com/apps."; + + ui_report.generic_embed_error(error); + } +}; + exports.find_message = function (message_id) { // Try to find the message object. It might be in the narrow list // (if it was loaded when narrowed), or only in the message_list.all @@ -285,6 +299,7 @@ $(function () { exports.initialize = function () { i18n.ensure_i18n(_setup_info_overlay); + exports.show_error_for_unsupported_platform(); }; return exports; diff --git a/static/js/ui_report.js b/static/js/ui_report.js index 251c7be183..dfe62b4138 100644 --- a/static/js/ui_report.js +++ b/static/js/ui_report.js @@ -43,6 +43,13 @@ exports.success = function (response, status_box, type) { exports.message(response, status_box, 'alert-success', type); }; +exports.generic_embed_error = function (error) { + var $alert = $("
"); + var $exit = ""; + + $(".alert-box").append($alert.html($exit + "