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

Commit c9ed5b4

Browse files
authored
Merge pull request #3602 from withspectrum/2.4.21
2.4.21
2 parents 1255d7d + 6bb0007 commit c9ed5b4

File tree

9 files changed

+94
-53
lines changed

9 files changed

+94
-53
lines changed

.eslintrc.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

api/mutations/communityMember/removeCommunityMember.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import { getChannelsByUserAndCommunity } from '../../models/channel';
1111
import { isAuthedResolver as requireAuth } from '../../utils/permissions';
1212
import { events } from 'shared/analytics';
1313
import { trackQueue } from 'shared/bull/queues';
14+
import {
15+
getThreadNotificationStatusForUser,
16+
updateThreadNotificationStatusForUser,
17+
} from '../../models/usersThreads';
1418

1519
type Input = {
1620
input: {
@@ -105,14 +109,41 @@ export default requireAuth(async (_: any, args: Input, ctx: GraphQLContext) => {
105109
communityId,
106110
user.id
107111
);
112+
108113
const leaveChannelsPromises = allChannelsInCommunity.map(channel =>
109114
removeMemberInChannel(channel, user.id)
110115
);
111116

112117
return await Promise.all([
113118
removeMemberInCommunity(communityId, user.id),
114119
...leaveChannelsPromises,
115-
]).then(() => community);
120+
])
121+
.then(async () => {
122+
// if the community has a watercooler and the current user has a subscription
123+
// to it, remove the subscription
124+
if (community.watercoolerId) {
125+
const threadId = community.watercoolerId;
126+
const threadNotificationStatus = await getThreadNotificationStatusForUser(
127+
threadId,
128+
user.id
129+
);
130+
if (
131+
!threadNotificationStatus ||
132+
!threadNotificationStatus.receiveNotifications
133+
) {
134+
return;
135+
}
136+
137+
return await updateThreadNotificationStatusForUser(
138+
threadId,
139+
user.id,
140+
false
141+
);
142+
}
143+
144+
return;
145+
})
146+
.then(() => community);
116147
}
117148

