mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-23 20:35:24 +01:00
fix(sql): do not check of affected rows bacause it can return incorrect number
This commit is contained in:
parent
38bb36736c
commit
ec036fd0c2
@ -61,16 +61,6 @@ func validateMutationResult(res sql.Result, err error) error {
|
||||
return err
|
||||
}
|
||||
|
||||
affected, err := res.RowsAffected()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if affected == 0 {
|
||||
return db.ErrNotFound
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,8 @@ func (d *SqlDb) GetAPIToken(tokenID string) (token db.APIToken, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (d *SqlDb) ExpireAPIToken(userID int, tokenID string) (err error) {
|
||||
res, err := d.exec("update user__token set expired=true where id=? and user_id=?", tokenID, userID)
|
||||
|
||||
return validateMutationResult(res, err)
|
||||
func (d *SqlDb) ExpireAPIToken(userID int, tokenID string) error {
|
||||
return validateMutationResult(d.exec("update user__token set expired=true where id=? and user_id=?", tokenID, userID))
|
||||
}
|
||||
|
||||
func (d *SqlDb) DeleteAPIToken(userID int, tokenID string) (err error) {
|
||||
|
@ -73,7 +73,7 @@
|
||||
v-model="item.ssh.private_key"
|
||||
:label="$t('privateKey')"
|
||||
:disabled="formSaving || !canEditSecrets"
|
||||
:rules="[v => !!v || $t('private_key_required')]"
|
||||
:rules="[v => !canEditSecrets || !!v || $t('private_key_required')]"
|
||||
v-if="item.type === 'ssh'"
|
||||
/>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user