handle conflicted note

This commit is contained in:
ammarahm-ed
2020-03-31 10:55:19 +05:00
parent 3c34a75cfb
commit c97f669e01
2 changed files with 8 additions and 3 deletions

View File

@@ -152,6 +152,7 @@ const MergeEditor = () => {
delta: primaryDelta, delta: primaryDelta,
}, },
id: note.id, id: note.id,
conflicted: false,
}); });
} else if (keepContentFrom === 'secondary') { } else if (keepContentFrom === 'secondary') {
await db.notes.add({ await db.notes.add({
@@ -160,6 +161,7 @@ const MergeEditor = () => {
delta: secondaryDelta, delta: secondaryDelta,
}, },
id: note.id, id: note.id,
conflicted: false,
}); });
} }
@@ -189,7 +191,7 @@ const MergeEditor = () => {
const show = async item => { const show = async item => {
note = item; note = item;
primaryDelta = await db.notes.note(note.id).delta(); primaryDelta = await db.notes.note(note.id).delta();
secondaryDelta = await db.notes.note(note.id).delta(); secondaryDelta = await db.notes.note(note.id).delta().conflicted;
setVisible(true); setVisible(true);
postMessageToPrimaryWebView({ postMessageToPrimaryWebView({
type: 'delta', type: 'delta',

View File

@@ -86,8 +86,11 @@ export default class NoteItem extends React.Component {
activeOpacity={0.8} activeOpacity={0.8}
onLongPress={() => onLongPress()} onLongPress={() => onLongPress()}
onPress={() => { onPress={() => {
eSendEvent(eShowMergeDialog, item); if (item.conflicted) {
return; eSendEvent(eShowMergeDialog, item);
return;
}
if (this.props.selectionMode) { if (this.props.selectionMode) {
this.props.onLongPress(); this.props.onLongPress();
return; return;