From 5a185d515746fb7f1ccdf3bf3eedc771f1be843f Mon Sep 17 00:00:00 2001 From: Paul Rangger Date: Wed, 16 Oct 2024 19:06:02 +0200 Subject: [PATCH] Hotfix for crashing communication module --- .../ui/post/PostContextBottomSheet.kt | 3 ++- .../shared/db/entities/MetisPostContextEntity.kt | 2 +- .../shared/db/entities/PostReactionEntity.kt | 15 +-------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/feature/metis/conversation/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/conversation/ui/post/PostContextBottomSheet.kt b/feature/metis/conversation/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/conversation/ui/post/PostContextBottomSheet.kt index 2e09e64dd..c8a9266c5 100644 --- a/feature/metis/conversation/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/conversation/ui/post/PostContextBottomSheet.kt +++ b/feature/metis/conversation/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/conversation/ui/post/PostContextBottomSheet.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth @@ -78,7 +79,7 @@ internal fun PostContextBottomSheet( Column( modifier = Modifier .fillMaxWidth() - .padding(horizontal = Spacings.ScreenHorizontalSpacing) + .padding(start = Spacings.ScreenHorizontalSpacing, end = Spacings.ScreenHorizontalSpacing, bottom = 40.dp) ) { postActions.onClickReaction?.let { onClickReaction -> EmojiReactionBar( diff --git a/feature/metis/shared/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/shared/db/entities/MetisPostContextEntity.kt b/feature/metis/shared/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/shared/db/entities/MetisPostContextEntity.kt index bc85bdaab..f415d9161 100644 --- a/feature/metis/shared/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/shared/db/entities/MetisPostContextEntity.kt +++ b/feature/metis/shared/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/shared/db/entities/MetisPostContextEntity.kt @@ -14,7 +14,7 @@ import androidx.room.Index */ @Entity( tableName = "metis_post_context", - primaryKeys = ["client_post_id", "course_id", "conversation_id", "type"], + primaryKeys = ["client_post_id", "course_id", "conversation_id", "type", "server_id"], foreignKeys = [ ForeignKey( entity = BasePostingEntity::class, diff --git a/feature/metis/shared/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/shared/db/entities/PostReactionEntity.kt b/feature/metis/shared/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/shared/db/entities/PostReactionEntity.kt index c370ebf88..ebf795960 100644 --- a/feature/metis/shared/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/shared/db/entities/PostReactionEntity.kt +++ b/feature/metis/shared/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/feature/metis/shared/db/entities/PostReactionEntity.kt @@ -7,20 +7,7 @@ import androidx.room.Index @Entity( tableName = "reactions", - primaryKeys = ["post_id", "emoji", "author_id"], - foreignKeys = [ - ForeignKey( - entity = BasePostingEntity::class, - parentColumns = ["id"], - childColumns = ["post_id"], - onDelete = ForeignKey.CASCADE - ), - ForeignKey( - entity = MetisUserEntity::class, - parentColumns = ["server_id", "id"], - childColumns = ["server_id", "author_id"] - ) - ], + primaryKeys = ["post_id", "emoji", "author_id", "server_id"], indices = [Index("server_id", "author_id", name = "server_id_author_id_index")] ) data class PostReactionEntity(