mirror of
https://github.com/wassname/talk.git
synced 2026-08-17 11:27:52 +08:00
[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:
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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 =>
|
||||
|
||||
Reference in New Issue
Block a user