Closed (fixed)
Project:
Share Message
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
11 Nov 2014 at 14:35 UTC
Updated:
6 Jan 2016 at 17:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
s_leu commentedComment #2
s_leu commentedHere's a first patch.
Comment #3
miro_dietikerAs investigated today, I recommend to switch to always add this url.
With typical Drupal development patterns, query strings can be considered part of the URL, change the results (such as a view filter) and should not be automatically dropped, ever. This fix makes this explicit.
However, please add a comment about the original issue any why we enforce it.. and link to this issue.
Finally, sure, this kind of things should be easily alterable. But this should be covered in a followup. (please create)
Comment #4
miro_dietikerActually the special option to add the meta info into the inline attributes then has a different meaning:
It now is only to suppress the global OG tag overwriting.
I think, we should have here some better solution, at least detects clashes and warn. Possibly have some hierarchy / weights. Possibly also invert the checkbox to "promote to page OG tags". (followup)
Comment #5
berdirAs discussed:
- Drop the current flag
- Ad the view mode to $context before calling the alter hook
- support the following view modes:
full: Default, display og tags if first like now, always add atributes
only_og: like now, only og tags, no visible output
no_attributes: like full, but don't add attributes
no_og: like full, but don't add og tags.
Then document those somewhere, README.txt probably.
Comment #6
s_leu commentedOk here's a new patch considering the feedback and adding a test for the view modes.
Comment #8
s_leu commentedChanged test as discussed.
Comment #10
berdirCommitted with the attached documentation changes. No need to be specific about entity reference there, view modes can always be used.
Comment #11
s_leu commentedNow that we have this patch committed i wonder if it's still necessary to have the option " Enforce the usage of this share message on the page it points to"?
Comment #12
berdirYes, definitely. That is what powers smid=1, this change only made it work out of the box, thanks to the attributes that are how there by default.
Comment #13
tduong commentedFor now I have ported only the test. I'm not sure what to do about the view_mode array and where is/should be defined the sharemessage_entity_info() method. Any suggestion?
Comment #14
miro_dietikerLet's see the tests running.
Comment #16
miro_dietikerThis function contains too much logic. It reads "assertShareButtons()" and adding an $invert is really strange to read code without knowing the implementation.
Make it more self explaining. Some code duplication in tests does not hurt. Or create wrapper methods with nice names.
Comment #17
tduong commentedSplit assertShareButtons(): getRawHtmlIconeStyle(), assertShareButton()
Comment #19
miro_dietikerHm, i think i didn't explain well.
I mean we should do less arguments and make the method more self explanatory by name:
- assertShareButton()
- assertNoShareButton()
- assertOGTags()
- assertNoOGTags()
Internally you might want to have assertShareButtonHelper() or assertOGTagsHelper() with an extra argument to do the inverse check to avoid code duplication.
But the test code only calls the nicely named methods with only few arguments.
Comment #20
tduong commentedComment #21
tduong commentedCreated the 6 assert methods mentioned in #19 and fixed the test method.
Comment #23
miro_dietikerYeah now it reads much nicer!
Now just the functionality is missing..? ;-)
And about assertOGTags():
Hm, we might want to verify more elements from OG than just the title. Or you think it is enough because covered elsewhere in more detail?
This loooks much risky if $title contains special characters such as "'" or '"'. The example should cover it to proof we have no XSS problems. And $title should be encoded here.
Comment #24
tduong commentedTried to port the rest.
Comment #25
tduong commentedOh, ok I'll do it next week :)
Comment #27
tduong commentedInterdiff:
As discussed with @miro_dietiker we might want to move the OGTags assertion methods to a base class, since there is also other tests regarding these OG properties. Created issue here: #2638624: Move assertOGTags() from test to base class
Also we have added a @todo in Drupal\sharemessage\Tests\ShareMessageSettingsTest::testShareMessageOGTags() to add a coverage for a safer check for the special characters in OG Tags.
Created issue here: #2638628: Add test coverage for special characters in OG tags
The test is still failing and I'm still not sure if the last ported parts are ok. I thought that it should be added some lines in AddthisSettingsForm and sharemessage.addthis.yml to set which view_mode to use or something like that, am I right?
Comment #29
miro_dietikerLooks fine to me. Now let's make it pass... ;-)
Comment #30
tduong commentedFixed!
Comment #32
tduong commentedCreated an issue to move the ShareButtons assertion methods to the base class in #2639208: Move assertShareButtons() from test to base class, already uploaded the patch. Need to be approved and committed so I can reroll the patch of this issue and make this test to pass.
Comment #33
miro_dietikerSo referred things progressed... Now back to work in this issue and make it pass? ;-)
Comment #34
tduong commentedYep, let's do it! :D
Comment #35
tduong commentedRerolled, fixed the additional AddThis attributes in the base class and the tests.
Comment #37
tduong commentedFixed! :D
Comment #39
tduong commentedFixed absolute url bug.
Comment #40
miro_dietikerI like! Committed! :-)