Fix marker for undefined
This commit is contained in:
parent
a67f0fd408
commit
3e4cd3f655
|
@ -598,12 +598,15 @@ ipcMain.on('reset-badge', () => {
|
|||
}
|
||||
})
|
||||
|
||||
ipcMain.handle('confirm-timelines', async (_event: IpcMainInvokeEvent, account: LocalAccount): Promise<EnabledTimelines> => {
|
||||
const proxy = await proxyConfiguration.forMastodon()
|
||||
const timelines = await confirm(account, proxy)
|
||||
ipcMain.handle(
|
||||
'confirm-timelines',
|
||||
async (_event: IpcMainInvokeEvent, account: LocalAccount): Promise<EnabledTimelines> => {
|
||||
const proxy = await proxyConfiguration.forMastodon()
|
||||
const timelines = await confirm(account, proxy)
|
||||
|
||||
return timelines
|
||||
})
|
||||
return timelines
|
||||
}
|
||||
)
|
||||
|
||||
// user streaming
|
||||
const userStreamings: { [key: string]: UserStreaming | null } = {}
|
||||
|
@ -1167,16 +1170,19 @@ ipcMain.handle('get-mentions-marker', async (_: IpcMainInvokeEvent, ownerID: str
|
|||
return marker
|
||||
})
|
||||
|
||||
ipcMain.on('save-marker', async (_: IpcMainEvent, marker: LocalMarker): Promise<LocalMarker | null> => {
|
||||
if (marker.owner_id === null || marker.owner_id === undefined || marker.owner_id === '') {
|
||||
return null
|
||||
ipcMain.on(
|
||||
'save-marker',
|
||||
async (_: IpcMainEvent, marker: LocalMarker): Promise<LocalMarker | null> => {
|
||||
if (marker.owner_id === null || marker.owner_id === undefined || marker.owner_id === '') {
|
||||
return null
|
||||
}
|
||||
if (markerRepo === null) {
|
||||
return null
|
||||
}
|
||||
const res = await markerRepo.save(marker)
|
||||
return res
|
||||
}
|
||||
if (markerRepo === null) {
|
||||
return null
|
||||
}
|
||||
const res = await markerRepo.save(marker)
|
||||
return res
|
||||
})
|
||||
)
|
||||
|
||||
// hashtag
|
||||
ipcMain.handle('save-hashtag', async (_: IpcMainInvokeEvent, tag: string) => {
|
||||
|
@ -1202,17 +1208,23 @@ ipcMain.handle('list-fonts', async (_: IpcMainInvokeEvent) => {
|
|||
})
|
||||
|
||||
// Settings
|
||||
ipcMain.handle('get-account-setting', async (_: IpcMainInvokeEvent, accountID: string): Promise<Setting> => {
|
||||
const settings = new Settings(settingsDBPath)
|
||||
const setting = await settings.get(accountID)
|
||||
return setting
|
||||
})
|
||||
ipcMain.handle(
|
||||
'get-account-setting',
|
||||
async (_: IpcMainInvokeEvent, accountID: string): Promise<Setting> => {
|
||||
const settings = new Settings(settingsDBPath)
|
||||
const setting = await settings.get(accountID)
|
||||
return setting
|
||||
}
|
||||
)
|
||||
|
||||
ipcMain.handle('update-account-setting', async (_: IpcMainInvokeEvent, setting: Setting): Promise<BaseSettings> => {
|
||||
const settings = new Settings(settingsDBPath)
|
||||
const res = await settings.update(setting)
|
||||
return res
|
||||
})
|
||||
ipcMain.handle(
|
||||
'update-account-setting',
|
||||
async (_: IpcMainInvokeEvent, setting: Setting): Promise<BaseSettings> => {
|
||||
const settings = new Settings(settingsDBPath)
|
||||
const res = await settings.update(setting)
|
||||
return res
|
||||
}
|
||||
)
|
||||
|
||||
// Cache
|
||||
ipcMain.handle('get-cache-hashtags', async (_: IpcMainInvokeEvent) => {
|
||||
|
@ -1670,10 +1682,11 @@ const getMarker = async (client: MegalodonInterface, accountID: string): Promise
|
|||
} catch (err) {
|
||||
console.warn(err)
|
||||
}
|
||||
if ((serverMarker as Entity.Marker).notifications !== undefined) {
|
||||
const s = serverMarker as Entity.Marker
|
||||
if (s.notifications !== undefined) {
|
||||
return {
|
||||
timeline: 'notifications',
|
||||
last_read_id: (serverMarker as Entity.Marker).notifications.last_read_id
|
||||
last_read_id: s.notifications.last_read_id
|
||||
} as LocalMarker
|
||||
}
|
||||
if (markerRepo === null) {
|
||||
|
|
|
@ -263,10 +263,11 @@ const actions: ActionTree<HomeState, RootState> = {
|
|||
} catch (err) {
|
||||
console.warn(err)
|
||||
}
|
||||
if ((serverMarker as Entity.Marker).home !== undefined) {
|
||||
const s = serverMarker as Entity.Marker
|
||||
if (s.home !== undefined) {
|
||||
return {
|
||||
timeline: 'home',
|
||||
last_read_id: (serverMarker as Entity.Marker).home.last_read_id
|
||||
last_read_id: s.home.last_read_id
|
||||
} as LocalMarker
|
||||
}
|
||||
const localMarker: LocalMarker | null = await win.ipcRenderer.invoke('get-home-marker', rootState.TimelineSpace.account._id)
|
||||
|
|
|
@ -241,10 +241,11 @@ const actions: ActionTree<NotificationsState, RootState> = {
|
|||
} catch (err) {
|
||||
console.warn(err)
|
||||
}
|
||||
if ((serverMarker as Entity.Marker).notifications !== undefined) {
|
||||
const s = serverMarker as Entity.Marker
|
||||
if (s.notifications !== undefined) {
|
||||
return {
|
||||
timeline: 'notifications',
|
||||
last_read_id: (serverMarker as Entity.Marker).notifications.last_read_id
|
||||
last_read_id: s.notifications.last_read_id
|
||||
} as LocalMarker
|
||||
}
|
||||
const localMarker: LocalMarker | null = await win.ipcRenderer.invoke('get-notifications-marker', rootState.TimelineSpace.account._id)
|
||||
|
|
Loading…
Reference in New Issue