Merge branch 'master' into config

This commit is contained in:
Paul Nameless 2020-05-22 14:18:48 +08:00
commit ece42b5846
3 changed files with 5 additions and 5 deletions

View file

@ -105,13 +105,13 @@ class Controller:
"^[": lambda _: self.discard_selected_msgs(), # esc
}
def forward_msgs(self, _: int):
def forward_msgs(self):
# TODO: check <can_be_forwarded> flag
chat_id = self.model.chats.id_by_index(self.model.current_chat)
if not chat_id:
return
from_chat_id, msg_ids = self.model.yanked_msgs
if from_chat_id is None:
if not msg_ids:
return
self.tg.forward_msgs(chat_id, from_chat_id, msg_ids)
self.present_info(f"Forwarded {len(msg_ids)} messages")
@ -140,7 +140,6 @@ class Controller:
self.model.selected[chat_id].append(msg.msg_id)
self.model.next_msg()
self.refresh_msgs()
self.present_info("Removed selections")
def discard_selected_msgs(self):
chat_id = self.model.chats.id_by_index(self.model.current_chat)
@ -148,6 +147,7 @@ class Controller:
return
self.model.selected[chat_id] = []
self.refresh_msgs()
self.present_info("Discarded selected messages")
def jump_bottom(self):
if self.model.jump_bottom():

View file

@ -17,7 +17,7 @@ class Model:
self.current_chat = 0
self.downloads: Dict[int, Tuple[int, int]] = {}
self.selected: Dict[int, List[int]] = defaultdict(list)
self.yanked_msgs: Tuple[Optional[int], List[int]] = (None, [])
self.yanked_msgs: Tuple[int, List[int]] = (0, [])
def get_me(self):
return self.users.get_me()

View file

@ -188,4 +188,4 @@ class MsgProxy:
@property
def forward(self) -> Optional[Dict[str, Any]]:
return self.msg.get('forward_info')
return self.msg.get("forward_info")