mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-05 22:55:58 +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.Attributes exposing (..)
|
||||||
import Html.Events exposing (onCheck, onClick, onInput)
|
import Html.Events exposing (onCheck, onClick, onInput)
|
||||||
import Http
|
import Http
|
||||||
|
import Util.Folder
|
||||||
import Util.Html exposing (KeyCode(..))
|
import Util.Html exposing (KeyCode(..))
|
||||||
import Util.ItemDragDrop as DD
|
import Util.ItemDragDrop as DD
|
||||||
import Util.Maybe
|
import Util.Maybe
|
||||||
@ -567,7 +568,11 @@ updateDrop ddm flags settings msg model =
|
|||||||
GetFolderResp (Ok fs) ->
|
GetFolderResp (Ok fs) ->
|
||||||
let
|
let
|
||||||
model_ =
|
model_ =
|
||||||
{ model | folderList = Comp.FolderSelect.init fs.items }
|
{ model
|
||||||
|
| folderList =
|
||||||
|
Util.Folder.onlyVisible flags fs.items
|
||||||
|
|> Comp.FolderSelect.init
|
||||||
|
}
|
||||||
in
|
in
|
||||||
{ model = model_
|
{ model = model_
|
||||||
, cmd = Cmd.none
|
, cmd = Cmd.none
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
module Util.Folder exposing
|
module Util.Folder exposing
|
||||||
( isFolderMember
|
( isFolderMember
|
||||||
, mkFolderOption
|
, mkFolderOption
|
||||||
|
, onlyVisible
|
||||||
)
|
)
|
||||||
|
|
||||||
import Api.Model.FolderItem exposing (FolderItem)
|
import Api.Model.FolderItem exposing (FolderItem)
|
||||||
@ -51,3 +52,13 @@ isFolderMember allFolders selected =
|
|||||||
in
|
in
|
||||||
Maybe.map .isMember folder
|
Maybe.map .isMember folder
|
||||||
|> Maybe.withDefault True
|
|> 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