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
#7469 - stop ignoring from hovercards #7748
base: develop
Are you sure you want to change the base?
Conversation
caccb63
to
3d954c4
Compare
b0da839
to
7b2f271
Compare
@Flaburgan I pushed my first try. Tests are still missing. I'll add them later. |
7b2f271
to
a2c5b2b
Compare
status: 200, | ||
responseText: JSON.stringify({id: 1337, block: {id: 5}}) | ||
}); | ||
expect(this.view.aspectDropdownOrUnblock.templateName).toEqual('unblock_person'); |
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.
Strings must use doublequote.
a2c5b2b
to
592b1de
Compare
I updated the specs. Ready for some reviewing. |
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.
Thanks for your PR, I tested it locally, but I found a problem. In some cases the hovercard doesn't reload properly (see comment below), also it would be cool to have some more tests for this.
block.fail(function() { | ||
app.flashMessages.error(Diaspora.I18.t("unblock_failed")); | ||
}); | ||
this.parent._populateHovercard(); |
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.
There is a race-condition with this. The unblock happens in parallel with the reload, so when the reload reloads the hovercard.json before the unblock is persisted, the hovercard is stuck in an inconsistent state (happens in about 50% of my tries):
There is an event triggered when the unblock is done, see:
app.events.on("person:unblock:"+id, this.reload, this); |
Maybe you can do it similar?
592b1de
to
a271616
Compare
I tried something like |
Thanks for the update and sorry for the slow response.
It works for me with However your current solution seems to work too, but I don't know which is the cleaner solution. I'm not a frontend guy and this is becoming to much javascript for my knowledge. Hopefully somebody with more JS knowhow can review the PR and tell if the current solution is OK to merge. |
}); | ||
|
||
unblock.done(function() { | ||
that.parent._populateHovercard(); |
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.
Now that this method is called outside of the class it should probably drop the leading underscore since it is no longer private use. The method itself assumes that parent has been set with a parent that has the href attr which is only true if the parent used already went through the showHovercardOn: _.debounce path. It seems any time someone would use it that it would have been through that path already but if want to do some more defensive programming could catch/check that too perhaps.
Not a core member but think this looks pretty good. It works well in the browser in testing on my instance too. I had a comment on the formerly "private" member. I know the name should change but not sure if we need to cover case where it is invoked before the card is shown (which triggers the event that populates the parent of the hovercard). |
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.
See previous comment.
No description provided.