Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
4c718c4b9a
Коммит
2a35a97a18
@@ -331,7 +331,9 @@ function shouldSkipNotification(
|
|||||||
if (attachment.fields) {
|
if (attachment.fields) {
|
||||||
for (const field of attachment.fields) {
|
for (const field of attachment.fields) {
|
||||||
appendText(field.title);
|
appendText(field.title);
|
||||||
appendText(field.value);
|
if (typeof field.value === 'string') {
|
||||||
|
appendText(field.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ const ActionButton = ({
|
|||||||
(action.style.match('^#(?:[0-9a-fA-F]{3}){1,2}$') && action.style);
|
(action.style.match('^#(?:[0-9a-fA-F]{3}){1,2}$') && action.style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const name = action.name || action.id || '';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActionBtn
|
<ActionBtn
|
||||||
data-action-id={action.id}
|
data-action-id={action.id}
|
||||||
@@ -71,7 +73,7 @@ const ActionButton = ({
|
|||||||
text={actionExecutingMessage}
|
text={actionExecutingMessage}
|
||||||
>
|
>
|
||||||
<Markdown
|
<Markdown
|
||||||
message={action.name}
|
message={name}
|
||||||
options={markdownOptions}
|
options={markdownOptions}
|
||||||
/>
|
/>
|
||||||
</LoadingWrapper>
|
</LoadingWrapper>
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ export default class ActionMenu extends React.PureComponent<Props, State> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {action, disabled} = this.props;
|
const {action, disabled} = this.props;
|
||||||
|
const name = action.name || action.id || '';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PostContext.Consumer>
|
<PostContext.Consumer>
|
||||||
@@ -106,7 +107,7 @@ export default class ActionMenu extends React.PureComponent<Props, State> {
|
|||||||
<AutocompleteSelector
|
<AutocompleteSelector
|
||||||
providers={this.providers}
|
providers={this.providers}
|
||||||
onSelected={this.handleSelected}
|
onSelected={this.handleSelected}
|
||||||
placeholder={action.name}
|
placeholder={name}
|
||||||
inputClassName='post-attachment-dropdown'
|
inputClassName='post-attachment-dropdown'
|
||||||
value={this.state.value}
|
value={this.state.value}
|
||||||
toggleFocus={handlePopupOpened}
|
toggleFocus={handlePopupOpened}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import truncate from 'lodash/truncate';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import type {KeyboardEvent, MouseEvent, CSSProperties} from 'react';
|
import type {KeyboardEvent, MouseEvent, CSSProperties} from 'react';
|
||||||
|
|
||||||
import type {PostAction, PostActionOption} from '@mattermost/types/integration_actions';
|
import type {PostActionOption} from '@mattermost/types/integration_actions';
|
||||||
import type {
|
import type {
|
||||||
MessageAttachment as MessageAttachmentType,
|
MessageAttachment as MessageAttachmentType,
|
||||||
} from '@mattermost/types/message_attachments';
|
} from '@mattermost/types/message_attachments';
|
||||||
@@ -144,7 +144,7 @@ export default class MessageAttachment extends React.PureComponent<Props, State>
|
|||||||
|
|
||||||
const content = [] as JSX.Element[];
|
const content = [] as JSX.Element[];
|
||||||
|
|
||||||
actions.forEach((action: PostAction) => {
|
actions.forEach((action) => {
|
||||||
if (!action.id || !action.name) {
|
if (!action.id || !action.name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
import {isArrayOf} from './utilities';
|
import {isArrayOf} from './utilities';
|
||||||
|
|
||||||
export type PostAction = {
|
export type PostAction = {
|
||||||
id: string;
|
id?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
name: string;
|
name?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
style?: string;
|
style?: string;
|
||||||
data_source?: string;
|
data_source?: string;
|
||||||
@@ -20,19 +20,11 @@ export function isPostAction(v: unknown): v is PostAction {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!('id' in v)) {
|
if ('id' in v && typeof v.id !== 'string') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof v.id !== 'string') {
|
if ('name' in v && typeof v.name !== 'string') {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!('name' in v)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof v.name !== 'string') {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,8 +103,8 @@ function isMessageAttachment(v: unknown): v is MessageAttachment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type MessageAttachmentField = {
|
export type MessageAttachmentField = {
|
||||||
title: string;
|
title?: string;
|
||||||
value: any;
|
value?: unknown;
|
||||||
short?: boolean;
|
short?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user