118149
trackQueue.add({

athena/queues/thread-notification.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default async (job: Job<ThreadNotificationJobData>) => {
114114
footer: 'Spectrum',
115115
footer_icon:
116116
'https://spectrum.chat/img/apple-icon-57x57-precomposed.png',
117-
ts: incomingThread.createdAt,
117+
ts: new Date(incomingThread.createdAt).getTime() / 1000,
118118
color: '#4400CC',
119119
actions: [
120120
{

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Spectrum",
3-
"version": "2.4.20",
3+
"version": "2.4.21",
44
"license": "BSD-3-Clause",
55
"devDependencies": {
66
"babel-cli": "^6.24.1",

shared/notification-to-text.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const formatNotification = (incomingNotification, currentUserId) => {
160160

161161
href = `/thread/${message.threadId}`;
162162
body =
163-
message.messageType === 'draftjs'
163+
message.messageType.toLowerCase() === 'draftjs'
164164
? toPlainText(toState(message.content.body))
165165
: message.content.body;
166166
break;
@@ -170,7 +170,7 @@ const formatNotification = (incomingNotification, currentUserId) => {
170170

171171
href = `/thread/${thread.id}`;
172172
body =
173-
thread.type === 'draftjs'
173+
thread.type.toLowerCase() === 'draftjs'
174174
? toPlainText(toState(thread.content.body))
175175
: thread.content.body;
176176
break;

src/components/badges/style.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Tooltip, Gradient } from '../globals';
44

55
export const Span = styled.span`
66
display: inline;
7-
align-self: center;
87
color: ${({ theme }) => theme.text.reverse};
98
background-color: ${props => props.theme.text.alt};
109
text-transform: uppercase;

src/components/message/authorByline.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import * as React from 'react';
33
import { convertTimestampToTime } from 'shared/time-formatting';
44
import Link from 'src/components/link';
55
import Badge from '../badges';
6-
import { Byline, Name, Username, GutterTimestamp } from './style';
6+
import {
7+
Byline,
8+
Name,
9+
Username,
10+
GutterTimestamp,
11+
BadgesContainer,
12+
} from './style';
713
import { UserHoverProfile } from 'src/components/hoverProfile';
814
import ConditionalWrap from 'src/components/conditionalWrap';
915
import { MessagesContext } from 'src/components/messageGroup';
@@ -26,7 +32,10 @@ export default (props: Props) => {
2632
<ConditionalWrap
2733
condition={!!user.username}
2834
wrap={children => (
29-
<UserHoverProfile username={user.username}>
35+
<UserHoverProfile
36+
username={user.username}
37+
style={{ flexWrap: 'wrap', flex: '0 1 auto' }}
38+
>
3039
<Link
3140
to={`/users/${user.username}`}
3241
onClick={e => e.stopPropagation()}
@@ -40,17 +49,19 @@ export default (props: Props) => {
4049
<Name>{user.name}</Name>
4150
</ConditionalWrap>
4251

43-
{roles &&
44-
roles.map((role, index) => (
45-
<Badge
46-
type={role}
47-
key={index}
48-
onClick={e => e.stopPropagation()}
49-
/>
50-
))}
51-
{user.isPro && (
52-
<Badge type="pro" onClick={e => e.stopPropagation()} />
53-
)}
52+
<BadgesContainer>
53+
{roles &&
54+
roles.map((role, index) => (
55+
<Badge
56+
type={role}
57+
key={index}
58+
onClick={e => e.stopPropagation()}
59+
/>
60+
))}
61+
{user.isPro && (
62+
<Badge type="pro" onClick={e => e.stopPropagation()} />
63+
)}
64+
</BadgesContainer>
5465
<GutterTimestamp
5566
to={messageUrl}
5667
data-cy="message-timestamp"

src/components/message/style.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,46 @@ export const Byline = styled.span`
2020
color: ${props => props.theme.text.default};
2121
max-width: 100%;
2222
position: relative;
23+
flex-wrap: wrap;
24+
25+
a {
26+
display: flex;
27+
flex-wrap: wrap;
28+
}
29+
30+
@media (max-width: 400px) {
31+
flex-direction: column;
32+
align-items: flex-start;
33+
}
2334
`;
2435

2536
export const Name = styled.span`
2637
font-weight: 600;
2738
font-size: 15px;
2839
color: ${({ theme }) => theme.text.default};
2940
margin-right: 2px;
41+
display: flex;
3042
3143
&:hover {
3244
color: ${({ theme }) => theme.text.default};
3345
cursor: pointer;
3446
}
47+
48+
@media (max-width: 400px) {
49+
line-height: 1.4;
50+
}
3551
`;
3652

3753
export const Username = styled(Name)`
3854
font-weight: 400;
3955
margin-left: 2px;
4056
margin-right: 2px;
4157
color: ${props => props.theme.text.alt};
58+
display: flex;
59+
60+
@media (max-width: 400px) {
61+
line-height: 1.4;
62+
}
4263
`;
4364

4465
export const ActionsContainer = styled.span`
@@ -108,6 +129,10 @@ export const GutterTimestamp = styled(Link)`
108129
color: ${props => props.theme.text.placeholder};
109130
opacity: 0;
110131
${Truncate};
132+
133+
@media (max-width: 400px) {
134+
display: none !important;
135+
}
111136
`;
112137

113138
export const OuterMessageContainer = styled.div`
@@ -384,3 +409,11 @@ export const QuoteWrapper = styled.div`
384409
color: ${props => props.theme.text.alt};
385410
}
386411
`;
412+
413+
export const BadgesContainer = styled.div`
414+
display: flex;
415+
416+
@media (max-width: 400px) {
417+
margin-top: 4px;
418+
}
419+
`;

src/views/directMessages/components/style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export const SearchResultsDropdown = styled.ul`
283283
width: 320px;
284284
max-height: 420px;
285285
overflow-y: scroll;
286-
z-index: ${zIndex.dropdown};
286+
z-index: ${zIndex.dropDown};
287287
288288
@media (max-width: 768px) {
289289
width: 100%;

0 commit comments

Comments
 (0)