Skip to content
Snippets Groups Projects
Commit fa29fc39 authored by Dave Mentens's avatar Dave Mentens Committed by Bram Driesen
Browse files

Issue #3420776: Improve caching when auto open is prevented on mobile

parent d061d378
Branches
Tags 4.0.0-alpha10
1 merge request!13Added cache tags to have separate cache for mobile and desktop requests.
Pipeline #93183 passed with warnings
......@@ -221,7 +221,7 @@ class OswaldChatbot extends ContentEntityBase implements OswaldChatbotInterface
}
/**
* Determine if the request if made from a mobile device.
* Determine if the request is made from a mobile device.
*
* @return bool
* Returns true if the request is made from a mobile device.
......@@ -237,4 +237,21 @@ class OswaldChatbot extends ContentEntityBase implements OswaldChatbotInterface
return $detect->isMobile();
}
/**
* {@inheritDoc}
*/
public function getCacheTags() {
$cache_tags = parent::getCacheTags();
if ($this->getPreventAutoOpenMobile() == 'true') {
$cache_tags[] = 'oswald_chatbot.prevent_auto_open:1';
$cache_tags[] = 'oswald_chatbot.is_mobile:' . $this->isMobileRequest();
}
else {
$cache_tags[] = 'oswald_chatbot.prevent_auto_open:0';
}
return $cache_tags;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment