1
0
Fork 0

Exclude replies by default

This commit is contained in:
Ryan Fox 2021-01-12 04:20:35 +00:00
parent 0f7a4c6bcf
commit 0162eeaeda
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
4 changed files with 41 additions and 2 deletions

View File

@ -14,6 +14,7 @@ module Command
, loadLocalTimeline
, loadGlobalTimeline
, loadAccountTimeline
, loadAccountTimelineReplies
, loadFavoriteTimeline
, loadHashtagTimeline
, loadMutes
@ -349,7 +350,25 @@ loadAccountTimeline client accountId url =
HttpBuilder.get (Maybe.withDefault (ApiUrl.accountTimeline accountId) url)
|> withClient client
|> withBodyDecoder (Decode.list statusDecoder)
|> withQueryParams [ ( "limit", "60" ) ]
|> withQueryParams [ ( "limit", "60" )
, ( "exclude_replies", "true" )
]
|> send (MastodonEvent << AccountTimeline (url /= Nothing))
Nothing ->
Cmd.none
loadAccountTimelineReplies : Maybe Client -> String -> Maybe String -> Cmd Msg
loadAccountTimelineReplies client accountId url =
case client of
Just client ->
HttpBuilder.get (Maybe.withDefault (ApiUrl.accountTimeline accountId) url)
|> withClient client
|> withBodyDecoder (Decode.list statusDecoder)
|> withQueryParams [ ( "limit", "60" )
, ( "exclude_replies", "false" )
]
|> send (MastodonEvent << AccountTimeline (url /= Nothing))
Nothing ->

View File

@ -166,6 +166,7 @@ type CurrentView
type CurrentAccountView
= AccountStatusesView
| AccountStatusesRepliesView
| AccountFollowersView
| AccountFollowingView

View File

@ -12,6 +12,7 @@ type Route
= AccountFollowersRoute String
| AccountFollowingRoute String
| AccountRoute String
| AccountRepliesRoute String
| AccountSelectorRoute
| BlocksRoute
| FavoriteTimelineRoute
@ -40,6 +41,7 @@ route =
, map MutesRoute (s "mutes" </> top)
, map AccountFollowersRoute (s "account" </> string </> s "followers")
, map AccountFollowingRoute (s "account" </> string </> s "following")
, map AccountRepliesRoute (s "account" </> string </> s "replies")
, map AccountRoute (s "account" </> string)
, map AccountSelectorRoute (s "accounts")
, map SearchRoute (s "search" </> top)
@ -79,6 +81,15 @@ update ({ accountInfo } as model) =
Just AccountSelectorRoute ->
{ model | currentView = AccountSelectorView, server = "" } ! []
Just (AccountRepliesRoute accountId) ->
{ model
| currentView = AccountView AccountStatusesRepliesView
, accountInfo = Update.AccountInfo.empty
}
! [ Command.loadAccount (List.head model.clients) accountId
, Command.loadAccountTimelineReplies (List.head model.clients) accountId Nothing
]
Just (AccountRoute accountId) ->
{ model
| currentView = AccountView AccountStatusesView

View File

@ -200,7 +200,7 @@ counterLink href_ label count active =
a
[ href href_
, class <|
"col-md-4"
"col-md-3"
++ (if active then
" active"
else
@ -225,6 +225,11 @@ counterLinks subView account =
"Statuses"
statuses_count
(subView == AccountStatusesView)
, counterLink
("#account/" ++ account.id ++ "/replies")
"With Replies"
statuses_count
(subView == AccountStatusesRepliesView)
, counterLink
("#account/" ++ account.id ++ "/following")
"Following"
@ -338,6 +343,9 @@ accountView subView currentUser accountInfo =
AccountStatusesView ->
accountTimelineView currentUser accountInfo
AccountStatusesRepliesView ->
accountTimelineView currentUser accountInfo
_ ->
accountFollowView subView currentUser accountInfo
]