Avoid DB query when there are no mentions

Avoid DB query when there are no mentions.

From 4752ddc9087c51f21c5929bab722a88825429667 Mon Sep 17 00:00:00 2001
From: Guo Xiang Tan <tgx_world@hotmail.com>
Date: Thu, 22 Nov 2018 16:42:56 +0800
Subject: [PATCH] Avoid DB query when there are no mentions.


diff --git a/lib/pretty_text.rb b/lib/pretty_text.rb
index 9b7463b..6738710 100644
--- a/lib/pretty_text.rb
+++ b/lib/pretty_text.rb
@@ -456,6 +456,8 @@ module PrettyText
   end
 
   def self.lookup_mentions(names, user_id: nil)
+    return {} if names.blank?
+
     sql = <<~SQL
     (
       SELECT

GitHub

2 Likes