Skip to content

Commit c5c1be5

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 293b119 + 7a73afa commit c5c1be5

File tree

563 files changed

+18644
-7778
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

563 files changed

+18644
-7778
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ config/discourse.pill
3535
# Ignore all logfiles and tempfiles.
3636
/log/*.log
3737
/tmp
38+
/logfile
3839

3940
# Ignore Eclipse .project file
4041
/.project

CONTRIBUTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,18 @@ Anyone wishing to contribute to the **[Discourse/Discourse](https://github.com/d
4242
3. Code
4343

4444
Make some magic happen! Remember to:
45+
4546
* Adhere to conventions.
46-
* Update CHANGELOG with a description of your work.
47+
* Update CHANGELOG with a detailed description of your work.
4748
* Include tests, and ensure they pass.
4849
* Remember to check to see if your new functionality has an impact on our Documentation, and include updates as appropriate.
4950

5051
Completing these steps will increase the chances of your code making it into **[Discourse/Discourse](https://github.com/discourse/discourse)**.
5152

5253
4. Follow the Coding Conventions
5354

54-
Discourse follows those code style conventions:
55+
Discourse follows these general code style conventions:
56+
5557
* two spaces, no tabs
5658
* no trailing whitespaces, blank lines should have no spaces
5759
* use spaces around operators, after commas, colons, semicolons, around `{` and before `}`
@@ -119,10 +121,10 @@ Anyone wishing to contribute to the **[Discourse/Discourse](https://github.com/d
119121
* Fill in some details about your potential patch including a meaningful title.
120122
* Click "Send pull request".
121123

122-
Once these steps are done, you will soon receive feedback from The Discourse team!
124+
Thanks for that -- we'll get to your pull request ASAP, we love pull requests!
123125

124126
10. Responding to Feedback
125127

126-
The Discourse team may recommend adjustments to your code, and this is perfectly normal. Part of interacting with a healthy open-source community requires you to be open to learning new techniques and strategies; *don't get discouraged!* Remember: if the Discourse team suggest changes to your code, **they care enough about your work that they want to include it**, and hope that you can assist by implementing those revisions on your own.
128+
The Discourse team may recommend adjustments to your code. Part of interacting with a healthy open-source community requires you to be open to learning new techniques and strategies; *don't get discouraged!* Remember: if the Discourse team suggest changes to your code, **they care enough about your work that they want to include it**, and hope that you can assist by implementing those revisions on your own.
127129

128130
[m]: http://meta.discourse.org

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ gem 'image_optim'
3636
# note: for image_sorcery to correctly work you need
3737
# sudo apt-get install -y imagemagick
3838
gem 'image_sorcery'
39-
# it patches stuff, I think we need it in prd
40-
gem 'jquery-rails'
4139
gem 'multi_json'
4240
gem 'mustache'
4341
gem 'nokogiri'

Gemfile.lock

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ GIT
1616

1717
GIT
1818
remote: https://github.com/SamSaffron/message_bus
19-
revision: 031a107bbe6e468caa67ff540485d70230d1c362
19+
revision: 9c16e7ebaafaf2a3933a84fa1c517c0eba44b052
2020
specs:
2121
message_bus (0.0.2)
2222
eventmachine
@@ -243,9 +243,6 @@ GEM
243243
coffee-rails
244244
haml
245245
journey (1.0.4)
246-
jquery-rails (2.2.1)
247-
railties (>= 3.0, < 5.0)
248-
thor (>= 0.14, < 2.0)
249246
jshint_on_rails (1.0.2)
250247
json (1.7.7)
251248
jwt (0.1.8)
@@ -268,7 +265,7 @@ GEM
268265
minitest (4.7.3)
269266
mocha (0.13.3)
270267
metaclass (~> 0.0.1)
271-
multi_json (1.7.2)
268+
multi_json (1.7.6)
272269
multipart-post (1.2.0)
273270
mustache (0.99.4)
274271
net-scp (1.1.0)
@@ -516,7 +513,6 @@ DEPENDENCIES
516513
image_optim
517514
image_sorcery
518515
jasminerice
519-
jquery-rails
520516
jshint_on_rails
521517
librarian (>= 0.0.25)
522518
listen

Guardfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,21 @@ unless ENV["USING_AUTOSPEC"]
5858
end
5959
end
6060

61+
6162
module ::Guard
6263
class AutoReload < ::Guard::Guard
6364

6465
require File.dirname(__FILE__) + '/config/environment'
66+
67+
def self.message_bus
68+
MessageBus::Instance.new.tap do |bus|
69+
bus.site_id_lookup do
70+
# this is going to be dev the majority of the time, if you have multisite configured in dev stuff may be different
71+
"default"
72+
end
73+
end
74+
end
75+
6576
def run_on_change(paths)
6677
paths.map! do |p|
6778
hash = nil
@@ -73,8 +84,7 @@ module ::Guard
7384
p = p.sub /^app\/assets\/stylesheets/, "assets"
7485
{name: p, hash: hash}
7586
end
76-
# target dev
77-
MessageBus::Instance.new.publish "/file-change", paths
87+
self.class.message_bus.publish "/file-change", paths
7888
end
7989

8090
def run_all
@@ -85,7 +95,7 @@ end
8595
Thread.new do
8696
Listen.to('tmp/') do |modified,added,removed|
8797
modified.each do |m|
88-
MessageBus::Instance.new.publish "/file-change", ["refresh"] if m =~ /refresh_browser/
98+
Guard::AutoReload.message_bus.publish "/file-change", ["refresh"] if m =~ /refresh_browser/
8999
end
90100
end
91101
end

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Discourse is built for the *next* 10 years of the Internet, so our requirements
4949
- Windows 8
5050
3. Modern small screen mobile/smartphones *as soon as possible*:
5151
- Windows Phone 8
52-
- iOS 5+
52+
- iOS 6+
5353
- Android 4.0+
5454

5555
## Built With
5.35 KB
Loading

app/assets/javascripts/admin/controllers/admin_email_logs_controller.js renamed to app/assets/javascripts/admin/controllers/admin_email_index_controller.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
/**
2-
This controller supports the interface for reviewing email logs.
2+
This controller supports email functionality.
33
4-
@class AdminEmailLogsController
5-
@extends Ember.ArrayController
4+
@class AdminEmailIndexController
5+
@extends Discourse.Controller
66
@namespace Discourse
77
@module Discourse
88
**/
9-
Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Presence, {
9+
Discourse.AdminEmailIndexController = Discourse.Controller.extend(Discourse.Presence, {
1010

1111
/**
1212
Is the "send test email" button disabled?
1313
1414
@property sendTestEmailDisabled
1515
**/
16-
sendTestEmailDisabled: function() {
17-
return this.blank('testEmailAddress');
18-
}.property('testEmailAddress'),
16+
sendTestEmailDisabled: Em.computed.empty('testEmailAddress'),
17+
18+
/**
19+
Clears the 'sentTestEmail' property on successful send.
20+
21+
@method testEmailAddressChanged
22+
**/
23+
testEmailAddressChanged: function() {
24+
this.set('sentTestEmail', false);
25+
}.observes('testEmailAddress'),
26+
1927

2028
/**
2129
Sends a test email to the currently entered email address
@@ -26,7 +34,7 @@ Discourse.AdminEmailLogsController = Ember.ArrayController.extend(Discourse.Pres
2634
this.set('sentTestEmail', false);
2735

2836
var adminEmailLogsController = this;
29-
Discourse.ajax("/admin/email_logs/test", {
37+
Discourse.ajax("/admin/email/test", {
3038
type: 'POST',
3139
data: { email_address: this.get('testEmailAddress') }
3240
}).then(function () {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
This controller previews an email digest
3+
4+
@class AdminEmailPreviewDigestController
5+
@extends Discourse.ObjectController
6+
@namespace Discourse
7+
@module Discourse
8+
**/
9+
Discourse.AdminEmailPreviewDigestController = Discourse.ObjectController.extend(Discourse.Presence, {
10+
11+
refresh: function() {
12+
var model = this.get('model');
13+
var controller = this;
14+
controller.set('loading', true);
15+
Discourse.EmailPreview.findDigest(this.get('lastSeen')).then(function (email) {
16+
model.setProperties(email.getProperties('html_content', 'text_content'));
17+
controller.set('loading', false);
18+
})
19+
}
20+
21+
});

app/assets/javascripts/admin/controllers/admin_reports_controller.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
Discourse.AdminReportsController = Ember.ObjectController.extend({
22
viewMode: 'table',
33

4-
// true if we're viewing the table mode
5-
viewingTable: function() {
6-
return this.get('viewMode') === 'table';
7-
}.property('viewMode'),
8-
9-
// true if we're viewing the bar chart mode
10-
viewingBarChart: function() {
11-
return this.get('viewMode') === 'barChart';
12-
}.property('viewMode'),
4+
viewingTable: Em.computed.equal('viewMode', 'table'),
5+
viewingBarChart: Em.computed.equal('viewMode', 'barChart'),
136

147
// Changes the current view mode to 'table'
158
viewAsTable: function() {

app/assets/javascripts/admin/controllers/admin_site_content_edit_controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@namespace Discourse
77
@module Discourse
88
**/
9-
Discourse.AdminSiteContentEditController = Discourse.ObjectController.extend({
9+
Discourse.AdminSiteContentEditController = Discourse.Controller.extend({
1010

1111
saveDisabled: function() {
1212
if (this.get('saving')) return true;

app/assets/javascripts/admin/controllers/admin_site_settings_controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P
1515
1616
@property filteredContent
1717
**/
18-
filteredContent: (function() {
18+
filteredContent: function() {
1919

2020
// If we have no content, don't bother filtering anything
2121
if (!this.present('content')) return null;
@@ -37,7 +37,7 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P
3737

3838
return true;
3939
});
40-
}).property('filter', 'content.@each', 'onlyOverridden'),
40+
}.property('filter', 'content.@each', 'onlyOverridden'),
4141

4242
/**
4343
Reset a setting to its default value

app/assets/javascripts/admin/controllers/admin_users_list_controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Pres
118118
**/
119119
approveUsers: function() {
120120
Discourse.AdminUser.bulkApprove(this.get('content').filterProperty('selected'));
121+
this.refreshUsers();
121122
}
122123

123124
});

app/assets/javascripts/admin/models/admin_api.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ Discourse.AdminApi = Discourse.Model.extend({
2020

2121
Discourse.AdminApi.reopenClass({
2222
find: function() {
23-
return Discourse.ajax("/admin/api").then(function(data) {
24-
return Discourse.AdminApi.create(data);
23+
var model = Discourse.AdminApi.create();
24+
Discourse.ajax("/admin/api").then(function(data) {
25+
model.setProperties(data);
2526
});
27+
return model;
2628
}
2729
});

app/assets/javascripts/admin/models/admin_user.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,28 @@ Discourse.AdminUser = Discourse.User.extend({
150150
});
151151
},
152152

153+
unblock: function() {
154+
Discourse.ajax('/admin/users/' + this.id + '/unblock', {type: 'PUT'}).then(function() {
155+
// succeeded
156+
window.location.reload();
157+
}, function(e) {
158+
// failed
159+
var error = Em.String.i18n('admin.user.unblock_failed', { error: "http: " + e.status + " - " + e.body });
160+
bootbox.alert(error);
161+
});
162+
},
163+
164+
block: function() {
165+
Discourse.ajax('/admin/users/' + this.id + '/block', {type: 'PUT'}).then(function() {
166+
// succeeded
167+
window.location.reload();
168+
}, function(e) {
169+
// failed
170+
var error = Em.String.i18n('admin.user.block_failed', { error: "http: " + e.status + " - " + e.body });
171+
bootbox.alert(error);
172+
});
173+
},
174+
153175
sendActivationEmail: function() {
154176
Discourse.ajax('/users/' + this.get('username') + '/send_activation_email').then(function() {
155177
// succeeded
@@ -206,6 +228,9 @@ Discourse.AdminUser.reopenClass({
206228
user.set('can_approve', false);
207229
return user.set('selected', false);
208230
});
231+
232+
bootbox.alert(Em.String.i18n("admin.user.approve_bulk_success"));
233+
209234
return Discourse.ajax("/admin/users/approve-bulk", {
210235
type: 'PUT',
211236
data: {

app/assets/javascripts/admin/models/email_log.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Discourse.EmailLog.reopenClass({
1818

1919
findAll: function(filter) {
2020
var result = Em.A();
21-
Discourse.ajax("/admin/email_logs.json", {
21+
Discourse.ajax("/admin/email/logs.json", {
2222
data: { filter: filter }
2323
}).then(function(logs) {
2424
logs.each(function(log) {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
Our data model for showing a preview of an email
3+
4+
@class EmailPreview
5+
@extends Discourse.Model
6+
@namespace Discourse
7+
@module Discourse
8+
**/
9+
Discourse.EmailPreview = Discourse.Model.extend({});
10+
11+
Discourse.EmailPreview.reopenClass({
12+
findDigest: function(last_seen_at) {
13+
return $.ajax("/admin/email/preview-digest.json", {
14+
data: {last_seen_at: last_seen_at}
15+
}).then(function (result) {
16+
return Discourse.EmailPreview.create(result);
17+
});
18+
}
19+
});
20+
21+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
Our data model for representing the current email settings
3+
4+
@class EmailSettings
5+
@extends Discourse.Model
6+
@namespace Discourse
7+
@module Discourse
8+
**/
9+
Discourse.EmailSettings = Discourse.Model.extend({});
10+
11+
Discourse.EmailSettings.reopenClass({
12+
find: function() {
13+
return Discourse.ajax("/admin/email.json").then(function (settings) {
14+
return Discourse.EmailSettings.create(settings);
15+
});
16+
}
17+
});

app/assets/javascripts/admin/models/flagged_post.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Discourse.FlaggedPost = Discourse.Post.extend({
6666
Discourse.FlaggedPost.reopenClass({
6767
findAll: function(filter) {
6868
var result = Em.A();
69+
result.set('loading', true);
6970
Discourse.ajax("/admin/flags/" + filter + ".json").then(function(data) {
7071
var userLookup = {};
7172
data.users.each(function(u) {
@@ -76,6 +77,7 @@ Discourse.FlaggedPost.reopenClass({
7677
f.userLookup = userLookup;
7778
result.pushObject(f);
7879
});
80+
result.set('loading', false);
7981
});
8082
return result;
8183
}

app/assets/javascripts/admin/models/group.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Discourse.Group.reopenClass({
8181
findAll: function(){
8282
var list = Discourse.SelectableArray.create();
8383

84-
Discourse.ajax("/admin/groups").then(function(groups){
84+
Discourse.ajax("/admin/groups.json").then(function(groups){
8585
groups.each(function(group){
8686
list.addObject(Discourse.Group.create(group));
8787
});

app/assets/javascripts/admin/routes/admin_api_route.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ Discourse.AdminApiRoute = Discourse.Route.extend({
1010

1111
model: function() {
1212
return Discourse.AdminApi.find();
13-
},
14-
15-
renderTemplate: function() {
16-
this.render({into: 'admin/templates/admin'});
1713
}
1814

1915
});

0 commit comments

Comments
 (0)