mirror of
https://github.com/jech/galene.git
synced 2024-12-22 15:25:48 +01:00
Rename tokens.Edit to Extend.
This commit is contained in:
parent
31f89163a2
commit
68887f13d5
3 changed files with 8 additions and 8 deletions
|
@ -1793,7 +1793,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
|
|||
if tok.Expires == nil {
|
||||
return terror("error", "trying to edit nothing")
|
||||
}
|
||||
new, err := token.Edit(
|
||||
new, err := token.Extend(
|
||||
c.group.Name(), tok.Token, *tok.Expires,
|
||||
)
|
||||
if err != nil {
|
||||
|
|
|
@ -217,18 +217,18 @@ func Add(token *Stateful) (*Stateful, error) {
|
|||
return tokens.Add(token)
|
||||
}
|
||||
|
||||
func Edit(group, token string, expires time.Time) (*Stateful, error) {
|
||||
return tokens.Edit(group, token, expires)
|
||||
func Extend(group, token string, expires time.Time) (*Stateful, error) {
|
||||
return tokens.Extend(group, token, expires)
|
||||
}
|
||||
|
||||
func (state *state) Edit(group, token string, expires time.Time) (*Stateful, error) {
|
||||
func (state *state) Extend(group, token string, expires time.Time) (*Stateful, error) {
|
||||
tokens.mu.Lock()
|
||||
defer tokens.mu.Unlock()
|
||||
return state.edit(group, token, expires)
|
||||
return state.extend(group, token, expires)
|
||||
}
|
||||
|
||||
// called locked
|
||||
func (state *state) edit(group, token string, expires time.Time) (*Stateful, error) {
|
||||
func (state *state) extend(group, token string, expires time.Time) (*Stateful, error) {
|
||||
err := state.load()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -269,11 +269,11 @@ func TestTokenStorage(t *testing.T) {
|
|||
}
|
||||
expectTokens(t, s.tokens, tokens)
|
||||
|
||||
_, err = s.Edit("test2", tokens[1].Token, now.Add(time.Hour))
|
||||
_, err = s.Extend("test2", tokens[1].Token, now.Add(time.Hour))
|
||||
if err == nil {
|
||||
t.Errorf("Edit succeeded with wrong group")
|
||||
}
|
||||
new, err := s.Edit("test", tokens[1].Token, now.Add(time.Hour))
|
||||
new, err := s.Extend("test", tokens[1].Token, now.Add(time.Hour))
|
||||
if err != nil {
|
||||
t.Errorf("Edit: %v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue