mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
chore: remove all comments
This commit is contained in:
@@ -28,7 +28,6 @@ test.skip("login user and check for token", async () => {
|
|||||||
usermanager.login(user.email, user.password)
|
usermanager.login(user.email, user.password)
|
||||||
).resolves.not.toThrow();
|
).resolves.not.toThrow();
|
||||||
|
|
||||||
console.log(await usermanager.tokenManager.getToken());
|
|
||||||
await expect(usermanager.tokenManager.getToken()).resolves.toBeDefined();
|
await expect(usermanager.tokenManager.getToken()).resolves.toBeDefined();
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
@@ -39,7 +38,6 @@ test.skip("login user and get user data", async () => {
|
|||||||
await usermanager.login(user.email, user.password);
|
await usermanager.login(user.email, user.password);
|
||||||
|
|
||||||
const userData = await usermanager.getUser();
|
const userData = await usermanager.getUser();
|
||||||
console.log(userData);
|
|
||||||
expect(userData.email).toBe(process.env.EMAIL);
|
expect(userData.email).toBe(process.env.EMAIL);
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ test("editing one topic should not update dateEdited of all", () =>
|
|||||||
|
|
||||||
const newTopics = topics.all.filter((t) => t.title !== "Hello22");
|
const newTopics = topics.all.filter((t) => t.title !== "Hello22");
|
||||||
|
|
||||||
//console.log(newTopics, oldTopics);
|
|
||||||
expect(
|
expect(
|
||||||
newTopics.every(
|
newTopics.every(
|
||||||
(t) =>
|
(t) =>
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ class Database {
|
|||||||
this
|
this
|
||||||
);
|
);
|
||||||
EV.subscribe(EVENTS.attachmentDeleted, async (attachment) => {
|
EV.subscribe(EVENTS.attachmentDeleted, async (attachment) => {
|
||||||
console.log("deleted:", attachment);
|
|
||||||
await this.fs.cancel(attachment.metadata.hash);
|
await this.fs.cancel(attachment.metadata.hash);
|
||||||
});
|
});
|
||||||
EV.subscribe(EVENTS.userLoggedOut, async () => {
|
EV.subscribe(EVENTS.userLoggedOut, async () => {
|
||||||
@@ -140,7 +139,7 @@ class Database {
|
|||||||
try {
|
try {
|
||||||
var { type, data } = JSON.parse(event.data);
|
var { type, data } = JSON.parse(event.data);
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
console.log(type, data);
|
// console.log(type, data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("SSE: Unsupported message. Message = ", event.data);
|
console.log("SSE: Unsupported message. Message = ", event.data);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ export default class Sync {
|
|||||||
async _uploadAttachments() {
|
async _uploadAttachments() {
|
||||||
const attachments = this._db.attachments.pending;
|
const attachments = this._db.attachments.pending;
|
||||||
try {
|
try {
|
||||||
console.log("Uploading attachments", this._db.attachments.pending);
|
|
||||||
for (var i = 0; i < attachments.length; ++i) {
|
for (var i = 0; i < attachments.length; ++i) {
|
||||||
const attachment = attachments[i];
|
const attachment = attachments[i];
|
||||||
const { hash } = attachment.metadata;
|
const { hash } = attachment.metadata;
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ export default class Attachments extends Collection {
|
|||||||
dateUploaded: undefined,
|
dateUploaded: undefined,
|
||||||
dateDeleted: undefined,
|
dateDeleted: undefined,
|
||||||
};
|
};
|
||||||
console.log("adding attachmentitem", attachmentItem);
|
|
||||||
return this._collection.addItem(attachmentItem);
|
return this._collection.addItem(attachmentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +154,6 @@ export default class Attachments extends Collection {
|
|||||||
|
|
||||||
markAsUploaded(id) {
|
markAsUploaded(id) {
|
||||||
const attachment = this.all.find((a) => a.id === id);
|
const attachment = this.all.find((a) => a.id === id);
|
||||||
console.log("mark as uploaded", id, attachment);
|
|
||||||
if (!attachment) return;
|
if (!attachment) return;
|
||||||
attachment.dateUploaded = Date.now();
|
attachment.dateUploaded = Date.now();
|
||||||
return this._collection.updateItem(attachment);
|
return this._collection.updateItem(attachment);
|
||||||
@@ -174,38 +172,36 @@ export default class Attachments extends Collection {
|
|||||||
const attachments = this.images.filter((attachment) =>
|
const attachments = this.images.filter((attachment) =>
|
||||||
hasItem(attachment.noteIds, noteId)
|
hasItem(attachment.noteIds, noteId)
|
||||||
);
|
);
|
||||||
console.log("Downloading attachments", attachments);
|
try {
|
||||||
for (let i = 0; i < attachments.length; i++) {
|
for (let i = 0; i < attachments.length; i++) {
|
||||||
const { hash } = attachments[i].metadata;
|
const { hash } = attachments[i].metadata;
|
||||||
await this._downloadMedia(hash, {
|
await this._downloadMedia(hash, {
|
||||||
total: attachments.length,
|
total: attachments.length,
|
||||||
current: i,
|
current: i,
|
||||||
groupId: noteId,
|
groupId: noteId,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
sendAttachmentsProgressEvent("download", noteId, attachments.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _downloadMedia(hash, { total, current, groupId }, notify = true) {
|
async _downloadMedia(hash, { total, current, groupId }, notify = true) {
|
||||||
sendAttachmentsProgressEvent("download", groupId, total, current);
|
sendAttachmentsProgressEvent("download", groupId, total, current);
|
||||||
try {
|
const isDownloaded = await this._db.fs.downloadFile(groupId, hash);
|
||||||
const isDownloaded = await this._db.fs.downloadFile(groupId, hash);
|
if (!isDownloaded) return;
|
||||||
if (!isDownloaded) return;
|
|
||||||
|
|
||||||
const src = await this.read(hash);
|
const src = await this.read(hash);
|
||||||
if (!src) return;
|
if (!src) return;
|
||||||
|
|
||||||
if (notify)
|
if (notify)
|
||||||
EV.publish(EVENTS.mediaAttachmentDownloaded, {
|
EV.publish(EVENTS.mediaAttachmentDownloaded, {
|
||||||
groupId,
|
groupId,
|
||||||
hash,
|
hash,
|
||||||
src,
|
src,
|
||||||
});
|
});
|
||||||
|
|
||||||
return src;
|
return src;
|
||||||
} finally {
|
|
||||||
if (1 + current === total)
|
|
||||||
sendAttachmentsProgressEvent("download", groupId, total);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async cleanup() {
|
async cleanup() {
|
||||||
|
|||||||
@@ -35,11 +35,9 @@ export default class FileStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async cancel(groupId, type = undefined) {
|
async cancel(groupId, type = undefined) {
|
||||||
console.trace("Cancelling", groupId, type);
|
|
||||||
const [op] = this._deleteOp(groupId, type);
|
const [op] = this._deleteOp(groupId, type);
|
||||||
if (!op) return;
|
if (!op) return;
|
||||||
await op.cancel("Operation canceled.");
|
await op.cancel("Operation canceled.");
|
||||||
console.log("Cancellation done:", groupId, this._queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_deleteOp(groupId, type = undefined) {
|
_deleteOp(groupId, type = undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user