diff --git a/sites/backend/src/models/apikey.mjs b/sites/backend/src/models/apikey.mjs index 5d6c6fa7f65..d57f0238edf 100644 --- a/sites/backend/src/models/apikey.mjs +++ b/sites/backend/src/models/apikey.mjs @@ -13,16 +13,11 @@ export function ApikeyModel(tools, models) { /* * See utils/model-decorator.mjs for details */ - return decorateModel( - this, - tools, - { - name: 'apikey', - encryptedFields: ['name'], - models: ['user'], - }, - models - ) + return decorateModel(this, tools, { + name: 'apikey', + encryptedFields: ['name'], + models: ['user'], + }) } /* diff --git a/sites/backend/src/models/bookmark.mjs b/sites/backend/src/models/bookmark.mjs index b011f4eeff2..6459d900622 100644 --- a/sites/backend/src/models/bookmark.mjs +++ b/sites/backend/src/models/bookmark.mjs @@ -190,7 +190,7 @@ BookmarkModel.prototype.userBookmarks = async function (uid) { log.warn(`Failed to search bookmarks for user ${uid}: ${err}`) } const list = [] - for (const bookmark of bookmarks) list.push(this.bookmark) + for (const bookmark of bookmarks) list.push(bookmark) return list } diff --git a/sites/backend/src/utils/index.mjs b/sites/backend/src/utils/index.mjs index 55826b8dd6c..8af258285af 100644 --- a/sites/backend/src/utils/index.mjs +++ b/sites/backend/src/utils/index.mjs @@ -1,7 +1,6 @@ import { log } from './log.mjs' import { website, exports } from '../config.mjs' import { randomString } from './crypto.mjs' -import path from 'path' import fs from 'fs' /* diff --git a/sites/backend/tests/index.mjs b/sites/backend/tests/index.mjs index bb2af8b5e75..4de18d75b55 100644 --- a/sites/backend/tests/index.mjs +++ b/sites/backend/tests/index.mjs @@ -11,16 +11,16 @@ import { flowTests } from './flow.mjs' import { setup } from './shared.mjs' const runTests = async (...params) => { - //await userTests(...params) - //await mfaTests(...params) - //await apikeyTests(...params) - //await accountTests(...params) - //await setTests(...params) + await userTests(...params) + await mfaTests(...params) + await apikeyTests(...params) + await accountTests(...params) + await setTests(...params) await bookmarkTests(...params) - //await curatedSetTests(...params) - //await patternTests(...params) - //await subscriberTests(...params) - //await flowTests(...params) + await curatedSetTests(...params) + await patternTests(...params) + await subscriberTests(...params) + await flowTests(...params) } // Load initial data required for tests diff --git a/sites/org/pages/account/[platform].mjs b/sites/org/pages/account/[platform].mjs index 103fe25e78c..b811f3977da 100644 --- a/sites/org/pages/account/[platform].mjs +++ b/sites/org/pages/account/[platform].mjs @@ -4,8 +4,6 @@ import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { nsMerge, capitalize } from 'shared/utils.mjs' import { freeSewingConfig } from 'shared/config/freesewing.config.mjs' import { siteConfig } from 'site/site.config.mjs' -// Hooks -import { useTranslation } from 'next-i18next' // Components import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs' import { ns as authNs } from 'shared/components/wrappers/auth/index.mjs' @@ -34,17 +32,13 @@ const DynamicPlatform = dynamic( * when path and locale come from static props (as here) * or set them manually. */ -const AccountPage = ({ page, platform }) => { - const { t } = useTranslation(ns) - - return ( - - - - - - ) -} +const AccountPage = ({ page, platform }) => ( + + + + + +) export default AccountPage diff --git a/sites/org/pages/account/github.mjs b/sites/org/pages/account/github.mjs index a5b0f78fe4b..a8a0de3f47b 100644 --- a/sites/org/pages/account/github.mjs +++ b/sites/org/pages/account/github.mjs @@ -2,7 +2,6 @@ import dynamic from 'next/dynamic' import { serverSideTranslations } from 'next-i18next/serverSideTranslations' import { nsMerge } from 'shared/utils.mjs' -// Hooks import { useTranslation } from 'next-i18next' // Components import { PageWrapper, ns as pageNs } from 'shared/components/wrappers/page.mjs' @@ -32,17 +31,13 @@ const DynamicGithub = dynamic( * when path and locale come from static props (as here) * or set them manually. */ -const AccountPage = ({ page }) => { - const { t } = useTranslation(ns) - - return ( - - - - - - ) -} +const AccountPage = ({ page }) => ( + + + + + +) export default AccountPage diff --git a/sites/shared/components/account/bio.mjs b/sites/shared/components/account/bio.mjs index 2e9f842fd60..a71def21dd6 100644 --- a/sites/shared/components/account/bio.mjs +++ b/sites/shared/components/account/bio.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' diff --git a/sites/shared/components/account/consent.mjs b/sites/shared/components/account/consent.mjs index 0ba2030ab5d..a21f869074b 100644 --- a/sites/shared/components/account/consent.mjs +++ b/sites/shared/components/account/consent.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' import { nsMerge } from 'shared/utils.mjs' // Hooks diff --git a/sites/shared/components/account/github.mjs b/sites/shared/components/account/github.mjs index 2207f4bb76c..2a385263a73 100644 --- a/sites/shared/components/account/github.mjs +++ b/sites/shared/components/account/github.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' diff --git a/sites/shared/components/account/img.mjs b/sites/shared/components/account/img.mjs index d6620f86de8..7e3d3db4d7a 100644 --- a/sites/shared/components/account/img.mjs +++ b/sites/shared/components/account/img.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext, useCallback } from 'react' +import { useState, useCallback } from 'react' import { useTranslation } from 'next-i18next' import { useDropzone } from 'react-dropzone' import { cloudflareImageUrl } from 'shared/utils.mjs' @@ -11,7 +11,6 @@ import { useLoadingStatus } from 'shared/hooks/use-loading-status.mjs' import { Icons, welcomeSteps, BackToAccountButton } from './shared.mjs' import { ContinueButton } from 'shared/components/buttons/continue-button.mjs' import { SaveSettingsButton } from 'shared/components/buttons/save-settings-button.mjs' -import { DownloadIcon } from 'shared/components/icons.mjs' export const ns = ['account', 'status'] @@ -32,11 +31,6 @@ export const ImgSettings = ({ title = false, welcome = false }) => { acceptedFiles.forEach((file) => reader.readAsDataURL(file)) }, []) - const imageFromUrl = async () => { - const result = await backend.uploadImage({ type, subId, slug, url }) - if (result.success) setImg(result.data.imgId) - } - const { getRootProps, getInputProps } = useDropzone({ onDrop }) const save = async () => { diff --git a/sites/shared/components/account/imperial.mjs b/sites/shared/components/account/imperial.mjs index bcf08c4877d..0d23d23c11d 100644 --- a/sites/shared/components/account/imperial.mjs +++ b/sites/shared/components/account/imperial.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' diff --git a/sites/shared/components/account/language.mjs b/sites/shared/components/account/language.mjs index be74f1b7665..761050078d6 100644 --- a/sites/shared/components/account/language.mjs +++ b/sites/shared/components/account/language.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' diff --git a/sites/shared/components/account/links.mjs b/sites/shared/components/account/links.mjs index cf2930966e5..18a7865ecc9 100644 --- a/sites/shared/components/account/links.mjs +++ b/sites/shared/components/account/links.mjs @@ -3,7 +3,6 @@ import { useAccount } from 'shared/hooks/use-account.mjs' import { useBackend } from 'shared/hooks/use-backend.mjs' import { useTranslation } from 'next-i18next' import Link from 'next/link' -import { PageLink } from 'shared/components/page-link.mjs' import { freeSewingConfig as conf } from 'shared/config/freesewing.config.mjs' import { DesignIcon, @@ -44,14 +43,6 @@ import { ControlScore } from 'shared/components/control/score.mjs' export const ns = ['account', 'i18n'] -const actions = { - reload: 4, - export: 3, - restrict: 4, - disable: 4, - remove: 2, -} - const itemIcons = { bookmarks: , sets: , @@ -121,9 +112,7 @@ export const AccountLinks = () => { getUserData() }, [account.id]) - const lprops = { t, control: account.control } const btnClasses = 'btn capitalize flex flex-row justify-between' - const linkClasses = 'flex flex-row gap-2 text-lg py-2 items-center font-medium capitalize' const itemPreviews = { apikeys: apikeys?.length || 0, @@ -166,7 +155,7 @@ export const AccountLinks = () => {

