Closed NikolayRys closed 1 year ago
@vitkarpov Could you please share your opinion on this? I'm afraid that somebody might be using this to achieve something.
Like so:
<div class="twitter" data-hello="goodbye">Tweet</div>
that changes URL to:
https://twitter.com/intent/tweet?url={url}&text={title}&hello=goodbye
It all makes sense to me. Let's implement warnings in 2.5 and see who's going to come 😄(probably nobody but that's okay).
Have been fixed in PRs above
Status quo
All the params from each widget are being appended to the URL that is being used by the button for the sharing call: https://github.com/NikolayRys/Likely/blob/master/source/button.js#L216 As I understand, this has been done to unify the way the URL build between all the services.
The problem
This approach doesn't make much sense. Each service constructs the URL in each own way, knows a finite list of parameters, or doesn't use different parameters at all.
Proposed solution
Initial change for 2.5:
Add a concept of "known params" for each service. For example, "data-via", but not "data-hello" to Twitter. Continue attaching all the parameters to the URL, but throw console warning each time the parameter not recognised.
Breaking change for 3.0:
Remove the shared logic of constructing URL out of all provided parameters. Instead, do a custom thing in each service according to its capabilities. Expand the list of known params. Introduce the difference between obligatory params and known, but not obligatory. Remove warning.