mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-12 00:32:56 +02:00
Block forwarded todo lists.
This commit is contained in:
parent
6e77126a65
commit
bcd42dbb6a
6 changed files with 13 additions and 7 deletions
|
@ -5988,6 +5988,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_todo_mark_premium" = "Only subscribers of {link} can mark tasks as done.";
|
||||
"lng_todo_premium_link" = "Telegram Premium";
|
||||
"lng_todo_mark_restricted" = "{user} has restricted others from marking tasks as done.";
|
||||
"lng_todo_mark_forwarded" = "You can't change forwarded checklists.";
|
||||
|
||||
"lng_outdated_title" = "PLEASE UPDATE YOUR OPERATING SYSTEM.";
|
||||
"lng_outdated_title_bits" = "PLEASE SWITCH TO A 64-BIT OPERATING SYSTEM.";
|
||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/send_credits_box.h" // CreditsEmoji.
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h" // CreateMedia.
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/history_location_manager.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "history/view/history_view_item_preview.h"
|
||||
|
|
|
@ -4178,10 +4178,7 @@ not_null<TodoListData*> Session::duplicateTodoList(
|
|||
const auto result = todoList(id);
|
||||
result->title = existing->title;
|
||||
result->items = existing->items;
|
||||
for (auto &item : result->items) {
|
||||
item.completedBy = nullptr;
|
||||
item.completionDate = TimeId();
|
||||
}
|
||||
++result->version;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,6 @@ struct TodoListData {
|
|||
static constexpr auto kMaxOptions = 32;
|
||||
|
||||
private:
|
||||
bool applyCompletionToItems(const MTPTodoCompletion *result);
|
||||
|
||||
const not_null<Data::Session*> _owner;
|
||||
Flags _flags = Flags();
|
||||
|
||||
|
|
|
@ -341,7 +341,14 @@ void TodoList::startToggleAnimation(Task &task) {
|
|||
}
|
||||
|
||||
void TodoList::toggleCompletion(int id) {
|
||||
if (!canComplete()) {
|
||||
if (_parent->data()->isBusinessShortcut()) {
|
||||
return;
|
||||
} else if (_parent->data()->Has<HistoryMessageForwarded>()) {
|
||||
_parent->delegate()->elementShowTooltip(
|
||||
tr::lng_todo_mark_forwarded(tr::now, Ui::Text::RichLangValue),
|
||||
[] {});
|
||||
return;
|
||||
} else if (!canComplete()) {
|
||||
_parent->delegate()->elementShowTooltip(
|
||||
tr::lng_todo_mark_restricted(
|
||||
tr::now,
|
||||
|
|
|
@ -66,6 +66,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mtproto/mtproto_config.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item_helpers.h" // GetErrorForSending.
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/view/history_view_context_menu.h"
|
||||
#include "window/window_separate_id.h"
|
||||
#include "window/window_session_controller.h"
|
||||
|
@ -2077,6 +2078,7 @@ bool PeerMenuShowAddTodoListTasks(not_null<HistoryItem*> item) {
|
|||
const auto todolist = media ? media->todolist() : nullptr;
|
||||
const auto appConfig = &item->history()->session().appConfig();
|
||||
return item->isRegular()
|
||||
&& !item->Has<HistoryMessageForwarded>()
|
||||
&& todolist
|
||||
&& (todolist->items.size() < appConfig->todoListItemsLimit())
|
||||
&& (item->out() || todolist->othersCanAppend());
|
||||
|
|
Loading…
Add table
Reference in a new issue