{t('data')}

{Object.keys(conf.account.fields.data).map((item) => ( - +
{itemIcons[item]} {t(`your${capitalize(item)}`)} @@ -179,7 +168,7 @@ export const AccountLinks = () => {

{t('info')}

{Object.keys(conf.account.fields.info).map((item) => ( - +
{itemIcons[item]} {t(item)} @@ -199,7 +188,7 @@ export const AccountLinks = () => {

{t('settings')}

{Object.keys(conf.account.fields.settings).map((item) => ( - +
{itemIcons[item]} {t(item)} @@ -212,7 +201,7 @@ export const AccountLinks = () => {

{t('linkedIdentities')}

{Object.keys(conf.account.fields.identities).map((item) => ( - +
{itemIcons[item]} {t(item)} @@ -225,7 +214,7 @@ export const AccountLinks = () => {

{t('security')}

{Object.keys(conf.account.fields.security).map((item) => ( - +
{itemIcons[item]} {t(item)} diff --git a/sites/shared/components/account/mfa.mjs b/sites/shared/components/account/mfa.mjs index ce76e72e930..56e8c35ba54 100644 --- a/sites/shared/components/account/mfa.mjs +++ b/sites/shared/components/account/mfa.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' diff --git a/sites/shared/components/account/newsletter.mjs b/sites/shared/components/account/newsletter.mjs index 03883b76a31..6c7e5b945fb 100644 --- a/sites/shared/components/account/newsletter.mjs +++ b/sites/shared/components/account/newsletter.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' diff --git a/sites/shared/components/account/password.mjs b/sites/shared/components/account/password.mjs index 3911202a01c..c7e6c10481d 100644 --- a/sites/shared/components/account/password.mjs +++ b/sites/shared/components/account/password.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' diff --git a/sites/shared/components/account/platform.mjs b/sites/shared/components/account/platform.mjs index 387f5753dfc..1a3ff536148 100644 --- a/sites/shared/components/account/platform.mjs +++ b/sites/shared/components/account/platform.mjs @@ -1,5 +1,5 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' diff --git a/sites/shared/components/account/remove.mjs b/sites/shared/components/account/remove.mjs index 197892bbba5..2d7dbb201d0 100644 --- a/sites/shared/components/account/remove.mjs +++ b/sites/shared/components/account/remove.mjs @@ -7,14 +7,13 @@ import { useLoadingStatus } from 'shared/hooks/use-loading-status.mjs' // Components import { BackToAccountButton } from './shared.mjs' import { Popout } from 'shared/components/popout/index.mjs' -import { WebLink } from 'shared/components/web-link.mjs' export const ns = ['account', 'status'] export const RemoveAccount = () => { // Hooks - const { setAccount, token, signOut } = useAccount() - const backend = useBackend(token) + const { signOut } = useAccount() + const backend = useBackend() const { t } = useTranslation(ns) const { setLoadingStatus, LoadingStatus } = useLoadingStatus() diff --git a/sites/shared/components/account/restrict.mjs b/sites/shared/components/account/restrict.mjs index 8452cc5779d..e72b2b42165 100644 --- a/sites/shared/components/account/restrict.mjs +++ b/sites/shared/components/account/restrict.mjs @@ -7,14 +7,13 @@ import { useLoadingStatus } from 'shared/hooks/use-loading-status.mjs' // Components import { BackToAccountButton } from './shared.mjs' import { Popout } from 'shared/components/popout/index.mjs' -import { WebLink } from 'shared/components/web-link.mjs' export const ns = ['account', 'status'] export const RestrictAccount = () => { // Hooks - const { setAccount, token } = useAccount() - const backend = useBackend(token) + const { signOut } = useAccount() + const backend = useBackend() const { t } = useTranslation(ns) const { setLoadingStatus, LoadingStatus } = useLoadingStatus() @@ -22,8 +21,10 @@ export const RestrictAccount = () => { const restrictAccount = async () => { setLoadingStatus([true, 'processingUpdate']) const result = await backend.restrictAccount() - if (result.success) setLoadingStatus([true, 'nailedIt', true, true]) - else setLoadingStatus([true, 'backendError', true, false]) + if (result.success) { + setLoadingStatus([true, 'nailedIt', true, true]) + signOut() + } else setLoadingStatus([true, 'backendError', true, false]) } return ( diff --git a/sites/shared/components/account/username.mjs b/sites/shared/components/account/username.mjs index eb2c4caa887..325d7b519d4 100644 --- a/sites/shared/components/account/username.mjs +++ b/sites/shared/components/account/username.mjs @@ -1,13 +1,11 @@ // Dependencies -import { useState, useContext } from 'react' +import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' import { useBackend } from 'shared/hooks/use-backend.mjs' import { useLoadingStatus } from 'shared/hooks/use-loading-status.mjs' -import { LoadingContext } from 'shared/context/loading-context.mjs' // Components -import { Spinner } from 'shared/components/spinner.mjs' import { Icons, welcomeSteps, BackToAccountButton } from './shared.mjs' import { OkIcon, NoIcon } from 'shared/components/icons.mjs' import { ContinueButton } from 'shared/components/buttons/continue-button.mjs' diff --git a/sites/shared/components/control/score.mjs b/sites/shared/components/control/score.mjs index d0f371cefb9..19c822249e6 100644 --- a/sites/shared/components/control/score.mjs +++ b/sites/shared/components/control/score.mjs @@ -6,7 +6,7 @@ export const ControlScore = ({ control, color = 'base-content' }) => control ? (
{scores.map((score) => ( - = score ? true : false} className="w-6 h-6 -ml-1" /> + = score ? true : false} className="w-6 h-6 -ml-1" key={score} /> ))}
) : null diff --git a/sites/shared/components/susi/sign-in.mjs b/sites/shared/components/susi/sign-in.mjs index df7bf73ccb8..837f7fbab1e 100644 --- a/sites/shared/components/susi/sign-in.mjs +++ b/sites/shared/components/susi/sign-in.mjs @@ -1,5 +1,5 @@ // Hooks -import { useState, useEffect, useContext } from 'react' +import { useState, useEffect } from 'react' import { useAccount } from 'shared/hooks/use-account.mjs' import { useTranslation } from 'next-i18next' import { useBackend } from 'shared/hooks/use-backend.mjs' @@ -88,7 +88,6 @@ export const SignIn = () => { ? await backend.signIn({ username, password: false }) : await backend.signIn({ username, password }) // Sign-in succeeded - console.log(result.response.response) if (result.success) { let msg if (magicLink) {