Skip to content

Commit

Permalink
Merge branch 'main' into mi/import-board
Browse files Browse the repository at this point in the history
  • Loading branch information
mateo-ivc authored Nov 11, 2024
2 parents 84a1f66 + 791e502 commit 3ebca84
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 123 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
"react-dom": "^18.3.1",
"react-focus-lock": "^2.13.2",
"react-helmet": "^6.1.0",
"react-hotkeys-hook": "^4.5.1",
"react-hotkeys-hook": "^4.6.1",
"react-i18next": "^15.1.0",
"react-redux": "^9.1.2",
"react-router": "^6.22.0",
"react-router-dom": "^6.27.0",
"react-router-dom": "^6.28.0",
"react-to-print": "^2.15.1",
"react-toastify": "^10.0.6",
"react-tooltip": "^5.28.0",
Expand All @@ -51,7 +51,7 @@
},
"devDependencies": {
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/classnames": "^2.3.4",
Expand All @@ -60,7 +60,7 @@
"@types/i18next-fs-backend": "^1.1.5",
"@types/jest": "^29.5.14",
"@types/js-cookie": "^3.0.6",
"@types/node": "^22.8.1",
"@types/node": "^22.9.0",
"@types/qrcode.react": "^1.0.5",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
Expand All @@ -72,15 +72,15 @@
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"cross-env": "^7.0.3",
"cypress": "^13.15.1",
"cypress": "^13.15.2",
"eslint": "^8.57.1",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-css-modules": "^2.12.0",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-jest": "^28.9.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-only-warn": "^1.1.0",
"eslint-plugin-prettier": "^5.2.1",
Expand All @@ -96,7 +96,7 @@
"react-scripts": "^5.0.1",
"redux-mock-store": "^1.5.4",
"resize-observer-polyfill": "^1.5.1",
"sass": "^1.80.5",
"sass": "^1.80.6",
"stylelint": "^16.10.0",
"stylelint-config-standard": "^36.0.1",
"ts-jest": "^29.2.5",
Expand Down
5 changes: 5 additions & 0 deletions server/src/api/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import (
"fmt"
"math"
"net/http"
"os"
"strings"
"time"

"scrumlr.io/server/common"
"scrumlr.io/server/logger"

"github.com/go-chi/render"
"github.com/gorilla/sessions"
"github.com/markbates/goth/gothic"
"scrumlr.io/server/common/dto"
"scrumlr.io/server/database/types"
Expand Down Expand Up @@ -72,6 +74,9 @@ func (s *Server) logout(w http.ResponseWriter, r *http.Request) {

// beginAuthProviderVerification will redirect the user to the specified auth provider consent page
func (s *Server) beginAuthProviderVerification(w http.ResponseWriter, r *http.Request) {
store := sessions.NewFilesystemStore(os.TempDir(), []byte("scrumlr.io"))
store.MaxLength(0x8000)
gothic.Store = store
gothic.BeginAuthHandler(w, r)
}

Expand Down
8 changes: 4 additions & 4 deletions server/src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
github.com/urfave/cli/v2 v2.27.5
github.com/weppos/publicsuffix-go v0.40.2
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.28.0
golang.org/x/crypto v0.29.0
)

require (
Expand All @@ -56,7 +56,7 @@ require (
github.com/go-viper/mapstructure/v2 v2.0.0 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.0 // indirect
Expand Down Expand Up @@ -102,8 +102,8 @@ require (
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/text v0.20.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
24 changes: 12 additions & 12 deletions server/src/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs=
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-migrate/migrate/v4 v4.18.1 h1:JML/k+t4tpHCpQTCAD62Nu43NUFzHY4CV3uAuvHGC+Y=
github.com/golang-migrate/migrate/v4 v4.18.1/go.mod h1:HAX6m3sQgcdO81tdjn5exv20+3Kb13cmGli1hrD6hks=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -270,8 +270,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
Expand Down Expand Up @@ -308,8 +308,8 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -330,8 +330,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -343,8 +343,8 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand All @@ -357,8 +357,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
Expand Down
26 changes: 8 additions & 18 deletions src/components/AccessPolicySelection/AccessPolicySelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,10 @@ export const AccessPolicySelection: FC<AccessPolicySelectionProps> = ({accessPol
const {t} = useTranslation();
const [visiblePassphrase, setVisiblePassphrase] = useState(true);

const handlePolicyChange = (newAccessPolicy: AccessPolicy) => {
if (newAccessPolicy >= 0 && newAccessPolicy <= 2) {
onAccessPolicyChange(newAccessPolicy);
}
};

let AccessPolicyDescription;
let AdditionalAccessPolicySettings;
switch (accessPolicy) {
case AccessPolicy.BY_PASSPHRASE:
case "BY_PASSPHRASE":
AccessPolicyDescription = <span>{t("AccessPolicySelection.byPassphrase")}</span>;
AdditionalAccessPolicySettings = (
<>
Expand Down Expand Up @@ -68,10 +62,10 @@ export const AccessPolicySelection: FC<AccessPolicySelectionProps> = ({accessPol
</>
);
break;
case AccessPolicy.BY_INVITE:
case "BY_INVITE":
AccessPolicyDescription = <span>{t("AccessPolicySelection.manualVerification")}</span>;
break;
case AccessPolicy.PUBLIC:
case "PUBLIC":
default:
AccessPolicyDescription = <span>{t("AccessPolicySelection.public")}</span>;
break;
Expand All @@ -82,24 +76,20 @@ export const AccessPolicySelection: FC<AccessPolicySelectionProps> = ({accessPol
<h2 className="access-policy-selection__title">{t("AccessPolicySelection.title")}</h2>

<div className="access-policy-selection__tabs">
<Button
className="access-policy-selection__access-policy"
variant={accessPolicy === AccessPolicy.PUBLIC ? "contained" : "outlined"}
onClick={() => handlePolicyChange(AccessPolicy.PUBLIC)}
>
<Button className="access-policy-selection__access-policy" variant={accessPolicy === "PUBLIC" ? "contained" : "outlined"} onClick={() => onAccessPolicyChange("PUBLIC")}>
{t("AccessPolicySelection.publicTitle")}
</Button>
<Button
className="access-policy-selection__access-policy"
variant={accessPolicy === AccessPolicy.BY_PASSPHRASE ? "contained" : "outlined"}
onClick={() => handlePolicyChange(AccessPolicy.BY_PASSPHRASE)}
variant={accessPolicy === "BY_PASSPHRASE" ? "contained" : "outlined"}
onClick={() => onAccessPolicyChange("BY_PASSPHRASE")}
>
{t("AccessPolicySelection.byPassphraseTitle")}
</Button>
<Button
className="access-policy-selection__access-policy"
variant={accessPolicy === AccessPolicy.BY_INVITE ? "contained" : "outlined"}
onClick={() => handlePolicyChange(AccessPolicy.BY_INVITE)}
variant={accessPolicy === "BY_INVITE" ? "contained" : "outlined"}
onClick={() => onAccessPolicyChange("BY_INVITE")}
>
{t("AccessPolicySelection.manualVerificationTitle")}
</Button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
import {fireEvent, waitFor} from "@testing-library/react";
import {AccessPolicySelection} from "components/AccessPolicySelection/AccessPolicySelection";
import {AccessPolicy} from "store/features/board/types";
import {render} from "testUtils";

describe("AccessPolicySelection", () => {
test("dont show passphrase input on default state", () => {
const {container} = render(<AccessPolicySelection accessPolicy={AccessPolicy.PUBLIC} onAccessPolicyChange={jest.fn()} passphrase="" onPassphraseChange={jest.fn()} />);
const {container} = render(<AccessPolicySelection accessPolicy="PUBLIC" onAccessPolicyChange={jest.fn()} passphrase="" onPassphraseChange={jest.fn()} />);
expect(container.querySelector(`[data-testid="passphrase-input"]`)).toBeNull();
});

test("show passphrase input on access policy by passphrase", () => {
const {container} = render(<AccessPolicySelection accessPolicy={AccessPolicy.BY_PASSPHRASE} onAccessPolicyChange={jest.fn()} passphrase="" onPassphraseChange={jest.fn()} />);
const {container} = render(<AccessPolicySelection accessPolicy="BY_PASSPHRASE" onAccessPolicyChange={jest.fn()} passphrase="" onPassphraseChange={jest.fn()} />);
expect(container.querySelector(`[data-testid="passphrase-input"]`)).toBeDefined();
});

test("trigger on change on passphrase change", async () => {
const onChangeOfPassphrase = jest.fn();
const {container} = render(
<AccessPolicySelection accessPolicy={AccessPolicy.BY_PASSPHRASE} onAccessPolicyChange={jest.fn()} passphrase="" onPassphraseChange={onChangeOfPassphrase} />
);
const {container} = render(<AccessPolicySelection accessPolicy="BY_PASSPHRASE" onAccessPolicyChange={jest.fn()} passphrase="" onPassphraseChange={onChangeOfPassphrase} />);

fireEvent.change(container.querySelector(`[data-testid="passphrase-input"]`)!, {target: {value: "1234"}});

Expand All @@ -29,9 +26,7 @@ describe("AccessPolicySelection", () => {

test("trigger on password change when random generator is clicked", async () => {
const onChangeOfPassphrase = jest.fn();
const {container} = render(
<AccessPolicySelection accessPolicy={AccessPolicy.BY_PASSPHRASE} onAccessPolicyChange={jest.fn()} passphrase="" onPassphraseChange={onChangeOfPassphrase} />
);
const {container} = render(<AccessPolicySelection accessPolicy="BY_PASSPHRASE" onAccessPolicyChange={jest.fn()} passphrase="" onPassphraseChange={onChangeOfPassphrase} />);

fireEvent.click(container.querySelector(`[data-testid="random-passwort-generator"]`)!);

Expand Down
2 changes: 1 addition & 1 deletion src/components/ColorPicker/ColorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const ColorPicker = (props: ColorPickerProps) => {
}

return (
<ReactFocusLock autoFocus={false} className="fix-focus-lock-placement">
<ReactFocusLock autoFocus className="fix-focus-lock-placement">
<ul className="color-picker">
<li className={`${getColorClassName(props.activeColor)} color-picker__item`}>
<button
Expand Down
2 changes: 1 addition & 1 deletion src/components/MiniMenu/MiniMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type MiniMenuProps = {
};

export const MiniMenu = ({className, items}: MiniMenuProps) => (
<ReactFocusLock autoFocus={false}>
<ReactFocusLock autoFocus>
<div className={classNames(className, "mini-menu")}>
{items.map((item) => {
const anchor = uniqueId(`mini-menu-${item.label}`);
Expand Down
6 changes: 3 additions & 3 deletions src/routes/NewBoard/NewBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const NewBoard = () => {
const navigate = useNavigate();
const [boardName, setBoardName] = useState<string | undefined>();
const [columnTemplate, setColumnTemplate] = useState<string | undefined>(undefined);
const [accessPolicy, setAccessPolicy] = useState(0);
const [accessPolicy, setAccessPolicy] = useState<AccessPolicy>("PUBLIC");
const [passphrase, setPassphrase] = useState("");
const [extendedConfiguration, setExtendedConfiguration] = useState(false);
const [importFile, setImportFileConfiguration] = useState(false);
Expand Down Expand Up @@ -101,7 +101,7 @@ export const NewBoard = () => {

const onCreateBoard = async () => {
let additionalAccessPolicyOptions = {};
if (accessPolicy === AccessPolicy.BY_PASSPHRASE && Boolean(passphrase)) {
if (accessPolicy === "BY_PASSPHRASE" && Boolean(passphrase)) {
additionalAccessPolicyOptions = {
passphrase,
};
Expand All @@ -112,7 +112,7 @@ export const NewBoard = () => {
const boardId = await API.createBoard(
boardName,
{
type: AccessPolicy[accessPolicy],
type: accessPolicy,
...additionalAccessPolicyOptions,
},
columnTemplates[columnTemplate].columns
Expand Down
8 changes: 2 additions & 6 deletions src/store/features/board/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ import {Reaction} from "../reactions";
import {Vote} from "../votes";
import {Voting} from "../votings";

export enum AccessPolicy {
"PUBLIC" = 0,
"BY_PASSPHRASE" = 1,
"BY_INVITE" = 2,
}
export type AccessPolicy = "PUBLIC" | "BY_PASSPHRASE" | "BY_INVITE";

export interface Board {
id: string;

name?: string;
accessPolicy: keyof typeof AccessPolicy;
accessPolicy: AccessPolicy;
showAuthors: boolean;
showNotesOfOtherUsers: boolean;
showNoteReactions: boolean;
Expand Down
Loading

0 comments on commit 3ebca84

Please sign in to comment.