Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #2087, do not show the call-to-action banner on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
ianb committed Jan 19, 2017
1 parent 2b01997 commit 8e7275c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"express": "4.14.0",
"jpm": "1.2.2",
"keygrip": "1.0.1",
"mobile-detect": "1.3.5",
"morgan": "1.7.0",
"mozlog": "2.0.6",
"node-statsd": "0.1.1",
Expand Down
8 changes: 6 additions & 2 deletions server/src/pages/shot/model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const { getGitRevision } = require("../../linker");
const MobileDetect = require('mobile-detect');

exports.createModel = function (req) {
let buildTime = require("../../build-time").string;
let isMobile = !! (new MobileDetect(req.headers['user-agent'])).mobile();
let serverPayload = {
title: req.shot.title,
allowExport: req.config.allowExport,
Expand All @@ -26,7 +28,8 @@ exports.createModel = function (req) {
sentryPublicDSN: req.config.sentryPublicDSN,
cspNonce: req.cspNonce,
hashAnalytics: true,
userAgent: req.headers['user-agent']
userAgent: req.headers['user-agent'],
isMobile
};
let clientPayload = {
title: req.shot.title,
Expand All @@ -52,7 +55,8 @@ exports.createModel = function (req) {
retentionTime: req.config.expiredRetentionTime*1000,
defaultExpiration: req.config.defaultExpiration*1000,
hashAnalytics: true,
userAgent: req.headers['user-agent']
userAgent: req.headers['user-agent'],
isMobile
};
if (serverPayload.expireTime !== null && Date.now() > serverPayload.expireTime) {
clientPayload.shot = {
Expand Down
2 changes: 1 addition & 1 deletion server/src/pages/shot/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ class Body extends React.Component {

let renderGetFirefox = this.props.userAgent && (this.props.userAgent + "").search(/firefox\/\d+/i) === -1;
let renderExtensionNotification = ! (this.props.isExtInstalled || renderGetFirefox);
if (this.state.closePageshotBanner) {
if (this.props.isMobile || this.state.closePageshotBanner) {
renderGetFirefox = renderExtensionNotification = false;
}

Expand Down

0 comments on commit 8e7275c

Please sign in to comment.