diff --git a/src/Command.elm b/src/Command.elm index 26fe77e..fba5c45 100644 --- a/src/Command.elm +++ b/src/Command.elm @@ -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 -> diff --git a/src/Types.elm b/src/Types.elm index 4a01284..e0ae6a8 100644 --- a/src/Types.elm +++ b/src/Types.elm @@ -166,6 +166,7 @@ type CurrentView type CurrentAccountView = AccountStatusesView + | AccountStatusesRepliesView | AccountFollowersView | AccountFollowingView diff --git a/src/Update/Route.elm b/src/Update/Route.elm index 4f797c2..a441e48 100644 --- a/src/Update/Route.elm +++ b/src/Update/Route.elm @@ -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 diff --git a/src/View/Account.elm b/src/View/Account.elm index 8a4853b..51e16b9 100644 --- a/src/View/Account.elm +++ b/src/View/Account.elm @@ -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 ]