Skip to content

Commit d331d5b

Browse files
authored
Merge pull request #4746 from mozilla/MNTOR-3353
MNTOR-3353: add expiry to subscribers table
2 parents 4885868 + f2dcaf0 commit d331d5b

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

src/app/(proper_react)/(redesign)/(authenticated)/user/(dashboard)/settings/SettingsPage.test.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const mockedSubscriber: SubscriberRow = {
7979
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0",
8080
fxa_refresh_token:
8181
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1",
82+
fxa_session_expiry: new Date(0),
8283
fxa_uid: "12346",
8384
fxa_profile_json: {
8485
uid: "123",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
export function up(knex) {
6+
return knex.schema.table('subscribers', table => {
7+
table.timestamp('fxa_session_expiry').after("fxa_access_token").nullable();
8+
});
9+
}
10+
11+
/**
12+
* @param { import("knex").Knex } knex
13+
* @returns { Promise<void> }
14+
*/
15+
export function down(knex) {
16+
return knex.schema.table('subscribers', table => {
17+
table.dropColumn('fxa_session_expiry');
18+
});
19+
}

src/knex-tables.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ declare module "knex/types/tables" {
102102
signup_language: null | string;
103103
fxa_refresh_token: null | string;
104104
fxa_access_token: null | string;
105+
fxa_session_expiry: null | Date;
105106
fxa_profile_json: null | Profile;
106107
fxa_uid: null | string;
107108
// TODO: Find unknown type
@@ -139,6 +140,7 @@ declare module "knex/types/tables" {
139140
| "fx_newsletter"
140141
| "fxa_access_token"
141142
| "fxa_refresh_token"
143+
| "fxa_session_expiry"
142144
| "fxa_profile_json"
143145
| "fxa_uid"
144146
| "breaches_last_shown"

src/utils/subscriberBreaches.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const subscriber: SubscriberRow = {
3232
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0",
3333
fxa_refresh_token:
3434
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1",
35+
fxa_session_expiry: new Date(0),
3536
fxa_uid: "12346",
3637
fxa_profile_json: {
3738
uid: "123",
@@ -488,6 +489,7 @@ describe("getSubBreaches", () => {
488489
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0",
489490
fxa_refresh_token:
490491
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1",
492+
fxa_session_expiry: new Date(0),
491493
fxa_uid: "12346",
492494
fxa_profile_json: {
493495
uid: "123",
@@ -590,6 +592,7 @@ describe("getSubBreaches", () => {
590592
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0",
591593
fxa_refresh_token:
592594
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1",
595+
fxa_session_expiry: new Date(0),
593596
fxa_uid: "12346",
594597
fxa_profile_json: {
595598
uid: "123",
@@ -688,6 +691,7 @@ describe("getSubBreaches", () => {
688691
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0",
689692
fxa_refresh_token:
690693
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1",
694+
fxa_session_expiry: new Date(0),
691695
fxa_uid: "12346",
692696
fxa_profile_json: {
693697
uid: "123",
@@ -808,6 +812,7 @@ describe("getSubBreaches", () => {
808812
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0",
809813
fxa_refresh_token:
810814
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1",
815+
fxa_session_expiry: new Date(0),
811816
fxa_uid: "12346",
812817
fxa_profile_json: {
813818
uid: "123",
@@ -924,6 +929,7 @@ describe("getSubBreaches", () => {
924929
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0",
925930
fxa_refresh_token:
926931
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1",
932+
fxa_session_expiry: new Date(0),
927933
fxa_uid: "12346",
928934
fxa_profile_json: {
929935
uid: "123",
@@ -1040,6 +1046,7 @@ describe("getSubBreaches", () => {
10401046
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0",
10411047
fxa_refresh_token:
10421048
"5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1",
1049+
fxa_session_expiry: new Date(0),
10431050
fxa_uid: "12346",
10441051
fxa_profile_json: {
10451052
uid: "123",

0 commit comments

Comments
 (0)