From cae1b765f1b30e311b8dd020935cc65e1d788cf0 Mon Sep 17 00:00:00 2001 From: Tim Cheung Date: Tue, 17 Jul 2018 12:15:01 +0100 Subject: [PATCH 1/8] remove old eslint configuration --- .eslintrc.json | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 510dfaf1d3..0000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "env": { - "browser": true, - "commonjs": true, - "es6": true, - "node": true - }, - "parserOptions": { - "ecmaFeatures": { - "jsx": true - }, - "sourceType": "module" - }, - "rules": { - "no-const-assign": 1, - "no-extra-semi": 0, - "semi": 0, - "no-fallthrough": 0, - "no-empty": 0, - "no-mixed-spaces-and-tabs": 0, - "no-redeclare": 0, - "no-this-before-super": 1, - "no-undef": 0, - "no-unreachable": 1, - "no-unused-vars": 1, - "no-use-before-define": 0, - "constructor-super": 1, - "curly": 0, - "eqeqeq": 0, - "func-names": 0, - "valid-typeof": 1 - } -} \ No newline at end of file From d89d2edbe21d274cde2fbdea767a94ec7fc3d156 Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Tue, 17 Jul 2018 08:28:56 -0700 Subject: [PATCH 2/8] Fixes issues with usernames overflowing on small viewports --- src/components/badges/style.js | 1 - src/components/message/authorByline.js | 37 +++++++++++++++++--------- src/components/message/style.js | 33 +++++++++++++++++++++++ 3 files changed, 57 insertions(+), 14 deletions(-) diff --git a/src/components/badges/style.js b/src/components/badges/style.js index 0ffe1bb4fa..5486431760 100644 --- a/src/components/badges/style.js +++ b/src/components/badges/style.js @@ -4,7 +4,6 @@ import { Tooltip, Gradient } from '../globals'; export const Span = styled.span` display: inline; - align-self: center; color: ${({ theme }) => theme.text.reverse}; background-color: ${props => props.theme.text.alt}; text-transform: uppercase; diff --git a/src/components/message/authorByline.js b/src/components/message/authorByline.js index cae992406b..245c9efba9 100644 --- a/src/components/message/authorByline.js +++ b/src/components/message/authorByline.js @@ -3,7 +3,13 @@ import * as React from 'react'; import { convertTimestampToTime } from 'shared/time-formatting'; import Link from 'src/components/link'; import Badge from '../badges'; -import { Byline, Name, Username, GutterTimestamp } from './style'; +import { + Byline, + Name, + Username, + GutterTimestamp, + BadgesContainer, +} from './style'; import { UserHoverProfile } from 'src/components/hoverProfile'; import ConditionalWrap from 'src/components/conditionalWrap'; import { MessagesContext } from 'src/components/messageGroup'; @@ -26,7 +32,10 @@ export default (props: Props) => { ( - + e.stopPropagation()} @@ -40,17 +49,19 @@ export default (props: Props) => { {user.name} - {roles && - roles.map((role, index) => ( - e.stopPropagation()} - /> - ))} - {user.isPro && ( - e.stopPropagation()} /> - )} + + {roles && + roles.map((role, index) => ( + e.stopPropagation()} + /> + ))} + {user.isPro && ( + e.stopPropagation()} /> + )} + props.theme.text.default}; max-width: 100%; position: relative; + flex-wrap: wrap; + + a { + display: flex; + flex-wrap: wrap; + } + + @media (max-width: 400px) { + flex-direction: column; + align-items: flex-start; + } `; export const Name = styled.span` @@ -27,11 +38,16 @@ export const Name = styled.span` font-size: 15px; color: ${({ theme }) => theme.text.default}; margin-right: 2px; + display: flex; &:hover { color: ${({ theme }) => theme.text.default}; cursor: pointer; } + + @media (max-width: 400px) { + line-height: 1.4; + } `; export const Username = styled(Name)` @@ -39,6 +55,11 @@ export const Username = styled(Name)` margin-left: 2px; margin-right: 2px; color: ${props => props.theme.text.alt}; + display: flex; + + @media (max-width: 400px) { + line-height: 1.4; + } `; export const ActionsContainer = styled.span` @@ -108,6 +129,10 @@ export const GutterTimestamp = styled(Link)` color: ${props => props.theme.text.placeholder}; opacity: 0; ${Truncate}; + + @media (max-width: 400px) { + display: none !important; + } `; export const OuterMessageContainer = styled.div` @@ -384,3 +409,11 @@ export const QuoteWrapper = styled.div` color: ${props => props.theme.text.alt}; } `; + +export const BadgesContainer = styled.div` + display: flex; + + @media (max-width: 400px) { + margin-top: 4px; + } +`; From 2bf48b99a1f951bce28f7aabb0fba9ced1e29a89 Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Tue, 17 Jul 2018 08:34:49 -0700 Subject: [PATCH 3/8] Fix thread like push notification formatting --- shared/notification-to-text.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared/notification-to-text.js b/shared/notification-to-text.js index 99a9da7659..9a44c24346 100644 --- a/shared/notification-to-text.js +++ b/shared/notification-to-text.js @@ -160,7 +160,7 @@ const formatNotification = (incomingNotification, currentUserId) => { href = `/thread/${message.threadId}`; body = - message.messageType === 'draftjs' + message.messageType.toLowerCase() === 'draftjs' ? toPlainText(toState(message.content.body)) : message.content.body; break; @@ -170,7 +170,7 @@ const formatNotification = (incomingNotification, currentUserId) => { href = `/thread/${thread.id}`; body = - thread.type === 'draftjs' + thread.type.toLowerCase() === 'draftjs' ? toPlainText(toState(thread.content.body)) : thread.content.body; break; From b118932d0df36c26a6983d7abb28d698aab78e9e Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Tue, 17 Jul 2018 08:40:52 -0700 Subject: [PATCH 4/8] Fix slack integration timestamps --- athena/queues/thread-notification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/athena/queues/thread-notification.js b/athena/queues/thread-notification.js index 2a2d7ebf46..58500eddf7 100644 --- a/athena/queues/thread-notification.js +++ b/athena/queues/thread-notification.js @@ -114,7 +114,7 @@ export default async (job: Job) => { footer: 'Spectrum', footer_icon: 'https://spectrum.chat/img/apple-icon-57x57-precomposed.png', - ts: incomingThread.createdAt, + ts: new Date(incomingThread.createdAt).getTime() / 1000, color: '#4400CC', actions: [ { From eec610618c8ca5a9c2047490e39bded50cb325fa Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Tue, 17 Jul 2018 08:49:30 -0700 Subject: [PATCH 5/8] Fix zindex issue --- src/views/directMessages/components/style.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/directMessages/components/style.js b/src/views/directMessages/components/style.js index 240ab6870f..e1e1a82b28 100644 --- a/src/views/directMessages/components/style.js +++ b/src/views/directMessages/components/style.js @@ -283,7 +283,7 @@ export const SearchResultsDropdown = styled.ul` width: 320px; max-height: 420px; overflow-y: scroll; - z-index: ${zIndex.dropdown}; + z-index: ${zIndex.dropDown}; @media (max-width: 768px) { width: 100%; From 68f0fc2d65b95004cef9e23afb6cf61ce65768fc Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Tue, 17 Jul 2018 09:00:26 -0700 Subject: [PATCH 6/8] Unsub from watercooler when leaving a community --- .../communityMember/removeCommunityMember.js | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/api/mutations/communityMember/removeCommunityMember.js b/api/mutations/communityMember/removeCommunityMember.js index f7d991cacb..4ab5be0fbf 100644 --- a/api/mutations/communityMember/removeCommunityMember.js +++ b/api/mutations/communityMember/removeCommunityMember.js @@ -11,6 +11,10 @@ import { getChannelsByUserAndCommunity } from '../../models/channel'; import { isAuthedResolver as requireAuth } from '../../utils/permissions'; import { events } from 'shared/analytics'; import { trackQueue } from 'shared/bull/queues'; +import { + getThreadNotificationStatusForUser, + updateThreadNotificationStatusForUser, +} from '../../models/usersThreads'; type Input = { input: { @@ -105,6 +109,7 @@ export default requireAuth(async (_: any, args: Input, ctx: GraphQLContext) => { communityId, user.id ); + const leaveChannelsPromises = allChannelsInCommunity.map(channel => removeMemberInChannel(channel, user.id) ); @@ -112,7 +117,32 @@ export default requireAuth(async (_: any, args: Input, ctx: GraphQLContext) => { return await Promise.all([ removeMemberInCommunity(communityId, user.id), ...leaveChannelsPromises, - ]).then(() => community); + ]) + .then(async () => { + // if the community has a watercooler and the current user has a subscription + // to it, remove the subscription + if (community.watercoolerId) { + const threadId = community.watercoolerId; + const threadNotificationStatus = await getThreadNotificationStatusForUser( + threadId, + user.id + ); + if ( + !threadNotificationStatus || + !threadNotificationStatus.receiveNotifications + ) + return; + + return await updateThreadNotificationStatusForUser( + threadId, + user.id, + false + ); + } + + return; + }) + .then(() => community); } trackQueue.add({ From 246d9615384554a3f32f141a88ee7a26b658834c Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Tue, 17 Jul 2018 09:01:47 -0700 Subject: [PATCH 7/8] Use brackets for if --- api/mutations/communityMember/removeCommunityMember.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/mutations/communityMember/removeCommunityMember.js b/api/mutations/communityMember/removeCommunityMember.js index 4ab5be0fbf..c2c19d14c6 100644 --- a/api/mutations/communityMember/removeCommunityMember.js +++ b/api/mutations/communityMember/removeCommunityMember.js @@ -130,8 +130,9 @@ export default requireAuth(async (_: any, args: Input, ctx: GraphQLContext) => { if ( !threadNotificationStatus || !threadNotificationStatus.receiveNotifications - ) + ) { return; + } return await updateThreadNotificationStatusForUser( threadId, From 6bb00078331bc270fcb7a7f16566388b0497dbfe Mon Sep 17 00:00:00 2001 From: Brian Lovin Date: Tue, 17 Jul 2018 09:29:21 -0700 Subject: [PATCH 8/8] 2.4.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e48fde2e8f..8cfb99eb4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Spectrum", - "version": "2.4.20", + "version": "2.4.21", "license": "BSD-3-Clause", "devDependencies": { "babel-cli": "^6.24.1",