This commit is contained in:
ariskotsomitopoulos 2022-01-18 15:28:44 +02:00
parent 10599aa728
commit 707397cb9d
6 changed files with 14 additions and 17 deletions

View file

@ -176,6 +176,7 @@ internal class DefaultRelationService @AssistedInject constructor(
formattedText: String?,
eventReplied: TimelineEvent?): Cancelable? {
val event = if (eventReplied != null) {
// Reply within a thread
eventFactory.createReplyTextEvent(
roomId = roomId,
eventReplied = eventReplied,
@ -187,6 +188,7 @@ internal class DefaultRelationService @AssistedInject constructor(
}
?: return null
} else {
// Normal thread reply
eventFactory.createThreadTextEvent(
rootThreadEventId = rootThreadEventId,
roomId = roomId,

View file

@ -457,6 +457,14 @@ internal class LocalEchoEventFactory @Inject constructor(
/**
* Generates the appropriate relatesTo object for a reply event.
* It can either be a regular reply or a reply within a thread
* "m.relates_to": {
* "rel_type": "m.thread",
* "event_id": "$thread_root",
* "m.in_reply_to": {
* "event_id": "$event_target",
* "render_in": ["m.thread"]
* }
* }
*/
private fun generateReplyRelationContent(eventId: String, rootThreadEventId: String? = null): RelationDefaultContent =
rootThreadEventId?.let {

View file

@ -171,7 +171,6 @@ internal class LoadTimelineStrategy(
}
suspend fun loadMore(count: Int, direction: Timeline.Direction, fetchOnServerIfNeeded: Boolean = true): LoadMoreResult {
// /
if (mode is Mode.Permalink && timelineChunk == null) {
val params = GetContextOfEventTask.Params(roomId, mode.originEventId)
try {

View file

@ -289,22 +289,10 @@ internal class TimelineChunk(private val chunkEntity: ChunkEntity,
val displayIndex = getNextDisplayIndex(direction) ?: return LoadedFromStorage()
val baseQuery = timelineEventEntities.where()
// val timelineEvents = if (timelineSettings.rootThreadEventId != null) {
// baseQuery
// .beginGroup()
// .equalTo(TimelineEventEntityFields.ROOT.ROOT_THREAD_EVENT_ID, timelineSettings.rootThreadEventId)
// .or()
// .equalTo(TimelineEventEntityFields.ROOT.EVENT_ID, timelineSettings.rootThreadEventId)
// .endGroup()
// .offsets(direction, count, displayIndex)
// .findAll()
// .orEmpty()
// } else {
val timelineEvents = baseQuery
.offsets(direction, count, displayIndex)
.findAll()
.orEmpty()
// }
if (timelineEvents.isEmpty()) return LoadedFromStorage()
fetchRootThreadEventsIfNeeded(timelineEvents)
@ -331,7 +319,7 @@ internal class TimelineChunk(private val chunkEntity: ChunkEntity,
}
/**
* Returns whether or not the the thread has reached end. It returned false if the current timeline
* Returns whether or not the the thread has reached end. It returns false if the current timeline
* is not a thread timeline
*/
private fun threadReachedEnd(timelineEvents: List<TimelineEventEntity>): Boolean =

View file

@ -171,7 +171,7 @@ internal class ThreadsAwarenessHandler @Inject constructor(
/**
* If the event is a thread event then transform/enhance it to a visual Reply Event,
* If the event is not a thread event, null value will be returned
* If there is an error (ex. the root/origin thread event is not found), null willl be returend
* If there is an error (ex. the root/origin thread event is not found), null will be returned
*/
private fun transformThreadToReplyIfNeeded(realm: Realm, roomId: String?, event: Event, decryptedResult: JsonDict?): JsonDict? {
roomId ?: return null

View file

@ -45,8 +45,8 @@ enum class Command(val command: String,
REMOVE_USER("/remove", arrayOf("/kick"), "<user-id> [reason]", R.string.command_description_kick_user, false, false),
CHANGE_DISPLAY_NAME("/nick", null, "<display-name>", R.string.command_description_nick, false, false),
CHANGE_DISPLAY_NAME_FOR_ROOM("/myroomnick", arrayOf("/roomnick"), "<display-name>", R.string.command_description_nick_for_room, false, false),
ROOM_AVATAR("/roomavatar", null, "<mxc_url>", R.string.command_description_room_avatar, true /* Since user has to know the mxc url */, false),
CHANGE_AVATAR_FOR_ROOM("/myroomavatar", null, "<mxc_url>", R.string.command_description_avatar_for_room, true /* Since user has to know the mxc url */, false),
ROOM_AVATAR("/roomavatar", null, "<mxc_url>", R.string.command_description_room_avatar, true /* User has to know the mxc url */, false),
CHANGE_AVATAR_FOR_ROOM("/myroomavatar", null, "<mxc_url>", R.string.command_description_avatar_for_room, true /* User has to know the mxc url */, false),
MARKDOWN("/markdown", null, "<on|off>", R.string.command_description_markdown, false, false),
RAINBOW("/rainbow", null, "<message>", R.string.command_description_rainbow, false, true),
RAINBOW_EMOTE("/rainbowme", null, "<message>", R.string.command_description_rainbow_emote, false, true),