remove Chat::get_info_json()

get_info_json() was added some years ago with the goal to
help desktop getting information about a a chat.

i came over this function when working on #3520,
i thought, that may be a nice function, just add a field, no new api, done.

however, looking at the code, drawbacks of get_info_json() are,
that it does no just write the internal chat info to json -
but also do quite some more expensive things that result in several db calls.

so, if we would have added the "mailing list" address here,
reading it would result in quite some overhead,
therefore i decided against it.

having a closer look,
the function seems unmaintained and also incomplete,
eg. pinning is missing.
diving deeper, it looks as if the function is mostly unused,
i could not find any reference to it even on desktop.

there is only one call to it with the bit misleading name `getSummary()` -
idk, if that is used.

if it turns out, the function is not used,
i suggest to remove it:
- desktop goes for a much broader json-rpc
- in general, i like the idea of getting a structure retuned like that,
  that may be also useful for ios/android, and json is alread in use meanwhile,
  but i would prefer not to mix returning already loaded structure fields
  and things that require database access,
  this is a waste of resources most times.
This commit is contained in:
B. Petersen
2022-07-26 12:36:35 +02:00
parent 8533057881
commit 7d292ceca9
4 changed files with 0 additions and 119 deletions

View File

@@ -171,12 +171,6 @@ class Chat(object):
"""
return lib.dc_chat_get_color(self._dc_chat)
def get_summary(self):
"""return dictionary with summary information."""
dc_res = lib.dc_chat_get_info_json(self.account._dc_context, self.id)
s = from_dc_charpointer(dc_res)
return json.loads(s)
def mute(self, duration: Optional[int] = None) -> None:
"""mutes the chat