summaryrefslogtreecommitdiffstats
path: root/lib/Model/ActivityPub/Actor/Person.php
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-12-21 12:50:03 -0100
committerMaxence Lange <maxence@artificial-owl.com>2018-12-21 12:50:03 -0100
commit1570d9cd3d6976f1d9312ed1c6db8083e0ffc62c (patch)
tree3f0ed2472a57cbff81bb7176685214b7f7ef27e8 /lib/Model/ActivityPub/Actor/Person.php
parent7ba6beb745e583f5abbfb5b38eaefeb98c762e9a (diff)
content of note is validated only when imported from database
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/Model/ActivityPub/Actor/Person.php')
-rw-r--r--lib/Model/ActivityPub/Actor/Person.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Model/ActivityPub/Actor/Person.php b/lib/Model/ActivityPub/Actor/Person.php
index adb0ce2f..522c1fb7 100644
--- a/lib/Model/ActivityPub/Actor/Person.php
+++ b/lib/Model/ActivityPub/Actor/Person.php
@@ -443,7 +443,6 @@ class Person extends ACore implements JsonSerializable {
* @param array $data
*
* @throws UrlCloudException
- * @throws InvalidResourceEntryException
*/
public function import(array $data) {
parent::import($data);
@@ -476,17 +475,17 @@ class Person extends ACore implements JsonSerializable {
*/
public function importFromDatabase(array $data) {
parent::importFromDatabase($data);
- $this->setPreferredUsername($this->get('preferred_username', $data, ''))
- ->setName($this->get('name', $data, ''))
- ->setAccount($this->get('account', $data, ''))
+ $this->setPreferredUsername($this->validate(self::AS_USERNAME, 'preferred_username', $data, ''))
+ ->setName($this->validate(self::AS_USERNAME, 'name', $data, ''))
+ ->setAccount($this->validate(self::AS_ACCOUNT, 'account', $data, ''))
->setPublicKey($this->get('public_key', $data, ''))
->setPrivateKey($this->get('private_key', $data, ''))
- ->setInbox($this->get('inbox', $data, ''))
- ->setOutbox($this->get('outbox', $data, ''))
- ->setFollowers($this->get('followers', $data, ''))
- ->setFollowing($this->get('following', $data, ''))
- ->setSharedInbox($this->get('shared_inbox', $data, ''))
- ->setFeatured($this->get('featured', $data, ''))
+ ->setInbox($this->validate(self::AS_URL, 'inbox', $data, ''))
+ ->setOutbox($this->validate(self::AS_URL, 'outbox', $data, ''))
+ ->setFollowers($this->validate(self::AS_URL, 'followers', $data, ''))
+ ->setFollowing($this->validate(self::AS_URL, 'following', $data, ''))
+ ->setSharedInbox($this->validate(self::AS_URL, 'shared_inbox', $data, ''))
+ ->setFeatured($this->validate(self::AS_URL, 'featured', $data, ''))
->setDetails($this->getArray('details', $data, []))
->setCreation($this->getInt('creation', $data, 0));
}