Add public flag to profile entity
This commit is contained in:
parent
df1c9b0350
commit
e81acd0a0f
9 changed files with 18 additions and 5 deletions
|
|
@ -24,6 +24,7 @@ This entity contains all the profile data of a person.
|
||||||
| `bio` | [Markdown][markdown] (65535) | The description of the person. This field can contain markdown. |
|
| `bio` | [Markdown][markdown] (65535) | The description of the person. This field can contain markdown. |
|
||||||
| `location` | [String][string] (255) | The location of the person. |
|
| `location` | [String][string] (255) | The location of the person. |
|
||||||
| `searchable` | [Boolean][boolean] | `false` if the person doesn't want to be searchable by name. |
|
| `searchable` | [Boolean][boolean] | `false` if the person doesn't want to be searchable by name. |
|
||||||
|
| `public` | [Boolean][boolean] | `true` if the profile is visible to everyone. |
|
||||||
| `nsfw` | [Boolean][boolean] | `true` if all posts of this person should be marked as NSFW. |
|
| `nsfw` | [Boolean][boolean] | `true` if all posts of this person should be marked as NSFW. |
|
||||||
| `tag_string` | [String][string] | A list of hashtags for this person, each tag beginning with `#` and seperated by spaces, at most 5 tags. |
|
| `tag_string` | [String][string] | A list of hashtags for this person, each tag beginning with `#` and seperated by spaces, at most 5 tags. |
|
||||||
|
|
||||||
|
|
@ -42,6 +43,7 @@ This entity contains all the profile data of a person.
|
||||||
<bio>some text about me</bio>
|
<bio>some text about me</bio>
|
||||||
<location>github</location>
|
<location>github</location>
|
||||||
<searchable>true</searchable>
|
<searchable>true</searchable>
|
||||||
|
<public>false</public>
|
||||||
<nsfw>false</nsfw>
|
<nsfw>false</nsfw>
|
||||||
<tag_string>#i #love #tags</tag_string>
|
<tag_string>#i #love #tags</tag_string>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,11 @@ module DiasporaFederation
|
||||||
# @return [Boolean] searchable flag
|
# @return [Boolean] searchable flag
|
||||||
property :searchable, :boolean, default: true
|
property :searchable, :boolean, default: true
|
||||||
|
|
||||||
|
# @!attribute [r] public
|
||||||
|
# Shows whether the profile is visible to everyone or only to contacts
|
||||||
|
# @return [Boolean] is it public
|
||||||
|
property :public, :boolean, default: false
|
||||||
|
|
||||||
property :nsfw, :boolean, default: false
|
property :nsfw, :boolean, default: false
|
||||||
property :tag_string, :string, default: nil
|
property :tag_string, :string, default: nil
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ module DiasporaFederation
|
||||||
bio "some text about me"
|
bio "some text about me"
|
||||||
location "github"
|
location "github"
|
||||||
searchable true
|
searchable true
|
||||||
|
public false
|
||||||
nsfw false
|
nsfw false
|
||||||
tag_string "#i #love #tags"
|
tag_string "#i #love #tags"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ module DiasporaFederation
|
||||||
rule :location, length: {maximum: 255}
|
rule :location, length: {maximum: 255}
|
||||||
|
|
||||||
rule :searchable, :boolean
|
rule :searchable, :boolean
|
||||||
|
rule :public, :boolean
|
||||||
rule :nsfw, :boolean
|
rule :nsfw, :boolean
|
||||||
|
|
||||||
rule :tag_string, tag_count: {maximum: 5}
|
rule :tag_string, tag_count: {maximum: 5}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ module DiasporaFederation
|
||||||
<bio>#{data[:profile].bio}</bio>
|
<bio>#{data[:profile].bio}</bio>
|
||||||
<location>#{data[:profile].location}</location>
|
<location>#{data[:profile].location}</location>
|
||||||
<searchable>#{data[:profile].searchable}</searchable>
|
<searchable>#{data[:profile].searchable}</searchable>
|
||||||
|
<public>#{data[:profile].public}</public>
|
||||||
<nsfw>#{data[:profile].nsfw}</nsfw>
|
<nsfw>#{data[:profile].nsfw}</nsfw>
|
||||||
<tag_string>#{data[:profile].tag_string}</tag_string>
|
<tag_string>#{data[:profile].tag_string}</tag_string>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ module DiasporaFederation
|
||||||
<bio>#{data[:profile].bio}</bio>
|
<bio>#{data[:profile].bio}</bio>
|
||||||
<location>#{data[:profile].location}</location>
|
<location>#{data[:profile].location}</location>
|
||||||
<searchable>#{data[:profile].searchable}</searchable>
|
<searchable>#{data[:profile].searchable}</searchable>
|
||||||
|
<public>#{data[:profile].public}</public>
|
||||||
<nsfw>#{data[:profile].nsfw}</nsfw>
|
<nsfw>#{data[:profile].nsfw}</nsfw>
|
||||||
<tag_string>#{data[:profile].tag_string}</tag_string>
|
<tag_string>#{data[:profile].tag_string}</tag_string>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ module DiasporaFederation
|
||||||
<bio>#{data[:bio]}</bio>
|
<bio>#{data[:bio]}</bio>
|
||||||
<location>#{data[:location]}</location>
|
<location>#{data[:location]}</location>
|
||||||
<searchable>#{data[:searchable]}</searchable>
|
<searchable>#{data[:searchable]}</searchable>
|
||||||
|
<public>#{data[:public]}</public>
|
||||||
<nsfw>#{data[:nsfw]}</nsfw>
|
<nsfw>#{data[:nsfw]}</nsfw>
|
||||||
<tag_string>#{data[:tag_string]}</tag_string>
|
<tag_string>#{data[:tag_string]}</tag_string>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
@ -35,6 +36,7 @@ XML
|
||||||
"bio": "#{data[:bio]}",
|
"bio": "#{data[:bio]}",
|
||||||
"location": "#{data[:location]}",
|
"location": "#{data[:location]}",
|
||||||
"searchable": #{data[:searchable]},
|
"searchable": #{data[:searchable]},
|
||||||
|
"public": #{data[:public]},
|
||||||
"nsfw": #{data[:nsfw]},
|
"nsfw": #{data[:nsfw]},
|
||||||
"tag_string": "#{data[:tag_string]}"
|
"tag_string": "#{data[:tag_string]}"
|
||||||
}
|
}
|
||||||
|
|
@ -68,6 +70,7 @@ XML
|
||||||
expect(parsed_instance.bio).to be_nil
|
expect(parsed_instance.bio).to be_nil
|
||||||
expect(parsed_instance.location).to be_nil
|
expect(parsed_instance.location).to be_nil
|
||||||
expect(parsed_instance.searchable).to be_truthy
|
expect(parsed_instance.searchable).to be_truthy
|
||||||
|
expect(parsed_instance.public).to be_falsey
|
||||||
expect(parsed_instance.nsfw).to be_falsey
|
expect(parsed_instance.nsfw).to be_falsey
|
||||||
expect(parsed_instance.tag_string).to be_nil
|
expect(parsed_instance.tag_string).to be_nil
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -126,10 +126,10 @@ module DiasporaFederation
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows entities without public flag" do
|
it "allows entities without public flag" do
|
||||||
profile = Fabricate(:profile_entity)
|
like = Fabricate(:like_entity)
|
||||||
magic_env = Salmon::MagicEnvelope.new(profile, profile.author)
|
magic_env = Salmon::MagicEnvelope.new(like, like.author)
|
||||||
|
|
||||||
expect_callback(:receive_entity, profile, profile.author, nil)
|
expect_callback(:receive_entity, like, like.author, nil)
|
||||||
|
|
||||||
described_class.new(magic_env).receive
|
described_class.new(magic_env).receive
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ module DiasporaFederation
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
%i(searchable nsfw).each do |prop|
|
%i(searchable public nsfw).each do |prop|
|
||||||
describe "##{prop}" do
|
describe "##{prop}" do
|
||||||
it_behaves_like "a boolean validator" do
|
it_behaves_like "a boolean validator" do
|
||||||
let(:property) { prop }
|
let(:property) { prop }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue