Falco
(Falco)
Juillet 21, 2015, 8:51
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.
3 « J'aime »
Possible this is a bug with subfolders, @neil can you have a look?
1 « J'aime »
neil
(Neil Lalonde)
Juillet 27, 2015, 8:02
3
Even with your fixes, the emoji upload is broken with subfolders. I’ll spend more time on it.
2 « J'aime »
Falco
(Falco)
Juillet 27, 2015, 10:56
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?
2 « J'aime »
Hmm yeah, I agree, fine, but what’s a good Emoji that means “Custom goes here?” Suggestions?
1 « J'aime »
sam
(Sam Saffron)
Juillet 27, 2015, 11:16
6
first uploaded emoji (or first non hanky) is probably a reasonable default.
1 « J'aime »
Falco
(Falco)
Juillet 27, 2015, 11:21
7
I like it, maybe put a message before first upload saying this, and we have a deal
sam
(Sam Saffron)
Juillet 27, 2015, 11:23
8
you know we accept PRs for this kind of stuff
1 « J'aime »
Falco
(Falco)
Juillet 27, 2015, 11:30
9
OK, will do this.
Just after The Internacional
1 « J'aime »
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 « J'aime »
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.
2 « J'aime »
neil
(Neil Lalonde)
Août 24, 2015, 8:27
12
FYI I added this fix for uploading emoji’s on a subfolder install.
3 « J'aime »
Falco
(Falco)
Août 24, 2015, 10:24
13
Just found it here . Good to know that my patch was useful
3 « J'aime »