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

zerver: Replace log_event with RealmAuditLog in do_change_avatar_fields #4278

Closed
wants to merge 1 commit into from
Closed

Conversation

misteraverin
Copy link
Collaborator

@misteraverin misteraverin commented Mar 23, 2017

@timabbott please review. This pull request hasbug with length of extra_data. Sorry for dirty pull request. I don't know why 2 previous commits appear again as they have already been merged into master.

@smarx
Copy link

smarx commented Mar 23, 2017

Automated message from Dropbox CLA bot

@misteraverin, it looks like you've already signed the Dropbox CLA. Thanks!

@showell
Copy link
Contributor

showell commented Mar 25, 2017

@misteraverin This looks pretty good. Can you squash this into one commit, rebase against a current copy of master, and re-run the migrations again in your dev environment to ensure that no other migrations have hit master since your original change?

@misteraverin
Copy link
Collaborator Author

@showell I merge migrations, but an error still appears

@showell
Copy link
Contributor

showell commented Mar 26, 2017

@misteraverin Thanks for the progress update!

Do you need help understanding the Travis output or debugging zerver.tests.test_audit_log.TestChangeAvatarFields.test_change_avatar_source? If so, maybe find somebody on chat (including me) who can help you.

@misteraverin
Copy link
Collaborator Author

misteraverin commented Mar 26, 2017

@showell Well, actually problem is "value too long for type character varying(1)", when I add new field to model

realm = get_realm('zulip')
now = timezone.now()
user = do_create_user('email', 'password', realm, 'full_name', 'short_name')
avatar_source = '/img/1.jpg'
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Your bug is because valid values for avatar_source are things like AVATAR_FROM_GRAVATAR = G. Read the zerver/models.py code for this field and you'll understand.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, great thanks

@@ -1552,3 +1552,4 @@ class RealmAuditLog(models.Model):
event_type = models.CharField(max_length=40) # type: Text
event_time = models.DateTimeField() # type: datetime.datetime
backfilled = models.BooleanField(default=False) # type: bool
extra_data = models.TextField() # type: Text
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I think you should add null=True to this.

fix migrations

merge migration

fix test

fix type annotation

fix whitespace
@timabbott
Copy link
Sponsor Member

@misteraverin I cleaned up the unnecessary "merge" migration by regenerating migrations, added null=true and merged this as 1414693 and f213369.

Thanks @misteraverin!

@timabbott timabbott closed this Mar 27, 2017
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.

None yet

5 participants