Merge pull request #977 from believethehype/gallery_alternative_version

GalleryEntryEvent: add relay hint to etag
This commit is contained in:
Vitor Pamplona
2024-07-11 12:05:19 -04:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@@ -83,6 +83,7 @@ class ProfileGalleryEntryEvent(
fun create(
url: String,
eventid: String? = null,
relayhint: String? = null,
magnetUri: String? = null,
mimeType: String? = null,
alt: String? = null,
@@ -99,10 +100,13 @@ class ProfileGalleryEntryEvent(
createdAt: Long = TimeUtils.now(),
onReady: (ProfileGalleryEntryEvent) -> Unit,
) {
var etag = eventid?.let { arrayOf("e", it) }
relayhint?.let { etag = etag?.plus(it) }
val tags =
listOfNotNull(
arrayOf(URL, url),
eventid?.let { arrayOf("e", it) },
eventid?.let { etag },
magnetUri?.let { arrayOf(MAGNET_URI, it) },
mimeType?.let { arrayOf(MIME_TYPE, it) },
alt?.ifBlank { null }?.let { arrayOf(ALT, it) } ?: arrayOf("alt", ALT_DESCRIPTION),