DEV: Convert admin API keys to conform to UI guidelines (#30660)

Re-opening of #30096. It was reverted because it was missing a sidebar link to Webhooks in the admin panel.
This commit is contained in:
Ted Johansson
2025-01-09 10:57:40 +08:00
committed by GitHub
parent 9bf31add6a
commit 590b3e11fb
22 changed files with 958 additions and 516 deletions

View File

@ -6,7 +6,7 @@ import discourseComputed from "discourse-common/utils/decorators";
import AdminUser from "admin/models/admin-user";
export default class ApiKey extends RestModel {
@fmt("truncated_key", "%@...") truncatedKey;
@fmt("truncated_key", "%@ ...") truncatedKey;
@computed("_user")
get user() {
@ -21,6 +21,19 @@ export default class ApiKey extends RestModel {
}
}
@computed("_created_by")
get createdBy() {
return this._created_by;
}
set created_by(value) {
if (value && !(value instanceof AdminUser)) {
this.set("_created_by", AdminUser.create(value));
} else {
this.set("_created_by", value);
}
}
@discourseComputed("description")
shortDescription(description) {
if (!description || description.length < 40) {