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

mozilla / blurts-server / c12b763b-3145-4de7-902f-e08dab211da6

pending completion
c12b763b-3145-4de7-902f-e08dab211da6

Pull #2889

circleci

Florian Zia
fix: Append utm params
Pull Request #2889: Opt-out mechanism for emails

282 of 1437 branches covered (19.62%)

Branch coverage included in aggregate %.

53 of 53 new or added lines in 7 files covered. (100.0%)

959 of 3954 relevant lines covered (24.25%)

4.03 hits per line

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

0.0
/src/controllers/unsubscribe.js
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4

5
import { mainLayout } from '../views/mainLayout.js'
6
import { unsubscribe } from '../views/partials/unsubscribe.js'
7
import { generateToken } from '../utils/csrf.js'
8
import { UnauthorizedError } from '../utils/error.js'
9

10
const mandatoryParams = ['hash', 'token']
×
11

12
function unsubscribePage (req, res) {
13
  const queryParams = req.query
×
14
  const hasMandatoryParams = mandatoryParams.every(paramKey => (
×
15
    Object.hasOwn(queryParams, paramKey) && queryParams[paramKey] !== ''
×
16
  ))
17

18
  if (!hasMandatoryParams) {
×
19
    throw new UnauthorizedError('Not all mandatory params were provided.')
×
20
  }
21

22
  const data = {
×
23
    csrfToken: generateToken(res),
24
    partial: unsubscribe,
25
    queryParams
26
  }
27

28
  res.send(mainLayout(data))
×
29
}
30

31
export { unsubscribePage }
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