Quick Messages Plugin


(| full stack virgin) #51

This is how my quick message plugin looks when someone message me:

Is this okay? @angus


(Angus McLeod) #52

Are you also using my Topic List Previews plugin by any chance? This happens if you use both of these together at the moment. I will be fixing this, so you can use both together, soon.


(| full stack virgin) #53

yha. i think i am. ill disable that for the time being.

but it’s a default plugin right? can’t do anything about it?


(cpradio) #54

No, quick messages is not a default plugin (in the sense that is comes with Discourse), you will have to remove it from your plugins directory/app.yml and then perform a rebuild to remove it.


(| full stack virgin) #55

got it. thanks

fixed now.


(Angus McLeod) #56

@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.

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

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.


Help with customize css and plugin
(Marco) #57

Ok, I update and try now… =D


(Anton) #58

The concept fits very well in the Discourse paradigm. Thank you very much for your great work.

Has the issue with your topic list preview plugin been fixed since then? I wanted to use both.


(Anton) #59

Issue

After clicking on the “close” button, the input textarea gets hidden, but the chatbox remains open and I can’t close it anymore wherever I click.


(Angus McLeod) #60

Has the issue with your topic list preview plugin been fixed since then? I wanted to use both.

@meglio Yup!


(Angus McLeod) #61

Ok thanks for the bug report. I’ll fix this after fixing the issue with topic list previews.


(Angus McLeod) #62

hm, I’ve seen this issue a while ago (in a previous version of the plugin), but I can’t seem to reproduce it now (here’s a screencast of me trying: http://quick.as/LeZoh6Dol).

I made a small tweak, but it’s just a guess.

Can you reproduce it reliably? Are there are any errors in the console when it happens? Cheers.


(Anton) #63

It happens occasionally, so no reproduction steps, unfortunately.
No new errors in console when it happens.
When it happens, the only way to hide it is to reload the whole page.


(| full stack virgin) #64

I could no longer send quick message;

It keeps loading.

when you send it , no message appear. all the users are having the same problems.


(| full stack virgin) #65

When sending message, I get this pop


(Angus McLeod) #66

@Rodelio_Lagahit @meglio Thanks for the bug reports guys. Trying to pin them down…


(Angus McLeod) #67

I think this is because of rate limiting. I can reproduce this error by posting quickly. I thought this would come up eventually :slight_smile:

One wat to ‘fix’ this immediately is by changing the create post rate limit.

However, this is not a permanent solution, as the limit is in there to prevent spam. I’ll try to remove the limit from quick messages only.


(Anton) #68

Removing the limit for quick messages is exposure to spam risk - please don’t do it. That’s why that setting is there. I’d recommend showing the same alert that would be shown to someone if they posted PM messages one after another too often.

The idea here is that if I configure the limit, no way I expect every plugin to respect it.

If you don’t like showing a warning, then create another setting with some reasonable default value. But don’t ignore the rate limit.


(Angus McLeod) #69

Yes, I’m not going to remove it entirely. I think I might try to create a new limit, set it at 1 or 2 seconds by default and let the user configure it in the settings.


(| full stack virgin) #70

No probs. This is the only way I can help for this app to move forward. :smiley: