Chore: make notification center UI

Chore: fiatBalancesNotify refactor

Chore: removed now-unused code in some files

Feat: change column "detail" in database to use jsonb

Chore: add notification center background and button

Chore: notifications screen scaffolding

Fix: change position of notification UI

Feat: join backend and frontend

Feat: notification icons and machine names

Feat: add clear all button, stripe overlay on invalid notification

Fix: rework notification styles

Feat: use popper to render notifications

Feat: make notification center UI

Fix: fix css on notification center

Fix: fix invalidateNotification

Chore: apply PR requested changes

Fix: PR fixes

Fix: make toggleable body/root styles be handled by react

Chore: delete old notifier file

Fix: undo variable name changes for cryptobalance notifs
This commit is contained in:
Cesar 2020-12-17 22:18:35 +00:00 committed by Josh Harvey
parent 2a9e8dadba
commit c457faab40
37 changed files with 1337 additions and 1332 deletions

View file

@ -15,7 +15,8 @@ const complianceOverrides = require('./compliance_overrides')
const users = require('./users')
const options = require('./options')
const writeFile = util.promisify(fs.writeFile)
const notifierQueries = require('./notifier/queries')
const notifierUtils = require('./notifier/utils')
const NUM_RESULTS = 1000
const idPhotoCardBasedir = _.get('idPhotoCardDir', options)
const frontCameraBaseDir = _.get('frontCameraDir', options)
@ -115,7 +116,7 @@ async function updateCustomer (id, data, userToken) {
const sql = Pgp.helpers.update(updateData, _.keys(updateData), 'customers') +
' where id=$1'
invalidateCustomerNotifications(id, formattedData)
invalidateCustomerNotifications(id, formattedData).catch(console.error)
await db.none(sql, [id])
@ -123,12 +124,10 @@ async function updateCustomer (id, data, userToken) {
}
const invalidateCustomerNotifications = (id, data) => {
let detail = '';
if(data.authorized_override === 'verified') {
detail = `BLOCKED_${id}`
}
const sql = `UPDATE notifications SET valid = 'f', read = 't' WHERE valid = 't' AND detail = $1`
return db.none(sql, [detail])
if (data.authorized_override !== 'verified') return Promise.resolve()
const detailB = notifierUtils.buildDetail({ code: 'BLOCKED', customerId: id })
return notifierQueries.invalidateNotification(detailB, 'compliance').catch(console.error)
}
/**
@ -409,7 +408,7 @@ function populateOverrideUsernames (customer) {
return users.getByIds(queryTokens)
.then(usersList => {
return _.map(userField => {
const user = _.find({token: userField.token}, usersList)
const user = _.find({ token: userField.token }, usersList)
return {
[userField.field]: user ? user.name : null
}
@ -443,7 +442,7 @@ function batch () {
// TODO: getCustomersList and getCustomerById are very similar, so this should be refactored
/**
* Query all customers, ordered by last activity
* Query all customers, ordered by last activity
* and with aggregate columns based on their
* transactions
*
@ -481,7 +480,7 @@ function getCustomersList () {
}
/**
* Query all customers, ordered by last activity
* Query all customers, ordered by last activity
* and with aggregate columns based on their
* transactions
*