// SetParam update Topic Parameters : MaxLength, CanForeceDate, CanUpdateMsg, CanDeleteMsg, CanUpdateAllMsg, CanDeleteAllMsg, IsROPublic // admin only, except on Private topic func (t *TopicsController) SetParam(ctx *gin.Context) { var paramJSON paramJSON ctx.Bind(¶mJSON) topic := models.Topic{} var err error if strings.HasPrefix(paramJSON.Topic, "/Private/"+utils.GetCtxUsername(ctx)) { err := topic.FindByTopic(paramJSON.Topic, false) if err != nil { ctx.JSON(http.StatusInternalServerError, gin.H{"error": "Error while fetching topic /Private/" + utils.GetCtxUsername(ctx)}) return } } else { topic, err = t.preCheckUserAdminOnTopic(ctx, paramJSON.Topic) if err != nil { ctx.JSON(http.StatusInternalServerError, err) return } } err = topic.SetParam(utils.GetCtxUsername(ctx), paramJSON.Recursive, paramJSON.MaxLength, paramJSON.CanForceDate, paramJSON.CanUpdateMsg, paramJSON.CanDeleteMsg, paramJSON.CanUpdateAllMsg, paramJSON.CanDeleteAllMsg, paramJSON.IsROPublic) if err != nil { ctx.AbortWithError(http.StatusInternalServerError, errors.New(err.Error())) return } ctx.JSON(http.StatusCreated, "") }