models: Add long_term_idle/last_active_message_id to UserProfile.

In this commit we are adding two new fields to the UserProfile
table. These fields are the:
long_term_idle: For storing a bool value representing status of user
being online in long time where 'long' will have a specific
definition.
last_active_message_id: For storing the message id which was last
updated into the UserMessage table for a particular user.
This commit is contained in:
Aditya Bansal 2017-07-10 19:25:15 +05:30 committed by showell
parent 96321b3069
commit ec6fdd92d4
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-10 13:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0088_remove_referral_and_invites'),
]
operations = [
migrations.AddField(
model_name='userprofile',
name='last_active_message_id',
field=models.IntegerField(null=True),
),
migrations.AddField(
model_name='userprofile',
name='long_term_idle',
field=models.BooleanField(db_index=True, default=False),
),
]

View File

@ -561,6 +561,7 @@ class UserProfile(ModelReprMixin, AbstractBaseUser, PermissionsMixin):
date_joined = models.DateTimeField(default=timezone_now) # type: datetime.datetime
is_mirror_dummy = models.BooleanField(default=False) # type: bool
bot_owner = models.ForeignKey('self', null=True, on_delete=models.SET_NULL) # type: Optional[UserProfile]
long_term_idle = models.BooleanField(default=False, db_index=True) # type: bool
USERNAME_FIELD = 'email'
MAX_NAME_LENGTH = 100
@ -577,6 +578,7 @@ class UserProfile(ModelReprMixin, AbstractBaseUser, PermissionsMixin):
realm = models.ForeignKey(Realm, on_delete=CASCADE) # type: Realm
api_key = models.CharField(max_length=API_KEY_LENGTH) # type: Text
tos_version = models.CharField(null=True, max_length=10) # type: Optional[Text]
last_active_message_id = models.IntegerField(null=True) # type: int
### Notifications settings. ###