@@ 361-375 (lines=15) @@ | ||
358 | ) |
|
359 | self.publish(self.create_send_message(message, Actions.DELETE_MESSAGE, None, js_id), message.room_id) |
|
360 | elif giphy_match is not None: |
|
361 | self.edit_message_giphy(giphy_match, message, js_id) |
|
362 | else: |
|
363 | self.edit_message_edit(data, message, js_id) |
|
364 | ||
365 | def edit_message_giphy(self, giphy_match, message, js_id): |
|
366 | def edit_glyphy(message, giphy): |
|
367 | do_db(Message.objects.filter(id=message.id).update, content=message.content, symbol=message.symbol, giphy=giphy, |
|
368 | edited_times=message.edited_times) |
|
369 | message.giphy = giphy |
|
370 | self.publish(self.create_send_message(message, Actions.EDIT_MESSAGE, None, js_id), message.room_id) |
|
371 | ||
372 | self.search_giphy(message, giphy_match, edit_glyphy) |
|
373 | ||
374 | def edit_message_edit(self, data, message, js_id): |
|
375 | action = Actions.EDIT_MESSAGE |
|
376 | message.giphy = None |
|
377 | files = UploadedFile.objects.filter(id__in=data.get(VarNames.FILES), user_id=self.user_id) |
|
378 | if files: |
|
@@ 459-470 (lines=12) @@ | ||
456 | ||
457 | def retry_file_connection(self, in_message): |
|
458 | connection_id = in_message[VarNames.CONNECTION_ID] |
|
459 | opponent_ws_id = in_message[VarNames.WEBRTC_OPPONENT_ID] |
|
460 | sender_ws_id = self.sync_redis.shget(WEBRTC_CONNECTION, connection_id) |
|
461 | receiver_ws_status = self.sync_redis.shget(connection_id, opponent_ws_id) |
|
462 | if receiver_ws_status == WebRtcRedisStates.READY and self.id == sender_ws_id: |
|
463 | self.publish(self.retry_file(connection_id), opponent_ws_id) |
|
464 | else: |
|
465 | raise ValidationError("Invalid channel status.") |
|
466 | ||
467 | def reply_file_connection(self, in_message): |
|
468 | connection_id = in_message[VarNames.CONNECTION_ID] |
|
469 | sender_ws_id = self.sync_redis.shget(WEBRTC_CONNECTION, connection_id) |
|
470 | sender_ws_status = self.sync_redis.shget(connection_id, sender_ws_id) |
|
471 | self_ws_status = self.sync_redis.shget(connection_id, self.id) |
|
472 | if sender_ws_status == WebRtcRedisStates.READY and self_ws_status == WebRtcRedisStates.OFFERED: |
|
473 | self.async_redis_publisher.hset(connection_id, self.id, WebRtcRedisStates.RESPONDED) |