Show only visible folders in search menu

This commit is contained in:
Eike Kettner 2020-08-08 14:16:13 +02:00
parent d6d16e39bd
commit b1ef0c55af
2 changed files with 17 additions and 1 deletions

View File

@ -32,6 +32,7 @@ import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onCheck, onClick, onInput)
import Http
import Util.Folder
import Util.Html exposing (KeyCode(..))
import Util.ItemDragDrop as DD
import Util.Maybe
@ -567,7 +568,11 @@ updateDrop ddm flags settings msg model =
GetFolderResp (Ok fs) ->
let
model_ =
{ model | folderList = Comp.FolderSelect.init fs.items }
{ model
| folderList =
Util.Folder.onlyVisible flags fs.items
|> Comp.FolderSelect.init
}
in
{ model = model_
, cmd = Cmd.none

View File

@ -1,6 +1,7 @@
module Util.Folder exposing
( isFolderMember
, mkFolderOption
, onlyVisible
)
import Api.Model.FolderItem exposing (FolderItem)
@ -51,3 +52,13 @@ isFolderMember allFolders selected =
in
Maybe.map .isMember folder
|> Maybe.withDefault True
onlyVisible : Flags -> List FolderItem -> List FolderItem
onlyVisible flags folders =
let
isVisible folder =
folder.isMember
|| (Maybe.map .user flags.account == Just folder.owner.name)
in
List.filter isVisible folders