fix lint
This commit is contained in:
parent
bf1db27824
commit
1ae1385d43
6 changed files with 51 additions and 55 deletions
|
@ -155,11 +155,11 @@ if (loginId) {
|
|||
if (!$i || $i.id !== loginId) {
|
||||
const account = await getAccountFromId(loginId);
|
||||
if (account) {
|
||||
login(account.token, target)
|
||||
login(account.token, target);
|
||||
}
|
||||
}
|
||||
|
||||
history.replaceState({ misskey: 'loginId' }, '', target)
|
||||
history.replaceState({ misskey: 'loginId' }, '', target);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
@ -252,7 +252,7 @@ navigator.serviceWorker.addEventListener('message', ev => {
|
|||
return getAccountFromId(data.loginId).then(account => {
|
||||
if (!account) return;
|
||||
return login(account.token, data.url);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
switch (data.order) {
|
||||
|
|
|
@ -3,5 +3,5 @@ import { get } from 'idb-keyval';
|
|||
export async function getAccountFromId(id: string) {
|
||||
const accounts = await get('accounts') as { token: string; id: string; }[];
|
||||
if (!accounts) console.log('Accounts are not recorded');
|
||||
return accounts.find(e => e.id === id)
|
||||
return accounts.find(e => e.id === id);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import { getAccountFromId } from '@/scripts/get-account-from-id';
|
|||
import { appendLoginId } from '@/scripts/login-id';
|
||||
|
||||
export async function api(endpoint: string, userId: string, options: any = {}) {
|
||||
const account = await getAccountFromId(userId)
|
||||
const account = await getAccountFromId(userId);
|
||||
if (!account) return;
|
||||
|
||||
return fetch(`${origin}/api/${endpoint}`, {
|
||||
|
@ -26,24 +26,24 @@ export async function api(endpoint: string, userId: string, options: any = {}) {
|
|||
|
||||
if (res.status === 200) return res.json();
|
||||
return;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// rendered acctからユーザーを開く
|
||||
export function openUser(acct: string, loginId: string) {
|
||||
return openClient('push', `/@${acct}`, loginId, { acct })
|
||||
return openClient('push', `/@${acct}`, loginId, { acct });
|
||||
}
|
||||
|
||||
// noteIdからノートを開く
|
||||
export function openNote(noteId: string, loginId: string) {
|
||||
return openClient('push', `/notes/${noteId}`, loginId, { noteId })
|
||||
return openClient('push', `/notes/${noteId}`, loginId, { noteId });
|
||||
}
|
||||
|
||||
export async function openChat(body: any, loginId: string) {
|
||||
if (body.groupId === null) {
|
||||
return openClient('push', `/my/messaging/${renderAcct(body.user)}`, loginId, { body })
|
||||
return openClient('push', `/my/messaging/${renderAcct(body.user)}`, loginId, { body });
|
||||
} else {
|
||||
return openClient('push', `/my/messaging/group/${body.groupId}`, loginId, { body })
|
||||
return openClient('push', `/my/messaging/group/${body.groupId}`, loginId, { body });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ export async function openPost(options: any, loginId: string) {
|
|||
if (options.reply) url += `replyId=${options.reply.id}&`;
|
||||
if (options.renote) url += `renoteId=${options.renote.id}&`;
|
||||
|
||||
return openClient('post', url, loginId, { options })
|
||||
return openClient('post', url, loginId, { options });
|
||||
}
|
||||
|
||||
export async function openClient(order: swMessageOrderType, url: string, loginId: string, query: any = {}) {
|
||||
|
|
|
@ -169,7 +169,7 @@ self.addEventListener('notificationclick', ev => {
|
|||
notification.close();
|
||||
}
|
||||
|
||||
})())
|
||||
})());
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclose', ev => {
|
||||
|
@ -189,7 +189,7 @@ self.addEventListener('message', async ev => {
|
|||
await caches.keys()
|
||||
.then(cacheNames => Promise.all(
|
||||
cacheNames.map(name => caches.delete(name))
|
||||
))
|
||||
));
|
||||
return; // TODO
|
||||
}
|
||||
|
||||
|
|
|
@ -62,12 +62,10 @@ export async function readUserMessagingMessage(
|
|||
isRead: false,
|
||||
},
|
||||
take: 1
|
||||
})
|
||||
});
|
||||
|
||||
if (!count) {
|
||||
pushNotification(userId, 'readAllMessagingMessagesOfARoom', { userId: otherpartyId });
|
||||
} else {
|
||||
console.log('count')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,12 +129,10 @@ export async function readGroupMessagingMessage(
|
|||
.andWhere('message.userId != :userId', { userId: userId })
|
||||
.andWhere('NOT (:userId = ANY(message.reads))', { userId: userId })
|
||||
.andWhere('message.createdAt > :joinedAt', { joinedAt: joining.createdAt }) // 自分が加入する前の会話については、未読扱いしない
|
||||
.getOne().then(x => x != null)
|
||||
.getOne().then(x => x != null);
|
||||
|
||||
if (!unreadExist) {
|
||||
pushNotification(userId, 'readAllMessagingMessagesOfARoom', { groupId });
|
||||
} else {
|
||||
console.log('unread exist')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue