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