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)
|
* 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)
|
* 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)
|
* 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
|
## Bug fixes
|
||||||
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
|
* 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-markdown-it-sup", "1.0.0"
|
||||||
gem "rails-assets-highlightjs", "9.7.0"
|
gem "rails-assets-highlightjs", "9.7.0"
|
||||||
gem "rails-assets-bootstrap-markdown", "2.10.0"
|
gem "rails-assets-bootstrap-markdown", "2.10.0"
|
||||||
|
gem "rails-assets-corejs-typeahead", "1.0.1"
|
||||||
|
|
||||||
# jQuery plugins
|
# jQuery plugins
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -646,6 +646,8 @@ GEM
|
||||||
rails-assets-jquery (>= 1.9.1, < 4)
|
rails-assets-jquery (>= 1.9.1, < 4)
|
||||||
rails-assets-bootstrap-markdown (2.10.0)
|
rails-assets-bootstrap-markdown (2.10.0)
|
||||||
rails-assets-bootstrap (~> 3)
|
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-diaspora_jsxc (0.1.5.develop.7)
|
||||||
rails-assets-emojione (~> 2.0.1)
|
rails-assets-emojione (~> 2.0.1)
|
||||||
rails-assets-favico.js (>= 0.3.10, < 0.4)
|
rails-assets-favico.js (>= 0.3.10, < 0.4)
|
||||||
|
|
@ -997,6 +999,7 @@ DEPENDENCIES
|
||||||
rails-assets-autosize (= 3.0.17)!
|
rails-assets-autosize (= 3.0.17)!
|
||||||
rails-assets-blueimp-gallery (= 2.21.3)!
|
rails-assets-blueimp-gallery (= 2.21.3)!
|
||||||
rails-assets-bootstrap-markdown (= 2.10.0)!
|
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-diaspora_jsxc (= 0.1.5.develop.7)!
|
||||||
rails-assets-highlightjs (= 9.7.0)!
|
rails-assets-highlightjs (= 9.7.0)!
|
||||||
rails-assets-jasmine-ajax (= 3.2.0)!
|
rails-assets-jasmine-ajax (= 3.2.0)!
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
//= require markdown-it-sup
|
//= require markdown-it-sup
|
||||||
//= require highlightjs
|
//= require highlightjs
|
||||||
//= require clear-form
|
//= require clear-form
|
||||||
//= require typeahead.bundle.js
|
//= require corejs-typeahead
|
||||||
//= require app/app
|
//= require app/app
|
||||||
//= require diaspora
|
//= require diaspora
|
||||||
//= require_tree ./helpers
|
//= require_tree ./helpers
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,14 @@ class ShareVisibilitiesController < ApplicationController
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
|
||||||
def update
|
def update
|
||||||
#note :id references a postvisibility
|
post = post_service.find!(params[:post_id])
|
||||||
params[:shareable_id] ||= params[:post_id]
|
current_user.toggle_hidden_shareable(post)
|
||||||
params[:shareable_type] ||= 'Post'
|
head :ok
|
||||||
|
|
||||||
vis = current_user.toggle_hidden_shareable(accessible_post)
|
|
||||||
render :nothing => true, :status => 200
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def accessible_post
|
def post_service
|
||||||
@post ||= params[:shareable_type].constantize.where(:id => params[:post_id]).select("id, guid, author_id, created_at").first
|
@post_service ||= PostService.new(current_user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -199,15 +199,11 @@ describe ConversationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a conversation" do
|
it "does not create a conversation" do
|
||||||
count = Conversation.count
|
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Conversation.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a message" do
|
it "does not create a message" do
|
||||||
count = Message.count
|
expect { post :create, @hash }.not_to change(Message, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Message.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with an error message" do
|
it "responds with an error message" do
|
||||||
|
|
@ -227,15 +223,11 @@ describe ConversationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a conversation" do
|
it "does not create a conversation" do
|
||||||
count = Conversation.count
|
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Conversation.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a message" do
|
it "does not create a message" do
|
||||||
count = Message.count
|
expect { post :create, @hash }.not_to change(Message, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Message.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with an error message" do
|
it "responds with an error message" do
|
||||||
|
|
@ -255,15 +247,11 @@ describe ConversationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a conversation" do
|
it "does not create a conversation" do
|
||||||
count = Conversation.count
|
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Conversation.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a message" do
|
it "does not create a message" do
|
||||||
count = Message.count
|
expect { post :create, @hash }.not_to change(Message, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Message.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with an error message" do
|
it "responds with an error message" do
|
||||||
|
|
@ -288,15 +276,11 @@ describe ConversationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a conversation" do
|
it "does not create a conversation" do
|
||||||
count = Conversation.count
|
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Conversation.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a message" do
|
it "does not create a message" do
|
||||||
count = Message.count
|
expect { post :create, @hash }.not_to change(Message, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Message.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with an error message" do
|
it "responds with an error message" do
|
||||||
|
|
@ -385,15 +369,11 @@ describe ConversationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a conversation" do
|
it "does not create a conversation" do
|
||||||
count = Conversation.count
|
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Conversation.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a message" do
|
it "does not create a message" do
|
||||||
count = Message.count
|
expect { post :create, @hash }.not_to change(Message, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Message.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with an error message" do
|
it "responds with an error message" do
|
||||||
|
|
@ -413,15 +393,11 @@ describe ConversationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a conversation" do
|
it "does not create a conversation" do
|
||||||
count = Conversation.count
|
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Conversation.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a message" do
|
it "does not create a message" do
|
||||||
count = Message.count
|
expect { post :create, @hash }.not_to change(Message, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Message.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with an error message" do
|
it "responds with an error message" do
|
||||||
|
|
@ -441,15 +417,11 @@ describe ConversationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a conversation" do
|
it "does not create a conversation" do
|
||||||
count = Conversation.count
|
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Conversation.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a message" do
|
it "does not create a message" do
|
||||||
count = Message.count
|
expect { post :create, @hash }.not_to change(Message, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Message.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with an error message" do
|
it "responds with an error message" do
|
||||||
|
|
@ -471,15 +443,11 @@ describe ConversationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a conversation" do
|
it "does not create a conversation" do
|
||||||
count = Conversation.count
|
expect { post :create, @hash }.not_to change(Conversation, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Conversation.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not create a message" do
|
it "does not create a message" do
|
||||||
count = Message.count
|
expect { post :create, @hash }.not_to change(Message, :count)
|
||||||
post :create, @hash
|
|
||||||
expect(Message.count).to eq(count)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it "responds with an error message" do
|
it "responds with an error message" do
|
||||||
|
|
|
||||||
|
|
@ -7,32 +7,42 @@ require 'spec_helper'
|
||||||
describe ShareVisibilitiesController, :type => :controller do
|
describe ShareVisibilitiesController, :type => :controller do
|
||||||
before do
|
before do
|
||||||
@status = alice.post(:status_message, :text => "hello", :to => alice.aspects.first)
|
@status = alice.post(:status_message, :text => "hello", :to => alice.aspects.first)
|
||||||
sign_in(bob, scope: :user)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#update' do
|
describe '#update' do
|
||||||
context "on a post you can see" do
|
context "on a post you can see" do
|
||||||
|
before do
|
||||||
|
sign_in(bob, scope: :user)
|
||||||
|
end
|
||||||
|
|
||||||
it 'succeeds' do
|
it 'succeeds' do
|
||||||
put :update, :format => :js, :id => 42, :post_id => @status.id
|
put :update, :format => :js, :id => 42, :post_id => @status.id
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'it calls toggle_hidden_shareable' do
|
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
|
put :update, :format => :js, :id => 42, :post_id => @status.id
|
||||||
end
|
end
|
||||||
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)
|
context "on a post you can't see" do
|
||||||
2.times do |n|
|
before do
|
||||||
@controller.send(:accessible_post)
|
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
|
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