• 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/client/js/partials/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
const unsubscribeButton = document.querySelector('.js-unsubscribe-button')
×
6

7
unsubscribeButton.addEventListener('click', async event => {
×
8
  try {
×
9
    const csrfToken = event.target.getAttribute('data-csrf-token')
×
10
    const response = await fetch('/user/unsubscribe', {
×
11
      headers: {
12
        'Content-Type': 'application/json',
13
        'x-csrf-token': csrfToken
14
      },
15
      mode: 'same-origin',
16
      method: 'POST',
17
      body: JSON.stringify({ test: 'test' })
18
    })
19

20
    if (!response.ok) {
×
21
      const toast = document.createElement('toast-alert')
×
22
      toast.textContent = `Unsubscribing failed: ${response.statusText}`
×
23
      document.body.append(toast)
×
24
    }
25

26
    if (response?.redirected) {
×
27
      throw response.error
×
28
    }
29
  } catch (err) {
30
    throw new Error(`Unsubscribing failed: ${err}`)
×
31
  }
32
})
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