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

Fix an error occurring on message.save #233

Merged
merged 3 commits into from
Sep 4, 2019
Merged

Fix an error occurring on message.save #233

merged 3 commits into from
Sep 4, 2019

Conversation

arunagw
Copy link
Contributor

@arunagw arunagw commented Aug 30, 2019

Right now when we call .save on a message it raises an error
because labels attributes also being sent to server along with
other attributes. Server won't know anything about labels so it
was failing. This issues also mentioned here #183

This PR right now rejecting the labels attribute to be sent to server so
we can save a message.

In this PR also using a feature where we can define exclude_when call
for certain actions.

@arunagw arunagw changed the title Fix message.save Fix an error occurring on message.save. Aug 30, 2019
@arunagw arunagw changed the title Fix an error occurring on message.save. Fix an error occurring on message.save Aug 30, 2019
@arunagw arunagw requested a review from adarsh August 30, 2019 05:58
Copy link
Contributor

@adarsh adarsh 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. Any documentation changes that go with this?

@@ -37,7 +37,7 @@ class Message
attribute :folder, :folder
attribute :folder_id, :string

has_n_of_attribute :labels, :label
has_n_of_attribute :labels, :label, exclude_when: [:saving]
Copy link
Contributor

Choose a reason for hiding this comment

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

This is neat, although I can't tell where it is defined.

@arunagw
Copy link
Contributor Author

arunagw commented Sep 4, 2019

I don't think we need any documentation changes for this as excluding this is an internal change.

We might remove this check when we implement change to allow labels to be set which gets converted into label_ids internally.

@arunagw arunagw merged commit 87e2faa into master Sep 4, 2019
@arunagw arunagw deleted the allow-save-call branch September 4, 2019 14:09
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.

2 participants