2020-06-02 13:56:59 -07:00
|
|
|
class Message {
|
|
|
|
constructor(model) {
|
|
|
|
this.author = model.author
|
|
|
|
this.body = model.body
|
|
|
|
this.image = "https://robohash.org/" + model.author
|
|
|
|
}
|
|
|
|
|
2020-06-02 15:37:36 -07:00
|
|
|
linkedText() {
|
|
|
|
return autoLink(this.body, { embed: true })
|
|
|
|
}
|
|
|
|
|
2020-06-02 13:56:59 -07:00
|
|
|
toModel() {
|
|
|
|
return {
|
|
|
|
author: this.author(),
|
|
|
|
body: this.body(),
|
|
|
|
image: this.image()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|