mirror of
https://github.com/mattermost/focalboard.git
synced 2025-03-20 20:45:00 +02:00
Showing properly channel association in DMs and GMs (#3529)
This commit is contained in:
parent
6350263f68
commit
d754b498a1
@ -20,6 +20,7 @@ import (
|
|||||||
"github.com/mattermost/focalboard/server/services/permissions"
|
"github.com/mattermost/focalboard/server/services/permissions"
|
||||||
"github.com/mattermost/focalboard/server/utils"
|
"github.com/mattermost/focalboard/server/utils"
|
||||||
|
|
||||||
|
mmModel "github.com/mattermost/mattermost-server/v6/model"
|
||||||
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
"github.com/mattermost/mattermost-server/v6/shared/mlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -2389,8 +2390,10 @@ func (a *API) handleGetChannel(w http.ResponseWriter, r *http.Request) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if channel.TeamId != teamID {
|
if channel.TeamId != teamID {
|
||||||
a.errorResponse(w, r.URL.Path, http.StatusNotFound, "", nil)
|
if channel.Type != mmModel.ChannelTypeDirect && channel.Type != mmModel.ChannelTypeGroup {
|
||||||
return
|
a.errorResponse(w, r.URL.Path, http.StatusNotFound, "", nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(channel)
|
data, err := json.Marshal(channel)
|
||||||
|
@ -10,6 +10,7 @@ import Menu from '../../widgets/menu'
|
|||||||
import {createBoard} from '../../blocks/board'
|
import {createBoard} from '../../blocks/board'
|
||||||
import {useAppSelector} from '../../store/hooks'
|
import {useAppSelector} from '../../store/hooks'
|
||||||
import {getCurrentBoard} from '../../store/boards'
|
import {getCurrentBoard} from '../../store/boards'
|
||||||
|
import {getBoardUsers} from '../../store/users'
|
||||||
import {Channel} from '../../store/channels'
|
import {Channel} from '../../store/channels'
|
||||||
import {Utils} from '../../utils'
|
import {Utils} from '../../utils'
|
||||||
import mutator from '../../mutator'
|
import mutator from '../../mutator'
|
||||||
@ -24,9 +25,14 @@ import ConfirmationDialogBox from "../confirmationDialogBox"
|
|||||||
|
|
||||||
import BoardPermissionGate from '../permissions/boardPermissionGate'
|
import BoardPermissionGate from '../permissions/boardPermissionGate'
|
||||||
|
|
||||||
const ChannelPermissionsRow = (): JSX.Element => {
|
type Props = {
|
||||||
|
teammateNameDisplay: string,
|
||||||
|
}
|
||||||
|
|
||||||
|
const ChannelPermissionsRow = (props: Props): JSX.Element => {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const board = useAppSelector(getCurrentBoard)
|
const board = useAppSelector(getCurrentBoard)
|
||||||
|
const users = useAppSelector(getBoardUsers)
|
||||||
const [linkedChannel, setLinkedChannel] = useState<Channel|null>(null)
|
const [linkedChannel, setLinkedChannel] = useState<Channel|null>(null)
|
||||||
const [showUnlinkChannelConfirmation, setShowUnlinkChannelConfirmation] = useState<boolean>(false)
|
const [showUnlinkChannelConfirmation, setShowUnlinkChannelConfirmation] = useState<boolean>(false)
|
||||||
|
|
||||||
@ -72,6 +78,17 @@ const ChannelPermissionsRow = (): JSX.Element => {
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const getDMName = () => {
|
||||||
|
const userIds = linkedChannel.name.split("__")
|
||||||
|
if (userIds.length !== 2) {
|
||||||
|
Utils.logError('Invalid DM channel name, unable to get user ids')
|
||||||
|
}
|
||||||
|
let result = Utils.getUserDisplayName(users[userIds[0]], props.teammateNameDisplay)
|
||||||
|
result += ", "
|
||||||
|
result += Utils.getUserDisplayName(users[userIds[1]], props.teammateNameDisplay)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='user-item channel-item'>
|
<div className='user-item channel-item'>
|
||||||
{showUnlinkChannelConfirmation && confirmationDialog}
|
{showUnlinkChannelConfirmation && confirmationDialog}
|
||||||
@ -79,8 +96,17 @@ const ChannelPermissionsRow = (): JSX.Element => {
|
|||||||
<span className='user-item__img'>
|
<span className='user-item__img'>
|
||||||
{linkedChannel.type === 'P' && <PrivateIcon/>}
|
{linkedChannel.type === 'P' && <PrivateIcon/>}
|
||||||
{linkedChannel.type === 'O' && <PublicIcon/>}
|
{linkedChannel.type === 'O' && <PublicIcon/>}
|
||||||
|
{linkedChannel.type === 'D' && <PrivateIcon/>}
|
||||||
|
{linkedChannel.type === 'G' && <PrivateIcon/>}
|
||||||
</span>
|
</span>
|
||||||
<div className='ml-3'><strong>{linkedChannel.display_name}</strong></div>
|
{linkedChannel.type === 'D' && (
|
||||||
|
<div className='ml-3'>
|
||||||
|
<strong>
|
||||||
|
{getDMName()}
|
||||||
|
</strong>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{linkedChannel.type !== 'D' && <div className='ml-3'><strong>{linkedChannel.display_name}</strong></div>}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<BoardPermissionGate permissions={[Permission.ManageBoardRoles]}>
|
<BoardPermissionGate permissions={[Permission.ManageBoardRoles]}>
|
||||||
|
@ -395,7 +395,7 @@ export default function ShareBoardDialog(props: Props): JSX.Element {
|
|||||||
</BoardPermissionGate>
|
</BoardPermissionGate>
|
||||||
<div className='user-items'>
|
<div className='user-items'>
|
||||||
<TeamPermissionsRow/>
|
<TeamPermissionsRow/>
|
||||||
<ChannelPermissionsRow/>
|
<ChannelPermissionsRow teammateNameDisplay={me?.props?.teammateNameDisplay || clientConfig.teammateNameDisplay}/>
|
||||||
|
|
||||||
{boardUsers.map((user) => {
|
{boardUsers.map((user) => {
|
||||||
if (!members[user.id]) {
|
if (!members[user.id]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user