parent
70c659192f
commit
e0eb76eb2a
10 changed files with 23 additions and 55 deletions
|
|
@ -3,6 +3,7 @@
|
|||
## Bug fixes
|
||||
* Ignore invalid `diaspora://` links [#7652](https://github.com/diaspora/diaspora/pull/7652)
|
||||
* Fix deformed avatar in hovercards [#7656](https://github.com/diaspora/diaspora/pull/7656)
|
||||
* Fix default aspects on profile page and bookmarklet publisher [#7679](https://github.com/diaspora/diaspora/issues/7679)
|
||||
|
||||
## Features
|
||||
* Add birthday notifications [#7624](https://github.com/diaspora/diaspora/pull/7624)
|
||||
|
|
|
|||
|
|
@ -20,8 +20,6 @@ class StatusMessagesController < ApplicationController
|
|||
@contact = current_user.contact_for(@person)
|
||||
if @contact
|
||||
@aspects_with_person = @contact.aspects.load
|
||||
@aspect_ids = @aspects_with_person.map(&:id)
|
||||
gon.aspect_ids = @aspect_ids
|
||||
render layout: nil
|
||||
else
|
||||
@aspects_with_person = []
|
||||
|
|
@ -29,8 +27,6 @@ class StatusMessagesController < ApplicationController
|
|||
elsif request.format == :mobile
|
||||
@aspect = :all
|
||||
@aspects = current_user.aspects.load
|
||||
@aspect_ids = @aspects.map(&:id)
|
||||
gon.aspect_ids = @aspect_ids
|
||||
else
|
||||
redirect_to stream_path
|
||||
end
|
||||
|
|
@ -38,7 +34,6 @@ class StatusMessagesController < ApplicationController
|
|||
|
||||
def bookmarklet
|
||||
@aspects = current_user.aspects
|
||||
@aspect_ids = current_user.aspect_ids
|
||||
|
||||
gon.preloads[:bookmarklet] = {
|
||||
content: params[:content],
|
||||
|
|
|
|||
|
|
@ -17,14 +17,12 @@ module AspectGlobalHelper
|
|||
if stream
|
||||
aspects = stream.aspects
|
||||
aspect = stream.aspect
|
||||
aspect_ids = stream.aspect_ids
|
||||
elsif current_user
|
||||
aspects = current_user.post_default_aspects
|
||||
aspect = aspects.first
|
||||
aspect_ids = current_user.aspect_ids
|
||||
else
|
||||
return {}
|
||||
end
|
||||
{selected_aspects: aspects, aspect: aspect, aspect_ids: aspect_ids}
|
||||
{selected_aspects: aspects, aspect: aspect}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -62,6 +62,4 @@
|
|||
data: {toggle: "modal", target: "#publicExplainModal"}}
|
||||
%i.entypo-cog
|
||||
|
||||
= link_to "", contacts_path(aspect_ids: aspect_ids), class: "selected_contacts_link hidden"
|
||||
|
||||
= render "shared/public_explain"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
= render :partial => 'publisher/publisher', :locals => { :aspect => :profile, :selected_aspects => @aspects, :aspect_ids => @aspect_ids }
|
||||
= render partial: "publisher/publisher", locals: {aspect: :profile, selected_aspects: @aspects}
|
||||
|
||||
= javascript_include_tag "mobile/bookmarklet"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,2 @@
|
|||
= render :partial => 'publisher/publisher',
|
||||
:locals => { :aspect => @aspect,
|
||||
:aspect_ids => @aspect_ids,
|
||||
:selected_aspects => @aspects_with_person,
|
||||
:person => @person }
|
||||
|
||||
= render partial: "publisher/publisher",
|
||||
locals: {aspect: @aspect, selected_aspects: @aspects_with_person, person: @person}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
= render :partial => 'publisher/publisher', :locals => {:aspect => @aspects.first, :aspect_ids => @aspect_ids, :selected_aspects => @aspects}
|
||||
= render partial: "publisher/publisher", locals: {aspect: @aspects.first, selected_aspects: @aspects}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,6 @@ class Stream::Aspect < Stream::Base
|
|||
end.call
|
||||
end
|
||||
|
||||
# Maps ids into an array from #aspects
|
||||
#
|
||||
# @return [Array<Integer>] Aspect ids
|
||||
def aspect_ids
|
||||
@aspect_ids ||= aspects.map { |a| a.id }
|
||||
end
|
||||
|
||||
# @return [ActiveRecord::Association<Post>] AR association of posts
|
||||
def posts
|
||||
# NOTE(this should be something like Post.all_for_stream(@user, aspect_ids, {}) that calls visible_shareables
|
||||
|
|
@ -84,7 +77,7 @@ class Stream::Aspect < Stream::Base
|
|||
#
|
||||
# @return [Boolean]
|
||||
def for_all_aspects?
|
||||
@all_aspects ||= aspect_ids.length == user.aspects.size
|
||||
@all_aspects ||= aspects.size == user.aspects.size
|
||||
end
|
||||
|
||||
# This is perfomance optimization, as everyone in your aspect stream you have
|
||||
|
|
@ -95,4 +88,10 @@ class Stream::Aspect < Stream::Base
|
|||
def can_comment?(post)
|
||||
true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def aspect_ids
|
||||
@aspect_ids ||= aspects.map(&:id)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -67,10 +67,6 @@ class Stream::Base
|
|||
aspects.first
|
||||
end
|
||||
|
||||
def aspect_ids
|
||||
aspects.map {|x| x.try(:id) }
|
||||
end
|
||||
|
||||
def max_time=(time_string)
|
||||
@max_time = Time.at(time_string.to_i) unless time_string.blank?
|
||||
@max_time ||= (Time.now + 1)
|
||||
|
|
|
|||
|
|
@ -31,19 +31,6 @@ describe Stream::Aspect do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#aspect_ids' do
|
||||
it 'maps ids from aspects' do
|
||||
alice = double.as_null_object
|
||||
aspects = double.as_null_object
|
||||
|
||||
stream = Stream::Aspect.new(alice, [1,2])
|
||||
|
||||
expect(stream).to receive(:aspects).and_return(aspects)
|
||||
expect(aspects).to receive(:map)
|
||||
stream.aspect_ids
|
||||
end
|
||||
end
|
||||
|
||||
describe '#posts' do
|
||||
before do
|
||||
@alice = double.as_null_object
|
||||
|
|
@ -83,16 +70,14 @@ describe Stream::Aspect do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#people' do
|
||||
it 'should call Person.all_from_aspects' do
|
||||
class Person ; end
|
||||
|
||||
describe "#people" do
|
||||
it "should call Person.all_from_aspects" do
|
||||
alice = double.as_null_object
|
||||
aspect_ids = [1,2,3]
|
||||
aspect_ids = [1, 2, 3]
|
||||
stream = Stream::Aspect.new(alice, [])
|
||||
|
||||
allow(stream).to receive(:aspect_ids).and_return(aspect_ids)
|
||||
expect(Person).to receive(:unique_from_aspects).with(stream.aspect_ids, alice).and_return(double(:includes => :profile))
|
||||
expect(Person).to receive(:unique_from_aspects).with(aspect_ids, alice).and_return(double(includes: :profile))
|
||||
stream.people
|
||||
end
|
||||
end
|
||||
|
|
@ -114,20 +99,20 @@ describe Stream::Aspect do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'for_all_aspects?' do
|
||||
describe "for_all_aspects?" do
|
||||
before do
|
||||
alice = double.as_null_object
|
||||
allow(alice.aspects).to receive(:size).and_return(2)
|
||||
@stream = Stream::Aspect.new(alice, [1,2])
|
||||
@stream = Stream::Aspect.new(alice, [1, 2])
|
||||
end
|
||||
|
||||
it "is true if the count of aspect_ids is equal to the size of the user's aspect count" do
|
||||
allow(@stream.aspect_ids).to receive(:length).and_return(2)
|
||||
it "is true if the count of aspects is equal to the size of the user's aspect count" do
|
||||
allow(@stream).to receive(:aspects).and_return(double(size: 2))
|
||||
expect(@stream).to be_for_all_aspects
|
||||
end
|
||||
|
||||
it "is false if the count of aspect_ids is not equal to the size of the user's aspect count" do
|
||||
allow(@stream.aspect_ids).to receive(:length).and_return(1)
|
||||
it "is false if the count of aspects is not equal to the size of the user's aspect count" do
|
||||
allow(@stream).to receive(:aspects).and_return(double(size: 1))
|
||||
expect(@stream).not_to be_for_all_aspects
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue