Custom Emoji Upload on Subfolder install

emoji

(Rafael dos Santos Silva) #1

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:


Subfolder support with Docker
(Jeff Atwood) #2

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


(Neil Lalonde) #3

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


(Rafael dos Santos Silva) #4

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?


(Jeff Atwood) #5

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


(Sam Saffron) #6

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


(Rafael dos Santos Silva) #7

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


(Sam Saffron) #8

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


(Rafael dos Santos Silva) #9

OK, will do this.

Just after The Internacional :blush:


(Jeff Atwood) #10

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.


(Jeff Atwood) #11

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:


(Neil Lalonde) #12

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


Arguments against integrated intranet solutions?
(Rafael dos Santos Silva) #13

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


(Neil Lalonde) #14