<commit_before>package main

import (
	"fmt"
	"koding/db/models"
	"koding/db/mongodb/modelhelper"
	"math/rand"
	"socialapi/workers/email/emailsender"
	"time"
)

var currentVersion = "v1"

type Action func(*models.User, string) error

func SendEmail(user *models.User, warningID string) error {
	subject := fmt.Sprintf("%s %s", warningID, currentVersion)

	account, err := modelhelper.GetAccount(user.Name)
	if err != nil {
		return err
	}

	mail := &emailsender.Mail{
		To:      user.Email,
		Subject: subject,
		Properties: &emailsender.Properties{
			Username: user.Name,
			Options: map[string]interface{}{
				"firstName": account.Profile.FirstName,
			},
		},
	}

	return emailsender.Send(mail)
}

type requestArgs struct {
	MachineID string `json:"machineId"`
}

func DeleteVMs(user *models.User, _ string) error {
	if KiteClient == nil {
		return ErrKloudKlientNotInitialized
	}

	machines, err := modelhelper.GetMachinesByUsername(user.Name)
	if err != nil {
		return err<commit_msg>janitor: send vm_name as part of email<commit_after>package main

import (
	"errors"
	"fmt"
	"koding/db/models"
	"koding/db/mongodb/modelhelper"
	"math/rand"
	"socialapi/workers/email/emailsender"
	"time"
)

var currentVersion = "v1"

type Action func(*models.User, string) error

func SendEmail(user *models.User, warningID string) error {
	subject := fmt.Sprintf("%s %s", warningID, currentVersion)

	account, err := modelhelper.GetAccount(user.Name)
	if err != nil {
		return err
	}

	machines, err := modelhelper.GetMachinesByUsername(user.Name)
	if err != nil {
		return err
	}

	if len(machines) < 1 {
		return errors.New("user has no vms")
	}

	mail := &emailsender.Mail{
		To:      user.Email,
		Subject: subject,
		Properties: &emailsender.Properties{
			Username: user.Name,
			Options: map[string]interface{}{
				"first_name": account.Profile.FirstName,
				"vm_name":    machines[0].Label,
			},
		},
	}

	return emailsender.Send(mail)
}

type requestArgs struct {
	MachineID string `json:"machineId"`
}

func DeleteVMs(user *models.User, _ string) error {
	if KiteClient == nil {
		return ErrKloudKlientNotInitialized
	}

	machines, err := modelhelper.GetMachinesByUsername(user.Name)
	if err != nil {
		return err
{'fraction_non_alphanumeric': 0.1284362325371789, 'fraction_numerical': 0.0018026137899954935, 'mean_word_length': 4.260663507109005, 'pattern_counts': {'":': 3, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7472846', 'n_tokens_mistral': 833, 'n_tokens_neox': 774, 'n_words': 176}