mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
mobile: fix all attachments showin in note attachments
This commit is contained in:
committed by
Abdullah Atta
parent
78cbce5ca0
commit
0374aa17c4
@@ -61,10 +61,15 @@ export const AttachmentDialog = ({ note }: { note?: Note }) => {
|
||||
|
||||
const refresh = React.useCallback(() => {
|
||||
if (note) {
|
||||
db.attachments.ofNote(note.id, "all").sorted({
|
||||
...DEFAULT_SORTING,
|
||||
sortBy: "dateModified"
|
||||
});
|
||||
db.attachments
|
||||
.ofNote(note.id, "all")
|
||||
.sorted({
|
||||
...DEFAULT_SORTING,
|
||||
sortBy: "dateModified"
|
||||
})
|
||||
.then((attachments) => {
|
||||
setAttachments(attachments);
|
||||
});
|
||||
} else {
|
||||
db.attachments.all
|
||||
.sorted({
|
||||
@@ -155,7 +160,9 @@ export const AttachmentDialog = ({ note }: { note?: Note }) => {
|
||||
|
||||
switch (type) {
|
||||
case "all":
|
||||
items = db.attachments.all;
|
||||
items = note
|
||||
? db.attachments.ofNote(note.id, "all")
|
||||
: db.attachments.all;
|
||||
break;
|
||||
case "images":
|
||||
items = note
|
||||
@@ -164,15 +171,17 @@ export const AttachmentDialog = ({ note }: { note?: Note }) => {
|
||||
break;
|
||||
case "video":
|
||||
items = items = note
|
||||
? db.attachments.ofNote(note.id, "all")
|
||||
? db.attachments.ofNote(note.id, "videos")
|
||||
: db.attachments.videos;
|
||||
break;
|
||||
case "audio":
|
||||
items = db.attachments.all;
|
||||
items = note
|
||||
? db.attachments.ofNote(note.id, "audio")
|
||||
: db.attachments.all;
|
||||
break;
|
||||
case "documents":
|
||||
items = note
|
||||
? db.attachments.ofNote(note.id, "all")
|
||||
? db.attachments.ofNote(note.id, "documents")
|
||||
: db.attachments.documents;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user