mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
FIX: use CDN for user avatars (take 2)
This commit is contained in:
parent
23dadfc06e
commit
25a1bf421e
3 changed files with 4 additions and 6 deletions
|
@ -33,7 +33,7 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
|
||||||
getURLWithCDN: function(url) {
|
getURLWithCDN: function(url) {
|
||||||
url = this.getURL(url);
|
url = this.getURL(url);
|
||||||
// https:// and http:// and // should be skipped, only /xyz is allowed here
|
// https:// and http:// and // should be skipped, only /xyz is allowed here
|
||||||
if (Discourse.CDN && url[1] !== "/") {
|
if (Discourse.CDN && /^\/[^\/]/.test(url)) {
|
||||||
url = Discourse.CDN + url;
|
url = Discourse.CDN + url;
|
||||||
} else if (Discourse.S3CDN) {
|
} else if (Discourse.S3CDN) {
|
||||||
url = url.replace(Discourse.S3BaseUrl, Discourse.S3CDN);
|
url = url.replace(Discourse.S3BaseUrl, Discourse.S3CDN);
|
||||||
|
|
|
@ -20,10 +20,7 @@ Em.Handlebars.helper('bound-avatar', function(user, size, uploadId) {
|
||||||
* Used when we only have a template
|
* Used when we only have a template
|
||||||
*/
|
*/
|
||||||
Em.Handlebars.helper('bound-avatar-template', function(avatarTemplate, size) {
|
Em.Handlebars.helper('bound-avatar-template', function(avatarTemplate, size) {
|
||||||
return new safe(Discourse.Utilities.avatarImg({
|
return new safe(Discourse.Utilities.avatarImg({ size: size, avatarTemplate: avatarTemplate }));
|
||||||
size: size,
|
|
||||||
avatarTemplate: avatarTemplate
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
registerUnbound('raw-date', function(dt) {
|
registerUnbound('raw-date', function(dt) {
|
||||||
|
|
|
@ -44,7 +44,8 @@ Discourse.Utilities = {
|
||||||
|
|
||||||
var classes = "avatar" + (options.extraClasses ? " " + options.extraClasses : "");
|
var classes = "avatar" + (options.extraClasses ? " " + options.extraClasses : "");
|
||||||
var title = (options.title) ? " title='" + Handlebars.Utils.escapeExpression(options.title || "") + "'" : "";
|
var title = (options.title) ? " title='" + Handlebars.Utils.escapeExpression(options.title || "") + "'" : "";
|
||||||
return "<img alt='' width='" + size + "' height='" + size + "' src='" + url + "' class='" + classes + "'" + title + ">";
|
|
||||||
|
return "<img alt='' width='" + size + "' height='" + size + "' src='" + Discourse.getURLWithCDN(url) + "' class='" + classes + "'" + title + ">";
|
||||||
},
|
},
|
||||||
|
|
||||||
tinyAvatar: function(avatarTemplate, options) {
|
tinyAvatar: function(avatarTemplate, options) {
|
||||||
|
|
Loading…
Reference in a new issue