-
Notifications
You must be signed in to change notification settings - Fork 80
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
Adding tags #2088
Adding tags #2088
Conversation
@biocore/qiita-admin, wanna take a look/review? |
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.
Minor comments
qiita_db/study.py
Outdated
@@ -1152,6 +1137,75 @@ def unshare(self, user): | |||
qdb.sql_connection.TRN.add(sql, [self._id, user.id]) | |||
qdb.sql_connection.TRN.execute() | |||
|
|||
def add_tags(self, user, tags): |
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.
Should this be named update_tags
, given that it can add and remove tags?
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.
k
qiita_db/study.py
Outdated
Parameters | ||
---------- | ||
user: User object | ||
The user to unshare the study with |
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.
Update doc
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.
k
qiita_db/study.py
Outdated
user: User object | ||
The user to unshare the study with | ||
tags : list of str | ||
The tags to add to the study |
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.
The tags to attach to the study - or something along those lines (since it is not only adding)
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.
k
qiita_db/study.py
Outdated
if user_level != 'admin': | ||
admin_tags = to_add & system_tags_admin | ||
if admin_tags: | ||
message += ('Only admins can assing: ' |
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.
assing
-> assign
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.
k
Seems reasonable |
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!
qiita_db/study.py
Outdated
@@ -1152,6 +1137,75 @@ def unshare(self, user): | |||
qdb.sql_connection.TRN.add(sql, [self._id, user.id]) | |||
qdb.sql_connection.TRN.execute() | |||
|
|||
def add_tags(self, user, tags): |
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.
k
qiita_db/study.py
Outdated
Parameters | ||
---------- | ||
user: User object | ||
The user to unshare the study with |
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.
k
qiita_db/study.py
Outdated
user: User object | ||
The user to unshare the study with | ||
tags : list of str | ||
The tags to add to the study |
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.
k
qiita_db/study.py
Outdated
if user_level != 'admin': | ||
admin_tags = to_add & system_tags_admin | ||
if admin_tags: | ||
message += ('Only admins can assing: ' |
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.
k
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.
Just one typo. I think the tag-it license should also be added in qiita_pet/static/vendor/licences
. Otherwise looks good!
qiita_db/study.py
Outdated
@@ -1152,6 +1137,75 @@ def unshare(self, user): | |||
qdb.sql_connection.TRN.add(sql, [self._id, user.id]) | |||
qdb.sql_connection.TRN.execute() | |||
|
|||
def updata_tags(self, user, tags): |
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.
updata -> update
self.assertEqual(response.code, 200) | ||
self.assertEqual(response.body, exp) | ||
|
||
def test_patch(self): |
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.
same question as in #2092, should there be negative tests?
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.
I don't think is required as all possible options are tested here: https://github.com/biocore/qiita/pull/2088/files#diff-a0b367a8e2e2e1d72fee16533d797415R541, what do you think?
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.
I think this is logically distinct. The goal of a negative test here, and with test_get
, is to verify the status codes and response messages are rational for malformed or inappropriate REST requests
Based on reviews during the Qiita meeting, I'm changed the way this feature works. You can see how it works in the attachment below. Another big change from original definition is that now we are using REST calls to get the tags and the updates.
Note that this adds the possibility of adding tags to studies and keeping track of them by user. However, we are still not showing or filtering the studies in the study list by this. I'll make another PR adding that functionality as this PR is pretty long (but not terrible) already.