# Custom Emoji Upload on Subfolder install

**URL:** https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271
**Category:** Bug
**Tags:** emoji
**Created:** [July 21, 2015, 8:51pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271 "2015-07-21T20:51:23Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 21, 2015, 8:51pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/1 "2015-07-21T20:51:23Z")

</div>

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

```plaintext
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. 😄

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 21, 2015, 11:56pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/2 "2015-07-21T23:56:43Z")

</div>

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

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [July 27, 2015, 8:02pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/3 "2015-07-27T20:02:21Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 27, 2015, 10:56pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/4 "2015-07-27T22:56:56Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 27, 2015, 10:58pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/5 "2015-07-27T22:58:57Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 27, 2015, 11:16pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/6 "2015-07-27T23:16:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 27, 2015, 11:21pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/7 "2015-07-27T23:21:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 27, 2015, 11:23pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/8 "2015-07-27T23:23:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 27, 2015, 11:30pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/9 "2015-07-27T23:30:31Z")

</div>

OK, will do this.

Just after The Internacional 😊

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 28, 2015, 6:29am UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/10 "2015-07-28T06:29:05Z")

</div>

OK, I normalized what we have with Slack:

![](https://global.discourse-cdn.com/meta/original/3X/d/c/dc4b1ad77b44186ac61bf9889a1f7e1c1b4a4c55.png)

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…

![](https://global.discourse-cdn.com/meta/original/3X/3/e/3e8002dcd03cf976c60a766a1923bd6493fae443.png)

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 29, 2015, 12:27am UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/11 "2015-07-29T00:27:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [August 24, 2015, 8:27pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/12 "2015-08-24T20:27:01Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [August 24, 2015, 10:24pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/13 "2015-08-24T22:24:00Z")

</div>

Just found it [here](https://github.com/discourse/discourse/commit/d8d18ee0c3929494cb4be2258b784b55f19b508c). Good to know that [my patch](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271) was useful 👍

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [August 25, 2015, 4:09pm UTC](https://meta.discourse.org/t/custom-emoji-upload-on-subfolder-install/31271/14 "2015-08-25T16:09:59Z")

</div>


