Skip to content

Commit

Permalink
Fix implicit team system messages
Browse files Browse the repository at this point in the history
  • Loading branch information
joshblum committed Oct 3, 2019
1 parent 4dbae41 commit fb86485
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,16 @@ const mapDispatchToProps = dispatch => ({
path: [{props: {conversationIDKey: conversationIDKey, tab: 'settings'}, selected: 'chatInfoPanel'}],
})
),
_onViewTeam: (teamname: string) => {
dispatch(RouteTreeGen.createNavigateAppend({path: [teamsTab, {props: {teamname}, selected: 'team'}]}))
_onViewTeam: (teamname: string, conversationIDKey) => {
if (teamname) {
dispatch(RouteTreeGen.createNavigateAppend({path: [teamsTab, {props: {teamname}, selected: 'team'}]}))
} else {
dispatch(
RouteTreeGen.createNavigateAppend({
path: [{props: {conversationIDKey: conversationIDKey, tab: 'settings'}, selected: 'chatInfoPanel'}],
})
)
}
},
})

Expand All @@ -45,7 +53,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps: OwnProps) => ({
isAdmin: stateProps.isAdmin,
onManageChannels: () => dispatchProps._onManageChannels(stateProps.teamname),
onManageNotifications: () => dispatchProps._onManageNotifications(ownProps.message.conversationIDKey),
onViewTeam: () => dispatchProps._onViewTeam(stateProps.teamname),
onViewTeam: () => dispatchProps._onViewTeam(stateProps.teamname, ownProps.message.conversationIDKey),
role: stateProps.role,
teamname: stateProps.teamname,
timestamp: stateProps.timestamp,
Expand Down
27 changes: 16 additions & 11 deletions shared/chat/conversation/messages/system-added-to-team/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ const ManageComponent = (props: Props) => {
<Kb.Text onClick={props.onManageNotifications} type={textType} center={true}>
Manage phone and computer notifications
</Kb.Text>
<Kb.Text onClick={props.onManageChannels} type={textType}>
Browse other channels
</Kb.Text>
{props.teamname && (
<Kb.Text onClick={props.onManageChannels} type={textType}>
Browse other channels
</Kb.Text>
)}
</Kb.Box>
)
} else if (props.isAdmin) {
Expand Down Expand Up @@ -95,14 +97,17 @@ const YouAddedToTeam = (props: Props) => {
style={{color: Styles.globalColors.black_50}}
>
{youOrUsername({capitalize: true, username: adder, you})} added{' '}
{youOrUsername({adder, capitalize: false, username: addee, you})} to{' '}
<Kb.Text
onClick={onViewTeam}
style={{color: Styles.globalColors.black_50}}
type="BodySmallSemiboldSecondaryLink"
>
{teamname}
</Kb.Text>
{youOrUsername({adder, capitalize: false, username: addee, you})}
{teamname && ` to `}
{teamname && (
<Kb.Text
onClick={onViewTeam}
style={{color: Styles.globalColors.black_50}}
type="BodySmallSemiboldSecondaryLink"
>
{teamname}
</Kb.Text>
)}
{typeToLabelWithBots[props.role] && ` as a ${typeToLabelWithBots[role].toLowerCase()}`}.{' '}
<Kb.Text type="BodySmallSemibold">
Say hi!{' '}
Expand Down

0 comments on commit fb86485

Please sign in to comment.