Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Commit

Permalink
Merge branch 'alpha' of github.com:withspectrum/spectrum into 2.2.14
Browse files Browse the repository at this point in the history
  • Loading branch information
brianlovin committed May 21, 2018
2 parents 6ec82f7 + 7910ba8 commit 515b29f
Show file tree
Hide file tree
Showing 105 changed files with 230 additions and 103 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ api/.env
mobile/.expo
test-results.json
public/uploads
cypress/screenshots/
cypress/videos/
25 changes: 25 additions & 0 deletions api/queries/thread/content.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// @flow
import type { GraphQLContext } from '../../';
import type { DBThread } from 'shared/types';

export default ({ content }: DBThread, _: any, ctx: GraphQLContext) => {
const defaultDraftState = JSON.stringify({
blocks: [
{
key: 'foo',
text: '',
type: 'unstyled',
depth: 0,
inlineStyleRanges: [],
entityRanges: [],
data: {},
},
],
entityMap: {},
});

return {
title: content.title,
body: content.body ? content.body : defaultDraftState,
};
};
2 changes: 2 additions & 0 deletions api/queries/thread/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import author from './author';
import creator from './creator';
import messageCount from './messageCount';
import currentUserLastSeen from './currentUserLastSeen';
import content from './content';

module.exports = {
Query: {
Expand All @@ -33,5 +34,6 @@ module.exports = {
creator, // deprecated
messageCount,
currentUserLastSeen,
content,
},
};
3 changes: 2 additions & 1 deletion mobile/components/Login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Text, View, Button } from 'react-native';
import { AuthSession, SecureStore } from 'expo';
import { authenticate } from '../../actions/authentication';
import { DEV_BASE_URI } from '../../../shared/graphql/constants.native';
import type { Dispatch } from 'redux';
import {
Container,
Emoji,
Expand All @@ -26,7 +27,7 @@ const API_URL =
type Provider = 'twitter' | 'facebook' | 'google' | 'github';

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
};

