Introduce warning message for Safari 13 and below (#18258)

Discourse will be dropping support for these browsers in early 2023. https://meta.discourse.org/t/224747
This commit is contained in:
David Taylor 2022-09-16 11:17:49 +01:00 committed by GitHub
parent 4af080d20b
commit 3904c23121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,30 @@
import I18n from "I18n";
import { withPluginApi } from "discourse/lib/plugin-api";
function setupMessage(api) {
const isSafari = navigator.vendor === "Apple Computer, Inc.";
if (!isSafari) {
return;
}
let safariMajorVersion = navigator.userAgent.match(/Version\/(\d+)\./)?.[1];
safariMajorVersion = safariMajorVersion
? parseInt(safariMajorVersion, 10)
: null;
if (safariMajorVersion && safariMajorVersion <= 13) {
api.addGlobalNotice(
I18n.t("safari_13_warning"),
"browser-deprecation-warning",
{ dismissable: true, dismissDuration: moment.duration(1, "week") }
);
}
}
export default {
name: "safari-13-deprecation",
initialize() {
withPluginApi("0.8.37", setupMessage);
},
};

View File

@ -3731,6 +3731,8 @@ en:
browser_update: 'Unfortunately, <a href="https://www.discourse.org/faq/#browser">your browser is unsupported</a>. Please <a href="https://browsehappy.com">switch to a supported browser</a> to view rich content, log in and reply.'
safari_13_warning: This site will soon remove support for iOS and Safari versions 13 and below - please update your browser
permission_types:
full: "Create / Reply / See"
create_post: "Reply / See"