mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-04 10:29:34 +00:00
Show only visible folders in search menu
This commit is contained in:
parent
d6d16e39bd
commit
b1ef0c55af
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user