-
Notifications
You must be signed in to change notification settings - Fork 923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add social sharing functionality #4985
Add social sharing functionality #4985
Conversation
f86274e
to
dc594d0
Compare
58ac1a5
to
02b6a81
Compare
Thank you. Some of the links seem to be a bit dated, e.g. Twitter is now known as X, and links/logos would have to be updated, I suppose. |
bd75443
to
66c48af
Compare
Updated the x icon and link as suggested by @mmd-osm. Also if you think we should include some other socials too, suggestions are welcome. Any chance @tomhughes @gravitystorm @AntonKhorev some of you guys can review this soon? |
Thanks for the hard work on this! Since we're on the topic of social sharing I thought I'd resurface an idea from 10 years ago that I still think would add value to users of the site. Perhaps the technology hurdles back then are less likely to be hurdles now. #739 |
6669767
to
45949e4
Compare
Refactored this according to @AntonKhorev review. Please let me know If you think I can further improve this. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few comments inline... Other things to consider are whether to offer some other sites - bluesky and threads being the obvious candidates.
d73482b
to
c55095d
Compare
Thank you for the review! |
9334366
to
ff4b223
Compare
Updated mastodon link, everything should be working fine now. Can you please check and let me know if anything else can be improved. Thank you. |
ff4b223
to
4efc63d
Compare
As @AntonKhorev suggested, we're now displaying these icons only when users open the full diary entry, as outlined in #5121. Since this is currently used in one place, turbo pagination issues can be handled in a future PR if a use case arises for combining it with turbo pagination. Thank you. |
4efc63d
to
8ba2316
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine if we're ok with mastodonshare.com for now, but we can replace it later.
8ba2316
to
b02d625
Compare
b02d625
to
95e1aff
Compare
|
||
# Generates a set of social share buttons based on the specified options. | ||
def render_social_share_buttons(opts = {}) | ||
sites = opts.fetch(:allow_sites, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of the allow_sites
option and the supporting logic that allows filtering? As far as I can tell it's tested but never actually used by any other code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably use it if sharing on some site requires some setting, to filter out that site if it's not set, like if we add Mastodon host preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well obviously we can come up with ways to use it, like adding a configuration option to control which ones was enabled. But given that no such thing currently exists I was wondering we it had been implemented - is there some plan to make use of it in the future?
Merged, thanks. Although we're effectively outsourcing Mastodon host option to mastodonshare.com, it works for anonymous users too. Currently our preferences page is not available for anonymous users but we probably should make it available and save preferences to cookies. We have other preferences like #5201 and color mode settings and we shouldn't add a button for each one. |
I think you mean users who are not logged in - "anonymous users" is the term we use for accounts with As for preferences, I'm happy keeping most preferences available for only logged in users, since account creation is free and we aim to serve our mappers (who by definition have accounts) more than just casual visitors. Storing preferences in cookies does have drawbacks (like cross-device consistency, automatic cookie expiry etc) so it's not my first choice in general. |
yes
Are you against the entire idea of #1115 or just against the cookies and want preferences stored somewhere else like session? I don't think anyone who is not logged in expects cross-device consistency etc. |
Add social network sharing to diary entry pages
Description:
This PR addresses the issue #1391 by introducing social media sharing functionality for diary entries, allowing users to share posts on platforms like Twitter, Facebook, LinkedIn, Mastodon, Telegram, and Email. It includes required JavaScript to handle opening share URLs in pop-up windows and Ruby helper methods to filter and validate allowed social media sites. The changes also incorporate error logging for invalid sites and missing icons, ensuring robustness.
Implementation details:
lib/social_share_button_helper.rb
- config, validation & helper functionsrender_social_share_buttons
function insideapplication_helper.rb
responsible for rendering the buttons with helper utilizationsocial_share_button.js
- javascript utility functions for opening the popups, generating urls for sharing & handling onclick events on buttonsScreenshots:
Reviews welcome,
Thank you.