chore: Syncs changes that were erroneously made in enterprise repo (#1949)

This commit is contained in:
Tom Moor 2021-03-10 14:56:34 -08:00 committed by GitHub
parent d530edcc2f
commit dc967be4fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 11 deletions

View File

@ -6,7 +6,7 @@ import HelpText from "components/HelpText";
export type Props = {|
checked?: boolean,
label?: string,
label?: React.Node,
labelHidden?: boolean,
className?: string,
name?: string,
@ -26,6 +26,7 @@ const LabelText = styled.span`
const Wrapper = styled.div`
padding-bottom: 8px;
${(props) => (props.small ? "font-size: 14px" : "")};
width: 100%;
`;
const Label = styled.label`

View File

@ -42,6 +42,7 @@ const RealInput = styled.input`
const Wrapper = styled.div`
flex: ${(props) => (props.flex ? "1" : "0")};
width: ${(props) => (props.short ? "49%" : "auto")};
max-width: ${(props) => (props.short ? "350px" : "100%")};
min-height: ${({ minHeight }) => (minHeight ? `${minHeight}px` : "0")};
max-height: ${({ maxHeight }) => (maxHeight ? `${maxHeight}px` : "initial")};
@ -55,7 +56,6 @@ const IconWrapper = styled.span`
`;
export const Outline = styled(Flex)`
display: flex;
flex: 1;
margin: ${(props) =>
props.margin !== undefined ? props.margin : "0 0 16px"};
@ -64,7 +64,7 @@ export const Outline = styled(Flex)`
border-style: solid;
border-color: ${(props) =>
props.hasError
? "red"
? props.theme.danger
: props.focused
? props.theme.inputBorderFocused
: props.theme.inputBorder};
@ -81,7 +81,7 @@ export const LabelText = styled.div`
`;
export type Props = {|
type?: "text" | "email" | "checkbox" | "search",
type?: "text" | "email" | "checkbox" | "search" | "textarea",
value?: string,
label?: string,
className?: string,
@ -97,8 +97,11 @@ export type Props = {|
autoComplete?: boolean | string,
readOnly?: boolean,
required?: boolean,
disabled?: boolean,
placeholder?: string,
onChange?: (ev: SyntheticInputEvent<HTMLInputElement>) => mixed,
onChange?: (
ev: SyntheticInputEvent<HTMLInputElement | HTMLTextAreaElement>
) => mixed,
onFocus?: (ev: SyntheticEvent<>) => void,
onBlur?: (ev: SyntheticEvent<>) => void,
|};

View File

@ -452,7 +452,9 @@ class DocumentScene extends React.Component<Props> {
</MaxWidth>
</Container>
</Background>
{isShare && !isCustomDomain() && <Branding />}
{isShare && !isCustomDomain() && (
<Branding href="//www.getoutline.com" />
)}
{!isShare && <KeyboardShortcutsButton />}
</ErrorBoundary>
);

View File

@ -9,11 +9,11 @@ import env from "env";
type Props = {
scopes?: string[],
redirectUri: string,
state: string,
state?: string,
label?: string,
};
function SlackButton({ state, scopes, redirectUri, label }: Props) {
function SlackButton({ state = "", scopes, redirectUri, label }: Props) {
const handleClick = () =>
(window.location.href = slackAuth(
state,

View File

@ -174,7 +174,7 @@ export default class AuthStore {
runInAction("AuthStore#updateUser", () => {
this.addPolicies(res.policies);
this.user = res.data;
this.user = new User(res.data);
});
} finally {
this.isSaving = false;

View File

@ -48,6 +48,12 @@ export default function validation() {
}
};
ctx.assertValueInArray = (value, values, message) => {
if (!values.includes(value)) {
throw new ValidationError(message);
}
};
return next();
};
}

View File

@ -95,6 +95,8 @@ const Document = sequelize.define(
},
getterMethods: {
url: function () {
if (!this.title) return `/doc/untitled-${this.urlId}`;
const slugifiedTitle = slugify(this.title);
return `/doc/${slugifiedTitle}-${this.urlId}`;
},

View File

@ -60,11 +60,12 @@ const User = sequelize.define(
return original;
}
const initial = this.name ? this.name[0] : "?";
const hash = crypto
.createHash("md5")
.update(this.email || "")
.digest("hex");
return `${DEFAULT_AVATAR_HOST}/avatar/${hash}/${this.name[0]}.png`;
return `${DEFAULT_AVATAR_HOST}/avatar/${hash}/${initial}.png`;
},
},
}

View File

@ -69,7 +69,15 @@ export async function getUserForEmailSigninToken(token: string): Promise<User> {
}
}
const user = await User.findByPk(payload.id);
const user = await User.findByPk(payload.id, {
include: [
{
model: Team,
as: "team",
required: true,
},
],
});
// if user has signed in at all since the token was created then
// it's no longer valid, they'll need a new one.