Bug 1772415: Filter devices list by 21 days. r=markh

Differential Revision: https://phabricator.services.mozilla.com/D148203
This commit is contained in:
Tarik Eshaq 2022-07-29 00:02:20 +00:00
Родитель 17004e0f5d
Коммит 0ee439431f
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -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;
@ -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
@ -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, {});
},