Skip to content

Conversation

@squirrelo
Copy link
Contributor

Fixes #1615

Requires #1755

This adds the ability to share analyses to the completed analysis page. It also adds messaging to sharing, so users will receive a message when a study or analysis is shared or unshared with them.

screen shot 2016-04-08 at 11 16 56

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 82.753% when pulling 2314e24 on squirrelo:share-analyses into c93058d on biocore:master.

@antgonza
Copy link
Member

antgonza commented Apr 9, 2016

Conflicts, please solve.

@squirrelo
Copy link
Contributor Author

done, ready for review.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b40bb8b on squirrelo:share-analyses into * on biocore:master*.

if user.id in self.shared_with:
return
# Make sure the analysis is not already shared with the given user
if user.id == self.owner:
Copy link
Member

Choose a reason for hiding this comment

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

I think you are missing and user.id in self.shared_with, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

@antgonza
Copy link
Member

antgonza commented Apr 9, 2016

A few comments.

@squirrelo
Copy link
Contributor Author

Comments addressed

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 82.753% when pulling 32f052b on squirrelo:share-analyses into 63f7033 on biocore:master.

selected = self.get_argument('selected', None)
deselected = self.get_argument('deselected', None)

if selected is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if both are None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No share or unshare actions, but the user email links and user list is still returned. This is leveraged for initial population of the shared list in the page.

@josenavas
Copy link
Contributor

A couple of comments

@squirrelo
Copy link
Contributor Author

Comments addressed

<script type="text/javascript">
$(document).ready(function () {
current_id = {{analysis_id}};
update_share('analysis');
Copy link
Contributor

Choose a reason for hiding this comment

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

Pass the current_id as a parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does not work for the on select and deselect that are in the sharing.js

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you elaborate? Are you saying that you can't modify the functions that you created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I'm saying that the calls on line 21 and 25 of sharing.js have no idea what the current_id is if it is not a global variable, so this suggestion will not work.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see current_id used in those lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly. There is no way of passing in current_id there as a parameter if it is not a global variable since it is unknown, so modifying the function will not work. I have a way of using data variables I am testing right now.

current_study = {{study_info['study_id']}};
update_share();
current_id = {{study_info['study_id']}};
update_share('study');
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here and fix indentation.

@squirrelo
Copy link
Contributor Author

Now uses data attribute instead of global.

@@ -1,5 +1,3 @@
var current_study = null;

$(document).ready(function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually I just saw this - this is a library, why does it has a $(document).ready call? It seems weird that this is in the library and this may be the source of the difficulties that you where finding. If this is used to initialize the different parts of this library, it may be useful to actually have a sharing_init call that you call in the $(document).ready of the actual HTML pages that is using this library.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because you can have as many document.ready calls in a single page as needed, and this also standardizes naming and initialization of the sharing dropdown for use in the other helper functions.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 82.781% when pulling 5ad25f0 on squirrelo:share-analyses into 9877526 on biocore:master.

@squirrelo
Copy link
Contributor Author

Closed to merge onto portals branch.

@squirrelo squirrelo closed this Apr 11, 2016
@squirrelo squirrelo mentioned this pull request Apr 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants