Ensure all eventId start with $, even ids for local echo

This commit is contained in:
Benoit Marty 2020-02-24 17:35:43 +01:00
parent b694721728
commit 9c566b19f7
2 changed files with 2 additions and 2 deletions

View file

@ -20,7 +20,7 @@ import java.util.UUID
object LocalEcho { object LocalEcho {
private const val PREFIX = "local." private const val PREFIX = "\$local."
fun isLocalEchoId(eventId: String) = eventId.startsWith(PREFIX) fun isLocalEchoId(eventId: String) = eventId.startsWith(PREFIX)

View file

@ -33,7 +33,7 @@ internal object EventMapper {
else MoshiProvider.providesMoshi().adapter(UnsignedData::class.java).toJson(event.unsignedData) else MoshiProvider.providesMoshi().adapter(UnsignedData::class.java).toJson(event.unsignedData)
val eventEntity = EventEntity() val eventEntity = EventEntity()
// TODO change this as we shouldn't use event everywhere // TODO change this as we shouldn't use event everywhere
eventEntity.eventId = event.eventId ?: "$roomId-${System.currentTimeMillis()}-${event.hashCode()}" eventEntity.eventId = event.eventId ?: "$$roomId-${System.currentTimeMillis()}-${event.hashCode()}"
eventEntity.roomId = event.roomId ?: roomId eventEntity.roomId = event.roomId ?: roomId
eventEntity.content = ContentMapper.map(event.content) eventEntity.content = ContentMapper.map(event.content)
val resolvedPrevContent = event.prevContent ?: event.unsignedData?.prevContent val resolvedPrevContent = event.prevContent ?: event.unsignedData?.prevContent