// NewNotifyingCommentsController creates a comments controller with notification broadcast.
339529
func NewNotifyingCommentsController(service *goa.Service, db application.DB, notificationChannel notification.Channel, config CommentsControllerConfiguration) *CommentsController {
	n := notificationChannel
	if n == nil {
		n = &notification.DevNullChannel{}
	}
	return &CommentsController{
		Controller:   service.NewController("CommentsController"),
		db:           db,
		notification: n,
		config:       config,
	}
}
1147471
func NewStatusController(service *goa.Service, dbChecker DBChecker, config statusConfiguration) *StatusController {
	return &StatusController{
		Controller: service.NewController("StatusController"),
		dbChecker:  dbChecker,
		config:     config,
	}
}
668743
func CreateCommentsRelationLinks(request *http.Request, wi *workitem.WorkItem) *app.GenericLinks {
	commentsSelf := rest.AbsoluteURL(request, app.WorkitemHref(wi.ID)) + "/relationships/comments"
	commentsRelated := rest.AbsoluteURL(request, app.WorkitemHref(wi.ID)) + "/comments"
	return &app.GenericLinks{
		Self:    &commentsSelf,
		Related: &commentsRelated,
	}
}
729416
func CreateComment(opts *CreateCommentOptions) (comment *Comment, err error) {
	sess := x.NewSession()
	defer sess.Close()
	if err = sess.Begin(); err != nil {
		return nil, err
	}

	comment, err = createComment(sess, opts)
	if err != nil {
		return nil, err
	}

	return comment, sess.Commit()
}
548149
func LexInlineComment(l *Lexer) StateFn {

	// We are going to Find the start of the Comments
	p2 := l.PeekX(2)
	r := l.Next()

	// Should we be emitting the --, #, // ?  is that meaningful?
	if r == '-' && p2 == "--" {
		l.Next()
		l.Emit(TokenCommentSingleLine)
	} else if r == '/' && p2 == "//" {
		l.Next()
		l.Emit(TokenCommentSlashes)
	} else if r == '#' {
		l.Emit(TokenCommentHash)
	}

	return lexSingleLineComment
}
990111
func NewWorkItemCommentsController(service *goa.Service, db application.DB, config WorkItemCommentsControllerConfiguration) *WorkItemCommentsController {
	return NewNotifyingWorkItemCommentsController(service, db, &notification.DevNullChannel{}, config)
}
775921
func (c oauthClient) TaskComments() ([]wl.TaskComment, error) {
	lists, err := c.Lists()
	if err != nil {
		return nil, err
	}

	listCount := len(lists)
	c.logger.Debug(
		"taskComments",
		map[string]interface{}{"listCount": listCount},
	)

	taskCommentsChan := make(chan []wl.TaskComment, listCount)
	idErrChan := make(chan idErr, listCount)
	for _, l := range lists {
		go func(list wl.List) {
			c.logger.Debug(
				"taskComments - getting taskComments for list",
				map[string]interface{}{"listID": list.ID},
			)
			taskComments, err := c.TaskCommentsForListID(list.ID)
			idErrChan <- idErr{idType: "list", id: list.ID, err: err}
			taskCommentsChan <- taskComments
		}(l)
	}

	e := multiIDErr{}
	for i := 0; i < listCount; i++ {
		idErr := <-idErrChan
		if idErr.err != nil {
			c.logger.Debug(
				"taskComments - error received getting taskComments for list",
				map[string]interface{}{"listID": idErr.id, "err": err},
			)
			e.addError(idErr)
		}
	}

	totalTaskComments := []wl.TaskComment{}
	for i := 0; i < listCount; i++ {
		taskComments := <-taskCommentsChan
		totalTaskComments = append(totalTaskComments, taskComments...)
	}

	if len(e.errors()) > 0 {
		return totalTaskComments, e
	}

	return totalTaskComments, nil
}
631963
func (s *UpdateFindingsFeedbackInput) SetComments(v string) *UpdateFindingsFeedbackInput {
	s.Comments = &v
	return s
}
361034
func LexInlineCommentNoTag(l *Lexer) StateFn {

	// We are going to Find the start of the Comments
	p2 := l.PeekX(2)
	r := l.Next()

	// Should we be emitting the --, #, // ?  is that meaningful?
	if r == '-' && p2 == "--" {
		l.Next()
	} else if r == '/' && p2 == "//" {
		l.Next()
	} else if r == '#' {
		// we have consumed it
	}
	// Consume the word
	l.start = l.pos

	// Should we actually be consuming Whitespace? or is it meaningful?
	// l.SkipWhiteSpaces()

	// for {
	// 	r = l.Next()
	// 	if r == '\n' || r == eof {
	// 		l.backup()
	// 		break
	// 	}
	// }
	// l.Emit(TokenComment)
	return nil
}
342459
func NewNotification(summary, body string) Notification {
	return Notification{
		Summary: summary,
		Body:    body,
		Timeout: ExpiresDefault,
	}
}
481915
func PostComment() echo.HandlerFunc {

	// swagger:route GET /me/posts/{pid}/comments/{cid} me post comment GetMePostComment
	//
	// Shows selected comment on specified post, filtered by some parameters.
	//
	// You can personalize the request via query string parameters
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile_comments:read
	//
	//	Responses:
	//		default: MePostsPidCommentsCid

	return func(c echo.Context) error {
		return user.PostComment()(c)
	}
}
354207
func NewPostComment() echo.HandlerFunc {

	// swagger:route POST /me/posts/{pid}/comments me post NewMePostComment
	//
	// Creates a new post on the specified user board
	//
	// Consumes:
	// - application/json
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile_comments:write
	//
	//	Responses:
	//		default: MePostsPidCommentsCid

	return func(c echo.Context) error {
		return user.NewPostComment()(c)
	}
}
910856
func (s *BaremetalService) NewNotifyBaremetalProvisionDoneParams(mac string) *NotifyBaremetalProvisionDoneParams {
	p := &NotifyBaremetalProvisionDoneParams{}
	p.p = make(map[string]interface{})
	p.p["mac"] = mac
	return p
}
737072
func (item *Item) PreviewComments() []Comment {
	switch s := item.Previewcomments.(type) {
	case []interface{}:
		if len(s) == 0 {
			return nil
		}

		switch s[0].(type) {
		case interface{}:
			comments := make([]Comment, 0)
			for i := range s {
				if buf, err := json.Marshal(s[i]); err != nil {
					return nil
				} else {
					comment := &Comment{}

					if err = json.Unmarshal(buf, comment); err != nil {
						return nil
					} else {
						comments = append(comments, *comment)
					}
				}
			}
			return comments
		case string:
			comments := make([]Comment, 0)
			for i := range s {
				comments = append(comments, Comment{
					Text: s[i].(string),
				})
			}
			return comments
		}
	case string:
		comments := []Comment{
			{
				Text: s,
			},
		}
		return comments
	}
	return nil
}
1325870
func NewPostComment() echo.HandlerFunc {

	// swagger:route POST /projects/{id}/posts/{pid}/comments project post comment NewProjectPostComment
	//
	// Creates a new post on the specified project board
	//
	// Consumes:
	// - application/json
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: project_comments:write
	//
	//	Responses:
	//		default: ProjectsIdPostsPidCommentsCid

	return func(c echo.Context) error {
		if !rest.IsGranted("project_comments:write", c) {
			return rest.InvalidScopeResponse("project_comments:write", c)
		}

		// Read a rest.Message from the body request.
		message := rest.NewMessage{}
		if err := c.Bind(&message); err != nil {
			return err
		}

		// Create a nerdz.ProjectPostComment from the message
		// and current context.
		comment := nerdz.ProjectPostComment{}
		comment.Message = message.Message
		comment.Lang = message.Lang
		comment.To = c.Get("project").(*nerdz.Project).ID()
		comment.Hpid = c.Get("post").(*nerdz.ProjectPost).ID()

		// Send it
		me := c.Get("me").(*nerdz.User)
		if err := me.Add(&comment); err != nil {
			return err
		}
		// Extract the TO from the new post and return
		// selected fields.
		return rest.SelectFields(comment.GetTO(me), c)
	}
}
267618
func NewPostCommentVote() echo.HandlerFunc {

	// swagger:route POST /me/posts/{pid}/comments/{cid}/votes me post comment vote NewMePostCommentVote
	//
	// Adds a new vote on the current user post comment
	//
	// Consumes:
	// - application/json
	//
	//	Produces:
	//	- application/json
	//
	//	Security:
	//		oauth: profile_comments:write
	//
	//	Responses:
	//		default: MePostsPidCommentsCidVotes

	return func(c echo.Context) error {
		return user.NewPostCommentVote()(c)
	}
}
706211
func printComments(w io.Writer, rpt *Report) error {
	p := rpt.prof

	for _, c := range p.Comments {
		fmt.Fprintln(w, c)
	}
	return nil
}