Skip to content

Commit ff14a57

Browse files
authored
PUT /me/token: Remove unused revoked field from response payload (#6316)
The `revoked` field is not used by the frontend, and the only API endpoint that returns the `revoked` field is the one that creates a brand new token, in which case it makes no sense for the token to be immediately revoked. This is technically a breaking change, but since this endpoint is only meant to be used by the frontend when creating new tokens via the user interface the risk of breaking something should be fairly small.
1 parent 2a52174 commit ff14a57

5 files changed

+0
-6
lines changed

src/models/token.rs

-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ mod tests {
143143
id: 12345,
144144
name: "".to_string(),
145145
token: "".to_string(),
146-
revoked: false,
147146
created_at: NaiveDate::from_ymd_opt(2017, 1, 6)
148147
.unwrap()
149148
.and_hms_opt(14, 23, 11)

src/tests/routes/me/tokens/snapshots/all__routes__me__tokens__create__create_token_success.snap

-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ api_token:
99
id: "[id]"
1010
last_used_at: "[datetime]"
1111
name: bar
12-
revoked: false
1312
token: "[token]"
1413

src/tests/routes/me/tokens/snapshots/all__routes__me__tokens__create__create_token_with_null_scopes.snap

-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ api_token:
99
id: "[id]"
1010
last_used_at: "[datetime]"
1111
name: bar
12-
revoked: false
1312
token: "[token]"
1413

src/tests/routes/me/tokens/snapshots/all__routes__me__tokens__create__create_token_with_scopes.snap

-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@ api_token:
1212
id: "[id]"
1313
last_used_at: "[datetime]"
1414
name: bar
15-
revoked: false
1615
token: "[token]"
1716

src/views.rs

-2
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,6 @@ pub struct EncodableApiTokenWithToken {
473473
pub id: i32,
474474
pub name: String,
475475
pub token: String,
476-
pub revoked: bool,
477476
#[serde(with = "rfc3339")]
478477
pub created_at: NaiveDateTime,
479478
#[serde(with = "rfc3339::option")]
@@ -490,7 +489,6 @@ impl From<CreatedApiToken> for EncodableApiTokenWithToken {
490489
id: token.model.id,
491490
name: token.model.name,
492491
token: token.plaintext,
493-
revoked: token.model.revoked,
494492
created_at: token.model.created_at,
495493
last_used_at: token.model.last_used_at,
496494
crate_scopes: token.model.crate_scopes,

0 commit comments

Comments
 (0)