cleanup
This commit is contained in:
@@ -32,7 +32,7 @@ const resolveCorrespondents = (doc) => {
|
||||
const results = [];
|
||||
|
||||
doc.correspondents.forEach((entry, index) => {
|
||||
if (!entry) return;
|
||||
if (!entry || typeof entry.name !== 'string') return;
|
||||
|
||||
const id = entry.id;
|
||||
const name = entry.name.trim();
|
||||
@@ -68,16 +68,8 @@ const resolveDocumentType = (doc) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof type === 'string') {
|
||||
const name = type.trim();
|
||||
if (!name) {
|
||||
return null;
|
||||
}
|
||||
return { id: fallbackId, name };
|
||||
}
|
||||
|
||||
if (typeof type === 'object') {
|
||||
const name = (type.name || type.label || '').trim();
|
||||
if (typeof type === 'object' && typeof type.name === 'string') {
|
||||
const name = type.name.trim();
|
||||
if (!name) {
|
||||
return null;
|
||||
}
|
||||
@@ -138,7 +130,7 @@ const DocumentThumbnailImage = ({
|
||||
document,
|
||||
ensureAssetUrl,
|
||||
getDocumentAsset,
|
||||
alt,
|
||||
alt = '',
|
||||
maxSize = LIST_ICON_SIZE,
|
||||
scrollRootRef = null,
|
||||
}) => {
|
||||
@@ -210,7 +202,7 @@ const DocumentThumbnailImage = ({
|
||||
{url ? (
|
||||
<img
|
||||
src={url}
|
||||
alt={alt || ''}
|
||||
alt={alt}
|
||||
className="document-thumbnail"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
@@ -883,7 +875,7 @@ const DocumentsTable = ({
|
||||
aria-label={`Rename folder ${folder.name}`}
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
const nextName = window.prompt('Rename folder', folder.name || '');
|
||||
const nextName = window.prompt('Rename folder', folder.name);
|
||||
if (!nextName) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,26 +29,14 @@ const sanitizeTags = (tags) => {
|
||||
if (!Array.isArray(tags)) {
|
||||
return [];
|
||||
}
|
||||
return tags
|
||||
.filter((tag) => tag && (tag.label || tag.id))
|
||||
.map((tag) => ({
|
||||
id: tag.id,
|
||||
label: tag.label || '',
|
||||
color: tag.color || null,
|
||||
}));
|
||||
return tags.filter((tag) => tag && (tag.label || tag.id));
|
||||
};
|
||||
|
||||
const sanitizeCorrespondents = (entries) => {
|
||||
if (!Array.isArray(entries)) {
|
||||
return [];
|
||||
}
|
||||
return entries
|
||||
.filter((entry) => entry && (entry.name || entry.id))
|
||||
.map((entry) => ({
|
||||
id: entry.id,
|
||||
name: entry.name || '',
|
||||
count: entry.count,
|
||||
}));
|
||||
return entries.filter((entry) => entry && (entry.name || entry.id));
|
||||
};
|
||||
|
||||
export const describeDocumentSummary = (document, options = {}) => {
|
||||
@@ -76,8 +64,8 @@ export const describeDocumentSummary = (document, options = {}) => {
|
||||
formatDateTime = defaultFormatDateTime,
|
||||
} = options;
|
||||
|
||||
const title = document.title || '';
|
||||
const originalName = document.original_name || '';
|
||||
const title = document.title;
|
||||
const originalName = document.original_name;
|
||||
const mimeTypeLabel = document.content_type || 'Unknown';
|
||||
|
||||
const sizeBytes = Number(document.current_version?.size_bytes);
|
||||
|
||||
Reference in New Issue
Block a user