From 2acee613f6a0d331dca665881880e16f1c51a97b Mon Sep 17 00:00:00 2001 From: Jonas Lochmann Date: Mon, 21 Dec 2020 01:00:00 +0100 Subject: [PATCH] Sign in parents by default --- src/function/child/add-device.ts | 3 ++- src/function/device/prepare-device-entry.ts | 5 +++-- src/function/parent/create-family.ts | 3 ++- src/function/parent/sign-in-into-family.ts | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/function/child/add-device.ts b/src/function/child/add-device.ts index 710b569..a377854 100644 --- a/src/function/child/add-device.ts +++ b/src/function/child/add-device.ts @@ -52,7 +52,8 @@ export const addChildDevice = async ({ database, websocket, request }: { deviceAuthToken, deviceName: request.deviceName, newDeviceInfo: request.childDevice, - userId: '' + userId: '', + isUserKeptSignedIn: false }), { transaction }) await database.family.update({ diff --git a/src/function/device/prepare-device-entry.ts b/src/function/device/prepare-device-entry.ts index e0c9edc..af82120 100644 --- a/src/function/device/prepare-device-entry.ts +++ b/src/function/device/prepare-device-entry.ts @@ -19,13 +19,14 @@ import { NewDeviceInfo } from '../../api/schema' import { DeviceAttributes } from '../../database/device' import { generateVersionId } from '../../util/token' -export const prepareDeviceEntry = ({ familyId, userId, deviceAuthToken, deviceId, deviceName, newDeviceInfo }: { +export const prepareDeviceEntry = ({ familyId, userId, deviceAuthToken, deviceId, deviceName, newDeviceInfo, isUserKeptSignedIn }: { familyId: string userId: string deviceAuthToken: string deviceId: string deviceName: string newDeviceInfo: NewDeviceInfo + isUserKeptSignedIn: boolean }): DeviceAttributes => ({ familyId, deviceId, @@ -52,7 +53,7 @@ export const prepareDeviceEntry = ({ familyId, userId, deviceAuthToken, deviceId lastConnectivity: '0', notSeenForLongTime: false, didDeviceReportUninstall: false, - isUserKeptSignedIn: false, + isUserKeptSignedIn, showDeviceConnected: false, defaultUserId: '', defaultUserTimeout: 0, diff --git a/src/function/parent/create-family.ts b/src/function/parent/create-family.ts index 54262df..9d763ff 100644 --- a/src/function/parent/create-family.ts +++ b/src/function/parent/create-family.ts @@ -94,7 +94,8 @@ export const createFamily = async ({ database, mailAuthToken, firstParentDevice, deviceName, newDeviceInfo: firstParentDevice, userId, - deviceAuthToken + deviceAuthToken, + isUserKeptSignedIn: true }), { transaction }) return { diff --git a/src/function/parent/sign-in-into-family.ts b/src/function/parent/sign-in-into-family.ts index 4da0527..81e69b0 100644 --- a/src/function/parent/sign-in-into-family.ts +++ b/src/function/parent/sign-in-into-family.ts @@ -61,7 +61,8 @@ export const signInIntoFamily = async ({ database, mailAuthToken, newDeviceInfo, userId: userEntry.userId, deviceName, deviceAuthToken, - newDeviceInfo + newDeviceInfo, + isUserKeptSignedIn: true }), { transaction }) // notify about changes