mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
revert - FIX: use CDN for user card/profile background and user avatars
This commit is contained in:
parent
07d5d8faac
commit
22adb682d8
@ -24,12 +24,6 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
|
||||
return u + url;
|
||||
},
|
||||
|
||||
getURLWithCDN: function(url) {
|
||||
url = this.getURL(url);
|
||||
if (Discourse.CDN) { url = Discourse.CDN + url; }
|
||||
return url;
|
||||
},
|
||||
|
||||
Resolver: DiscourseResolver,
|
||||
|
||||
_titleChanged: function() {
|
||||
|
@ -1,5 +1,4 @@
|
||||
var esc = Handlebars.Utils.escapeExpression;
|
||||
|
||||
Discourse.BBCode.register('quote', {noWrap: true, singlePara: true}, function(contents, bbParams, options) {
|
||||
var params = {'class': 'quote'},
|
||||
username = null;
|
||||
|
@ -51,7 +51,7 @@ Discourse.Utilities = {
|
||||
|
||||
var classes = "avatar" + (options.extraClasses ? " " + options.extraClasses : "");
|
||||
var title = (options.title) ? " title='" + Handlebars.Utils.escapeExpression(options.title || "") + "'" : "";
|
||||
return "<img width='" + size + "' height='" + size + "' src='" + Discourse.getURLWithCDN(url) + "' class='" + classes + "'" + title + ">";
|
||||
return "<img width='" + size + "' height='" + size + "' src='" + url + "' class='" + classes + "'" + title + ">";
|
||||
},
|
||||
|
||||
tinyAvatar: function(avatarTemplate, options) {
|
||||
|
@ -72,9 +72,10 @@ Discourse.User = Discourse.Model.extend({
|
||||
@type {String}
|
||||
**/
|
||||
profileBackground: function() {
|
||||
var url = this.get('profile_background');
|
||||
if (Em.isEmpty(url) || !Discourse.SiteSettings.allow_profile_backgrounds) { return; }
|
||||
return 'background-image: url(' + Discourse.getURLWithCDN(url) + ')';
|
||||
var background = this.get('profile_background');
|
||||
if(Em.isEmpty(background) || !Discourse.SiteSettings.allow_profile_backgrounds) { return; }
|
||||
|
||||
return 'background-image: url(' + background + ')';
|
||||
}.property('profile_background'),
|
||||
|
||||
/**
|
||||
@ -441,7 +442,6 @@ Discourse.User.reopenClass(Discourse.Singleton, {
|
||||
|
||||
avatarTemplate: function(username, uploadedAvatarId) {
|
||||
var url;
|
||||
|
||||
if (uploadedAvatarId) {
|
||||
url = "/user_avatar/" +
|
||||
Discourse.BaseUrl +
|
||||
@ -456,7 +456,11 @@ Discourse.User.reopenClass(Discourse.Singleton, {
|
||||
Discourse.LetterAvatarVersion + ".png";
|
||||
}
|
||||
|
||||
return Discourse.getURLWithCDN(url);
|
||||
url = Discourse.getURL(url);
|
||||
if (Discourse.CDN) {
|
||||
url = Discourse.CDN + url;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -11,7 +11,6 @@ export default Discourse.View.extend(CleansUp, {
|
||||
|
||||
addBackground: function() {
|
||||
var url = this.get('controller.user.card_background');
|
||||
|
||||
if (!this.get('allowBackgrounds')) { return; }
|
||||
|
||||
var $this = this.$();
|
||||
@ -20,7 +19,7 @@ export default Discourse.View.extend(CleansUp, {
|
||||
if (Ember.isEmpty(url)) {
|
||||
$this.css('background-image', '').addClass('no-bg');
|
||||
} else {
|
||||
$this.css('background-image', "url(" + Discourse.getURLWithCDN(url) + ")").removeClass('no-bg');
|
||||
$this.css('background-image', "url(" + url + ")").removeClass('no-bg');
|
||||
}
|
||||
}.observes('controller.user.card_background'),
|
||||
|
||||
|
@ -128,9 +128,7 @@ module PrettyText
|
||||
context.eval("Discourse.SiteSettings = #{SiteSetting.client_settings_json};")
|
||||
context.eval("Discourse.CDN = '#{Rails.configuration.action_controller.asset_host}';")
|
||||
context.eval("Discourse.BaseUrl = 'http://#{RailsMultisite::ConnectionManagement.current_hostname}';")
|
||||
|
||||
context.eval("Discourse.getURL = function(url) { return '#{Discourse::base_uri}' + url };")
|
||||
context.eval("Discourse.getURLWithCDN = function(url) { url = Discourse.getURL(url); if (Discourse.CDN) { url = Discourse.CDN + url; } return url; };")
|
||||
context.eval("Discourse.getURL = function(url) {return '#{Discourse::base_uri}' + url};")
|
||||
end
|
||||
|
||||
def self.markdown(text, opts=nil)
|
||||
|
Loading…
Reference in New Issue
Block a user