fbmessenger.android: use Optional name, best to leave for the consumer to decide how to behave when it's unavailable
e.g. using <NAME UNAVAILABLE> was causing issues when used as zulip contact name
This commit is contained in:
parent
4dfc4029c3
commit
bee17d932b
1 changed files with 3 additions and 3 deletions
|
@ -41,7 +41,7 @@ def inputs() -> Sequence[Path]:
|
||||||
@dataclass(unsafe_hash=True)
|
@dataclass(unsafe_hash=True)
|
||||||
class Sender:
|
class Sender:
|
||||||
id: str
|
id: str
|
||||||
name: str
|
name: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(unsafe_hash=True)
|
@dataclass(unsafe_hash=True)
|
||||||
|
@ -103,7 +103,7 @@ def _process_db(db: sqlite3.Connection) -> Iterator[Res[Entity]]:
|
||||||
for r in db.execute('''SELECT * FROM thread_users'''):
|
for r in db.execute('''SELECT * FROM thread_users'''):
|
||||||
# for messaging_actor_type == 'REDUCED_MESSAGING_ACTOR', name is None
|
# for messaging_actor_type == 'REDUCED_MESSAGING_ACTOR', name is None
|
||||||
# but they are still referenced, so need to keep
|
# but they are still referenced, so need to keep
|
||||||
name = r['name'] or '<NAME UNAVAILABLE>'
|
name = r['name']
|
||||||
user_key = r['user_key']
|
user_key = r['user_key']
|
||||||
s = Sender(
|
s = Sender(
|
||||||
id=_normalise_user_id(user_key),
|
id=_normalise_user_id(user_key),
|
||||||
|
@ -135,7 +135,7 @@ def _process_db(db: sqlite3.Connection) -> Iterator[Res[Entity]]:
|
||||||
name = r['name'] # seems that it's only set for some groups
|
name = r['name'] # seems that it's only set for some groups
|
||||||
if name is None:
|
if name is None:
|
||||||
users = thread_users[thread_key]
|
users = thread_users[thread_key]
|
||||||
name = ', '.join([u.name for u in users])
|
name = ', '.join([u.name or u.id for u in users])
|
||||||
yield Thread(
|
yield Thread(
|
||||||
id=_normalise_thread_id(thread_key),
|
id=_normalise_thread_id(thread_key),
|
||||||
name=name,
|
name=name,
|
||||||
|
|
Loading…
Add table
Reference in a new issue