Skip to content
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 feature to remove reactions #101

Merged
merged 3 commits into from
Mar 5, 2019
Merged

Adding feature to remove reactions #101

merged 3 commits into from
Mar 5, 2019

Conversation

attzonko
Copy link
Owner

Per enhancment request #100 this adds a method to the Message class
called remove_reaction() which takes in the emoji_name to be removed as
a parameter.

Per enhancment request #100 this adds a method to the Message class
called remove_reaction() which takes in the emoji_name to be removed as
a parameter.
@attzonko attzonko requested a review from seLain February 23, 2019 19:15
@attzonko attzonko self-assigned this Feb 23, 2019
@attzonko attzonko added the enhancement New feature or request label Feb 23, 2019
@knedlsepp
Copy link
Contributor

knedlsepp commented Feb 24, 2019

I couldn't quite get this to work. I tried:

@listen_to('lunch\?$', re.IGNORECASE)
def lunch_reply(message):
    import time
    timeout_seconds = 10
    emojis = [
        "plate_with_cutlery", "b", "pizza", "curry", "bento",
        "stuffed_flatbread", "shell"
    ]
    for emoji in emojis:
        message.react(emoji)

    time.sleep(timeout_seconds)

    for emoji in emojis:
        message.remove_reaction(emoji)

but the reactions seem to stay there.

Copy link
Collaborator

@seLain seLain left a comment

Choose a reason for hiding this comment

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

hi @attzonko , I tested it. The DELETE call at mattermost.py :

def delete_reaction(self, user_id, post_id, emoji_name):
        return self.delete(
            '/{0}/posts/{1}/reactions/{2}'.format(
                user_id, post_id, emoji_name))

returned 404

Was there a missing /users/ url prefix ?

def delete_reaction(self, user_id, post_id, emoji_name):
        return self.delete(
            '/users/{0}/posts/{1}/reactions/{2}'.format(
                user_id, post_id, emoji_name))

I got the DELETE call success by adding the /users/ prefix.

@knedlsepp
Copy link
Contributor

@seLain Adding /users resolves the issue.

@attzonko
Copy link
Owner Author

Thanks @seLain for finding my typo 😃 and thank you @knedlsepp for testing this out. i want to figure out why our Travis CI is failing, so I'll keep this pull request open for now so I have something to test with. When I manually run pytest I see it passing so I need to investigate further.

@attzonko attzonko merged commit f9b825f into master Mar 5, 2019
@attzonko attzonko deleted the remove_reaction branch March 2, 2021 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants