Merge branch 'next-minor' into develop
This commit is contained in:
commit
f1510ba2d6
8 changed files with 107 additions and 36 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Fix path to `bundle` in `script/server` [#7281](https://github.com/diaspora/diaspora/pull/7281)
|
* Fix path to `bundle` in `script/server` [#7281](https://github.com/diaspora/diaspora/pull/7281)
|
||||||
* Update comment in database example config [#7282](https://github.com/diaspora/diaspora/pull/7282)
|
* Update comment in database example config [#7282](https://github.com/diaspora/diaspora/pull/7282)
|
||||||
|
* Make the \#newhere post public again [#7311](https://github.com/diaspora/diaspora/pull/7311)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* Add support for [Liberapay](https://liberapay.com) donations [#7290](https://github.com/diaspora/diaspora/pull/7290)
|
* Add support for [Liberapay](https://liberapay.com) donations [#7290](https://github.com/diaspora/diaspora/pull/7290)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ module AspectGlobalHelper
|
||||||
options
|
options
|
||||||
end
|
end
|
||||||
|
|
||||||
def publisher_aspects_for(stream=nil)
|
def publisher_aspects_for(stream)
|
||||||
if stream
|
if stream
|
||||||
aspects = stream.aspects
|
aspects = stream.aspects
|
||||||
aspect = stream.aspect
|
aspect = stream.aspect
|
||||||
|
|
@ -25,16 +25,4 @@ module AspectGlobalHelper
|
||||||
end
|
end
|
||||||
{selected_aspects: aspects, aspect: aspect, aspect_ids: aspect_ids}
|
{selected_aspects: aspects, aspect: aspect, aspect_ids: aspect_ids}
|
||||||
end
|
end
|
||||||
|
|
||||||
def public_selected?(selected_aspects)
|
|
||||||
"public" == selected_aspects.try(:first)
|
|
||||||
end
|
|
||||||
|
|
||||||
def all_aspects_selected?(aspects, selected_aspects)
|
|
||||||
!aspects.empty? && aspects.size == selected_aspects.size && !public_selected?(selected_aspects)
|
|
||||||
end
|
|
||||||
|
|
||||||
def aspect_selected?(aspect, aspects, selected_aspects)
|
|
||||||
selected_aspects.include?(aspect) && !all_aspects_selected?(aspects, selected_aspects)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,4 @@ module InterimStreamHackinessHelper
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def publisher_method(method)
|
|
||||||
@stream.try(:publisher).try(method) == true
|
|
||||||
end
|
|
||||||
|
|
||||||
def publisher_open
|
|
||||||
publisher_method(:open)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,25 +3,41 @@
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
module PublisherHelper
|
module PublisherHelper
|
||||||
def remote?
|
|
||||||
params[:controller] != "tags"
|
|
||||||
end
|
|
||||||
|
|
||||||
def service_button(service)
|
def service_button(service)
|
||||||
provider_title = I18n.t(
|
provider_title = I18n.t("services.index.share_to", provider: service.provider.titleize)
|
||||||
"services.index.share_to",
|
|
||||||
provider: service.provider.titleize)
|
|
||||||
content_tag :div,
|
content_tag :div,
|
||||||
class: "btn btn-link service_icon dim",
|
class: "btn btn-link service_icon dim",
|
||||||
title: "#{provider_title} (#{service.nickname})",
|
title: "#{provider_title} (#{service.nickname})",
|
||||||
id: "#{service.provider}",
|
id: service.provider,
|
||||||
maxchar: "#{service.class::MAX_CHARACTERS}",
|
maxchar: service.class::MAX_CHARACTERS,
|
||||||
data: {toggle: "tooltip", placement: "bottom"} do
|
data: {toggle: "tooltip", placement: "bottom"} do
|
||||||
if service.provider == "wordpress"
|
if service.provider == "wordpress"
|
||||||
content_tag(:span, "", class: "social-media-logos-wordpress-16x16")
|
content_tag(:span, "", class: "social-media-logos-wordpress-16x16")
|
||||||
else
|
else
|
||||||
content_tag(:i, "", class: "entypo-social-#{ service.provider } small")
|
content_tag(:i, "", class: "entypo-social-#{service.provider} small")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def public_selected?(selected_aspects)
|
||||||
|
"public" == selected_aspects.try(:first) || publisher_boolean?(:public)
|
||||||
|
end
|
||||||
|
|
||||||
|
def all_aspects_selected?(selected_aspects)
|
||||||
|
!all_aspects.empty? && all_aspects.size == selected_aspects.size && !public_selected?(selected_aspects)
|
||||||
|
end
|
||||||
|
|
||||||
|
def aspect_selected?(aspect, selected_aspects)
|
||||||
|
selected_aspects.include?(aspect) && !all_aspects_selected?(selected_aspects) && !public_selected?(selected_aspects)
|
||||||
|
end
|
||||||
|
|
||||||
|
def publisher_open?
|
||||||
|
publisher_boolean?(:open)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def publisher_boolean?(option)
|
||||||
|
@stream.try(:publisher).try(option) == true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
- else
|
- else
|
||||||
%i.entypo-lock.small#visibility-icon
|
%i.entypo-lock.small#visibility-icon
|
||||||
%span.text
|
%span.text
|
||||||
- if all_aspects_selected?(all_aspects, selected_aspects)
|
- if all_aspects_selected?(selected_aspects)
|
||||||
= t("all_aspects")
|
= t("all_aspects")
|
||||||
- elsif selected_aspects.size == 1
|
- elsif selected_aspects.size == 1
|
||||||
= selected_aspects.first.name
|
= selected_aspects.first.name
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
%span.text
|
%span.text
|
||||||
= t("public")
|
= t("public")
|
||||||
%li.all_aspects.radio{"data-aspect_id" => "all_aspects",
|
%li.all_aspects.radio{"data-aspect_id" => "all_aspects",
|
||||||
:class => ("selected" if all_aspects_selected?(all_aspects, selected_aspects))}
|
:class => ("selected" if all_aspects_selected?(selected_aspects))}
|
||||||
%a
|
%a
|
||||||
%span.status_indicator
|
%span.status_indicator
|
||||||
%i.glyphicon.glyphicon-ok
|
%i.glyphicon.glyphicon-ok
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
%li.divider
|
%li.divider
|
||||||
- all_aspects.each do |aspect|
|
- all_aspects.each do |aspect|
|
||||||
%li.aspect_selector{"data-aspect_id" => aspect.id,
|
%li.aspect_selector{"data-aspect_id" => aspect.id,
|
||||||
:class => ("selected" if aspect_selected?(aspect, all_aspects, selected_aspects))}
|
:class => ("selected" if aspect_selected?(aspect, selected_aspects))}
|
||||||
%a
|
%a
|
||||||
%span.status_indicator
|
%span.status_indicator
|
||||||
%i.glyphicon.glyphicon-ok
|
%i.glyphicon.glyphicon-ok
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
.row.publisher#publisher{class: ((aspect == :profile || publisher_open) ? "mention_popup" : "closed")}
|
.row.publisher#publisher{class: ((aspect == :profile || publisher_open?) ? "mention_popup" : "closed")}
|
||||||
.content_creation
|
.content_creation
|
||||||
= form_for(StatusMessage.new) do |status|
|
= form_for(StatusMessage.new) do |status|
|
||||||
= status.error_messages
|
= status.error_messages
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
- if public_selected?(selected_aspects)
|
- if public_selected?(selected_aspects)
|
||||||
= hidden_field_tag "aspect_ids[]", "public"
|
= hidden_field_tag "aspect_ids[]", "public"
|
||||||
- elsif all_aspects_selected?(all_aspects, selected_aspects)
|
- elsif all_aspects_selected?(selected_aspects)
|
||||||
= hidden_field_tag "aspect_ids[]", "all_aspects"
|
= hidden_field_tag "aspect_ids[]", "all_aspects"
|
||||||
- else
|
- else
|
||||||
- for aspect_id in aspect_ids
|
- for aspect_id in aspect_ids
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@ Feature: new user registration
|
||||||
Then I should be on the stream page
|
Then I should be on the stream page
|
||||||
And I close the publisher
|
And I close the publisher
|
||||||
|
|
||||||
|
Scenario: first status message is public
|
||||||
|
When I confirm the alert after I follow "awesome_button"
|
||||||
|
Then I should be on the stream page
|
||||||
|
And I should see "Public" within ".aspect_dropdown"
|
||||||
|
|
||||||
Scenario: new user without any tags posts first status message
|
Scenario: new user without any tags posts first status message
|
||||||
When I confirm the alert after I follow "awesome_button"
|
When I confirm the alert after I follow "awesome_button"
|
||||||
Then I should be on the stream page
|
Then I should be on the stream page
|
||||||
|
|
|
||||||
69
spec/helpers/publisher_helper_spec.rb
Normal file
69
spec/helpers/publisher_helper_spec.rb
Normal file
|
|
@ -0,0 +1,69 @@
|
||||||
|
describe PublisherHelper, type: :helper do
|
||||||
|
describe "#public_selected?" do
|
||||||
|
it "returns true when the selected_aspects contains 'public'" do
|
||||||
|
expect(helper.public_selected?(["public"])).to be_truthy
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns true when the publisher is set to public" do
|
||||||
|
@stream = double(publisher: double(public: true))
|
||||||
|
expect(helper.public_selected?(alice.aspects.to_a)).to be_truthy
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false when the selected_aspects does not contain 'public' and the publisher is not public" do
|
||||||
|
@stream = double(publisher: double(public: false))
|
||||||
|
expect(helper.public_selected?(alice.aspects.to_a)).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false when the selected_aspects does not contain 'public' and there is no stream" do
|
||||||
|
expect(helper.public_selected?(alice.aspects.to_a)).to be_falsey
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#all_aspects_selected?" do
|
||||||
|
it "returns true when the selected_aspects are the same size as all_aspects from the user" do
|
||||||
|
expect(helper).to receive(:all_aspects).twice.and_return(alice.aspects.to_a)
|
||||||
|
expect(helper.all_aspects_selected?(alice.aspects.to_a)).to be_truthy
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false when not all aspects are selected" do
|
||||||
|
alice.aspects.create(name: "other")
|
||||||
|
expect(helper).to receive(:all_aspects).twice.and_return(alice.aspects.to_a)
|
||||||
|
expect(helper.all_aspects_selected?([alice.aspects.first])).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false when the user does not have aspects" do
|
||||||
|
expect(helper).to receive(:all_aspects).and_return([])
|
||||||
|
expect(helper.all_aspects_selected?(alice.aspects.to_a)).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false when the publisher is set to public" do
|
||||||
|
@stream = double(publisher: double(public: true))
|
||||||
|
expect(helper).to receive(:all_aspects).twice.and_return(alice.aspects.to_a)
|
||||||
|
expect(helper.all_aspects_selected?(alice.aspects.to_a)).to be_falsey
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#aspect_selected?" do
|
||||||
|
before do
|
||||||
|
alice.aspects.create(name: "other")
|
||||||
|
allow(helper).to receive(:all_aspects).and_return(alice.aspects.to_a)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns true when the selected_aspects contains the aspect" do
|
||||||
|
expect(helper.aspect_selected?(alice.aspects.first, [alice.aspects.first])).to be_truthy
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false when the selected_aspects does not contain the aspect" do
|
||||||
|
expect(helper.aspect_selected?(alice.aspects.first, [alice.aspects.second])).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false when all aspects are selected" do
|
||||||
|
expect(helper.aspect_selected?(alice.aspects.first, alice.aspects.to_a)).to be_falsey
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns false when the publisher is set to public" do
|
||||||
|
@stream = double(publisher: double(public: true))
|
||||||
|
expect(helper.aspect_selected?(alice.aspects.first, [alice.aspects.first])).to be_falsey
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue