# Quick Messages Plugin

**URL:** https://meta.discourse.org/t/quick-messages-plugin/39188
**Category:** Plugin
**Tags:** broken
**Created:** [February 8, 2016, 12:13am UTC](https://meta.discourse.org/t/quick-messages-plugin/39188 "2016-02-08T00:13:55Z")
**Posts on this page:** 1
**Showing post:** 56

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [April 6, 2016, 1:18pm UTC](https://meta.discourse.org/t/quick-messages-plugin/39188/56 "2016-04-06T13:18:47Z")

</div>

@Rodelio_Lagahit @Roxelle Ok this issue should be fixed now. You can use Quick Messages and Topic List Previews together safely now.

What was happening was that both Quick Messages and Topic List Previews were overriding the `excerpt` and `include_excerpt` methods used in the Listable Topic (or Topic List Item) serializer. So I just moved Quick Messages over to a new method `message_excerpt` so the two would not conflict.

```plaintext
def message_excerpt
  if object.archetype == Archetype.private_message
     cooked = Post.where(topic_id: object.id, post_number: object.highest_post_number).pluck('cooked')
     excerpt = PrettyText.excerpt(cooked[0], 200, keep_emoji_images: true)
     excerpt.gsub!(/(\[image\])/, "<i class='fa fa-picture-o'></i>") if excerpt
     excerpt
  else
     return false
  end
end

def include_message_excerpt?
  !!message_excerpt
end

```

[https://github.com/angusmcleod/discourse-quick-messages/commit/2a71ff7c83f253edeea1d43224b1ef6c779cf836](https://github.com/angusmcleod/discourse-quick-messages/commit/2a71ff7c83f253edeea1d43224b1ef6c779cf836)

Btw, notice that, like in Topic List Previews, I’m stripping out the [image] text which acts as a placeholder for an image in a excerpt.

`excerpt.gsub!(/(\[image\])/, "<i class='fa fa-picture-o'></i>") if excerpt`

This was originally a request for Topic List Previews, and I also think that having ‘[image]’ placeholders in excerpts looks a little…unpolished. I’m experimenting here with putting the Font Awesome icon fa-picture-o in its place so that there is still a placeholder for images in excerpts. If message only contains an image some kind of placeholder is necessary, otherwise the excerpt will show up blank. Any feedback or ideas on that are welcome.

 ![](https://global.discourse-cdn.com/meta/original/3X/8/0/80cdd57f08151fb4d9407d1bc11520b59c143f5d.png)

---

_[View the full topic](https://meta.discourse.org/t/quick-messages-plugin/39188)._
