Skip to content

Commit

Permalink
🐛 [Story share] Fix revert of gplus share breaking (#37075)
Browse files Browse the repository at this point in the history
* Fix revert

* Update extensions/amp-story/1.0/amp-story-share.js

Co-authored-by: Alan Orozco <alanorozco@users.noreply.github.com>

* Updated comment

Co-authored-by: Alan Orozco <alanorozco@users.noreply.github.com>
  • Loading branch information
mszylkowski and alanorozco authored Nov 30, 2021
1 parent a778cae commit 0119346
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions extensions/amp-story/1.0/amp-story-share.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import {getRequestService} from './amp-story-request-service';
import {isObject} from '#core/types';

/**
* Maps share provider type to visible name.
* If the name only needs to be capitalized (e.g. `facebook` to `Facebook`) it
* does not need to be included here.
* Maps share provider type to localization asset.
* @const {!Object<string, !LocalizedStringId_Enum>}
*/
const SHARE_PROVIDER_LOCALIZED_STRING_ID = map({
Expand Down Expand Up @@ -88,15 +86,18 @@ function renderLinkShareItemElement(el, onClick) {
}

/**
* Returns the share button for the provider if available.
* @param {!Document} doc
* @param {string} shareType
* @return {!Element}
* @return {?Element}
*/
function buildProvider(doc, shareType) {
const shareProviderLocalizedStringId = devAssert(
SHARE_PROVIDER_LOCALIZED_STRING_ID[shareType],
`No localized string to display name for share type ${shareType}.`
);
const shareProviderLocalizedStringId =
SHARE_PROVIDER_LOCALIZED_STRING_ID[shareType];

if (!shareProviderLocalizedStringId) {
return null;
}

return (
<amp-social-share
Expand Down

0 comments on commit 0119346

Please sign in to comment.