Cache quote objects
Pretty wasteful approach, because we're saving a whole json object.
This commit is contained in:
parent
9d1159969f
commit
dac4f36f33
|
@ -108,6 +108,7 @@ fun Placeholder.toEntity(timelineUserId: Long): TimelineStatusEntity {
|
|||
language = null,
|
||||
filtered = null,
|
||||
pleroma = null,
|
||||
quote = null,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -154,6 +155,7 @@ fun Status.toEntity(
|
|||
language = actionableStatus.language,
|
||||
filtered = actionableStatus.filtered,
|
||||
pleroma = actionableStatus.pleroma.let(gson::toJson),
|
||||
quote = actionableStatus.quote.let(gson::toJson),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -171,6 +173,7 @@ fun TimelineStatusWithAccount.toViewData(gson: Gson, isDetailed: Boolean = false
|
|||
val poll: Poll? = gson.fromJson(status.poll, Poll::class.java)
|
||||
val card: Card? = gson.fromJson(status.card, Card::class.java)
|
||||
val pleroma : Status.PleromaStatus? = gson.fromJson(status.pleroma, Status.PleromaStatus::class.java)
|
||||
val quote : Status? = gson.fromJson(status.quote, Status::class.java)
|
||||
|
||||
val reblog = status.reblogServerId?.let { id ->
|
||||
Status(
|
||||
|
@ -204,7 +207,7 @@ fun TimelineStatusWithAccount.toViewData(gson: Gson, isDetailed: Boolean = false
|
|||
language = status.language,
|
||||
filtered = status.filtered,
|
||||
pleroma = pleroma,
|
||||
quote = null, // FIXME: cache this
|
||||
quote = quote,
|
||||
)
|
||||
}
|
||||
val status = if (reblog != null) {
|
||||
|
@ -239,7 +242,7 @@ fun TimelineStatusWithAccount.toViewData(gson: Gson, isDetailed: Boolean = false
|
|||
language = status.language,
|
||||
filtered = status.filtered,
|
||||
pleroma = pleroma,
|
||||
quote = null, // FIXME: cache this
|
||||
quote = quote,
|
||||
)
|
||||
} else {
|
||||
Status(
|
||||
|
@ -273,7 +276,7 @@ fun TimelineStatusWithAccount.toViewData(gson: Gson, isDetailed: Boolean = false
|
|||
language = status.language,
|
||||
filtered = status.filtered,
|
||||
pleroma = pleroma,
|
||||
quote = null, // FIXME: cache this
|
||||
quote = quote,
|
||||
)
|
||||
}
|
||||
return StatusViewData.Concrete(
|
||||
|
|
|
@ -656,6 +656,7 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||
database.execSQL("ALTER TABLE `DraftEntity` ADD COLUMN `statusId` TEXT");
|
||||
|
||||
database.execSQL("ALTER TABLE `TimelineStatusEntity` ADD COLUMN `pleroma` TEXT");
|
||||
database.execSQL("ALTER TABLE `TimelineStatusEntity` ADD COLUMN `quote` TEXT");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ SELECT s.serverId, s.url, s.timelineUserId,
|
|||
s.authorServerId, s.inReplyToId, s.inReplyToAccountId, s.createdAt, s.editedAt,
|
||||
s.emojis, s.reblogsCount, s.favouritesCount, s.repliesCount, s.reblogged, s.favourited, s.bookmarked, s.sensitive,
|
||||
s.spoilerText, s.visibility, s.mentions, s.tags, s.application, s.reblogServerId,s.reblogAccountId,
|
||||
s.content, s.attachments, s.poll, s.card, s.muted, s.expanded, s.contentShowing, s.contentCollapsed, s.pinned, s.language, s.filtered, s.pleroma,
|
||||
s.content, s.attachments, s.poll, s.card, s.muted, s.expanded, s.contentShowing, s.contentCollapsed, s.pinned, s.language, s.filtered, s.pleroma, s.quote,
|
||||
a.serverId as 'a_serverId', a.timelineUserId as 'a_timelineUserId',
|
||||
a.localUsername as 'a_localUsername', a.username as 'a_username',
|
||||
a.displayName as 'a_displayName', a.url as 'a_url', a.avatar as 'a_avatar',
|
||||
|
@ -59,7 +59,7 @@ SELECT s.serverId, s.url, s.timelineUserId,
|
|||
s.authorServerId, s.inReplyToId, s.inReplyToAccountId, s.createdAt, s.editedAt,
|
||||
s.emojis, s.reblogsCount, s.favouritesCount, s.repliesCount, s.reblogged, s.favourited, s.bookmarked, s.sensitive,
|
||||
s.spoilerText, s.visibility, s.mentions, s.tags, s.application, s.reblogServerId,s.reblogAccountId,
|
||||
s.content, s.attachments, s.poll, s.card, s.muted, s.expanded, s.contentShowing, s.contentCollapsed, s.pinned, s.language, s.filtered, s.pleroma,
|
||||
s.content, s.attachments, s.poll, s.card, s.muted, s.expanded, s.contentShowing, s.contentCollapsed, s.pinned, s.language, s.filtered, s.pleroma, s.quote,
|
||||
a.serverId as 'a_serverId', a.timelineUserId as 'a_timelineUserId',
|
||||
a.localUsername as 'a_localUsername', a.username as 'a_username',
|
||||
a.displayName as 'a_displayName', a.url as 'a_url', a.avatar as 'a_avatar',
|
||||
|
|
|
@ -87,6 +87,7 @@ data class TimelineStatusEntity(
|
|||
val language: String?,
|
||||
val filtered: List<FilterResult>?,
|
||||
val pleroma: String?,
|
||||
val quote: String?,
|
||||
) {
|
||||
val isPlaceholder: Boolean
|
||||
get() = this.authorServerId == null
|
||||
|
|
Loading…
Reference in New Issue