parent
97888067e6
commit
cce2c7fe31
9 changed files with 23 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ only contain the base profile.
|
||||||
| Property | Type (Length) | Editable | Description |
|
| Property | Type (Length) | Editable | Description |
|
||||||
| ------------------ | ---------------------------- |:--------:| -------------------------------------------------------------------------------------------------------- |
|
| ------------------ | ---------------------------- |:--------:| -------------------------------------------------------------------------------------------------------- |
|
||||||
| `edited_at` | [Timestamp][timestamp] | ✔ | The timestamp when the profile was edited. |
|
| `edited_at` | [Timestamp][timestamp] | ✔ | The timestamp when the profile was edited. |
|
||||||
|
| `full_name` | [Name][name] (70) | ✔ | The full name of the person. |
|
||||||
| `first_name` | [Name][name] (32) | ✔ | The first name of the person. |
|
| `first_name` | [Name][name] (32) | ✔ | The first name of the person. |
|
||||||
| `last_name` | [Name][name] (32) | ✔ | The last name of the person. |
|
| `last_name` | [Name][name] (32) | ✔ | The last name of the person. |
|
||||||
| `image_url` | [URL][url] (255) | ✔ | The URL to the big avatar (300x300) of the person. |
|
| `image_url` | [URL][url] (255) | ✔ | The URL to the big avatar (300x300) of the person. |
|
||||||
|
|
@ -50,6 +51,7 @@ only contain the base profile.
|
||||||
<profile>
|
<profile>
|
||||||
<author>alice@example.org</author>
|
<author>alice@example.org</author>
|
||||||
<edited_at>2018-01-23T01:19:56Z</edited_at>
|
<edited_at>2018-01-23T01:19:56Z</edited_at>
|
||||||
|
<full_name>Alice Smith</full_name>
|
||||||
<first_name>Alice</first_name>
|
<first_name>Alice</first_name>
|
||||||
<last_name>Smith</last_name>
|
<last_name>Smith</last_name>
|
||||||
<image_url>https://example.org/images/thumb_large_a795f872c93309597345.jpg</image_url>
|
<image_url>https://example.org/images/thumb_large_a795f872c93309597345.jpg</image_url>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ module DiasporaFederation
|
||||||
# @return [Time] edited time
|
# @return [Time] edited time
|
||||||
property :edited_at, :timestamp, optional: true
|
property :edited_at, :timestamp, optional: true
|
||||||
|
|
||||||
|
# @!attribute [r] full_name
|
||||||
|
# @return [String] display name of the user
|
||||||
|
property :full_name, :string, optional: true
|
||||||
|
|
||||||
# @!attribute [r] first_name
|
# @!attribute [r] first_name
|
||||||
# @deprecated We decided to only use one name field, these should be removed
|
# @deprecated We decided to only use one name field, these should be removed
|
||||||
# in later iterations (will affect older diaspora* installations).
|
# in later iterations (will affect older diaspora* installations).
|
||||||
|
|
|
||||||
|
|
@ -247,6 +247,7 @@
|
||||||
"entity_data": {
|
"entity_data": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"full_name": { "type": ["string", "null"] },
|
||||||
"first_name": { "type": ["string", "null"] },
|
"first_name": { "type": ["string", "null"] },
|
||||||
"last_name": { "type": ["string", "null"] },
|
"last_name": { "type": ["string", "null"] },
|
||||||
"gender": { "type": ["string", "null"] },
|
"gender": { "type": ["string", "null"] },
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ module DiasporaFederation
|
||||||
Fabricator(:profile_entity, class_name: DiasporaFederation::Entities::Profile) do
|
Fabricator(:profile_entity, class_name: DiasporaFederation::Entities::Profile) do
|
||||||
author { Fabricate.sequence(:diaspora_id) }
|
author { Fabricate.sequence(:diaspora_id) }
|
||||||
edited_at { Time.now.utc }
|
edited_at { Time.now.utc }
|
||||||
|
full_name "my name"
|
||||||
first_name "my name"
|
first_name "my name"
|
||||||
last_name nil
|
last_name nil
|
||||||
image_url "/assets/user/default.png"
|
image_url "/assets/user/default.png"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ module DiasporaFederation
|
||||||
|
|
||||||
# The name must not contain a semicolon because of mentions.
|
# The name must not contain a semicolon because of mentions.
|
||||||
# @{<full_name> ; <diaspora_id>}
|
# @{<full_name> ; <diaspora_id>}
|
||||||
|
rule :full_name, regular_expression: {regex: /\A[^;]{,70}\z/}
|
||||||
rule :first_name, regular_expression: {regex: /\A[^;]{,32}\z/}
|
rule :first_name, regular_expression: {regex: /\A[^;]{,32}\z/}
|
||||||
rule :last_name, regular_expression: {regex: /\A[^;]{,32}\z/}
|
rule :last_name, regular_expression: {regex: /\A[^;]{,32}\z/}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ module DiasporaFederation
|
||||||
<author>#{data[:author]}</author>
|
<author>#{data[:author]}</author>
|
||||||
<profile>
|
<profile>
|
||||||
<author>#{data[:profile].author}</author>
|
<author>#{data[:profile].author}</author>
|
||||||
|
<full_name>#{data[:profile].full_name}</full_name>
|
||||||
<first_name>#{data[:profile].first_name}</first_name>
|
<first_name>#{data[:profile].first_name}</first_name>
|
||||||
<image_url>#{data[:profile].image_url}</image_url>
|
<image_url>#{data[:profile].image_url}</image_url>
|
||||||
<image_url_medium>#{data[:profile].image_url}</image_url_medium>
|
<image_url_medium>#{data[:profile].image_url}</image_url_medium>
|
||||||
|
|
@ -148,6 +149,7 @@ XML
|
||||||
<author>#{data[:author]}</author>
|
<author>#{data[:author]}</author>
|
||||||
<profile>
|
<profile>
|
||||||
<author>#{data[:profile].author}</author>
|
<author>#{data[:profile].author}</author>
|
||||||
|
<full_name>#{data[:profile].full_name}</full_name>
|
||||||
<first_name>#{data[:profile].first_name}</first_name>
|
<first_name>#{data[:profile].first_name}</first_name>
|
||||||
<image_url>#{data[:profile].image_url}</image_url>
|
<image_url>#{data[:profile].image_url}</image_url>
|
||||||
<image_url_medium>#{data[:profile].image_url}</image_url_medium>
|
<image_url_medium>#{data[:profile].image_url}</image_url_medium>
|
||||||
|
|
@ -185,6 +187,7 @@ XML
|
||||||
<author>#{data[:author]}</author>
|
<author>#{data[:author]}</author>
|
||||||
<profile>
|
<profile>
|
||||||
<author>#{data[:profile].author}</author>
|
<author>#{data[:profile].author}</author>
|
||||||
|
<full_name>#{data[:profile].full_name}</full_name>
|
||||||
<first_name>#{data[:profile].first_name}</first_name>
|
<first_name>#{data[:profile].first_name}</first_name>
|
||||||
<image_url>#{data[:profile].image_url}</image_url>
|
<image_url>#{data[:profile].image_url}</image_url>
|
||||||
<image_url_medium>#{data[:profile].image_url}</image_url_medium>
|
<image_url_medium>#{data[:profile].image_url}</image_url_medium>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ module DiasporaFederation
|
||||||
<profile>
|
<profile>
|
||||||
<author>#{data[:profile].author}</author>
|
<author>#{data[:profile].author}</author>
|
||||||
<edited_at>#{data[:profile].edited_at.utc.iso8601}</edited_at>
|
<edited_at>#{data[:profile].edited_at.utc.iso8601}</edited_at>
|
||||||
|
<full_name>#{data[:profile].full_name}</full_name>
|
||||||
<first_name>#{data[:profile].first_name}</first_name>
|
<first_name>#{data[:profile].first_name}</first_name>
|
||||||
<image_url>#{data[:profile].image_url}</image_url>
|
<image_url>#{data[:profile].image_url}</image_url>
|
||||||
<image_url_medium>#{data[:profile].image_url}</image_url_medium>
|
<image_url_medium>#{data[:profile].image_url}</image_url_medium>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ module DiasporaFederation
|
||||||
<profile>
|
<profile>
|
||||||
<author>#{data[:author]}</author>
|
<author>#{data[:author]}</author>
|
||||||
<edited_at>#{data[:edited_at].utc.iso8601}</edited_at>
|
<edited_at>#{data[:edited_at].utc.iso8601}</edited_at>
|
||||||
|
<full_name>#{data[:full_name]}</full_name>
|
||||||
<first_name>#{data[:first_name]}</first_name>
|
<first_name>#{data[:first_name]}</first_name>
|
||||||
<image_url>#{data[:image_url]}</image_url>
|
<image_url>#{data[:image_url]}</image_url>
|
||||||
<image_url_medium>#{data[:image_url]}</image_url_medium>
|
<image_url_medium>#{data[:image_url]}</image_url_medium>
|
||||||
|
|
@ -27,6 +28,7 @@ XML
|
||||||
"entity_data": {
|
"entity_data": {
|
||||||
"author": "#{data[:author]}",
|
"author": "#{data[:author]}",
|
||||||
"edited_at": "#{data[:edited_at].iso8601}",
|
"edited_at": "#{data[:edited_at].iso8601}",
|
||||||
|
"full_name": "#{data[:full_name]}",
|
||||||
"first_name": "#{data[:first_name]}",
|
"first_name": "#{data[:first_name]}",
|
||||||
"image_url": "#{data[:image_url]}",
|
"image_url": "#{data[:image_url]}",
|
||||||
"image_url_medium": "#{data[:image_url]}",
|
"image_url_medium": "#{data[:image_url]}",
|
||||||
|
|
@ -60,6 +62,7 @@ JSON
|
||||||
XML
|
XML
|
||||||
|
|
||||||
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML(minimal_xml).root)
|
parsed_instance = DiasporaFederation::Salmon::XmlPayload.unpack(Nokogiri::XML(minimal_xml).root)
|
||||||
|
expect(parsed_instance.full_name).to be_nil
|
||||||
expect(parsed_instance.first_name).to be_nil
|
expect(parsed_instance.first_name).to be_nil
|
||||||
expect(parsed_instance.last_name).to be_nil
|
expect(parsed_instance.last_name).to be_nil
|
||||||
expect(parsed_instance.image_url).to be_nil
|
expect(parsed_instance.image_url).to be_nil
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,13 @@ module DiasporaFederation
|
||||||
let(:property) { :author }
|
let(:property) { :author }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#full_name" do
|
||||||
|
it_behaves_like "a name validator" do
|
||||||
|
let(:property) { :full_name }
|
||||||
|
let(:length) { 70 }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
%i[first_name last_name].each do |prop|
|
%i[first_name last_name].each do |prop|
|
||||||
describe "##{prop}" do
|
describe "##{prop}" do
|
||||||
it_behaves_like "a name validator" do
|
it_behaves_like "a name validator" do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue