When opening a post via "Open As", if post lookup from the target instance fails, display an error instead of opening the post in the browser. (#1531)
Addresses #1526
This commit is contained in:
parent
a308b4c139
commit
44bb1999af
5 changed files with 35 additions and 5 deletions
|
@ -214,6 +214,16 @@ class BottomSheetActivityTest {
|
|||
Assert.assertEquals(nonMastodonQuery, activity.link)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun search_withNoResults_appliesRequestedFallbackBehavior() {
|
||||
for (fallbackBehavior in listOf(PostLookupFallbackBehavior.OPEN_IN_BROWSER, PostLookupFallbackBehavior.DISPLAY_ERROR)) {
|
||||
activity.viewUrl(nonMastodonQuery, fallbackBehavior)
|
||||
testScheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS)
|
||||
Assert.assertEquals(nonMastodonQuery, activity.link)
|
||||
Assert.assertEquals(fallbackBehavior, activity.fallbackBehavior)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun search_withCancellation_doesNotLoadUrl_forAccount() {
|
||||
activity.viewUrl(accountQuery)
|
||||
|
@ -263,6 +273,7 @@ class BottomSheetActivityTest {
|
|||
var statusId: String? = null
|
||||
var accountId: String? = null
|
||||
var link: String? = null
|
||||
var fallbackBehavior: PostLookupFallbackBehavior? = null
|
||||
|
||||
init {
|
||||
mastodonApi = api
|
||||
|
@ -282,5 +293,9 @@ class BottomSheetActivityTest {
|
|||
this.statusId = statusId
|
||||
}
|
||||
|
||||
override fun performUrlFallbackAction(url: String, fallbackBehavior: PostLookupFallbackBehavior) {
|
||||
this.link = url
|
||||
this.fallbackBehavior = fallbackBehavior
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue