Merge branch 'next-minor' into develop
This commit is contained in:
commit
73d352920f
8 changed files with 50 additions and 2538 deletions
|
|
@ -13,6 +13,8 @@
|
|||
* Reduce i18n.load side effects [#7184](https://github.com/diaspora/diaspora/pull/7184)
|
||||
* Force jasmine fails on syntax errors [#7185](https://github.com/diaspora/diaspora/pull/7185)
|
||||
* Don't display mail-related view content if it is disabled in the pod's config [#7190](https://github.com/diaspora/diaspora/pull/7190)
|
||||
* Use typeahead.js from rails-assets.org [#7192](https://github.com/diaspora/diaspora/pull/7192)
|
||||
* Refactor ShareVisibilitesController to use PostService [#7196](https://github.com/diaspora/diaspora/pull/7196)
|
||||
|
||||
## Bug fixes
|
||||
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
|
||||
|
|
|
|||
1
Gemfile
1
Gemfile
|
|
@ -104,6 +104,7 @@ source "https://rails-assets.org" do
|
|||
gem "rails-assets-markdown-it-sup", "1.0.0"
|
||||
gem "rails-assets-highlightjs", "9.7.0"
|
||||
gem "rails-assets-bootstrap-markdown", "2.10.0"
|
||||
gem "rails-assets-corejs-typeahead", "1.0.1"
|
||||
|
||||
# jQuery plugins
|
||||
|
||||
|
|
|
|||
|
|
@ -646,6 +646,8 @@ GEM
|
|||
rails-assets-jquery (>= 1.9.1, < 4)
|
||||
rails-assets-bootstrap-markdown (2.10.0)
|
||||
rails-assets-bootstrap (~> 3)
|
||||
rails-assets-corejs-typeahead (1.0.1)
|
||||
rails-assets-jquery (>= 1.7)
|
||||
rails-assets-diaspora_jsxc (0.1.5.develop.7)
|
||||
rails-assets-emojione (~> 2.0.1)
|
||||
rails-assets-favico.js (>= 0.3.10, < 0.4)
|
||||
|
|
@ -997,6 +999,7 @@ DEPENDENCIES
|
|||
rails-assets-autosize (= 3.0.17)!
|
||||
rails-assets-blueimp-gallery (= 2.21.3)!
|
||||
rails-assets-bootstrap-markdown (= 2.10.0)!
|
||||
rails-assets-corejs-typeahead (= 1.0.1)!
|
||||
rails-assets-diaspora_jsxc (= 0.1.5.develop.7)!
|
||||
rails-assets-highlightjs (= 9.7.0)!
|
||||
rails-assets-jasmine-ajax (= 3.2.0)!
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
//= require markdown-it-sup
|
||||
//= require highlightjs
|
||||
//= require clear-form
|
||||
//= require typeahead.bundle.js
|
||||
//= require corejs-typeahead
|
||||
//= require app/app
|
||||
//= require diaspora
|
||||
//= require_tree ./helpers
|
||||
|
|
|
|||
|
|
@ -7,17 +7,14 @@ class ShareVisibilitiesController < ApplicationController
|
|||
before_action :authenticate_user!
|
||||
|
||||
def update
|
||||
#note :id references a postvisibility
|
||||
params[:shareable_id] ||= params[:post_id]
|
||||
params[:shareable_type] ||= 'Post'
|
||||
|
||||
vis = current_user.toggle_hidden_shareable(accessible_post)
|
||||
render :nothing => true, :status => 200
|
||||
post = post_service.find!(params[:post_id])
|
||||
current_user.toggle_hidden_shareable(post)
|
||||
head :ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def accessible_post
|
||||
@post ||= params[:shareable_type].constantize.where(:id => params[:post_id]).select("id, guid, author_id, created_at").first
|
||||
def post_service
|
||||
@post_service ||= PostService.new(current_user)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -199,15 +199,11 @@ describe ConversationsController, :type => :controller do
|
|||
end
|
||||
|
||||
it "does not create a conversation" do
|
||||
count = Conversation.count
|
||||
post :create, @hash
|
||||
expect(Conversation.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||
end
|
||||
|
||||
it "does not create a message" do
|
||||
count = Message.count
|
||||
post :create, @hash
|
||||
expect(Message.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Message, :count)
|
||||
end
|
||||
|
||||
it "responds with an error message" do
|
||||
|
|
@ -227,15 +223,11 @@ describe ConversationsController, :type => :controller do
|
|||
end
|
||||
|
||||
it "does not create a conversation" do
|
||||
count = Conversation.count
|
||||
post :create, @hash
|
||||
expect(Conversation.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||
end
|
||||
|
||||
it "does not create a message" do
|
||||
count = Message.count
|
||||
post :create, @hash
|
||||
expect(Message.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Message, :count)
|
||||
end
|
||||
|
||||
it "responds with an error message" do
|
||||
|
|
@ -255,15 +247,11 @@ describe ConversationsController, :type => :controller do
|
|||
end
|
||||
|
||||
it "does not create a conversation" do
|
||||
count = Conversation.count
|
||||
post :create, @hash
|
||||
expect(Conversation.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||
end
|
||||
|
||||
it "does not create a message" do
|
||||
count = Message.count
|
||||
post :create, @hash
|
||||
expect(Message.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Message, :count)
|
||||
end
|
||||
|
||||
it "responds with an error message" do
|
||||
|
|
@ -288,15 +276,11 @@ describe ConversationsController, :type => :controller do
|
|||
end
|
||||
|
||||
it "does not create a conversation" do
|
||||
count = Conversation.count
|
||||
post :create, @hash
|
||||
expect(Conversation.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||
end
|
||||
|
||||
it "does not create a message" do
|
||||
count = Message.count
|
||||
post :create, @hash
|
||||
expect(Message.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Message, :count)
|
||||
end
|
||||
|
||||
it "responds with an error message" do
|
||||
|
|
@ -385,15 +369,11 @@ describe ConversationsController, :type => :controller do
|
|||
end
|
||||
|
||||
it "does not create a conversation" do
|
||||
count = Conversation.count
|
||||
post :create, @hash
|
||||
expect(Conversation.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||
end
|
||||
|
||||
it "does not create a message" do
|
||||
count = Message.count
|
||||
post :create, @hash
|
||||
expect(Message.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Message, :count)
|
||||
end
|
||||
|
||||
it "responds with an error message" do
|
||||
|
|
@ -413,15 +393,11 @@ describe ConversationsController, :type => :controller do
|
|||
end
|
||||
|
||||
it "does not create a conversation" do
|
||||
count = Conversation.count
|
||||
post :create, @hash
|
||||
expect(Conversation.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||
end
|
||||
|
||||
it "does not create a message" do
|
||||
count = Message.count
|
||||
post :create, @hash
|
||||
expect(Message.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Message, :count)
|
||||
end
|
||||
|
||||
it "responds with an error message" do
|
||||
|
|
@ -441,15 +417,11 @@ describe ConversationsController, :type => :controller do
|
|||
end
|
||||
|
||||
it "does not create a conversation" do
|
||||
count = Conversation.count
|
||||
post :create, @hash
|
||||
expect(Conversation.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||
end
|
||||
|
||||
it "does not create a message" do
|
||||
count = Message.count
|
||||
post :create, @hash
|
||||
expect(Message.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Message, :count)
|
||||
end
|
||||
|
||||
it "responds with an error message" do
|
||||
|
|
@ -471,15 +443,11 @@ describe ConversationsController, :type => :controller do
|
|||
end
|
||||
|
||||
it "does not create a conversation" do
|
||||
count = Conversation.count
|
||||
post :create, @hash
|
||||
expect(Conversation.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||
end
|
||||
|
||||
it "does not create a message" do
|
||||
count = Message.count
|
||||
post :create, @hash
|
||||
expect(Message.count).to eq(count)
|
||||
expect { post :create, @hash }.not_to change(Message, :count)
|
||||
end
|
||||
|
||||
it "responds with an error message" do
|
||||
|
|
|
|||
|
|
@ -7,32 +7,42 @@ require 'spec_helper'
|
|||
describe ShareVisibilitiesController, :type => :controller do
|
||||
before do
|
||||
@status = alice.post(:status_message, :text => "hello", :to => alice.aspects.first)
|
||||
sign_in(bob, scope: :user)
|
||||
end
|
||||
|
||||
describe '#update' do
|
||||
context "on a post you can see" do
|
||||
before do
|
||||
sign_in(bob, scope: :user)
|
||||
end
|
||||
|
||||
it 'succeeds' do
|
||||
put :update, :format => :js, :id => 42, :post_id => @status.id
|
||||
expect(response).to be_success
|
||||
end
|
||||
|
||||
it 'it calls toggle_hidden_shareable' do
|
||||
expect(@controller.current_user).to receive(:toggle_hidden_shareable).with(an_instance_of(Post))
|
||||
expect(@controller.current_user).to receive(:toggle_hidden_shareable).with(an_instance_of(StatusMessage))
|
||||
put :update, :format => :js, :id => 42, :post_id => @status.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#accessible_post" do
|
||||
it "memoizes a query for a post given a post_id param" do
|
||||
id = 1
|
||||
@controller.params[:post_id] = id
|
||||
@controller.params[:shareable_type] = 'Post'
|
||||
|
||||
expect(Post).to receive(:where).with(hash_including(:id => id)).once.and_return(double.as_null_object)
|
||||
2.times do |n|
|
||||
@controller.send(:accessible_post)
|
||||
context "on a post you can't see" do
|
||||
before do
|
||||
sign_in(eve, scope: :user)
|
||||
end
|
||||
|
||||
it "raises an error" do
|
||||
expect {
|
||||
put :update, format: :js, id: 42, post_id: @status.id
|
||||
}.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
it "it doesn't call toggle_hidden_shareable" do
|
||||
expect(@controller.current_user).not_to receive(:toggle_hidden_shareable).with(an_instance_of(StatusMessage))
|
||||
begin
|
||||
put :update, format: :js, id: 42, post_id: @status.id
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
2469
vendor/assets/javascripts/typeahead.bundle.js
vendored
2469
vendor/assets/javascripts/typeahead.bundle.js
vendored
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue