diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 46f9e69dc..82a31ced1 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1521,6 +1521,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_action_suggested_video" = "{user} suggests you to use this profile video."; "lng_action_suggested_video_button" = "View Video"; "lng_action_attach_menu_bot_allowed" = "You allowed this bot to message you when you added it in the attachment menu."; +"lng_action_set_wallpaper_me" = "You set a new background for this chat."; +"lng_action_set_wallpaper" = "{user} set a new background for this chat."; "lng_action_topic_created_inside" = "Topic created"; "lng_action_topic_closed_inside" = "Topic closed"; "lng_action_topic_reopened_inside" = "Topic reopened"; @@ -1580,6 +1582,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_group_invite_no_joined" = "No one joined yet"; "lng_group_invite_joined#one" = "{count} joined"; "lng_group_invite_joined#other" = "{count} joined"; +"lng_group_invite_joined_via_filter" = "joined via a folder invite link"; "lng_group_invite_remaining#one" = "{count} remaining"; "lng_group_invite_remaining#other" = "{count} remaining"; "lng_group_invite_requested#one" = "{count} requested"; @@ -3095,6 +3098,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_admin_log_participant_joined_channel" = "{from} joined the channel"; "lng_admin_log_participant_joined_by_link" = "{from} joined the group via {link}"; "lng_admin_log_participant_joined_by_link_channel" = "{from} joined the channel via {link}"; +"lng_admin_log_participant_joined_by_filter_link" = "{from} joined the group via {link} from a folder"; +"lng_admin_log_participant_joined_by_filter_link_channel" = "{from} joined the channel via {link} from a folder"; "lng_admin_log_participant_approved_by_link" = "{from} was approved to join the group via {link} by {user}"; "lng_admin_log_participant_approved_by_link_channel" = "{from} was approved to join the channel via {link} by {user}"; "lng_admin_log_participant_approved_by_request" = "{from} joined to the group via public request, approved by {user}"; diff --git a/Telegram/Resources/tl/api.tl b/Telegram/Resources/tl/api.tl index c2ac7601d..e0b47d985 100644 --- a/Telegram/Resources/tl/api.tl +++ b/Telegram/Resources/tl/api.tl @@ -196,6 +196,7 @@ messageActionTopicCreate#d999256 flags:# title:string icon_color:int icon_emoji_ messageActionTopicEdit#c0944820 flags:# title:flags.0?string icon_emoji_id:flags.1?long closed:flags.2?Bool hidden:flags.3?Bool = MessageAction; messageActionSuggestProfilePhoto#57de635e photo:Photo = MessageAction; messageActionRequestedPeer#fe77345d button_id:int peer:Peer = MessageAction; +messageActionSetChatWallPaper#bc44a927 wallpaper:WallPaper = MessageAction; dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog; dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog; @@ -247,7 +248,7 @@ inputReportReasonFake#f5ddd6e7 = ReportReason; inputReportReasonIllegalDrugs#a8eb2be = ReportReason; inputReportReasonPersonalDetails#9ec7863d = ReportReason; -userFull#f8d32aed flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector = UserFull; +userFull#93eadb53 flags:# blocked:flags.0?true phone_calls_available:flags.4?true phone_calls_private:flags.5?true can_pin_message:flags.7?true has_scheduled:flags.12?true video_calls_available:flags.13?true voice_messages_forbidden:flags.20?true translations_disabled:flags.23?true id:long about:flags.1?string settings:PeerSettings personal_photo:flags.21?Photo profile_photo:flags.2?Photo fallback_photo:flags.22?Photo notify_settings:PeerNotifySettings bot_info:flags.3?BotInfo pinned_msg_id:flags.6?int common_chats_count:int folder_id:flags.11?int ttl_period:flags.14?int theme_emoticon:flags.15?string private_forward_name:flags.16?string bot_group_admin_rights:flags.17?ChatAdminRights bot_broadcast_admin_rights:flags.18?ChatAdminRights premium_gifts:flags.19?Vector wallpaper:flags.24?WallPaper = UserFull; contact#145ade0b user_id:long mutual:Bool = Contact; @@ -385,7 +386,7 @@ updateGroupCallParticipants#f2ebdb4e call:InputGroupCall participants:Vector = Update; @@ -959,7 +960,7 @@ channelAdminLogEventActionDiscardGroupCall#db9f9140 call:InputGroupCall = Channe channelAdminLogEventActionParticipantMute#f92424d2 participant:GroupCallParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionParticipantUnmute#e64429c0 participant:GroupCallParticipant = ChannelAdminLogEventAction; channelAdminLogEventActionToggleGroupCallSetting#56d6a247 join_muted:Bool = ChannelAdminLogEventAction; -channelAdminLogEventActionParticipantJoinByInvite#5cdada77 invite:ExportedChatInvite = ChannelAdminLogEventAction; +channelAdminLogEventActionParticipantJoinByInvite#fe9fc158 flags:# via_community:flags.0?true invite:ExportedChatInvite = ChannelAdminLogEventAction; channelAdminLogEventActionExportedInviteDelete#5a50fca4 invite:ExportedChatInvite = ChannelAdminLogEventAction; channelAdminLogEventActionExportedInviteRevoke#410a134e invite:ExportedChatInvite = ChannelAdminLogEventAction; channelAdminLogEventActionExportedInviteEdit#e90ebb59 prev_invite:ExportedChatInvite new_invite:ExportedChatInvite = ChannelAdminLogEventAction; @@ -1306,7 +1307,7 @@ messages.historyImportParsed#5e0fb7b9 flags:# pm:flags.0?true group:flags.1?true messages.affectedFoundMessages#ef8d3e6c pts:int pts_count:int offset:int messages:Vector = messages.AffectedFoundMessages; -chatInviteImporter#8c5adfd9 flags:# requested:flags.0?true user_id:long date:int about:flags.2?string approved_by:flags.1?long = ChatInviteImporter; +chatInviteImporter#8c5adfd9 flags:# requested:flags.0?true via_community:flags.3?true user_id:long date:int about:flags.2?string approved_by:flags.1?long = ChatInviteImporter; messages.exportedChatInvites#bdc62dcc count:int invites:Vector users:Vector = messages.ExportedChatInvites; @@ -1876,6 +1877,7 @@ messages.searchCustomEmoji#2c11c0d7 emoticon:string hash:long = EmojiList; messages.togglePeerTranslations#e47cb579 flags:# disabled:flags.0?true peer:InputPeer = Bool; messages.getBotApp#34fdc5c3 app:InputBotApp hash:long = messages.BotApp; messages.requestAppWebView#8c5a3b3c flags:# write_allowed:flags.0?true peer:InputPeer app:InputBotApp start_param:flags.1?string theme_params:flags.2?DataJSON platform:string = AppWebViewResult; +messages.setChatWallPaper#bddd7eaa peer:InputPeer wallpaper:InputWallPaper settings:WallPaperSettings = Updates; updates.getState#edd4882a = updates.State; updates.getDifference#25939651 flags:# pts:int pts_total_limit:flags.0?int date:int qts:int = updates.Difference; @@ -2068,6 +2070,7 @@ communities.joinCommunityInvite#4eff927 slug:string peers:Vector = Up communities.getCommunityUpdates#2956d635 community:InputCommunity = communities.CommunityUpdates; communities.joinCommunityUpdates#51d42216 community:InputCommunity peers:Vector = Updates; communities.hideCommunityUpdates#d678baf community:InputCommunity = Bool; +communities.getLeaveCommunitySuggestions#ee4e9ae2 community:InputCommunity = Vector; communities.leaveCommunity#35d9755f community:InputCommunity peers:Vector = Updates; // LAYER 158 diff --git a/Telegram/SourceFiles/api/api_invite_links.cpp b/Telegram/SourceFiles/api/api_invite_links.cpp index e6d8182f3..8958285f7 100644 --- a/Telegram/SourceFiles/api/api_invite_links.cpp +++ b/Telegram/SourceFiles/api/api_invite_links.cpp @@ -58,6 +58,7 @@ JoinedByLinkSlice ParseJoinedByLinkSlice( result.users.push_back({ .user = owner.user(data.vuser_id()), .date = data.vdate().v, + .viaFilterLink = data.is_via_community(), }); }); } diff --git a/Telegram/SourceFiles/api/api_invite_links.h b/Telegram/SourceFiles/api/api_invite_links.h index 14f510796..09b43c086 100644 --- a/Telegram/SourceFiles/api/api_invite_links.h +++ b/Telegram/SourceFiles/api/api_invite_links.h @@ -34,6 +34,7 @@ struct PeerInviteLinks { struct JoinedByLinkUser { not_null user; TimeId date = 0; + bool viaFilterLink = false; }; struct JoinedByLinkSlice { diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp index 050dccc99..681ce1f64 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp @@ -731,9 +731,14 @@ void Controller::loadMoreRows() { void Controller::appendSlice(const Api::JoinedByLinkSlice &slice) { for (const auto &user : slice.users) { _lastUser = user; - delegate()->peerListAppendRow((_role == Role::Requested) + auto row = (_role == Role::Requested) ? std::make_unique(user.user, user.date) - : std::make_unique(user.user)); + : std::make_unique(user.user); + if (_role != Role::Requested && user.viaFilterLink) { + row->setCustomStatus( + tr::lng_group_invite_joined_via_filter(tr::now)); + } + delegate()->peerListAppendRow(std::move(row)); } delegate()->peerListRefreshRows(); if (delegate()->peerListFullRowsCount() > 0) { diff --git a/Telegram/SourceFiles/data/data_file_origin.cpp b/Telegram/SourceFiles/data/data_file_origin.cpp index ee9a24ca4..92750b49f 100644 --- a/Telegram/SourceFiles/data/data_file_origin.cpp +++ b/Telegram/SourceFiles/data/data_file_origin.cpp @@ -97,6 +97,8 @@ struct FileReferenceAccumulator { push(data.vphoto()); }, [&](const MTPDmessageActionSuggestProfilePhoto &data) { push(data.vphoto()); + }, [&](const MTPDmessageActionSetChatWallPaper &data) { + push(data.vwallpaper()); }, [](const auto &data) { }); }, [](const MTPDmessageEmpty &data) { diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp index e8d9b86bf..34d4d3897 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.cpp +++ b/Telegram/SourceFiles/export/data/export_data_types.cpp @@ -1182,6 +1182,10 @@ ServiceAction ParseServiceAction( + "photos/" + PreparePhotoFileName(++context.photos, date)); result.content = content; + }, [&](const MTPDmessageActionSetChatWallPaper &data) { + auto content = ActionSetChatWallPaper(); + // #TODO wallpapers + result.content = content; }, [&](const MTPDmessageActionRequestedPeer &data) { auto content = ActionRequestedPeer(); content.peerId = ParsePeerId(data.vpeer()); @@ -1198,6 +1202,9 @@ File &Message::file() { } else if (const auto photo = std::get_if( content)) { return photo->photo.image.file; + } else if (const auto wallpaper = std::get_if( + content)) { + // #TODO wallpapers } return media.file(); } @@ -1209,6 +1216,9 @@ const File &Message::file() const { } else if (const auto photo = std::get_if( content)) { return photo->photo.image.file; + } else if (const auto wallpaper = std::get_if( + content)) { + // #TODO wallpapers } return media.file(); } diff --git a/Telegram/SourceFiles/export/data/export_data_types.h b/Telegram/SourceFiles/export/data/export_data_types.h index 71bae17f8..fa472850b 100644 --- a/Telegram/SourceFiles/export/data/export_data_types.h +++ b/Telegram/SourceFiles/export/data/export_data_types.h @@ -515,6 +515,10 @@ struct ActionSuggestProfilePhoto { Photo photo; }; +struct ActionSetChatWallPaper { + // #TODO wallpapers +}; + struct ActionRequestedPeer { PeerId peerId = 0; int buttonId = 0; @@ -556,7 +560,8 @@ struct ServiceAction { ActionTopicCreate, ActionTopicEdit, ActionSuggestProfilePhoto, - ActionRequestedPeer> content; + ActionRequestedPeer, + ActionSetChatWallPaper> content; }; ServiceAction ParseServiceAction( diff --git a/Telegram/SourceFiles/export/output/export_output_html.cpp b/Telegram/SourceFiles/export/output/export_output_html.cpp index 59c176bae..53f78c704 100644 --- a/Telegram/SourceFiles/export/output/export_output_html.cpp +++ b/Telegram/SourceFiles/export/output/export_output_html.cpp @@ -1173,6 +1173,8 @@ auto HtmlWriter::Wrap::pushMessage( return serviceFrom + " suggests to use this photo"; }, [&](const ActionRequestedPeer &data) { return "requested: "_q/* + data.peerId*/; + }, [&](const ActionSetChatWallPaper &data) { + return serviceFrom + " set a new background for this chat"; }, [](v::null_t) { return QByteArray(); }); if (!serviceText.isEmpty()) { diff --git a/Telegram/SourceFiles/export/output/export_output_json.cpp b/Telegram/SourceFiles/export/output/export_output_json.cpp index e24a364ba..142addf97 100644 --- a/Telegram/SourceFiles/export/output/export_output_json.cpp +++ b/Telegram/SourceFiles/export/output/export_output_json.cpp @@ -590,6 +590,9 @@ QByteArray SerializeMessage( pushAction("requested_peer"); push("button_id", data.buttonId); push("peer_id", data.peerId.value); + }, [&](const ActionSetChatWallPaper &data) { + pushActor(); + pushAction("set_chat_wallpaper"); }, [](v::null_t) {}); if (v::is_null(message.action.content)) { diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index b92ed2736..3cb49004c 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -1392,9 +1392,13 @@ void GenerateItems( const auto createParticipantJoinByInvite = [&]( const LogJoinByInvite &data) { - const auto text = (channel->isMegagroup() - ? tr::lng_admin_log_participant_joined_by_link - : tr::lng_admin_log_participant_joined_by_link_channel); + const auto text = data.is_via_community() + ? (channel->isMegagroup() + ? tr::lng_admin_log_participant_joined_by_filter_link + : tr::lng_admin_log_participant_joined_by_filter_link_channel) + : (channel->isMegagroup() + ? tr::lng_admin_log_participant_joined_by_link + : tr::lng_admin_log_participant_joined_by_link_channel); addInviteLinkServiceMessage( text( tr::now, diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 2a312bb4a..d92f088d7 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -4157,6 +4157,26 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { return result; }; + auto prepareSetChatWallPaper = [&]( + const MTPDmessageActionSetChatWallPaper &action) { + const auto isSelf = (_from->id == _from->session().userPeerId()); + const auto peer = isSelf ? history()->peer : _from; + const auto user = peer->asUser(); + const auto name = (user && !user->firstName.isEmpty()) + ? user->firstName + : peer->name(); + auto result = PreparedServiceText{}; + result.links.push_back(peer->createOpenLink()); + result.text = isSelf + ? tr::lng_action_set_wallpaper( + tr::now, + lt_user, + Ui::Text::Link(name, 1), // Link 1. + Ui::Text::WithEntities) + : tr::lng_action_set_wallpaper_me(tr::now, Ui::Text::WithEntities); + return result; + }; + setServiceText(action.match([&]( const MTPDmessageActionChatAddUser &data) { return prepareChatAddUserText(data); @@ -4233,6 +4253,8 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) { return prepareSuggestProfilePhoto(data); }, [&](const MTPDmessageActionRequestedPeer &data) { return prepareRequestedPeer(data); + }, [&](const MTPDmessageActionSetChatWallPaper &data) { + return prepareSetChatWallPaper(data); }, [](const MTPDmessageActionEmpty &) { return PreparedServiceText{ { tr::lng_message_empty(tr::now) } }; })); @@ -4296,6 +4318,8 @@ void HistoryItem::applyAction(const MTPMessageAction &action) { history()->owner().processPhoto(photo)); }, [](const MTPDphotoEmpty &) { }); + }, [&](const MTPDmessageActionSetChatWallPaper &data) { + //_media = std::make_unique.. #TODO wallpapers }, [](const auto &) { }); }