From a7d603e5ab26e70ff1aec0a09a16246b857f3c5b Mon Sep 17 00:00:00 2001 From: Tortue Torche Date: Thu, 9 Apr 2020 11:01:04 +0200 Subject: [PATCH] Fix Parsing error in activities when user request to join a circle Fix https://github.com/nextcloud/circles/issues/243 Signed-off-by: Tortue Torche --- lib/Activity/ProviderParser.php | 2 +- lib/Model/BaseMember.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/Activity/ProviderParser.php b/lib/Activity/ProviderParser.php index 6254d40b7..c667b3816 100644 --- a/lib/Activity/ProviderParser.php +++ b/lib/Activity/ProviderParser.php @@ -299,7 +299,7 @@ protected function generateViewerParameter(Circle $circle) { */ protected function generateExternalMemberParameter(Member $member) { return [ - 'type' => 'user', + 'type' => $member->getTypeName(), 'id' => $member->getUserId(), 'name' => $member->getDisplayName() . ' (' . $member->getTypeString() . ')', '_parsed' => $member->getDisplayName() diff --git a/lib/Model/BaseMember.php b/lib/Model/BaseMember.php index 60c177b71..d37596eec 100644 --- a/lib/Model/BaseMember.php +++ b/lib/Model/BaseMember.php @@ -439,4 +439,17 @@ public function getTypeString() { return 'none'; } + + public function getTypeName() { + switch ($this->getType()) { + case self::TYPE_USER: + case self::TYPE_MAIL: + case self::TYPE_CONTACT: + return 'user'; + case self::TYPE_GROUP: + return 'user-group'; + } + + return 'none'; + } }