Merge branch 'next-minor' into develop
This commit is contained in:
commit
f3d2a54050
5 changed files with 33 additions and 5 deletions
|
|
@ -22,6 +22,7 @@
|
|||
* Allow fonts to be served from asset host in CSP [#7825](https://github.com/diaspora/diaspora/pull/7825)
|
||||
|
||||
## Features
|
||||
* Support fetching StatusMessage by Poll GUID [#7815](https://github.com/diaspora/diaspora/pull/7815)
|
||||
|
||||
# 0.7.5.0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# diaspora*
|
||||
# diaspora\*
|
||||
### A privacy-aware, distributed, open source social network
|
||||
|
||||
**master:** [](http://travis-ci.org/diaspora/diaspora)
|
||||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
## Installation
|
||||
|
||||
You don't have to install diaspora* to use the network. There are many servers connected to diaspora*s network which are open to anyone, and you can create an account on one of these servers. Have a look at our [tips for finding a home](https://wiki.diasporafoundation.org/Choosing_a_pod), or you can just go straight to the [list of open servers](http://podupti.me) to sign up.
|
||||
You don't have to install diaspora\* to use the network. There are many servers connected to diaspora\*s network which are open to anyone, and you can create an account on one of these servers. Have a look at our [tips for finding a home](https://wiki.diasporafoundation.org/Choosing_a_pod), or you can just go straight to the [list of open servers](http://podupti.me) to sign up.
|
||||
|
||||
Want to own your data and install diaspora*? Whether you just want to try it out, want to install it on your server or want to contribute and need a development setup, our [installation guides](https://wiki.diasporafoundation.org/Installation) will get you started!
|
||||
Want to own your data and install diaspora\*? Whether you just want to try it out, want to install it on your server or want to contribute and need a development setup, our [installation guides](https://wiki.diasporafoundation.org/Installation) will get you started!
|
||||
|
||||
## Questions?
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ class Poll < ApplicationRecord
|
|||
validate :enough_poll_answers
|
||||
validates :question, presence: true
|
||||
|
||||
scope :all_public, -> { joins(:status_message).where(posts: {public: true}) }
|
||||
|
||||
self.include_root_in_json = false
|
||||
|
||||
def enough_poll_answers
|
||||
|
|
|
|||
|
|
@ -117,8 +117,13 @@ DiasporaFederation.configure do |config|
|
|||
end
|
||||
|
||||
on :fetch_public_entity do |entity_type, guid|
|
||||
entity = Diaspora::Federation::Mappings.model_class_for(entity_type).find_by(guid: guid, public: true)
|
||||
Diaspora::Federation::Entities.post(entity) if entity.is_a? Post
|
||||
entity = Diaspora::Federation::Mappings.model_class_for(entity_type).all_public.find_by(guid: guid)
|
||||
case entity
|
||||
when Post
|
||||
Diaspora::Federation::Entities.post(entity)
|
||||
when Poll
|
||||
Diaspora::Federation::Entities.status_message(entity.status_message)
|
||||
end
|
||||
end
|
||||
|
||||
on :fetch_person_url_to do |diaspora_id, path|
|
||||
|
|
|
|||
|
|
@ -430,6 +430,26 @@ describe "diaspora federation callbacks" do
|
|||
expect(entity.author).to eq(alice.diaspora_handle)
|
||||
end
|
||||
|
||||
it "fetches a StatusMessage by a Poll guid" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: true)
|
||||
poll = FactoryGirl.create(:poll, status_message: post)
|
||||
entity = DiasporaFederation.callbacks.trigger(:fetch_public_entity, "Poll", poll.guid)
|
||||
|
||||
expect(entity.guid).to eq(post.guid)
|
||||
expect(entity.author).to eq(alice.diaspora_handle)
|
||||
expect(entity.public).to be_truthy
|
||||
expect(entity.poll.guid).to eq(poll.guid)
|
||||
expect(entity.poll.question).to eq(poll.question)
|
||||
end
|
||||
|
||||
it "doesn't fetch a private StatusMessage by a Poll guid" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: false)
|
||||
poll = FactoryGirl.create(:poll, status_message: post)
|
||||
expect(
|
||||
DiasporaFederation.callbacks.trigger(:fetch_public_entity, "Poll", poll.guid)
|
||||
).to be_nil
|
||||
end
|
||||
|
||||
it "does not fetch a private post" do
|
||||
post = FactoryGirl.create(:status_message, author: alice.person, public: false)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue