nextcloud/dist/files_trashbin-init.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

2 lines
10 KiB
JavaScript
Raw Permalink Normal View History

(()=>{var e,t,n,r={15340:()=>{},21769:(e,t,n)=>{"use strict";var r=n(35810),i=n(21777),a=n(19051),s=n(85168),o=n(61338),l=n(53334),d=n(71225),c=n(63814),u=n(35947);const f=(0,u.YK)().setApp("files").detectUser().build();var b=n(3153);const p=`/trashbin/${(0,i.HW)()?.uid}/trash`,h=(0,r.H4)(),m=`<?xml version="1.0"?>\n<d:propfind ${(0,r.CP)()}>\n\t<d:prop>\n\t\t<nc:trashbin-deletion-time />\n\t\t<nc:trashbin-original-location />\n\t\t<nc:trashbin-title />\n\t\t<nc:trashbin-deleted-by-id />\n\t\t<nc:trashbin-deleted-by-display-name />\n\t\t${(0,r.VX)()}\n\t</d:prop>\n</d:propfind>`;function y(e){const t=(0,r.Al)(e,p);return t.attributes.previewUrl=(0,c.Jv)("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",{fileid:t.fileid}),t}var g=n(85471),v=n(77764);const w=new r.VP({id:"files_trashbin--original-location",title:(0,l.t)("files_trashbin","Original location"),render(e){const t=x(e),n=document.createElement("span");return n.title=t,n.textContent=t,n},sort(e,t){const n=x(e),r=x(t);return n.localeCompare(r,[(0,l.Z0)(),(0,l.lO)()],{numeric:!0,usage:"sort"})}}),A=new r.VP({id:"files_trashbin--deleted-by",title:(0,l.t)("files_trashbin","Deleted by"),render(e){const{userId:t,displayName:n,label:r}=C(e);if(r){const e=document.createElement("span");return e.textContent=r,e}return new(g.Ay.extend(v.A))({propsData:{size:32,user:t??void 0,displayName:n??t}}).$mount().$el},sort(e,t){const n=C(e),r=n.label??n.displayName??n.userId,i=C(t),a=i.label??i.displayName??i.userId;return r.localeCompare(a,[(0,l.Z0)(),(0,l.lO)()],{numeric:!0,usage:"sort"})}}),_=new r.VP({id:"files_trashbin--deleted",title:(0,l.t)("files_trashbin","Deleted"),render(e){const t=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3,n=document.createElement("span");if(t){const e=Intl.DateTimeFormat([(0,l.lO)()],{dateStyle:"long",timeStyle:"short"}),r=new Date(1e3*t);return n.title=e.format(r),n.textContent=(0,l.fw)(r,{ignoreSeconds:(0,l.t)("files","few seconds ago")}),n}return n.textContent=(0,l.t)("files_trashbin","A long time ago"),n},sort(e,t){const n=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3;return(t.attributes?.["trashbin-deletion-time"]||(t?.mtime?.getTime()??0)/1e3)-n}});function x(e){const t=S(e.attributes?.["trashbin-original-location"]);if(!t)return(0,l.t)("files_trashbin","Unknown");const n=(0,d.pD)(t);return n===t?(0,l.t)("files_trashbin","All files"):n.replace(/^\//,"")}function C(e){const t=S(e.attributes?.["trashbin-deleted-by-id"]),n=S(e.attributes?.["trashbin-deleted-by-display-name"]);let r;const a=(0,i.HW)()?.uid;return t===a&&(r=(0,l.t)("files_trashbin","You")),t||n||(r=(0,l.t)("files_trashbin","Unknown")),{userId:t,displayName:n,label:r}}function S(e){return e?String(e):null}const P="trashbin",T=new r.Ss({id:P,name:(0,l.t)("files_trashbin","Deleted files"),caption:(0,l.t)("files_trashbin","List of files that have been deleted."),emptyTitle:(0,l.t)("files_trashbin","No deleted files"),emptyCaption:(0,l.t)("files_trashbin","Files and folders you have deleted will show up here"),icon:b,order:50,sticky:!0,defaultSortKey:"deleted",columns:[w,A,_],getContents:async function(e="/"){const t=(await h.getDirectoryContents(`${p}${e}`,{details:!0,data:m,includeSelf:!0})).data.map(y),[n]=t.splice(t.findIndex(t=>t.path===e),1);return{folder:n,contents:t}}}),O=new r.hY({id:"restore",displayName:()=>(0,l.t)("files_trashbin","Restore"),iconSvgInline:()=>'<svg xmlns="http://www.w3.org/2000/svg" id="mdi-history" viewBox="0 0 24 24"><path d="M13.5,8H12V13L16.28,15.54L17,14.33L13.5,12.25V8M13,3A9,9 0 0,0 4,12H1L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3" /></svg>',enabled:(e,t)=>t.id===P&&e.length>0&&e.map(e=>e.permissions).every(e=>Boolean(e&r.aX.READ)),async exec(e){try{const t=(0,c.dC)((0,d.O0)(`dav/trashbin/${(0,i.HW)().uid}/restore/${e.basename}`));return await a.Ay.request({method:"MOVE",url:e.encodedSource,headers:{destination:t}}),(0,o.Ic)("files:node:deleted",e),!0}catch(t){return 507===t.resp
//# sourceMappingURL=files_trashbin-init.js.map?v=d9f6e19c606ab5ceec2f