зеркало из https://github.com/mozilla/fxa.git
fix(auth,profile): Fix missing event broker events
Because: - Profile change events were not being emitted by the event broker - Profile change events were not being tracked by grafana This Commit: - Fixes bad event names. - Changes all occurrences of profileDataChanged to profileDataChange - Adds metric and log for unknown events
This commit is contained in:
Родитель
c21f95fb8b
Коммит
a32aa3dee0
|
@ -20,7 +20,7 @@ module.exports = function (log) {
|
|||
// server is also listening for these events but will only
|
||||
// clear its cache when received.
|
||||
await log.notifyAttachedServices(
|
||||
'profileDataChanged',
|
||||
'profileDataChange',
|
||||
{},
|
||||
{
|
||||
uid,
|
||||
|
|
|
@ -130,7 +130,7 @@ export class StripeHandler {
|
|||
this.profile.deleteCache(uid),
|
||||
]);
|
||||
await this.push.notifyProfileUpdated(uid, devices);
|
||||
this.log.notifyAttachedServices('profileDataChanged', request, {
|
||||
this.log.notifyAttachedServices('profileDataChange', request, {
|
||||
uid,
|
||||
email,
|
||||
});
|
||||
|
|
|
@ -155,7 +155,7 @@ module.exports = (log, db, mailer, customs, config) => {
|
|||
// See #5154.
|
||||
await db.verifyTokensWithMethod(sessionToken.id, 'email-2fa');
|
||||
|
||||
await log.notifyAttachedServices('profileDataChanged', request, {
|
||||
await log.notifyAttachedServices('profileDataChange', request, {
|
||||
uid,
|
||||
});
|
||||
|
||||
|
@ -305,7 +305,7 @@ module.exports = (log, db, mailer, customs, config) => {
|
|||
tokenId: sessionToken && sessionToken.id,
|
||||
});
|
||||
|
||||
await log.notifyAttachedServices('profileDataChanged', request, {
|
||||
await log.notifyAttachedServices('profileDataChange', request, {
|
||||
uid: sessionToken.uid,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ describe('profile updates', () => {
|
|||
|
||||
assert.ok(
|
||||
log.notifyAttachedServices.calledWithExactly(
|
||||
'profileDataChanged',
|
||||
'profileDataChange',
|
||||
{},
|
||||
{ uid }
|
||||
)
|
||||
|
|
|
@ -530,7 +530,7 @@ describe('DirectStripeRoutes', () => {
|
|||
|
||||
assert.isTrue(
|
||||
directStripeRoutesInstance.log.notifyAttachedServices.calledOnceWith(
|
||||
'profileDataChanged',
|
||||
'profileDataChange',
|
||||
VALID_REQUEST,
|
||||
{ uid: UID, email: TEST_EMAIL }
|
||||
),
|
||||
|
|
|
@ -131,7 +131,7 @@ describe('totp', () => {
|
|||
);
|
||||
assert.equal(
|
||||
args[0],
|
||||
'profileDataChanged',
|
||||
'profileDataChange',
|
||||
'first argument was event name'
|
||||
);
|
||||
assert.equal(args[1], request, 'second argument was request object');
|
||||
|
@ -235,7 +235,7 @@ describe('totp', () => {
|
|||
);
|
||||
assert.equal(
|
||||
args[0],
|
||||
'profileDataChanged',
|
||||
'profileDataChange',
|
||||
'first argument was event name'
|
||||
);
|
||||
assert.equal(args[1], request, 'second argument was request object');
|
||||
|
|
|
@ -55,12 +55,12 @@ module.exports = function (server) {
|
|||
});
|
||||
}
|
||||
|
||||
function profileDataChanged(message) {
|
||||
function profileDataChange(message) {
|
||||
var userId = getUserId(message);
|
||||
return P.resolve()
|
||||
.then(function () {
|
||||
server.methods.profileCache.drop(userId).then(() => {
|
||||
logger.info('profileDataChanged:cacheCleared', { uid: userId });
|
||||
logger.info('profileDataChange:cacheCleared', { uid: userId });
|
||||
});
|
||||
})
|
||||
.then(function () {
|
||||
|
@ -78,8 +78,8 @@ module.exports = function (server) {
|
|||
return deleteUser(message);
|
||||
case 'primaryEmailChanged':
|
||||
return primaryEmailChanged(message);
|
||||
case 'profileDataChanged':
|
||||
return profileDataChanged(message);
|
||||
case 'profileDataChange':
|
||||
return profileDataChange(message);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -227,7 +227,7 @@ describe('#integration - events', function () {
|
|||
function Message(type, onDel) {
|
||||
if (typeof type === 'function') {
|
||||
onDel = type;
|
||||
type = 'profileDataChanged';
|
||||
type = 'profileDataChange';
|
||||
}
|
||||
return {
|
||||
event: type,
|
||||
|
@ -259,7 +259,7 @@ describe('#integration - events', function () {
|
|||
function Message(type, onDel) {
|
||||
if (typeof type === 'function') {
|
||||
onDel = type;
|
||||
type = 'profileDataChanged';
|
||||
type = 'profileDataChange';
|
||||
}
|
||||
return {
|
||||
event: type,
|
||||
|
|
Загрузка…
Ссылка в новой задаче