Skip to content

TagBase.delete_tags#14

Merged
Edouard360 merged 2 commits intomasterfrom
tag-base-delete-tags
Jul 29, 2019
Merged

TagBase.delete_tags#14
Edouard360 merged 2 commits intomasterfrom
tag-base-delete-tags

Conversation

@Edouard360
Copy link
Copy Markdown
Collaborator

Context:

We want to resort articles in a board.
To do that we first need to delete them, and re-tag them in the good order.
This should be done regardless of who saved the articles.

Compared to FeedlyUser.delete_tags, which worked on any streamable, and remove all tags that the user calling the method had created, TagBase.delete_tags removes only one tag per article, the tag corresponding to the id of TagBase, and that regardless of the user id.

Copy link
Copy Markdown
Contributor

@LouisTrezzini LouisTrezzini left a comment

Choose a reason for hiding this comment

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

Looks good to me, this is actually the function I needed on Friday

Comment thread feedly/api_client/data.py Outdated
def delete_tags(self, options: StreamOptions = None):
"""
*** WARNING *** Non-reversible operation
Given a TagBas Streamable, remove tags corresponding to this tag stream, whichever user saved it, for
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TagBase

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok I corrected it

Comment thread feedly/api_client/data.py Outdated
a_ids = [a["id"] for a in self.stream_contents(options)]
tag_id = self._get_id()
while len(a_ids) > 0:
batch_size = 50 # limitation due to the url length: articles are "de-tagged" by batch of 10.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

50 != 10 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok I wrote 50 for batch_size in the comment as well.

Comment thread feedly/api_client/data.py Outdated
def delete_tags(self, options: StreamOptions = None):
"""
*** WARNING *** Non-reversible operation
Given a TagBas Streamable, remove tags corresponding to this tag stream, whichever user saved it, for
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"whichever user saved it" may be unclear, especially since most non-feedly devs won't be too familiar with the teams product.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok I update the description then

@Edouard360
Copy link
Copy Markdown
Collaborator Author

Ok I have updated the description wrt. the user part by:
"If User is part of a Team, this will also delete the teammate tags that correspond to this board".
I am changing the batch size for the delete operation to 50 in both delete_tags method, to reduce a bit the number of API calls.

@Edouard360 Edouard360 merged commit 1a697aa into master Jul 29, 2019
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.

3 participants