1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-11 18:13:52 +02:00

Merge branch 'main' into compliance-history-export

This commit is contained in:
Mattermost Build 2023-02-01 16:33:20 +02:00 committed by GitHub
commit 25f7130719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 65 additions and 20 deletions

View File

@ -240,6 +240,20 @@ exports[`components/cardDialog limited card shows hidden view (no toolbar) 1`] =
<div
class="toolbar--right"
>
<div
class="d-flex"
>
<button
type="button"
>
<i
class="CompassIcon icon-paperclip"
/>
<span>
Attach
</span>
</button>
</div>
<button
aria-label="Close dialog"
title="Close dialog"

View File

@ -159,7 +159,7 @@ const CardDialog = (props: Props): JSX.Element => {
const attachmentBlock = createAttachmentBlock(uploadingBlock)
attachmentBlock.isUploading = true
dispatch(updateAttachments([attachmentBlock]))
if (attachment.size > clientConfig.maxFileSize) {
if (attachment.size > clientConfig.maxFileSize && Utils.isFocalboardPlugin()) {
removeUploadingAttachment(uploadingBlock)
sendFlashMessage({content: intl.formatMessage({id: 'AttachmentBlock.failed', defaultMessage: 'Unable to upload the file. Attachment size limit reached.'}), severity: 'normal'})
} else {
@ -262,7 +262,10 @@ const CardDialog = (props: Props): JSX.Element => {
</>
)
return (<>{attachBtn()}{following ? unfollowBtn : followBtn}</>)
if (!isTemplate && Utils.isFocalboardPlugin() && !card?.limited) {
return (<>{attachBtn()}{following ? unfollowBtn : followBtn}</>)
}
return (<>{attachBtn()}</>)
}
const followingCards = useAppSelector(getUserBlockSubscriptionList)
@ -276,7 +279,7 @@ const CardDialog = (props: Props): JSX.Element => {
className='cardDialog'
onClose={props.onClose}
toolsMenu={!props.readonly && !card?.limited && menu}
toolbar={!isTemplate && Utils.isFocalboardPlugin() && !card?.limited && toolbar}
toolbar={toolbar}
>
{isTemplate &&
<div className='banner'>

View File

@ -103,6 +103,8 @@ const TableRow = (props: Props) => {
} else if (template && template.type === 'updatedBy') {
groupValue = card.modifiedBy
}
} else if (Array.isArray(groupValue)) {
groupValue = groupValue[0]
}
if (collapsedOptionIds.indexOf(groupValue) > -1) {
className += ' hidden'

View File

@ -665,19 +665,39 @@ class Mutator {
const newBlockIDs: string[] = []
if (propertyTemplate.type !== newType) {
if (propertyTemplate.type === 'select' || propertyTemplate.type === 'multiSelect') { // If the old type was either select or multiselect
const isNewTypeSelectOrMulti = newType === 'select' || newType === 'multiSelect'
const isNewTypeSelectOrMulti = newType === 'select' || newType === 'multiSelect'
const isNewTypePersonOrMulti = newType === 'person' || newType === 'multiPerson'
const isOldTypeSelectOrMulti = propertyTemplate.type === 'select' || propertyTemplate.type === 'multiSelect'
const isOldTypePersonOrMulti = propertyTemplate.type === 'person' || propertyTemplate.type === 'multiPerson'
// If the old type was either select/multiselect or person/multiperson
if (isOldTypeSelectOrMulti || isOldTypePersonOrMulti) {
for (const card of cards) {
const oldValue = Array.isArray(card.fields.properties[propertyTemplate.id]) ? (card.fields.properties[propertyTemplate.id].length > 0 && card.fields.properties[propertyTemplate.id][0]) : card.fields.properties[propertyTemplate.id]
// if array get first value, if exists
const oldValue = Array.isArray(card.fields.properties[propertyTemplate.id]) ? (card.fields.properties[propertyTemplate.id].length > 0 && card.fields.properties[propertyTemplate.id][0] as string) : card.fields.properties[propertyTemplate.id] as string
if (oldValue) {
const newValue = isNewTypeSelectOrMulti ? propertyTemplate.options.find((o) => o.id === oldValue)?.id : propertyTemplate.options.find((o) => o.id === oldValue)?.value
let newValue: string | undefined
if (isOldTypePersonOrMulti) {
if (isNewTypePersonOrMulti) {
newValue = oldValue
}
} else if (isNewTypeSelectOrMulti) {
if (isOldTypeSelectOrMulti) {
newValue = propertyTemplate.options.find((o) => o.id === oldValue)?.id
} else {
newValue = propertyTemplate.options.find((o) => o.id === oldValue)?.value
}
}
const newCard = createCard(card)
if (newValue) {
newCard.fields.properties[propertyTemplate.id] = newType === 'multiSelect' ? [newValue] : newValue
if (newType === 'multiSelect' || newType === 'multiPerson') {
newCard.fields.properties[propertyTemplate.id] = [newValue]
} else {
newCard.fields.properties[propertyTemplate.id] = newValue
}
} else {
// This was an invalid select option, so delete it
// This was an invalid select option or old person id, so delete it
delete newCard.fields.properties[propertyTemplate.id]
}
@ -690,7 +710,7 @@ class Mutator {
newTemplate.options = propertyTemplate.options
}
}
} else if (newType === 'select' || newType === 'multiSelect') { // if the new type is either select or multiselect
} else if (isNewTypeSelectOrMulti) { // if the new type is either select or multiselect - old type is other
// Map values to new template option IDs
for (const card of cards) {
const oldValue = card.fields.properties[propertyTemplate.id] as string
@ -708,6 +728,18 @@ class Mutator {
const newCard = createCard(card)
newCard.fields.properties[propertyTemplate.id] = newType === 'multiSelect' ? [option.id] : option.id
newBlocks.push(newCard)
newBlockIDs.push(newCard.id)
oldBlocks.push(card)
}
}
} else if (isNewTypePersonOrMulti) { // if the new type is either person or multiperson - old type is other
// Clear old values
for (const card of cards) {
const oldValue = card.fields.properties[propertyTemplate.id] as string
if (oldValue) {
const newCard = createCard(card)
delete newCard.fields.properties[propertyTemplate.id]
newBlocks.push(newCard)
newBlockIDs.push(newCard.id)
oldBlocks.push(card)

View File

@ -85,7 +85,7 @@ const ConfirmPerson = (props: PropertyProps): JSX.Element => {
setConfirmAddUser(null)
await mutator.createBoardMember(newMember)
if (userIDs) {
if (propertyTemplate.type === 'multiPerson') {
await mutator.changePropertyValue(board.id, card, propertyTemplate.id, [...userIDs, newMember.userId])
} else {
await mutator.changePropertyValue(board.id, card, propertyTemplate.id, newMember.userId)

View File

@ -1,12 +1,6 @@
@import '../../styles/z-index';
.status-dropdown-menu {
> .Menu {
position: inherit;
}
}
.Menu {
.Menu:not(#statusDropdownMenu) {
@include z-index(menu);
display: flex;
flex-direction: column;
@ -179,7 +173,7 @@
}
}
.Menu,
.Menu:not(#statusDropdownMenu),
.SubMenuOption .SubMenu {
@media screen and (max-width: 430px) {
position: fixed;