-
-
Notifications
You must be signed in to change notification settings - Fork 392
Add support for the blur filter action #5038
Conversation
| val filter = status.getApplicableFilter(viewModel.kind.toFilterKind()) | ||
| val expanded = oldStatus?.expanded ?: activeAccount.alwaysOpenSpoiler | ||
| val contentShowing = oldStatus?.contentShowing ?: (activeAccount.alwaysShowSensitiveMedia || !status.actionableStatus.sensitive) | ||
| val contentShowing = oldStatus?.contentShowing ?: (activeAccount.alwaysShowSensitiveMedia || (!status.actionableStatus.sensitive && filter?.action != Filter.Action.BLUR)) |
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.
This logic is repeated in a bunch of places, but I didn't find a nice way to extract it 🤷
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.
maybe a new method shouldShowContent(alwaysShowSensitiveMedia, filterKind: Filter.Kind) on Status,
then it is "just"
val contentShowing = oldStatus?.contentShowing ?: status.shouldShowContent(activeAccount.alwaysShowSensitiveMedia, viewModel.kind.toFilterKind())
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.
Yeah, I had exactly that in one iteration and couldn't decide if it was better or not - if you think it's an improvement, then I'll readd it
...c/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/CachedTimelineViewModel.kt
Show resolved
Hide resolved
|
Tested with glitch.taks.garden |
connyduck
left a comment
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.
Nice!
I'm wondering if we could detect this feature somehow? Or at least have a nice error message when a user tries to set a blur filter on an instance that does not support it?
| ) : Parcelable { | ||
| enum class Action(val action: String) { | ||
| NONE("none"), | ||
| BLUR("blur"), |
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.
val context: List<String>,
@Json(name = "filter_action") val filterAction: String,
We could parse these directly as enums? Seems like that would simplify a few things
|
|
||
| if (status.poll?.options?.any { matcher.reset(it.title).find() } == true) { | ||
| return Filter.Action.HIDE | ||
| return Filter("", "", listOf(kind.kind), filterAction = Filter.Action.HIDE.action) |
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.
This looks like id & title could need "" default params
| if (oldStatus != null) break | ||
| } | ||
|
|
||
| val filter = viewModel.kind?.let { status.getApplicableFilter(it.toFilterKind()) } |
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.
| val filter = viewModel.kind?.let { status.getApplicableFilter(it.toFilterKind()) } | |
| val filter = status.getApplicableFilter(viewModel.kind.toFilterKind()) |
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.
This one failed a bunch of tests because kind was null on the test viewModel (maybe I should fix the tests 🤷)
| val filter = status.getApplicableFilter(viewModel.kind.toFilterKind()) | ||
| val expanded = oldStatus?.expanded ?: activeAccount.alwaysOpenSpoiler | ||
| val contentShowing = oldStatus?.contentShowing ?: (activeAccount.alwaysShowSensitiveMedia || !status.actionableStatus.sensitive) | ||
| val contentShowing = oldStatus?.contentShowing ?: (activeAccount.alwaysShowSensitiveMedia || (!status.actionableStatus.sensitive && filter?.action != Filter.Action.BLUR)) |
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.
maybe a new method shouldShowContent(alwaysShowSensitiveMedia, filterKind: Filter.Kind) on Status,
then it is "just"
val contentShowing = oldStatus?.contentShowing ?: status.shouldShowContent(activeAccount.alwaysShowSensitiveMedia, viewModel.kind.toFilterKind())
|
It doesn't look like the capability is advertised anywhere? It also doesn't look like we get a useful error when we send an unknown value. |
|
|
|
Is other software (e.g. gts) going to support |
GtS not yet, maybe in future. https://github.com/superseriousbusiness/gotosocial/issues/3466 |
|
@Tak Do you want to add feature detection? I'd prefer it but I'm also fine if we leave it out. |
|
I can add it, was just on vacation last week and didn't get to it |
Since #5038 the option to filter boosts was ignored and boosts never filtered. The issue here was that the `HomeTimelineData.status` holds no reblog information, so `timelineData.status?.toStatus(it)` will always return a unreblogged status. `timelineData.toViewData` constructs the correct structure as it considers `HomeTimelineData.reblogAccount` as well.
Add support for the blur filter action added in mastodon 4.4.0.
Images and videos on matched posts are hidden by default, and the label reads "Filtered: ${title of applied filter}".
If a matched post has a preview card, the preview image is also blurred.
This is draft for now until I upgrade my instance and test, I've tested so far with spoofed data.