mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
fixing topic load
This commit is contained in:
parent
79d308a627
commit
16f829d6a5
@ -126,11 +126,13 @@ export function useConversationContext() {
|
|||||||
if (entry.data) {
|
if (entry.data) {
|
||||||
if (entry.data.detail) {
|
if (entry.data.detail) {
|
||||||
const item = mapTopicEntry(entry);
|
const item = mapTopicEntry(entry);
|
||||||
|
setTopicItem(cardId, channelId, item);
|
||||||
topics.current.set(item.topicId, item);
|
topics.current.set(item.topicId, item);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const topic = await getTopic(cardId, channelId, entry.id);
|
const topic = await getTopic(cardId, channelId, entry.id);
|
||||||
const item = mapTopicEntry(entry);
|
const item = mapTopicEntry(entry);
|
||||||
|
setTopicItem(cardId, channelId, item);
|
||||||
topics.current.set(item.topicId, item);
|
topics.current.set(item.topicId, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState, useRef, useContext } from 'react';
|
import { useEffect, useState, useRef, useContext } from 'react';
|
||||||
import SQLite from "react-native-sqlite-storage";
|
import SQLite from "react-native-sqlite-storage";
|
||||||
|
|
||||||
const DATABAG_DB = 'db_v_110.db';
|
const DATABAG_DB = 'db_v_113.db';
|
||||||
|
|
||||||
export function useStoreContext() {
|
export function useStoreContext() {
|
||||||
const [state, setState] = useState({});
|
const [state, setState] = useState({});
|
||||||
@ -239,7 +239,7 @@ export function useStoreContext() {
|
|||||||
},
|
},
|
||||||
setChannelTopicItem: async (guid, channelId, topic) => {
|
setChannelTopicItem: async (guid, channelId, topic) => {
|
||||||
const { topicId, revision, detailRevision, detail } = topic;
|
const { topicId, revision, detailRevision, detail } = topic;
|
||||||
await db.current.executeSql(`INSERT OR REPLACE INTO channel_topic_${guid} (channel_id, topic_id, revision, detail_revision, blocked detail, unsealed_detail) values (?, ?, ?, ?, false, ?, null);`, [channelId, topicId, revision, detailRevision, encodeObject(detail)]);
|
await db.current.executeSql(`INSERT OR REPLACE INTO channel_topic_${guid} (channel_id, topic_id, revision, detail_revision, blocked, detail, unsealed_detail) values (?, ?, ?, ?, false, ?, null);`, [channelId, topicId, revision, detailRevision, encodeObject(detail)]);
|
||||||
},
|
},
|
||||||
setChannelTopicItemUnsealedDetail: async (guid, channelId, topicId, revision, unsealed) => {
|
setChannelTopicItemUnsealedDetail: async (guid, channelId, topicId, revision, unsealed) => {
|
||||||
await db.current.executeSql(`UPDATE channel_topic_${guid} set unsealed_detail=? where detail_revision=? AND channel_id=? AND topic_id=?`, [encodeObject(unsealed), revision, channelId, topicId]);
|
await db.current.executeSql(`UPDATE channel_topic_${guid} set unsealed_detail=? where detail_revision=? AND channel_id=? AND topic_id=?`, [encodeObject(unsealed), revision, channelId, topicId]);
|
||||||
@ -329,8 +329,8 @@ export function useStoreContext() {
|
|||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
setCardChannelTopicItem: async (guid, cardId, channelId, topic) => {
|
setCardChannelTopicItem: async (guid, cardId, channelId, topic) => {
|
||||||
const { id, revision, data } = topic;
|
const { topicId, revision, detailRevision, detail } = topic;
|
||||||
await db.current.executeSql(`INSERT OR REPLACE INTO card_channel_topic_${guid} (card_id, channel_id, topic_id, revision, detail_revision, detail, unsealed_detail) values (?, ?, ?, ?, ?, ?, null);`, [cardId, channelId, id, revision, data.detailRevision, encodeObject(data.topicDetail)]);
|
await db.current.executeSql(`INSERT OR REPLACE INTO card_channel_topic_${guid} (card_id, channel_id, topic_id, revision, detail_revision, detail, unsealed_detail) values (?, ?, ?, ?, ?, ?, null);`, [cardId, channelId, topicId, revision, detailRevision, encodeObject(detail)]);
|
||||||
},
|
},
|
||||||
setCardChannelTopicItemUnsealedDetail: async (guid, cardId, channelId, topicId, revision, unsealed) => {
|
setCardChannelTopicItemUnsealedDetail: async (guid, cardId, channelId, topicId, revision, unsealed) => {
|
||||||
await db.current.executeSql(`UPDATE card_channel_topic_${guid} set unsealed_detail=? where detail_revision=? AND card_id=? AND channel_id=? AND topic_id=?`, [encodeObject(unsealed), revision, cardId, channelId, topicId]);
|
await db.current.executeSql(`UPDATE card_channel_topic_${guid} set unsealed_detail=? where detail_revision=? AND card_id=? AND channel_id=? AND topic_id=?`, [encodeObject(unsealed), revision, cardId, channelId, topicId]);
|
||||||
|
@ -19,7 +19,7 @@ export function Conversation({ navigation, cardId, channelId, closeConversation,
|
|||||||
navigation.setOptions({
|
navigation.setOptions({
|
||||||
headerTitle: () => (
|
headerTitle: () => (
|
||||||
<View style={styles.title}>
|
<View style={styles.title}>
|
||||||
<Text style={styles.titletext}>{ state.subject }</Text>
|
<Text style={styles.titletext} numberOfLines={1} ellipsizeMode={'tail'}>{ state.subject }</Text>
|
||||||
</View>
|
</View>
|
||||||
),
|
),
|
||||||
headerRight: () => (
|
headerRight: () => (
|
||||||
|
Loading…
Reference in New Issue
Block a user