generated from exteraGramPlugins/pluginBase
The comments button of a deleted post opens the app's own comments section (discussion thread), its history request answered locally from the logged comments; the input bar is replaced by a "Viewing deleted comments" notice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9b2f26a845
commit
a2e4075a03
7 files changed
+499
-18
No files matched your search
+29
-14
@@ -217,6 +217,25 @@ class History:
|
||||
# the sheet
|
||||
|
||||
def _show(self, original, versions, reader, found, topic):
|
||||
entries = []
|
||||
last = len(versions) - 1
|
||||
for index, version in enumerate(versions):
|
||||
label = "Original" if version["version"] == 0 else f"Edit {version['version']}"
|
||||
if index == last:
|
||||
label += " · current"
|
||||
when = _when(version.get("edit_date"))
|
||||
entries.append((f"{label} · {when}" if when else label, version))
|
||||
self._sheet(original, "Edit history", entries, reader, found, topic)
|
||||
|
||||
def _message_for(self, original, item, copy, reader):
|
||||
"""(TL message, account to draw it as) of an entry: from its copy in
|
||||
the activity group when readable, else from the server's text."""
|
||||
if copy is not None and not isinstance(copy, _message_empty()):
|
||||
return self._from_copy(original, item, copy), reader
|
||||
return self._from_text(original, item), int(original.currentAccount)
|
||||
|
||||
def _sheet(self, original, title_text, entries, reader, found, topic):
|
||||
"""The mock chat: a service pill (label) and a bubble per entry."""
|
||||
from android.view import Gravity
|
||||
from android.widget import LinearLayout, ScrollView, TextView
|
||||
from client_utils import get_last_fragment
|
||||
@@ -232,21 +251,17 @@ class History:
|
||||
column = LinearLayout(context)
|
||||
column.setOrientation(LinearLayout.VERTICAL)
|
||||
column.setPadding(0, dp(8), 0, dp(12))
|
||||
last = len(versions) - 1
|
||||
for index, version in enumerate(versions):
|
||||
label = "Original" if version["version"] == 0 else f"Edit {version['version']}"
|
||||
if index == last:
|
||||
label += " · current"
|
||||
when = _when(version.get("edit_date"))
|
||||
column.addView(self._service(context, f"{label} · {when}" if when else label))
|
||||
copy = found.get(int(version.get("message_id") or 0)) if reader is not None else None
|
||||
if copy is not None and not isinstance(copy, _message_empty()):
|
||||
msg, account = self._from_copy(original, version, copy), reader
|
||||
else:
|
||||
msg, account = self._from_text(original, version), int(original.currentAccount)
|
||||
for label, item in entries:
|
||||
column.addView(self._service(context, label))
|
||||
copy = (
|
||||
found.get(int(item.get("message_id") or 0)) if reader is not None else None
|
||||
)
|
||||
try:
|
||||
msg, account = self._message_for(original, item, copy, reader)
|
||||
column.addView(
|
||||
self._bubble(context, account, self._message_object(account, original, msg), version)
|
||||
self._bubble(
|
||||
context, account, self._message_object(account, original, msg), item
|
||||
)
|
||||
)
|
||||
except Exception as exc:
|
||||
diag.error("history.bubble", exc)
|
||||
@@ -265,7 +280,7 @@ class History:
|
||||
header.setOrientation(LinearLayout.HORIZONTAL)
|
||||
header.setGravity(Gravity.CENTER_VERTICAL)
|
||||
title = TextView(context)
|
||||
title.setText("Edit history" + ("" if reader is not None else " · media unavailable"))
|
||||
title.setText(title_text + ("" if reader is not None else " · media unavailable"))
|
||||
title.setTextSize(17)
|
||||
title.setTextColor(jint(Theme.getColor(Theme.key_dialogTextBlack)))
|
||||
title.setPadding(dp(20), dp(14), dp(12), dp(12))
|
||||
|
||||
Reference in new issue
Block a user