mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
committed by
Tim Abbott
parent
e01d3be1ba
commit
dc1571426e
@@ -6,7 +6,7 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Open Graph / Facebook Meta Tags -->
|
||||
<meta property="og:url" content="{{ realm_uri }}">
|
||||
<meta property="og:url" content="{{ OPEN_GRAPH_URL }}">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:site_name" content="Zulip">
|
||||
{% if OPEN_GRAPH_TITLE %}
|
||||
|
||||
@@ -133,6 +133,7 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:
|
||||
'allow_search_engine_indexing': allow_search_engine_indexing,
|
||||
}
|
||||
|
||||
context['OPEN_GRAPH_URL'] = '%s%s' % (realm_uri, request.path)
|
||||
if realm is not None and realm.icon_source == realm.ICON_UPLOADED:
|
||||
context['OPEN_GRAPH_IMAGE'] = '%s%s' % (realm_uri, realm_icon)
|
||||
|
||||
|
||||
@@ -184,3 +184,13 @@ class OpenGraphTest(ZulipTestCase):
|
||||
twitter_image = bs.select_one('meta[name="twitter:image"]').get('content')
|
||||
self.assertTrue(open_graph_image.endswith(realm_icon))
|
||||
self.assertTrue(twitter_image.endswith(realm_icon))
|
||||
|
||||
def test_no_realm_api_page_og_url(self) -> None:
|
||||
response = self.client_get('/api/', subdomain='')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
decoded = response.content.decode('utf-8')
|
||||
bs = BeautifulSoup(decoded, features='lxml')
|
||||
open_graph_url = bs.select_one('meta[property="og:url"]').get('content')
|
||||
|
||||
self.assertTrue(open_graph_url.endswith('/api/'))
|
||||
|
||||
Reference in New Issue
Block a user