Reuse media content/info types from the js-sdk (#12308)

This commit is contained in:
Michael Telatynski
2024-03-11 09:30:00 +00:00
committed by GitHub
parent 89eb884821
commit 431ae32304
19 changed files with 74 additions and 258 deletions
+3 -3
View File
@@ -25,22 +25,22 @@ import {
FileSizeReturnArray,
FileSizeReturnObject,
} from "filesize";
import { MediaEventContent } from "matrix-js-sdk/src/types";
import { IMediaEventContent } from "../customisations/models/IMediaEventContent";
import { _t } from "../languageHandler";
/**
* Extracts a human-readable label for the file attachment to use as
* link text.
*
* @param {IMediaEventContent} content The "content" key of the matrix event.
* @param {MediaEventContent} content The "content" key of the matrix event.
* @param {string} fallbackText The fallback text
* @param {boolean} withSize Whether to include size information. Default true.
* @param {boolean} shortened Ensure the extension of the file name is visible. Default false.
* @return {string} the human-readable link text for the attachment.
*/
export function presentableTextForFile(
content: IMediaEventContent,
content: MediaEventContent,
fallbackText = _t("common|attachment"),
withSize = true,
shortened = false,