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

3.1.1 #4991

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
707d02a
Force inputs to match line heights to prevent awkward expanding
brianlovin Mar 27, 2019
2e43e5b
Fix list item width
brianlovin Mar 27, 2019
d41f247
Button loading state audit
brianlovin Mar 27, 2019
93ad969
More button loading labels
brianlovin Mar 27, 2019
4de0abf
Use clientside routing for spectrum urls
brianlovin Mar 27, 2019
3c50662
Fix new community onboarding flow
brianlovin Mar 27, 2019
e24e3db
Disable channel notifications by default
brianlovin Mar 27, 2019
1996f7c
Fixes to list item styling and truncation
brianlovin Mar 27, 2019
e615773
Conditionally apply margin to icons in buttons
brianlovin Mar 27, 2019
4ca10c9
Add notification controls to channel list item
brianlovin Mar 27, 2019
f1189c5
Add mute icon type
brianlovin Mar 27, 2019
ee52b0f
Convert dataCy to data-cys with prop passthrough
brianlovin Mar 27, 2019
53bf69c
Fix flow
brianlovin Mar 27, 2019
d7b4162
Fix flaky channel edit spec
brianlovin Mar 27, 2019
60d74cc
Merge pull request #4978 from withspectrum/spectrum-urls-detection
mxstbr Mar 28, 2019
836e035
Merge pull request #4977 from withspectrum/button-loading-state-audit
mxstbr Mar 28, 2019
f6c95fa
Merge pull request #4976 from withspectrum/fix-list-item-width
mxstbr Mar 28, 2019
b7c7363
Merge pull request #4975 from withspectrum/fix-composer-height-expanding
mxstbr Mar 28, 2019
4480b7f
Fix issue with refetchQueries
Mar 28, 2019
a93772c
Fix unseen robotext jumping around in real-time
Mar 28, 2019
8cc63ab
Fix thread subscriptions sending down age-old threads
Mar 28, 2019
1bef4eb
Merge pull request #4979 from withspectrum/fix-community-creation-flow
brianlovin Mar 28, 2019
b932600
Fix max width of select dropdowns in community settings
brianlovin Mar 28, 2019
c5c54ff
Merge pull request #4984 from withspectrum/fix-thread-changefeed
brianlovin Mar 28, 2019
a24b897
Remove console.log
brianlovin Mar 28, 2019
1dc9190
Merge pull request #4983 from withspectrum/fix-unseen-robotext
brianlovin Mar 28, 2019
2147e0d
Revert "Disable channel notifications by default"
brianlovin Mar 28, 2019
04c2e69
Merge pull request #4985 from withspectrum/fix-slack-channel-dropdown…
mxstbr Mar 28, 2019
645e9f9
Merge pull request #4980 from withspectrum/quieter-emails-by-default
brianlovin Mar 28, 2019
d14a883
Break word in mini composer
brianlovin Mar 28, 2019
97fee24
Fix dm scroll position when revisiting a thread
brianlovin Mar 28, 2019
0e4ad43
Merge pull request #4987 from withspectrum/break-word-in-mini-composer
mxstbr Mar 28, 2019
5fd4dc1
Mark notifications as seen on click
brianlovin Mar 28, 2019
f384748
Account for loading state
brianlovin Mar 28, 2019
3954161
Fix flow
brianlovin Mar 28, 2019
d34110b
Prevents the navigation avatars from scrolling behind the window buttons
brianlovin Mar 28, 2019
c07cd88
Force a static height on desktop titlebars
brianlovin Mar 28, 2019
794f087
Merge branch 'alpha' of github.com:withspectrum/spectrum into 3.1.1
brianlovin Mar 28, 2019
b898f89
3.1.1
brianlovin Mar 28, 2019
4bf2501
Merge pull request #4990 from withspectrum/desktop-cleanup
mxstbr Mar 28, 2019
af28dcd
Merge pull request #4989 from withspectrum/mark-notifications-seen-on…
brianlovin Mar 28, 2019
0869b38
Better solution for scrolling to bottom on previously viewed threads
brianlovin Mar 28, 2019
4a16f23
Subscribe before a potential early return
brianlovin Mar 28, 2019
2c9a854
Typo
brianlovin Mar 28, 2019
1cc5aa2
Merge pull request #4988 from withspectrum/fix-dm-scroll-position
brianlovin Mar 28, 2019
1c48967
Merge branch 'alpha' of github.com:withspectrum/spectrum into 3.1.1
brianlovin Mar 28, 2019
d12bc3e
Fix channel join action in mobile titlebar
brianlovin Mar 28, 2019
4e9da16
Merge pull request #4992 from withspectrum/fix-channel-join-on-mobile
brianlovin Mar 28, 2019
5ff88d9
Merge branch 'alpha' of github.com:withspectrum/spectrum into 3.1.1
brianlovin Mar 28, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions api/models/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
trackQueue,
searchQueue,
} from 'shared/bull/queues';
const { parseRange } = require('./utils');
const { parseRange, NEW_DOCUMENTS } = require('./utils');
import { createChangefeed } from 'shared/changefeed-utils';
import { deleteMessagesInThread } from '../models/message';
import { turnOffAllThreadNotifications } from '../models/usersThreads';
Expand Down Expand Up @@ -760,12 +760,30 @@ export const decrementReactionCount = (threadId: string) => {
.run();
};

