Files
outline/app/models/Emoji.ts
T
Tom Moor 57c110dbe5 chore: Upgrade MobX (#13554)
* Upgrade Mobx

* fix: Enforce MobX action boundaries

* fix: Wrap static observable updates in actions

* Remove iteration tests
2026-09-02 20:31:37 -04:00

61 lines
1.1 KiB
TypeScript

import { computed, observable } from "mobx";
import User from "./User";
import Model from "./base/Model";
import Field from "./decorators/Field";
import Relation from "./decorators/Relation";
class Emoji extends Model {
static modelName = "Emoji";
constructor(fields: Record<string, unknown>, store: Model["store"]) {
super(fields, store);
this.initialize(fields);
}
/** The name of the emoji */
@Field
@observable
private _name: string;
/** The URL of the emoji image */
@Field
@observable
url: string;
/** The ID of the related attachment */
@Field
@observable
attachmentId: string;
/** The user who created this emoji */
@Relation(() => User)
createdBy?: User;
/** The ID of the user who created this emoji */
@Field
@observable
createdById: string;
get searchContent(): string {
return this.name;
}
@computed
get shortName(): string {
return `:${this.name}:`;
}
/**
* emoji name
*/
get name() {
return this._name;
}
set name(value: string) {
this._name = value;
}
}
export default Emoji;