trying to fix initial messages loading
This commit is contained in:
parent
2fa592273d
commit
d059b12e5e
@ -17,14 +17,16 @@ class AggregationSourceForm(ModelForm):
|
||||
cleaned_data = super(AggregationSourceForm, self).clean()
|
||||
invite_link = cleaned_data.pop('invite_link')
|
||||
if invite_link:
|
||||
with get_client() as app:
|
||||
try:
|
||||
upd = app.join_chat(invite_link)
|
||||
chat = parse_mtproto_chat(app, upd.chats[0])
|
||||
cleaned_data['chat_id'] = chat.id
|
||||
Chat.from_obj(chat, app)
|
||||
except ChannelPrivate:
|
||||
raise ValidationError('I was banned in this chat')
|
||||
app = get_client()
|
||||
app.start()
|
||||
try:
|
||||
upd = app.join_chat(invite_link)
|
||||
except ChannelPrivate:
|
||||
raise ValidationError('I was banned in this chat')
|
||||
app.stop()
|
||||
chat = parse_mtproto_chat(app, upd.chats[0])
|
||||
cleaned_data['chat_id'] = chat.id
|
||||
Chat.from_obj(chat, app)
|
||||
return cleaned_data
|
||||
|
||||
class Meta:
|
||||
|
Loading…
Reference in New Issue
Block a user