mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 Fix missed wtf.Config occurrances
This commit is contained in:
@@ -8,16 +8,14 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/wtfutil/wtf/wtf"
|
||||
)
|
||||
|
||||
func CurrentActiveItems(accessToken string) (*ActiveItems, error) {
|
||||
func CurrentActiveItems(accessToken, assignedToName string, activeOnly bool) (*ActiveItems, error) {
|
||||
items := &ActiveItems{}
|
||||
|
||||
rollbarAPIURL.Host = "api.rollbar.com"
|
||||
rollbarAPIURL.Path = "/api/1/items"
|
||||
resp, err := rollbarItemRequest(accessToken)
|
||||
resp, err := rollbarItemRequest(accessToken, assignedToName, activeOnly)
|
||||
if err != nil {
|
||||
return items, err
|
||||
}
|
||||
@@ -33,13 +31,11 @@ var (
|
||||
rollbarAPIURL = &url.URL{Scheme: "https"}
|
||||
)
|
||||
|
||||
func rollbarItemRequest(accessToken string) (*http.Response, error) {
|
||||
func rollbarItemRequest(accessToken, assignedToName string, activeOnly bool) (*http.Response, error) {
|
||||
params := url.Values{}
|
||||
params.Add("access_token", accessToken)
|
||||
userName := wtf.Config.UString("wtf.mods.rollbar.assignedToName", "")
|
||||
params.Add("assigned_user", userName)
|
||||
active := wtf.Config.UBool("wtf.mods.rollbar.activeOnly", false)
|
||||
if active {
|
||||
params.Add("assigned_user", assignedToName)
|
||||
if activeOnly {
|
||||
params.Add("status", "active")
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
|
||||
accessToken: localConfig.UString("accessToken"),
|
||||
activeOnly: localConfig.UBool("activeOnly"),
|
||||
activeOnly: localConfig.UBool("activeOnly", false),
|
||||
assignedToName: localConfig.UString("assignedToName"),
|
||||
count: localConfig.UInt("count", 10),
|
||||
projectName: localConfig.UString("projectName", "Items"),
|
||||
|
||||
@@ -55,7 +55,11 @@ func (widget *Widget) Refresh() {
|
||||
return
|
||||
}
|
||||
|
||||
items, err := CurrentActiveItems(widget.settings.accessToken)
|
||||
items, err := CurrentActiveItems(
|
||||
widget.settings.accessToken,
|
||||
widget.settings.assignedToName,
|
||||
widget.settings.activeOnly,
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
widget.View.SetWrap(true)
|
||||
|
||||
Reference in New Issue
Block a user