Skip to content

Fix social share button sharing (Can't find variable: SocialShareButton console error)#9041

Merged
ahukkanen merged 4 commits intodevelopfrom
fix/social-share-button-webpacker
Mar 18, 2022
Merged

Fix social share button sharing (Can't find variable: SocialShareButton console error)#9041
ahukkanen merged 4 commits intodevelopfrom
fix/social-share-button-webpacker

Conversation

@andreslucena
Copy link
Copy Markdown
Member

🎩 What? Why?

After the update to Webpacker, we've lost the social-share-button provided functionality: the icons are visible but when you click on them, it doesn't do anything, just a console error that the Object is undefined.

This PR fixes that by copying the JavaScript that we need for this.

As this file was originally CoffeeScript, I needed to transform it first. It was converted using decaffeinate:

npm install -g decaffeinate
decaffeinate social-share-button.coffee

Related to this issue, I'm working on implementing this feature ourselves, so we don't depend on any external dependency. Personally, I think that this current solution is a bit ugly at the moment: we have the JS and CSS locally but depend on the gem's Ruby code for the helper.

📌 Related Issues

Testing

  1. Go to any resource with share (for instance, a Proposal)
  2. Click on Share link
  3. Click on any Share icon
  4. See that it opens the external service

♥️ Thank you!

It was converted using decaffeinate:

```bash
npm install -g decaffeinate
decaffeinate social-share-button.coffee
```
@andreslucena andreslucena added module: core dependencies Pull requests that update a dependency file or issues that talk about updating dependencies type: fix PRs that implement a fix for a bug labels Mar 18, 2022
@andreslucena andreslucena requested a review from ahukkanen March 18, 2022 09:43
@andreslucena andreslucena changed the title Add social-share-button.js in vendor dir Fix social share button sharing (Can't find variable: SocialShareButton console error) Mar 18, 2022
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of code styling preferences?

@ahukkanen
Copy link
Copy Markdown
Contributor

Tested this and it fixes the problem and works fine. I added a couple of code review comments above.

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ahukkanen ahukkanen merged commit aecc039 into develop Mar 18, 2022
@ahukkanen ahukkanen deleted the fix/social-share-button-webpacker branch March 18, 2022 15:07
andreslucena added a commit that referenced this pull request Mar 22, 2022
…ton` console error) (#9041)

* Add social-share-button.js in vendor/ dir

It was converted using decaffeinate:

```bash
npm install -g decaffeinate
decaffeinate social-share-button.coffee
```

* Add Copyright notice of the original author

* Fix linter offenses

* Apply suggestions from code review
@alecslupu alecslupu added this to the 0.27.0 milestone Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file or issues that talk about updating dependencies module: core type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Social Share Buttons not working with Rails 6 and Decidim 0.25

3 participants