mirror of https://github.com/procxx/kepka.git
				
				
				
			Fix assertion violation in the admin events log.
Add support for a log entry about group/channel photo being removed.
This commit is contained in:
		
							parent
							
								
									7b496b3741
								
							
						
					
					
						commit
						bf57a1506f
					
				| 
						 | 
					@ -1346,6 +1346,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
 | 
				
			||||||
"lng_admin_log_previous_link" = "Previous link";
 | 
					"lng_admin_log_previous_link" = "Previous link";
 | 
				
			||||||
"lng_admin_log_changed_photo_group" = "{from} changed group photo";
 | 
					"lng_admin_log_changed_photo_group" = "{from} changed group photo";
 | 
				
			||||||
"lng_admin_log_changed_photo_channel" = "{from} changed channel photo";
 | 
					"lng_admin_log_changed_photo_channel" = "{from} changed channel photo";
 | 
				
			||||||
 | 
					"lng_admin_log_removed_photo_group" = "{from} removed group photo";
 | 
				
			||||||
 | 
					"lng_admin_log_removed_photo_channel" = "{from} removed channel photo";
 | 
				
			||||||
"lng_admin_log_invites_enabled" = "{from} enabled group invites";
 | 
					"lng_admin_log_invites_enabled" = "{from} enabled group invites";
 | 
				
			||||||
"lng_admin_log_invites_disabled" = "{from} disabled group invites";
 | 
					"lng_admin_log_invites_disabled" = "{from} disabled group invites";
 | 
				
			||||||
"lng_admin_log_signatures_enabled" = "{from} enabled signatures";
 | 
					"lng_admin_log_signatures_enabled" = "{from} enabled signatures";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -307,11 +307,18 @@ void GenerateItems(gsl::not_null<History*> history, LocalIdManager &idManager, c
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto createChangePhoto = [&](const MTPDchannelAdminLogEventActionChangePhoto &action) {
 | 
						auto createChangePhoto = [&](const MTPDchannelAdminLogEventActionChangePhoto &action) {
 | 
				
			||||||
		t_assert(action.vnew_photo.type() == mtpc_chatPhoto);
 | 
							switch (action.vnew_photo.type()) {
 | 
				
			||||||
 | 
							case mtpc_chatPhoto: {
 | 
				
			||||||
			auto photo = GenerateChatPhoto(channel->bareId(), id, date, action.vnew_photo.c_chatPhoto());
 | 
								auto photo = GenerateChatPhoto(channel->bareId(), id, date, action.vnew_photo.c_chatPhoto());
 | 
				
			||||||
 | 
					 | 
				
			||||||
			auto text = (channel->isMegagroup() ? lng_admin_log_changed_photo_group : lng_admin_log_changed_photo_channel)(lt_from, fromLinkText);
 | 
								auto text = (channel->isMegagroup() ? lng_admin_log_changed_photo_group : lng_admin_log_changed_photo_channel)(lt_from, fromLinkText);
 | 
				
			||||||
			addSimpleServiceMessage(text, photo);
 | 
								addSimpleServiceMessage(text, photo);
 | 
				
			||||||
 | 
							} break;
 | 
				
			||||||
 | 
							case mtpc_chatPhotoEmpty: {
 | 
				
			||||||
 | 
								auto text = (channel->isMegagroup() ? lng_admin_log_removed_photo_group : lng_admin_log_removed_photo_channel)(lt_from, fromLinkText);
 | 
				
			||||||
 | 
								addSimpleServiceMessage(text);
 | 
				
			||||||
 | 
							} break;
 | 
				
			||||||
 | 
							default: Unexpected("ChatPhoto type in createChangePhoto()");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto createToggleInvites = [&](const MTPDchannelAdminLogEventActionToggleInvites &action) {
 | 
						auto createToggleInvites = [&](const MTPDchannelAdminLogEventActionToggleInvites &action) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue