[next] UserBox with respect to auth settings (#2079)

* feat: adapt userbox according to settings in embed stream

* fix: lint and test

* feat: respect allowRegistration
This commit is contained in:
Kiwi
2018-11-20 17:56:02 +01:00
committed by GitHub
parent 6fa0c7f538
commit 13147c4ba4
26 changed files with 534 additions and 43 deletions
@@ -7,6 +7,7 @@ export default function create(params: CreateParams) {
if (params.initLocalState) {
localRecord.setValue("COMMENTS", "activeTab");
localRecord.setValue(false, "loggedIn");
localRecord.setValue("jti", "authJTI");
params.initLocalState(localRecord, source, environment);
}
},
+21
View File
@@ -6,6 +6,27 @@ import {
} from "talk-framework/testHelpers";
export const settings = {
auth: {
integrations: {
facebook: {
enabled: false,
allowRegistration: true,
},
google: {
enabled: false,
allowRegistration: true,
},
sso: {
enabled: false,
allowRegistration: true,
},
local: {
enabled: true,
allowRegistration: true,
},
oidc: [],
},
},
reaction: {
icon: "thumb_up",
label: "Respect",
@@ -6,6 +6,7 @@ export default function create(params: CreateParams) {
initLocalState: (localRecord, source, environment) => {
if (params.initLocalState) {
localRecord.setValue("PROFILE", "activeTab");
localRecord.setValue("jti", "authJTI");
params.initLocalState(localRecord, source, environment);
}
},
@@ -4,7 +4,7 @@ import sinon from "sinon";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { comments, meWithComments, stories } from "../fixtures";
import { comments, meWithComments, settings, stories } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -54,6 +54,7 @@ beforeEach(() => {
const resolvers = {
Query: {
settings: sinon.stub().returns(settings),
story: createSinonStub(
s => s.throws(),
s =>
@@ -4,13 +4,14 @@ import sinon from "sinon";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { meWithComments, stories } from "../fixtures";
import { meWithComments, settings, stories } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
beforeEach(() => {
const resolvers = {
Query: {
settings: sinon.stub().returns(settings),
story: createSinonStub(
s => s.throws(),
s =>