summaryrefslogtreecommitdiff
path: root/rhimport/importer.go
diff options
context:
space:
mode:
Diffstat (limited to 'rhimport/importer.go')
-rw-r--r--rhimport/importer.go29
1 files changed, 2 insertions, 27 deletions
diff --git a/rhimport/importer.go b/rhimport/importer.go
index d7365a5..9b29e97 100644
--- a/rhimport/importer.go
+++ b/rhimport/importer.go
@@ -359,21 +359,6 @@ func removeAddCartCut(ctx *Context, res *Result) (err error) {
return addCartCut(ctx, res)
}
-func isCartMemberOfShow(ctx *Context, res *Result, carts []uint) (found bool) {
- if ctx.Cart == 0 {
- return true
- }
- for _, cart := range carts {
- if cart == ctx.Cart {
- return true
- }
- }
- res.ResponseCode = http.StatusBadRequest
- res.ErrorString = fmt.Sprintf("Requested cart %d is not a member of show: %d", ctx.Cart, ctx.ShowId)
- res.Cart = ctx.Cart
- return false
-}
-
func clearShowCarts(ctx *Context, res *Result, carts []uint) (err error) {
if ctx.ClearShowCarts {
origCart := ctx.Cart
@@ -453,14 +438,7 @@ func ImportFile(ctx *Context) (res *Result, err error) {
rmCartOnErr := false
rmCutOnErr := false
if ctx.ShowId != 0 { // Import to a show
- var showCarts []uint
- if showCarts, err = ctx.getShowInfo(); err != nil {
- return
- }
- if !isCartMemberOfShow(ctx, res, showCarts) {
- return
- }
- if err = clearShowCarts(ctx, res, showCarts); err != nil || (res.ResponseCode != http.StatusOK && res.ResponseCode != http.StatusNotFound) {
+ if err = clearShowCarts(ctx, res, ctx.ShowCarts); err != nil || (res.ResponseCode != http.StatusOK && res.ResponseCode != http.StatusNotFound) {
return
}
if ctx.ClearCart && !ctx.ClearShowCarts {
@@ -468,15 +446,12 @@ func ImportFile(ctx *Context) (res *Result, err error) {
return
}
} else {
- if err = addShowCartCut(ctx, res, showCarts); err != nil || res.ResponseCode != http.StatusOK {
+ if err = addShowCartCut(ctx, res, ctx.ShowCarts); err != nil || res.ResponseCode != http.StatusOK {
return
}
}
rmCartOnErr = true
} else if ctx.GroupName != "" { // Import to music pool
- if err = ctx.getMusicInfo(); err != nil {
- return
- }
if err = addCartCut(ctx, res); err != nil || res.ResponseCode != http.StatusOK {
return
}