mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 13:09:18 +08:00
Rails 4 updates
This commit is contained in:
parent
0a7bbb08e1
commit
f99acebdaa
5
Gemfile
5
Gemfile
|
@ -36,7 +36,6 @@ if rails4?
|
|||
gem 'rails', '4.0.0'
|
||||
gem 'redis-rails', :git => 'git://github.com/SamSaffron/redis-store.git'
|
||||
gem 'rails-observers'
|
||||
gem 'protected_attributes'
|
||||
gem 'actionpack-action_caching'
|
||||
gem 'seed-fu' , github: 'mbleigh/seed-fu'
|
||||
gem 'spork-rails', :github => 'sporkrb/spork-rails'
|
||||
|
@ -62,7 +61,7 @@ gem 'redis'
|
|||
gem 'hiredis'
|
||||
gem 'em-redis'
|
||||
|
||||
gem 'active_model_serializers', git: 'https://github.com/rails-api/active_model_serializers.git'
|
||||
gem 'active_model_serializers'
|
||||
|
||||
# we had issues with latest, stick to the rev till we figure this out
|
||||
# PR that makes it all hang together welcome
|
||||
|
@ -120,7 +119,7 @@ gem 'sinatra', require: nil
|
|||
gem 'slim' # required for sidekiq-web
|
||||
gem 'therubyracer', require: 'v8'
|
||||
gem 'thin', require: false
|
||||
gem 'diffy', require: false
|
||||
gem 'diffy', '>= 3.0', require: false
|
||||
gem 'highline', require: false
|
||||
|
||||
# Gem that enables support for plugins. It is required.
|
||||
|
|
15
Gemfile.lock
15
Gemfile.lock
|
@ -59,13 +59,6 @@ GIT
|
|||
specs:
|
||||
email_reply_parser (0.6)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rails-api/active_model_serializers.git
|
||||
revision: fe84e0ad5268f1439123fd9a1f9fd12e25a54cd3
|
||||
specs:
|
||||
active_model_serializers (0.8.1)
|
||||
activemodel (>= 3.0)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/zhangyuan/vestal_versions
|
||||
revision: 0ea75ec4e269b5a9e609639919ade0f36381a446
|
||||
|
@ -114,6 +107,8 @@ GEM
|
|||
active_attr (0.7.0)
|
||||
activemodel (>= 3.0.2, < 4.1)
|
||||
activesupport (>= 3.0.2, < 4.1)
|
||||
active_model_serializers (0.8.1)
|
||||
activemodel (>= 3.0)
|
||||
activemodel (3.2.12)
|
||||
activesupport (= 3.2.12)
|
||||
builder (~> 3.0.0)
|
||||
|
@ -161,7 +156,7 @@ GEM
|
|||
daemons (1.1.9)
|
||||
debug_inspector (0.0.2)
|
||||
diff-lcs (1.2.4)
|
||||
diffy (2.1.4)
|
||||
diffy (3.0.1)
|
||||
em-redis (0.3.0)
|
||||
eventmachine
|
||||
ember-rails (0.10.0)
|
||||
|
@ -467,7 +462,7 @@ PLATFORMS
|
|||
|
||||
DEPENDENCIES
|
||||
active_attr
|
||||
active_model_serializers!
|
||||
active_model_serializers
|
||||
activerecord-postgres-hstore
|
||||
airbrake (= 3.1.2)
|
||||
annotate!
|
||||
|
@ -476,7 +471,7 @@ DEPENDENCIES
|
|||
binding_of_caller
|
||||
certified
|
||||
clockwork
|
||||
diffy
|
||||
diffy (>= 3.0)
|
||||
discourse_emoji!
|
||||
discourse_plugin!
|
||||
em-redis
|
||||
|
|
|
@ -89,13 +89,6 @@ GIT
|
|||
specs:
|
||||
email_reply_parser (0.6)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/rails-api/active_model_serializers.git
|
||||
revision: 8ac4bf90067eef442a6208848f86e55892d724f1
|
||||
specs:
|
||||
active_model_serializers (0.8.1)
|
||||
activemodel (>= 3.2)
|
||||
|
||||
GIT
|
||||
remote: https://github.com/zhangyuan/vestal_versions
|
||||
revision: 0ea75ec4e269b5a9e609639919ade0f36381a446
|
||||
|
@ -139,6 +132,8 @@ GEM
|
|||
rack-test (~> 0.6.2)
|
||||
actionpack-action_caching (1.0.0)
|
||||
actionpack (>= 4.0.0.beta, < 5.0)
|
||||
active_model_serializers (0.8.1)
|
||||
activemodel (>= 3.0)
|
||||
activemodel (4.0.0)
|
||||
activesupport (= 4.0.0)
|
||||
builder (~> 3.1.0)
|
||||
|
@ -318,8 +313,6 @@ GEM
|
|||
pg (0.15.1)
|
||||
polyglot (0.3.3)
|
||||
progress (2.4.0)
|
||||
protected_attributes (1.0.3)
|
||||
activemodel (>= 4.0.0, < 5.0)
|
||||
pry (0.9.12.2)
|
||||
coderay (~> 1.0.5)
|
||||
method_source (~> 0.8)
|
||||
|
@ -477,7 +470,7 @@ PLATFORMS
|
|||
|
||||
DEPENDENCIES
|
||||
actionpack-action_caching
|
||||
active_model_serializers!
|
||||
active_model_serializers
|
||||
airbrake (= 3.1.2)
|
||||
annotate!
|
||||
barber
|
||||
|
@ -485,7 +478,7 @@ DEPENDENCIES
|
|||
binding_of_caller
|
||||
certified
|
||||
clockwork
|
||||
diffy
|
||||
diffy (>= 3.0)
|
||||
discourse_emoji!
|
||||
discourse_plugin!
|
||||
em-redis
|
||||
|
@ -525,7 +518,6 @@ DEPENDENCIES
|
|||
omniauth-twitter
|
||||
openid-redis-store
|
||||
pg
|
||||
protected_attributes
|
||||
pry-nav
|
||||
pry-rails
|
||||
qunit-rails
|
||||
|
|
|
@ -9,8 +9,9 @@ class DiscourseVersionCheck
|
|||
|
||||
attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha, :missing_versions_count, :updated_at
|
||||
|
||||
def active_model_serializer
|
||||
DiscourseVersionCheckSerializer
|
||||
unless rails4?
|
||||
def active_model_serializer
|
||||
DiscourseVersionCheckSerializer
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -468,7 +468,7 @@ class Topic < ActiveRecord::Base
|
|||
|
||||
# Chooses which topic users to feature
|
||||
def feature_topic_users(args={})
|
||||
reload
|
||||
reload unless rails4?
|
||||
|
||||
# Don't include the OP or the last poster
|
||||
to_feature = posts.where('user_id NOT IN (?, ?)', user_id, last_post_user_id)
|
||||
|
|
|
@ -13,7 +13,7 @@ class DiffEngine
|
|||
#
|
||||
# returns: html containing decorations indicating the changes
|
||||
def self.html_diff(html_before, html_after)
|
||||
Diffy::Diff.new(html_before, html_after).to_s(:html)
|
||||
Diffy::Diff.new(html_before, html_after, {allow_empty_diff: false}).to_s(:html)
|
||||
end
|
||||
|
||||
# same as html diff, except that it operates on markdown
|
||||
|
|
|
@ -15,13 +15,21 @@ module Trashable
|
|||
#
|
||||
# with this in place Post.limit(10).with_deleted, will work as expected
|
||||
#
|
||||
scope = self.scoped.with_default_scope
|
||||
if rails4?
|
||||
scope = self.all.with_default_scope
|
||||
else
|
||||
scope = self.scoped.with_default_scope
|
||||
end
|
||||
scope.where_values.delete(with_deleted_scope_sql)
|
||||
scope
|
||||
end
|
||||
|
||||
def with_deleted_scope_sql
|
||||
scoped.table[:deleted_at].eq(nil).to_sql
|
||||
if rails4?
|
||||
all.table[:deleted_at].eq(nil).to_sql
|
||||
else
|
||||
scoped.table[:deleted_at].eq(nil).to_sql
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,7 +13,11 @@ describe StaticController do
|
|||
end
|
||||
|
||||
it "renders the file" do
|
||||
response.should render_template('faq')
|
||||
if rails4?
|
||||
response.should render_template('static/faq.en')
|
||||
else
|
||||
response.should render_template('faq')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -23,7 +27,11 @@ describe StaticController do
|
|||
|
||||
context "when #{setting_name} site setting is NOT set" do
|
||||
it "renders the #{id} page" do
|
||||
expect(subject).to render_template(id)
|
||||
if rails4?
|
||||
expect(subject).to render_template("static/#{id}.en")
|
||||
else
|
||||
expect(subject).to render_template(id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ describe PostMover do
|
|||
|
||||
it "copies the OP, doesn't delete it" do
|
||||
new_topic.should be_present
|
||||
new_topic.posts.reload
|
||||
new_topic.posts.first.raw.should == p1.raw
|
||||
|
||||
new_topic.reload
|
||||
|
|
|
@ -661,7 +661,7 @@ describe Topic do
|
|||
end
|
||||
|
||||
describe 'meta data' do
|
||||
let(:topic) { Fabricate(:topic, meta_data: {hello: 'world'}) }
|
||||
let(:topic) { Fabricate(:topic, meta_data: {'hello' => 'world'}) }
|
||||
|
||||
it 'allows us to create a topic with meta data' do
|
||||
topic.meta_data['hello'].should == 'world'
|
||||
|
@ -671,7 +671,7 @@ describe Topic do
|
|||
|
||||
context 'existing key' do
|
||||
before do
|
||||
topic.update_meta_data(hello: 'bane')
|
||||
topic.update_meta_data('hello' => 'bane')
|
||||
end
|
||||
|
||||
it 'updates the key' do
|
||||
|
@ -681,7 +681,7 @@ describe Topic do
|
|||
|
||||
context 'new key' do
|
||||
before do
|
||||
topic.update_meta_data(city: 'gotham')
|
||||
topic.update_meta_data('city' => 'gotham')
|
||||
end
|
||||
|
||||
it 'adds the new key' do
|
||||
|
|
Loading…
Reference in New Issue
Block a user