-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comment fields in ConversationEntity related to expanding and collapsing content #3886
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ import com.keylesspalace.tusky.entity.TimelineAccount | |
import com.keylesspalace.tusky.viewdata.StatusViewData | ||
import java.util.Date | ||
|
||
/** A reply-tree of statuses which have been saved to disk. */ | ||
@Entity(primaryKeys = ["id", "accountId"]) | ||
@TypeConverters(Converters::class) | ||
data class ConversationEntity( | ||
|
@@ -50,6 +51,7 @@ data class ConversationEntity( | |
} | ||
} | ||
|
||
/** The account information associated with a status saved to disk. */ | ||
data class ConversationAccountEntity( | ||
val id: String, | ||
val localUsername: String, | ||
|
@@ -72,6 +74,7 @@ data class ConversationAccountEntity( | |
} | ||
} | ||
|
||
/** A previously-displayed status which has been saved to disk. */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @connyduck In the Mastodon API the Why is it a different type here? And can that reasoning please be added to the comment. |
||
@TypeConverters(Converters::class) | ||
data class ConversationStatusEntity( | ||
val id: String, | ||
|
@@ -87,14 +90,20 @@ data class ConversationStatusEntity( | |
val repliesCount: Int, | ||
val favourited: Boolean, | ||
val bookmarked: Boolean, | ||
/** If true, post attachments are marked as sensitive content. */ | ||
val sensitive: Boolean, | ||
/** If nonempty, post text has a spoiler/content warning. */ | ||
val spoilerText: String, | ||
val attachments: List<Attachment>, | ||
val mentions: List<Status.Mention>, | ||
val tags: List<HashTag>?, | ||
/** If sensitive is true, then this is true when the user has chosen to expose the attachments. */ | ||
val showingHiddenContent: Boolean, | ||
/** If spoilerText is nonempty, then this is true when the user has chosen to show the text. */ | ||
val expanded: Boolean, | ||
/** If content is long (see shouldTrimStatus()), then this is *false* when the user has chosen to show all content. */ | ||
val collapsed: Boolean, | ||
/** If true, the user has chosen not to see further notifications for this status. */ | ||
val muted: Boolean, | ||
val poll: Poll?, | ||
val language: String? | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,41 +25,63 @@ import com.keylesspalace.tusky.util.shouldTrimStatus | |
/** | ||
* Created by charlag on 11/07/2017. | ||
* | ||
* Class to represent data required to display either a notification or a placeholder. | ||
* Class to represent data required to display either a status or a placeholder ("Load More" bar). | ||
* It is either a [StatusViewData.Concrete] or a [StatusViewData.Placeholder]. | ||
* Can be created either from a ConversationStatusEntity, or by helpers in ViewDataUtils. | ||
Comment on lines
-28
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you be OK with holding off on adding the comments here, and adding them as suggestions to https://github.com/tuskyapp/Tusky/pull/3436/files#diff-eb35dc96f92845f7f47b51230940e1c57928b5337d164e64567f3511b19b9647 instead? It'll make syncing that PR with head easier, and that PR removes the That PR also includes some of the same comments that you're making here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess my question is, is PR #3436 on track for v24 inclusion? If so, then I agree it would make more sense to glom onto 3436. If not, I think it would be better to do a comments-only patch now. I could do the patch-3436 merge conflict resolution myself if that would help. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
¯\(ツ)/¯ Needs a code review and more people to try the APK. |
||
*/ | ||
sealed class StatusViewData { | ||
abstract val id: String | ||
var filterAction: Filter.Action = Filter.Action.NONE | ||
|
||
data class Concrete( | ||
/** The Mastodon-API level information about the status. */ | ||
val status: Status, | ||
/** | ||
* If StatusViewData spoilerText is nonempty, specifies whether the text content of this post | ||
* is currently hidden. | ||
* | ||
* @return If true, post is shown. If false, it is hidden. | ||
*/ | ||
val isExpanded: Boolean, | ||
/** | ||
* Specifies whether attachments are currently hidden as sensitive. | ||
* | ||
* @return If true, attachments are shown. If false, they is hidden. | ||
*/ | ||
val isShowingContent: Boolean, | ||
/** | ||
* Specifies whether the content of this post is currently limited in visibility to the first | ||
* 500 characters or not. | ||
* If StatusViewData isCollapsible, specifies whether the content of this post is currently | ||
* limited in visibility to the first characters or not. | ||
* | ||
* @return Whether the post is collapsed or fully expanded. | ||
* @return If true, post is collapsed. If false, it is fully expanded. | ||
*/ | ||
val isCollapsed: Boolean, | ||
/** | ||
* If true, the status is "big" (has been selected by the user for detailed display). | ||
*/ | ||
val isDetailed: Boolean = false | ||
) : StatusViewData() { | ||
override val id: String | ||
get() = status.id | ||
|
||
/** | ||
* Specifies whether the content of this post is long enough to be automatically | ||
* collapsed or if it should show all content regardless. | ||
* collapsed or if it should show all content regardless. (See shouldTrimStatus()) | ||
* | ||
* @return Whether the post is collapsible or never collapsed. | ||
*/ | ||
val isCollapsible: Boolean | ||
|
||
val content: Spanned | ||
|
||
/** | ||
* @return If nonempty, the spoiler/content warning text. If empty, there is no warning. | ||
*/ | ||
val spoilerText: String | ||
val username: String | ||
|
||
/** | ||
* @return The "true" status (same as status unless this is a reblog) | ||
*/ | ||
val actionable: Status | ||
get() = status.actionableStatus | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a tree. The API for conversations returns the most recent (last) status in the thread. You can see this in Tusky if you open the DMs tab; each DM (conversation) is represented by the last status in the message thread. You have to tap on that message to see the full thread.
"saved to disk" is an implementation detail.
For commenting these I've found it helpful to link directly to the relevant Mastodon API documentation. For this one, it's a https://docs.joinmastodon.org/entities/Conversation/