fix chat photo download
This commit is contained in:
parent
2f1076b75b
commit
0c0e63f545
@ -17,13 +17,11 @@ class AggregationSourceForm(ModelForm):
|
|||||||
cleaned_data = super(AggregationSourceForm, self).clean()
|
cleaned_data = super(AggregationSourceForm, self).clean()
|
||||||
invite_link = cleaned_data.pop('invite_link')
|
invite_link = cleaned_data.pop('invite_link')
|
||||||
if invite_link:
|
if invite_link:
|
||||||
app = get_client()
|
with get_client() as app:
|
||||||
app.start()
|
|
||||||
try:
|
try:
|
||||||
upd = app.join_chat(invite_link)
|
upd = app.join_chat(invite_link)
|
||||||
except ChannelPrivate:
|
except ChannelPrivate:
|
||||||
raise ValidationError('I was banned in this chat')
|
raise ValidationError('I was banned in this chat')
|
||||||
app.stop()
|
|
||||||
chat = parse_mtproto_chat(app, upd.chats[0])
|
chat = parse_mtproto_chat(app, upd.chats[0])
|
||||||
cleaned_data['chat_id'] = chat.id
|
cleaned_data['chat_id'] = chat.id
|
||||||
Chat.from_obj(chat, app)
|
Chat.from_obj(chat, app)
|
||||||
|
@ -58,3 +58,6 @@ class AggregationSourceDeleteView(LoginRequiredMixin, SingleObjectMixin, View):
|
|||||||
messages.success(self.request, 'Source "{}" was successfully deleted'.format(source.title))
|
messages.success(self.request, 'Source "{}" was successfully deleted'.format(source.title))
|
||||||
source.delete()
|
source.delete()
|
||||||
return redirect('cabinet:aggregator:index')
|
return redirect('cabinet:aggregator:index')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user