forked from Ivasoft/mattermost-mobile
MM-49219: fixes post priority (#6880)
We have changed how priority gets saved in the server, so now instead of post.props we are using post.metadata.priority. This commit adds the relevant changes for posts' priority to work in the mobile app.
This commit is contained in:
@@ -35,7 +35,7 @@ const style = StyleSheet.create({
|
||||
});
|
||||
|
||||
type Props = {
|
||||
label: PostPriorityType;
|
||||
label: PostPriorityData['priority'];
|
||||
};
|
||||
|
||||
const PostPriorityLabel = ({label}: Props) => {
|
||||
@@ -48,7 +48,7 @@ const PostPriorityLabel = ({label}: Props) => {
|
||||
containerStyle.push(style.urgent);
|
||||
iconName = 'alert-outline';
|
||||
labelText = intl.formatMessage({id: 'post_priority.label.urgent', defaultMessage: 'URGENT'});
|
||||
} else {
|
||||
} else if (label === PostPriorityType.IMPORTANT) {
|
||||
containerStyle.push(style.important);
|
||||
iconName = 'alert-circle-outline';
|
||||
labelText = intl.formatMessage({id: 'post_priority.label.important', defaultMessage: 'IMPORTANT'});
|
||||
|
||||
@@ -14,10 +14,6 @@ import {typography} from '@utils/typography';
|
||||
|
||||
import PostPriorityPickerItem from './post_priority_picker_item';
|
||||
|
||||
export type PostPriorityData = {
|
||||
priority: PostPriorityType;
|
||||
};
|
||||
|
||||
type Props = {
|
||||
data: PostPriorityData;
|
||||
onSubmit: (data: PostPriorityData) => void;
|
||||
@@ -61,8 +57,8 @@ const PostPriorityPicker = ({data, onSubmit}: Props) => {
|
||||
// For now, we just have one option but the spec suggest we have more in the next phase
|
||||
// const [data, setData] = React.useState<PostPriorityData>(defaultData);
|
||||
|
||||
const handleUpdatePriority = React.useCallback((priority: PostPriorityType) => {
|
||||
onSubmit({priority});
|
||||
const handleUpdatePriority = React.useCallback((priority: PostPriorityData['priority']) => {
|
||||
onSubmit({priority: priority || ''});
|
||||
}, [onSubmit]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user