From 5bd94c15c71a96a0be8b22e9bf5484e2f33b0926 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Wed, 27 Apr 2016 21:43:40 -0700 Subject: [PATCH] Use camo to avoid mixed content warnings when displaying emoji. --- frontend_tests/node_tests/echo.js | 3 ++- frontend_tests/node_tests/templates.js | 3 ++- static/js/admin.js | 5 +++-- static/js/emoji.js | 4 ++-- static/templates/admin_emoji_list.handlebars | 2 +- zerver/lib/bugdown/__init__.py | 4 ++-- zerver/models.py | 4 +++- zerver/tests/test_bugdown.py | 4 ++-- 8 files changed, 17 insertions(+), 12 deletions(-) diff --git a/frontend_tests/node_tests/echo.js b/frontend_tests/node_tests/echo.js index e58da0ea69..19e2b29733 100644 --- a/frontend_tests/node_tests/echo.js +++ b/frontend_tests/node_tests/echo.js @@ -3,7 +3,8 @@ var path = require('path'); var fs = require('fs'); set_global('page_params', {realm_emoji: { - burrito: 'static/third/gemoji/images/emoji/burrito.png' + burrito: {display_url: 'static/third/gemoji/images/emoji/burrito.png', + source_url: 'static/third/gemoji/images/emoji/burrito.png'} }}); add_dependencies({ diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.js index c774065152..8639ff756d 100644 --- a/frontend_tests/node_tests/templates.js +++ b/frontend_tests/node_tests/templates.js @@ -733,7 +733,8 @@ function render(template_name, args) { var args = { emoji: { "name": "MouseFace", - "url": "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png" + "display_url": "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png", + "source_url": "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png" } }; diff --git a/static/js/admin.js b/static/js/admin.js index e367b922a9..ae2d6884d2 100644 --- a/static/js/admin.js +++ b/static/js/admin.js @@ -77,8 +77,9 @@ function populate_streams (streams_data) { exports.populate_emoji = function (emoji_data) { var emoji_table = $('#admin_emoji_table').expectOne(); emoji_table.find('tr.emoji_row').remove(); - _.each(emoji_data, function (url, name) { - emoji_table.append(templates.render('admin_emoji_list', {emoji: {name: name, url: url}})); + _.each(emoji_data, function (data, name) { + emoji_table.append(templates.render('admin_emoji_list', {emoji: {name: name, source_url: data.source_url, + display_url: data.display_url}})); }); loading.destroy_indicator($('#admin_page_emoji_loading_indicator')); }; diff --git a/static/js/emoji.js b/static/js/emoji.js index 5cea821dcf..6f5543f10f 100644 --- a/static/js/emoji.js +++ b/static/js/emoji.js @@ -17,8 +17,8 @@ _.each(emoji_names, function (value) { exports.update_emojis = function update_emojis(realm_emojis) { // Copy the default emoji list and add realm-specific emoji to it exports.emojis = default_emojis.slice(0); - _.each(realm_emojis, function (url, name) { - exports.emojis.push({emoji_name:name, emoji_url: url}); + _.each(realm_emojis, function (data, name) { + exports.emojis.push({emoji_name:name, emoji_url: data.display_url}); }); exports.emojis_by_name = {}; _.each(exports.emojis, function (emoji) { diff --git a/static/templates/admin_emoji_list.handlebars b/static/templates/admin_emoji_list.handlebars index a73549d0d1..a17ea5d56f 100644 --- a/static/templates/admin_emoji_list.handlebars +++ b/static/templates/admin_emoji_list.handlebars @@ -4,7 +4,7 @@ {{name}} - {{name}} + {{name}}