Custom Emoji Upload on Subfolder install

Custom emoji uploaded on a subfolder install point to wrong location, without the subfolder prefix.

diff --git a/app/models/emoji.rb b/app/models/emoji.rb
index d1dcab4..10313e4 100644
--- a/app/models/emoji.rb
+++ b/app/models/emoji.rb
@@ -47,7 +47,7 @@ class Emoji
     extension = File.extname(path)
     Emoji.new(path).tap do |e|
       e.name = File.basename(path, ".*")
-      e.url = "/#{base_url}/#{e.name}#{extension}"
+      e.url = "#{base_url}/#{e.name}#{extension}"
     end
   end
 
@@ -110,12 +110,12 @@ class Emoji
   end
 
   def self.base_directory
-    "public/#{base_url}"
+    "public#{base_url}"
   end
 
   def self.base_url
     db = RailsMultisite::ConnectionManagement.current_db
-    "uploads/#{db}/_emoji"
+    "#{Discourse.base_uri}/uploads/#{db}/_emoji"
   end
 
 end

The patch above fix it, but I don’t know if they break non-subfolders installs. :smile:

3 לייקים

Possible this is a bug with subfolders, @neil can you have a look?

לייק 1

Even with your fixes, the emoji upload is broken with subfolders. I’ll spend more time on it.

2 לייקים

On a kinda related thing about custom emoji:

Installed discourse on my company

Financial company, lots of old people

Uploaded first custom emoji with company logo

Colleague asks where emoji is on the emoji dialog

After searching a bit I say: in the hankey section

I know I can change it, but maybe use another default?

2 לייקים

Hmm yeah, I agree, fine, but what’s a good Emoji that means “Custom goes here?” Suggestions?

לייק 1

first uploaded emoji (or first non hanky) is probably a reasonable default.

לייק 1

I like it, maybe put a message before first upload saying this, and we have a deal :smile:

you know we accept PRs for this kind of stuff :fonzie:

לייק 1

OK, will do this.

Just after The Internacional :blush:

לייק 1

OK, I normalized what we have with Slack:

Categories are:

  • People (smiley)
  • Nature (leaf)
  • Food & Drink (hamburger)
  • Celebration (gift)
  • Activities (football / soccer ball)
  • Travel & Places (airplane)
  • Objects & Symbols (glasses)

I also added a tabicon field to the data structure so we can specify which emoji (by name) should be on the tab.

And I added a fullname which could be used as the tooltip or complete name displayed for the category.

important side effect (which was kinda the point of this, not just to mimic Slack’s categories although they are clearly a bit better) the custom tab finally has only truly custom Emoji…

… not the confusing, weird mish-mash of “not categorized” official unicode Emoji and custom it had before. That was a bug in my opinion.

3 לייקים

Ok, @techapj did the last part of this – we can select which emoji is on each tab, and there is a proper category name + tooltip. :kissing_heart:

2 לייקים

FYI I added this fix for uploading emoji’s on a subfolder install.

3 לייקים

Just found it here. Good to know that my patch was useful :thumbsup:

3 לייקים