Skip to content

Commit

Permalink
add hidden status to sharedata
Browse files Browse the repository at this point in the history
Co-authored-by: André Duffeck <[email protected]>
Signed-off-by: Christian Richter <[email protected]>
  • Loading branch information
dragonchaser and aduffeck committed Oct 20, 2023
1 parent 530413c commit 3107f78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ func (h *Handler) AcceptReceivedShare(w http.ResponseWriter, r *http.Request) {
}

for id := range sharesToAccept {
fieldMask := &fieldmaskpb.FieldMask{Paths: []string{"rejectshare"}}
data := h.updateReceivedShare(w, r, id, mount, fieldMask)
data := h.updateReceivedShare(w, r, id, mount, &fieldmaskpb.FieldMask{})
// only render the data for the changed share
if id == shareID && data != nil {
response.WriteOCSSuccess(w, r, []*conversions.ShareData{data})
Expand All @@ -136,7 +135,8 @@ func (h *Handler) AcceptReceivedShare(w http.ResponseWriter, r *http.Request) {
// RejectReceivedShare handles DELETE Requests on /apps/files_sharing/api/v1/shares/{shareid}
func (h *Handler) RejectReceivedShare(w http.ResponseWriter, r *http.Request) {
shareID := chi.URLParam(r, "shareid")
data := h.updateReceivedShare(w, r, shareID, "", &fieldmaskpb.FieldMask{})
fieldMask := &fieldmaskpb.FieldMask{Paths: []string{"rejectshare"}}
data := h.updateReceivedShare(w, r, shareID, "", fieldMask)
if data != nil {
response.WriteOCSSuccess(w, r, []*conversions.ShareData{data})
}
Expand All @@ -160,7 +160,7 @@ func (h *Handler) updateReceivedShare(w http.ResponseWriter, r *http.Request, sh
case "mountpoint":
continue
case "hidden":
hideFlag, _ = strconv.ParseBool(chi.URLParam(r, "hidden"))
hideFlag, _ = strconv.ParseBool(r.URL.Query().Get("hidden"))
}
}
ctx := r.Context()
Expand Down Expand Up @@ -222,6 +222,7 @@ func (h *Handler) updateReceivedShare(w http.ResponseWriter, r *http.Request, sh
}

data.State = mapState(rs.GetState())
data.Hidden = rs.Hidden

h.addFileInfo(ctx, data, info)
h.mapUserIds(r.Context(), client, data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,9 @@ func (h *Handler) GetShare(w http.ResponseWriter, r *http.Request) {
},
})
if err == nil && uRes.GetShare() != nil {
receivedshare = uRes.Share
resourceID = uRes.Share.Share.ResourceId
share, err = conversions.CS3Share2ShareData(ctx, uRes.Share.Share)
share.Hidden = uRes.Share.Hidden
if err != nil {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "error mapping share data", err)
return
Expand Down
1 change: 1 addition & 0 deletions pkg/conversions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ type ShareData struct {
Quicklink bool `json:"quicklink,omitempty" xml:"quicklink,omitempty"`
// PasswordProtected represents a public share is password protected
// PasswordProtected bool `json:"password_protected,omitempty" xml:"password_protected,omitempty"`
Hidden bool `json:"hidden" xml:"hidden"`
}

// ShareeData holds share recipient search results
Expand Down

0 comments on commit 3107f78

Please sign in to comment.