aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-06-01 10:14:00 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-06-01 10:14:00 -1000
commitae9162cbf72e851a7349aa0579ba695bfa9be6b5 (patch)
treeef48cb14b0e2e6cd59cf42b1f9eccadf613f27e2 /lib/serve.js
parentd51b2ca77b945cef037d2da636d80ee9fa0cc4ce (diff)
downloadpatchfoo-ae9162cbf72e851a7349aa0579ba695bfa9be6b5.tar.gz
patchfoo-ae9162cbf72e851a7349aa0579ba695bfa9be6b5.zip
Cache emoji names from emojis page
%pnyiiuQYfenwuzyelJwZnp2kN9iC11QTpzkCKh/i/f0=.sha256
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index c1353aa..9d5eb82 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -2237,12 +2237,18 @@ Serve.prototype.getBuiltinEmojiLink = function (name) {
Serve.prototype.emojis = function (path) {
var self = this
+ var seen = {}
pull(
ph('section', [
ph('h3', 'Emojis'),
ph('ul', {class: 'mentions'}, pull(
self.app.streamEmojis(),
pull.map(function (emoji) {
+ if (!seen[emoji.name]) {
+ // cache the first use, so that our uses take precedence over other feeds'
+ self.app.reverseEmojiNameCache.set(emoji.name, emoji.link)
+ seen[emoji.name] = true
+ }
return ph('li', [
ph('a', {href: self.app.render.toUrl('/links/' + emoji.link)},
ph('img', {