Skip to content

Commit

Permalink
Bug 1772415: Filter devices list by 21 days. r=markh
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarik Eshaq committed Nov 17, 2022
1 parent 65a0300 commit fe767ee
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions services/fxaccounts/FxAccountsClient.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const HOST_PREF = "identity.fxaccounts.auth.uri";

const SIGNIN = "/account/login";
const SIGNUP = "/account/create";
// Devices older than this many days will not appear in the devices list
const DEVICES_FILTER_DAYS = 21;

var FxAccountsClient = function(host = Services.prefs.getCharPref(HOST_PREF)) {
this.host = host;
Expand Down Expand Up @@ -705,7 +707,8 @@ FxAccountsClient.prototype = {
},

/**
* Get a list of currently registered devices
* Get a list of currently registered devices that have been accessed
* in the last `DEVICES_FILTER_DAYS` days
*
* @method getDeviceList
* @param sessionTokenHex
Expand All @@ -724,9 +727,9 @@ FxAccountsClient.prototype = {
* ]
*/
async getDeviceList(sessionTokenHex) {
let path = "/account/devices";
let timestamp = Date.now() - 1000 * 60 * 60 * 24 * DEVICES_FILTER_DAYS;
let path = `/account/devices?filterIdleDevicesTimestamp=${timestamp}`;
let creds = await deriveHawkCredentials(sessionTokenHex, "sessionToken");

return this._request(path, "GET", creds, {});
},

Expand Down

0 comments on commit fe767ee

Please sign in to comment.