Просмотр исходного кода

Merge pull request #3542 from overleaf/ae-unsupported-browser

Display end of support notification to Internet Explorer users

GitOrigin-RevId: a81c0a74bf61fc412426197f6234dce1ee5de83b
Alf Eaton 5 лет назад
Родитель
Сommit
2270fe3c9f

+ 5 - 0
services/web/app/src/infrastructure/ExpressLocals.js

@@ -32,6 +32,11 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) {
     next()
     next()
   })
   })
 
 
+  webRouter.use(function(req, res, next) {
+    res.locals.isIE = /\b(msie|trident)\b/i.test(req.headers['user-agent'])
+    next()
+  })
+
   function addSetContentDisposition(req, res, next) {
   function addSetContentDisposition(req, res, next) {
     res.setContentDisposition = function(type, opts) {
     res.setContentDisposition = function(type, opts) {
       const directives = _.map(
       const directives = _.map(

+ 2 - 0
services/web/app/views/project/list/notifications.pug

@@ -1,6 +1,8 @@
 include ../../_mixins/saml
 include ../../_mixins/saml
 
 
 .user-notifications(ng-controller="NotificationsController")
 .user-notifications(ng-controller="NotificationsController")
+	include ./unsupported-browser
+
 	ul.list-unstyled(
 	ul.list-unstyled(
 		ng-if="notifications.length > 0 && projects.length > 0",
 		ng-if="notifications.length > 0 && projects.length > 0",
 		ng-cloak
 		ng-cloak

+ 11 - 0
services/web/app/views/project/list/unsupported-browser.pug

@@ -0,0 +1,11 @@
+if isIE
+	ul.list-unstyled
+		li.notification-entry
+			.alert.alert-info
+				.notification-body
+					p
+						i.fa.fa-fw.fa-exclamation-triangle
+						|
+						| It looks like you're accessing Overleaf with Internet Explorer, which we'll stop supporting in April 2021. We recommend that you upgrade to a newer browser.
+						|
+						a(href="https://www.overleaf.com/learn/how-to/What_browsers_do_you_support" target="_blank" rel="noopener") Learn More