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:
Kyriakos Z
2022-12-20 21:54:25 +02:00
committed by GitHub
parent 4206764881
commit bf5783252e
9 changed files with 49 additions and 45 deletions

View File

@@ -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'});

View File

@@ -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 (