• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / blurts-server / #13283

pending completion
#13283

push

circleci

Vinnl
Add a maximum width for email address

On large viewports, we don't want the hero content part to
endlessly grow if the user's email address happens to be
ridiculously long. This change limits it to a reasonable size that
maintains readability for the regular content, and truncates the
email address if it is wider than that.

282 of 1679 branches covered (16.8%)

Branch coverage included in aggregate %.

959 of 4548 relevant lines covered (21.09%)

1.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/controllers/ip-location.js
1
// IP location data includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com.
2
// For testing, you can compare IPs to the corresponding json, eg: https://github.com/maxmind/MaxMind-DB/blob/main/source-data/GeoLite2-City-Test.json
3

4
'use strict'
5

6
const AppConstants = require('../app-constants')
×
7
const { readLocationData } = require('../ip-location-service')
×
8

9
async function getIpLocation (req, res) {
10
  let clientIp
11

12
  switch (AppConstants.NODE_ENV) {
×
13
    case 'dev':
14
      clientIp = req.headers['test-ip'] || '216.160.83.56' // fallback an IP that exists in limited/local GeoLite2 test DB
×
15
      break
×
16
    case 'heroku':
17
    case 'stage':
18
      clientIp = req.headers['test-ip'] || req.ip // Use "test-ip" header if available, fallback to original IP
×
19
      break
×
20
    default:
21
      clientIp = req.ip
×
22
  }
23

24
  if (clientIp === req.session.locationData?.clientIp) {
×
25
    return res.status(200).json(req.session.locationData) // return cached data
×
26
  }
27

28
  const locationData = await readLocationData(clientIp, req.supportedLocales)
×
29

30
  if (locationData) {
×
31
    req.session.locationData = Object.assign(locationData, { clientIp }) // cache new location data, adding clientIP key
×
32
    return res.status(200).json(req.session.locationData)
×
33
  }
34

35
  return res.status(200).json({ clientIp })
×
36
}
37

38
module.exports = {
×
39
  getIpLocation
40
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc