fix: do not set subject in rooms without description
Setting the subject in rooms that don't have one resulted in an empty subject with a timestamp of '0001-01-01T00:00:00Z', which in turned raise warnings in gajim's logs. This commit changes the behaviour setting a subject and a subject date only if they are given by WA's servers.
This commit is contained in:
parent
d32f1f0a9e
commit
c4af612543
|
@ -100,15 +100,17 @@ class MUC(LegacyMUC[str, str, Participant, str]):
|
|||
self.user_nick = info.Nickname
|
||||
if info.Name:
|
||||
self.name = info.Name
|
||||
if info.Subject.Subject or info.Subject.SetAt:
|
||||
if info.Subject.Subject:
|
||||
self.subject = info.Subject.Subject
|
||||
if info.Subject.SetAt:
|
||||
set_at = datetime.fromtimestamp(info.Subject.SetAt, tz=timezone.utc)
|
||||
self.subject_date = set_at
|
||||
if info.Subject.SetByJID:
|
||||
participant = await self.get_participant_by_legacy_id(info.Subject.SetByJID)
|
||||
if name := participant.nickname:
|
||||
self.subject_setter = name
|
||||
if info.Subject.SetAt:
|
||||
set_at = datetime.fromtimestamp(info.Subject.SetAt, tz=timezone.utc)
|
||||
self.subject_date = set_at
|
||||
if info.Subject.SetByJID:
|
||||
participant = await self.get_participant_by_legacy_id(
|
||||
info.Subject.SetByJID
|
||||
)
|
||||
if name := participant.nickname:
|
||||
self.subject_setter = name
|
||||
for data in info.Participants:
|
||||
participant = await self.get_participant_by_legacy_id(data.JID)
|
||||
if data.Action == whatsapp.GroupParticipantActionRemove:
|
||||
|
|
Loading…
Reference in New Issue