class Login extends React.Component<Props> {
Expand Down
3 changes: 2 additions & 1 deletion src/actions/toasts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @flow
import type { Dispatch } from 'redux';
type Toasts = 'success' | 'error' | 'neutral';

const addToast = (
Expand All @@ -24,7 +25,7 @@ const removeToast = (id: number) => {

let nextToastId = 0;
export const addToastWithTimeout = (kind: Toasts, message: string) => (
dispatch: Function
dispatch: Dispatch<Object>
) => {
const timeout = kind === 'success' ? 2000 : 4000;
const id = nextToastId++;
Expand Down
3 changes: 2 additions & 1 deletion src/components/avatar/hoverProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import addProtocolToString from 'shared/normalize-url';
import { Card } from '../card';
import { initNewThreadWithUser } from '../../actions/directMessageThreads';
import AvatarImage from './image';
import type { Dispatch } from 'redux';
import {
Container,
CoverLink,
Expand All @@ -27,7 +28,7 @@ import { HoverWrapper } from './style';
type ProfileProps = {
user: Object,
community: ?Object,
dispatch: Function,
dispatch: Dispatch<Object>,
source: string,
currentUser: ?Object,
top: ?Boolean,
Expand Down
3 changes: 2 additions & 1 deletion src/components/badges/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as React from 'react';
import compose from 'recompose/compose';
import { connect } from 'react-redux';
import { openModal } from '../../actions/modals';
import type { Dispatch } from 'redux';
import {
Span,
ProBadge,
Expand All @@ -15,7 +16,7 @@ type Props = {
onClick?: Function,
tipText: string,
currentUser: ?Object,
dispatch: Function,
dispatch: Dispatch<Object>,
};

class Badge extends React.Component<Props> {
Expand Down
3 changes: 2 additions & 1 deletion src/components/chatInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import sendDirectMessage from 'shared/graphql/mutations/message/sendDirectMessag
import { getMessageById } from 'shared/graphql/queries/message/getMessage';
import MediaUploader from './components/mediaUploader';
import { QuotedMessage as QuotedMessageComponent } from '../message/view';
import type { Dispatch } from 'redux';

const QuotedMessage = connect()(
getMessageById(props => {
Expand Down Expand Up @@ -72,7 +73,7 @@ type State = {
type Props = {
onRef: Function,
currentUser: Object,
dispatch: Function,
dispatch: Dispatch<Object>,
onChange: Function,
state: Object,
createThread: Function,
Expand Down
3 changes: 2 additions & 1 deletion src/components/composer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { TextButton, Button } from '../buttons';
import { FlexRow } from '../../components/globals';
import { LoadingSelect } from '../loading';
import Titlebar from '../../views/titlebar';
import type { Dispatch } from 'redux';
import {
Container,
ThreadDescription,
Expand Down Expand Up @@ -69,7 +70,7 @@ type Props = {
loading: boolean,
},
isOpen: boolean,
dispatch: Function,
dispatch: Dispatch<Object>,
publishThread: Function,
history: Object,
location: Object,
Expand Down
1 change: 1 addition & 0 deletions src/components/emailInvitationForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import sendCommunityEmailInvitations from 'shared/graphql/mutations/community/se
import { Button } from '../buttons';
import { Error } from '../formElements';
import { SectionCardFooter } from '../settingsViews/style';
import type { Dispatch } from 'redux';
import {
EmailInviteForm,
EmailInviteInput,
Expand Down
3 changes: 2 additions & 1 deletion src/components/gallery/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as React from 'react';
import { connect } from 'react-redux';
import { closeGallery } from '../../actions/gallery';
import type { GetMediaMessagesForThreadType } from 'shared/graphql/queries/message/getMediaMessagesForThread';
import type { Dispatch } from 'redux';
import {
Overlay,
ActiveImage,
Expand All @@ -20,7 +21,7 @@ type State = {
};

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
data: {
messages?: GetMediaMessagesForThreadType,
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/granularUserProfile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Reputation from '../reputation';
import Badge from '../badges';
import Icon from '../icons';
import { initNewThreadWithUser } from '../../actions/directMessageThreads';
import type { Dispatch } from 'redux';
import {
Row,
Name,
Expand All @@ -35,7 +36,7 @@ type Props = {
children?: React.Node,
onlineSize?: 'small' | 'large',
history: Object,
dispatch: Function,
dispatch: Dispatch<Object>,
};

// Each prop both provides data AND indicates that the element should be included in the instance of the profile,
Expand Down
3 changes: 2 additions & 1 deletion src/components/message/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { openModal } from '../../actions/modals';
import { replyToMessage } from '../../actions/message';
import { track, events } from 'src/helpers/analytics';

import type { Dispatch } from 'redux';
import type { MessageInfoType } from 'shared/graphql/fragments/message/messageInfo';
import type { UserInfoType } from 'shared/graphql/fragments/user/userInfo';

Expand All @@ -18,7 +19,7 @@ type Props = {
threadId: string,
threadType: string,
selectedId: string,
dispatch: Function,
dispatch: Dispatch<Object>,
canModerate: boolean,
currentUser: UserInfoType,
me: boolean,
Expand Down
3 changes: 2 additions & 1 deletion src/components/messageGroup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { convertTimestampToDate } from '../../helpers/utils';
import Badge from '../badges';
import Avatar from '../avatar';
import Message from '../message';
import type { Dispatch } from 'redux';

import {
Byline,
Expand Down Expand Up @@ -70,7 +71,7 @@ type MessageGroupProps = {
thread: Object, // TODO: Refine type
isModerator: boolean,
toggleReaction: Function,
dispatch: Function,
dispatch: Dispatch<Object>,
selectedId: string,
changeSelection: Function,
lastSeen?: number | Date,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import getCommunitySettings, {
import AdministratorEmailForm from 'src/views/communityBilling/components/administratorEmailForm';
import viewNetworkHandler from 'src/components/viewNetworkHandler';
import ViewError from 'src/components/viewError';
import type { Dispatch } from 'redux';

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
isOpen: boolean,
currentUser: Object,
input: Object,
Expand Down
3 changes: 2 additions & 1 deletion src/components/modals/ChangeChannelModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import Icon from '../../icons';
import { IconContainer } from '../RepExplainerModal/style';
import { Actions, modalStyles, Section, Title, Subtitle } from './style';
import ChannelSelector from './channelSelector';
import type { Dispatch } from 'redux';

type Props = {
thread: any,
dispatch: Function,
dispatch: Dispatch<Object>,
isOpen: boolean,
moveThread: Function,
};
Expand Down
3 changes: 2 additions & 1 deletion src/components/modals/ChatInputLoginModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import { modalStyles } from '../styles';
import LoginButtonSet from 'src/components/loginButtonSet';
import { Container } from './style';
import { track, events } from 'src/helpers/analytics';
import type { Dispatch } from 'redux';

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
isOpen: boolean,
modalProps: any,
};
Expand Down
3 changes: 2 additions & 1 deletion src/components/modals/CreateChannelModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type { GetCommunityType } from 'shared/graphql/queries/community/getCommu
import createChannelMutation from 'shared/graphql/mutations/channel/createChannel';
import StripeModalWell from 'src/components/stripeCardForm/modalWell';
import { track, events, transformations } from 'src/helpers/analytics';
import type { Dispatch } from 'redux';

import ModalContainer from '../modalContainer';
import { TextButton, Button } from '../../buttons';
Expand Down Expand Up @@ -45,7 +46,7 @@ type State = {

type Props = {
client: Object,
dispatch: Function,
dispatch: Dispatch<Object>,
isOpen: boolean,
community: GetCommunityType,
createChannel: Function,
Expand Down
5 changes: 3 additions & 2 deletions src/components/modals/DeleteDoubleCheckModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { modalStyles } from '../styles';
import { Actions, Message } from './style';
import cancelSubscription from 'shared/graphql/mutations/community/cancelSubscription';
import disableCommunityAnalytics from 'shared/graphql/mutations/community/disableCommunityAnalytics';
import type { Dispatch } from 'redux';

/*
Generic component that should be used to confirm any 'delete' action.
Expand All @@ -42,7 +43,7 @@ type State = {
};

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
modalProps: {
id: string,
entity: string,
Expand All @@ -58,7 +59,7 @@ type Props = {
cancelSubscription: Function,
disableCommunityAnalytics: Function,
archiveChannel: Function,
dispatch: Function,
dispatch: Dispatch<Object>,
isOpen: boolean,
};

Expand Down
3 changes: 2 additions & 1 deletion src/components/modals/RestoreChannelModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import ModalContainer from '../modalContainer';
import { TextButton, Button } from '../../buttons';
import { modalStyles, Description } from '../styles';
import { Form, Actions } from './style';
import type { Dispatch } from 'redux';

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
isOpen: boolean,
channel: GetChannelType,
id: string,
Expand Down
3 changes: 2 additions & 1 deletion src/components/modals/UpgradeAnalyticsModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import StripeCardForm from 'src/components/stripeCardForm';
import enableCommunityAnalytics from 'shared/graphql/mutations/community/enableCommunityAnalytics';
import type { GetCommunitySettingsType } from 'shared/graphql/queries/community/getCommunitySettings';
import PoweredByStripe from '../components/poweredByStripe';
import type { Dispatch } from 'redux';

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
isOpen: boolean,
currentUser: Object,
community: GetCommunitySettingsType,
Expand Down
3 changes: 2 additions & 1 deletion src/components/modals/UpgradeModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { addToastWithTimeout } from '../../../actions/toasts';
import { connect } from 'react-redux';
import { Button, OutlineButton } from '../../buttons';
import { UpsellUpgradeToPro } from '../../upsell';
import type { Dispatch } from 'redux';
import {
modalStyles,
Section,
Expand All @@ -20,7 +21,7 @@ import {
import { track, events } from 'src/helpers/analytics';

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
downgradeFromPro: Function,
isOpen: boolean,
user: Object,
Expand Down
3 changes: 2 additions & 1 deletion src/components/modals/UpgradeModeratorSeatModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import StripeCardForm from 'src/components/stripeCardForm';
import addCommunityModerator from 'shared/graphql/mutations/communityMember/addCommunityModerator';
import type { GetCommunitySettingsType } from 'shared/graphql/queries/community/getCommunitySettings';
import PoweredByStripe from '../components/poweredByStripe';
import type { Dispatch } from 'redux';

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
isOpen: boolean,
currentUser: Object,
input: Object,
Expand Down
3 changes: 2 additions & 1 deletion src/components/profile/channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ import {
import Icon from '../icons';
import { Button } from '../buttons';
import { LoadingListItem } from '../loading';
import type { Dispatch } from 'redux';
import { FullTitle, FullDescription, ProfileCard, FullProfile } from './style';

type State = {
isLoading: boolean,
};

type Props = {
dispatch: Function,
dispatch: Dispatch<Object>,
toggleChannelSubscription: Function,
profileSize: string,
currentUser: Object,
Expand Down
3 changes: 2 additions & 1 deletion src/components/profile/community.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Avatar from '../avatar';
import { Button, OutlineButton } from '../buttons';
import type { GetCommunityType } from 'shared/graphql/queries/community/getCommunity';
import ToggleCommunityMembership from '../toggleCommunityMembership';
import type { Dispatch } from 'redux';
import {
ProfileHeader,
ProfileHeaderLink,
Expand All @@ -38,7 +39,7 @@ type Props = {
onLeave: Function,
joinedCommunity?: Function,
joinedFirstCommunity?: Function,
dispatch: Function,
dispatch: Dispatch<Object>,
data: {
community: GetCommunityType,
loading: boolean,
Expand Down
Loading

0 comments on commit 515b29f

Please sign in to comment.