const hasChanged = (field: string) =>
db
.row('old_val')(field)
.ne(db.row('new_val')(field));

const getUpdatedThreadsChangefeed = () =>
db
.table('threads')
.changes({
includeInitial: false,
})('new_val')
})
.filter(
NEW_DOCUMENTS.or(
hasChanged('content')
.or(hasChanged('lastActive'))
.or(hasChanged('channelId'))
.or(hasChanged('communityId'))
.or(hasChanged('creatorId'))
.or(hasChanged('isPublished'))
.or(hasChanged('modifiedAt'))
.or(hasChanged('messageCount'))
.or(hasChanged('reactionCount'))
)
)('new_val')
.run();

export const listenToUpdatedThreads = (cb: Function): Function => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/channel/settings/edit_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('edit a channel', () => {

it('should edit a channel', () => {
cy.get('[data-cy="channel-overview"]').should('be.visible');

cy.get('[data-cy="channel-members"]').should('be.visible');
cy.get('[data-cy="channel-name-input"]')
.should('be.visible')
.click()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Spectrum",
"version": "3.1.0",
"version": "3.1.1",
"license": "BSD-3-Clause",
"devDependencies": {
"@babel/preset-flow": "^7.0.0",
Expand Down
20 changes: 15 additions & 5 deletions shared/clients/draft-js/links-decorator/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
// @flow
import React from 'react';
import { Link } from 'react-router-dom';
import createLinksDecorator, {
type LinksDecoratorComponentProps,
} from './core';
import { SPECTRUM_URLS } from 'shared/regexps';

export default createLinksDecorator((props: LinksDecoratorComponentProps) => (
<a href={props.href} target="_blank" rel="noopener noreferrer">
{props.children}
</a>
));
export default createLinksDecorator((props: LinksDecoratorComponentProps) => {
const regexp = new RegExp(SPECTRUM_URLS, 'ig');
const match = regexp.exec(props.href);

if (match && match[0] && match[1])
return <Link to={match[1]}>{props.children}</Link>;

return (
<a href={props.href} target={'_blank'} rel={'noopener noreferrer'}>
{props.children}
</a>
);
});
29 changes: 19 additions & 10 deletions shared/clients/draft-js/renderer/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import React from 'react';
import { Link } from 'react-router-dom';
import Highlight, { defaultProps } from 'prism-react-renderer';
import { Line, Paragraph, BlockQuote } from 'src/components/message/style';
import {
Expand All @@ -13,6 +14,7 @@ import { hasStringElements } from '../utils/hasStringElements';
import mentionsDecorator from '../mentions-decorator';
import linksDecorator from '../links-decorator';
import type { Node } from 'react';
import { SPECTRUM_URLS } from 'shared/regexps';
import type { KeyObj, KeysObj, DataObj } from '../message/types';
import type {
EmbedData,
Expand Down Expand Up @@ -159,16 +161,23 @@ export const createRenderer = (options: Options) => {
),
},
entities: {
LINK: (children: Array<Node>, data: DataObj, { key }: KeyObj) => (
<a
key={key}
href={data.url || data.href}
target="_blank"
rel="noopener noreferrer"
>
{children}
</a>
),
LINK: (children: Array<Node>, data: DataObj, { key }: KeyObj) => {
const link = data.url || data.href;

if (typeof link !== 'string') {
return (
<a key={key} href={link} target="_blank" rel="noopener noreferrer">
{children}
</a>
);
}

const regexp = new RegExp(SPECTRUM_URLS, 'ig');
const match = regexp.exec(link);
if (match && match[0] && match[1]) {
return <Link to={match[1]}>{children}</Link>;
}
},
IMAGE: (
children: Array<Node>,
data: { src?: string, alt?: string },
Expand Down
11 changes: 11 additions & 0 deletions shared/graphql/mutations/community/createCommunity.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import gql from 'graphql-tag';
import { graphql } from 'react-apollo';
import communityInfoFragment from '../../fragments/community/communityInfo';
import { getCommunityBySlugQuery } from '../../queries/community/getCommunity';
import type { CommunityInfoType } from '../../fragments/community/communityInfo';

export type CreateCommunityType = {
Expand Down Expand Up @@ -39,6 +40,16 @@ const createCommunityOptions = {
},
}),
}),
options: {
refetchQueries: result => [
{
query: getCommunityBySlugQuery,
variables: {
slug: result.data.createCommunity.slug,
},
},
],
},
};

export default graphql(createCommunityMutation, createCommunityOptions);
7 changes: 6 additions & 1 deletion shared/graphql/queries/community/getCommunity.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,15 @@ export const getCommunityByMatchQuery = gql`
`;

const getCommunityByMatchOptions = {
options: ({ match: { params: { communitySlug } } }) => ({
options: ({
match: {
params: { communitySlug },
},
}) => ({
variables: {
slug: communitySlug,
},
fetchPolicy: 'cache-first',
}),
};

Expand Down
1 change: 1 addition & 0 deletions shared/regexps.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
module.exports.MENTIONS = /\/?\B@[a-z0-9._-]+[a-z0-9_-]/gi;
module.exports.URL = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/=]*)/gi;
module.exports.RELATIVE_URL = /^\/([^\/].*|$)/g;
module.exports.SPECTRUM_URLS = /(?:(?:https?:\/\/)?|\B)(?:spectrum\.chat|localhost:3000)(\/[A-Za-z0-9\-\._~:\/\?#\[\]@!$&'\(\)\*\+,;\=]*)?/gi;
2 changes: 1 addition & 1 deletion src/components/badges/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from 'styled-components';
import { Gradient } from 'src/components/globals';

export const Span = styled.span`
display: inline-flex;
display: inline-block;
color: ${theme.text.reverse};
background-color: ${theme.text.alt};
text-transform: uppercase;
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const StyledButton = styled.button`
line-height: 1.2;
transition: box-shadow 0.2s ease-in-out;

.icon {
.icon:not(:first-child):not(:last-child) {
margin-right: 4px;
}

Expand Down
6 changes: 6 additions & 0 deletions src/components/chatInput/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ export const Input = styled(MentionsInput).attrs({
font-size: 16px;
}

div,
textarea {
line-height: 1.4 !important;
word-break: break-word;
}

&::placeholder {
color: ${props =>
props.networkDisabled
Expand Down
2 changes: 1 addition & 1 deletion src/components/composer/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export const ThreadTitle = {
padding: '0',
outline: 'none',
border: '0',
lineHeight: '1.3',
lineHeight: '1.4',
fontWeight: '600',
boxShadow: 'none',
width: '100%',
Expand Down
19 changes: 5 additions & 14 deletions src/components/composerMini/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type { CommunityInfoType } from 'shared/graphql/fragments/community/commu
import type { History } from 'react-router-dom';
import { DISCARD_DRAFT_MESSAGE } from 'src/components/composer';
import { openModal } from 'src/actions/modals';
import { Container } from './style';
import { Container, BodyContainer } from './style';

type Props = {
community: CommunityInfoType,
Expand Down Expand Up @@ -278,23 +278,13 @@ const MiniComposer = ({
{!expanded && <PrimaryButton tabIndex={-1}>Post</PrimaryButton>}
</div>
{expanded && (
<div
css={{
width: '100%',
paddingLeft: '48px',
paddingRight: '8px',
marginTop: '8px',
fontSize: '16px',
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-end',
}}
>
<BodyContainer>
<Dropzone
accept={['image/gif', 'image/jpeg', 'image/png', 'video/mp4']}
disableClick
multiple={false}
onDropAccepted={uploadFiles}
style={{ lineHeight: '1.4' }}
>
{({ getRootProps, getInputProps, isDragActive }) => (
<div
Expand All @@ -316,6 +306,7 @@ const MiniComposer = ({
border: `1px solid ${theme.bg.border}`,
borderRadius: '8px',
width: '100%',
lineHeight: '1.4',
input: {
fontSize: '16px',
minHeight: '80px',
Expand Down Expand Up @@ -404,7 +395,7 @@ const MiniComposer = ({
</PrimaryButton>
</div>
</div>
</div>
</BodyContainer>
)}
</Container>
);
Expand Down
17 changes: 17 additions & 0 deletions src/components/composerMini/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,20 @@ export const Container = styled.div`
display: none;
}
`;

export const BodyContainer = styled.div`
width: 100%;
padding-left: 48px;
padding-right: 8px;
margin-top: 8px;
font-size: 16px;
display: flex;
flex-direction: column;
align-items: flex-end;

div,
textarea {
line-height: 1.4 !important;
word-break: break-word;
}
`;
2 changes: 1 addition & 1 deletion src/components/emailInvitationForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class EmailInvitationForm extends React.Component<Props, State> {
onClick={this.sendInvitations}
disabled={hasCustomMessage && customMessageError}
>
Send Invitations
{isLoading ? 'Sending...' : 'Send Invitations'}
</OutlineButton>
</SectionCardFooter>
</div>
Expand Down
Loading