mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 11:06:25 +08:00
feat(core): duplicated calendar subscription notification (#12364)
This commit is contained in:
+12
-1
@@ -55,9 +55,20 @@ const AddSubscription = () => {
|
||||
}, []);
|
||||
|
||||
const handleAddSub = useCallback(() => {
|
||||
const _url = url.trim();
|
||||
const exists = calendar.getSubscription(_url);
|
||||
if (exists) {
|
||||
notify.error({
|
||||
title: t['com.affine.integration.calendar.new-duplicate-error-title'](),
|
||||
message:
|
||||
t['com.affine.integration.calendar.new-duplicate-error-content'](),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
setVerifying(true);
|
||||
calendar
|
||||
.createSubscription(url)
|
||||
.createSubscription(_url)
|
||||
.then(() => {
|
||||
setOpen(false);
|
||||
setUrl('');
|
||||
|
||||
@@ -106,6 +106,10 @@ export class CalendarIntegration extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
getSubscription(url: string) {
|
||||
return this.store.getSubscription(url);
|
||||
}
|
||||
|
||||
deleteSubscription(url: string) {
|
||||
this.store.removeSubscription(url);
|
||||
}
|
||||
|
||||
@@ -99,6 +99,10 @@ export class CalendarStore extends Store {
|
||||
);
|
||||
}
|
||||
|
||||
getSubscription(url: string) {
|
||||
return this.getSubscriptionMap()[url];
|
||||
}
|
||||
|
||||
watchSubscriptionCache(url: string) {
|
||||
return this.cacheStorage.watch<string>(this.getCacheKey(url));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user