From ae9162cbf72e851a7349aa0579ba695bfa9be6b5 Mon Sep 17 00:00:00 2001 From: cel Date: Thu, 1 Jun 2017 10:14:00 -1000 Subject: Cache emoji names from emojis page %pnyiiuQYfenwuzyelJwZnp2kN9iC11QTpzkCKh/i/f0=.sha256 --- lib/serve.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/serve.js') 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', { -- cgit v1.2.3