From a33132f44e6f1c083680374733b82974c732acb1 Mon Sep 17 00:00:00 2001 From: firaga Date: Fri, 11 Dec 2020 15:15:22 +0800 Subject: [PATCH] fix resourse link context value --- src/ToolProvider/ToolProvider.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ToolProvider/ToolProvider.php b/src/ToolProvider/ToolProvider.php index acb236a..07ca601 100644 --- a/src/ToolProvider/ToolProvider.php +++ b/src/ToolProvider/ToolProvider.php @@ -994,9 +994,6 @@ private function authenticate() $contentItemId = $_POST['custom_content_item_id']; } $this->resourceLink = ResourceLink::fromConsumer($this->consumer, trim($_POST['resource_link_id']), $contentItemId); - if (!empty($this->context)) { - $this->resourceLink->setContextId($this->context->getRecordId()); - } $title = ''; if (isset($_POST['resource_link_title'])) { $title = trim($_POST['resource_link_title']); @@ -1145,6 +1142,9 @@ private function authenticate() $this->context->save(); } if ($this->ok && isset($this->resourceLink)) { + if (!empty($this->context)) { + $this->resourceLink->setContextId($this->context->getRecordId()); + } // Check if a share arrangement is in place for this resource link $this->ok = $this->checkForShare();