func viewAdminDeleteNotification(w http.ResponseWriter, r *http.Request) {
	vars := mux.Vars(r)
	rid := vars["rid"]
	nid, _ := strconv.Atoi(vars["nid"])

	not, err := database.GetNotification(int64(nid))

	if err == nil {
		not.Delete()
	}

	uri := fmt.Sprintf("/admin/repository/%s", rid)
	http.Redirect(w, r, uri, 302)
}
func viewAdminUpdateNotification(w http.ResponseWriter, r *http.Request) {
	template := "notification/admin/update.html"
	ctx := make(responseContext)

	vars := mux.Vars(r)
	rid, _ := strconv.Atoi(vars["rid"])
	nid, _ := strconv.Atoi(vars["nid"])

	repo, err := database.GetRepositoryByID(int64(rid))

	if err != nil {
		render(w, r, "403.html", make(responseContext)) // TODO: create 500
		return
	}

	not, err := database.GetNotification(int64(nid))

	if err != nil {
		render(w, r, "403.html", make(responseContext)) // TODO: create 500
		return
	}

	ctx["repository"] = repo
	ctx["notification"] = not
	ctx["services"] = []string{
		database.NotificationServiceEmail,
		database.NotificationServiceSlack,
		database.NotificationServiceHipchat,
		database.NotificationServiceCampfire,
	}

	if r.Method == "POST" {
		err := notificationAdminForm{}.update(r, not)

		if err == nil {
			ctx["message"] = "Update successful."
		} else {
			ctx["error"] = err.Error()
		}
	}

	render(w, r, template, ctx)
}