1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-05 05:25:27 +02:00

EmberJS: FolderID to SpaceID

Co-Authored-By: Harvey Kandola <harvey@documize.com>
This commit is contained in:
sauls8t 2018-10-12 17:54:15 +01:00
parent 66d5e73ed1
commit e0457b40da
45 changed files with 170 additions and 99 deletions

View file

@ -51,9 +51,9 @@ func (h *Handler) upload(w http.ResponseWriter, r *http.Request) (string, string
method := "conversion.upload"
ctx := domain.GetRequestContext(r)
folderID := request.Param(r, "folderID")
spaceID := request.Param(r, "spaceID")
if !permission.CanUploadDocument(ctx, *h.Store, folderID) {
if !permission.CanUploadDocument(ctx, *h.Store, spaceID) {
response.WriteForbiddenError(w)
return "", "", ""
}
@ -92,10 +92,10 @@ func (h *Handler) upload(w http.ResponseWriter, r *http.Request) (string, string
h.Runtime.Log.Info(fmt.Sprintf("Org %s (%s) [Uploaded] %s", ctx.OrgName, ctx.OrgID, filename.Filename))
return job, folderID, ctx.OrgID
return job, spaceID, ctx.OrgID
}
func (h *Handler) convert(w http.ResponseWriter, r *http.Request, job, folderID string, conversion api.ConversionJobRequest) {
func (h *Handler) convert(w http.ResponseWriter, r *http.Request, job, spaceID string, conversion api.ConversionJobRequest) {
method := "conversion.upload"
ctx := domain.GetRequestContext(r)
@ -145,7 +145,7 @@ func (h *Handler) convert(w http.ResponseWriter, r *http.Request, job, folderID
}
// Fetch space where document resides.
sp, err := h.Store.Space.Get(ctx, folderID)
sp, err := h.Store.Space.Get(ctx, spaceID)
if err != nil {
ctx.Transaction.Rollback()
response.WriteServerError(w, method, err)

View file

@ -29,12 +29,12 @@ type Handler struct {
// UploadConvert is an endpoint to both upload and convert a document
func (h *Handler) UploadConvert(w http.ResponseWriter, r *http.Request) {
job, folderID, orgID := h.upload(w, r)
job, spaceID, orgID := h.upload(w, r)
if job == "" {
return // error already handled
}
h.convert(w, r, job, folderID, api.ConversionJobRequest{
h.convert(w, r, job, spaceID, api.ConversionJobRequest{
Job: job,
IndexDepth: 4,
OrgID: orgID,