Fix profile fetches for empty groups.
This commit is contained in:
parent
10c31e6591
commit
b6528e843e
3 changed files with 8 additions and 15 deletions
|
@ -486,13 +486,15 @@ class RetrieveProfileJob private constructor(parameters: Parameters, private val
|
|||
* Submits the necessary job to refresh the profile of the requested recipient. Works for any
|
||||
* RecipientId, including individuals, groups, or yourself.
|
||||
*
|
||||
*
|
||||
* Identical to [.enqueue])}
|
||||
* May not enqueue any jobs in certain circumstances. In particular, if the recipient is a group
|
||||
* with no other members, then no job will be enqueued.
|
||||
*/
|
||||
@JvmStatic
|
||||
@WorkerThread
|
||||
fun enqueue(recipientId: RecipientId) {
|
||||
ApplicationDependencies.getJobManager().add(forRecipient(recipientId))
|
||||
forRecipients(setOf(recipientId)).firstOrNull()?.let { job ->
|
||||
ApplicationDependencies.getJobManager().add(job)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,19 +510,10 @@ class RetrieveProfileJob private constructor(parameters: Parameters, private val
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Works for any RecipientId, whether it's an individual, group, or yourself.
|
||||
*/
|
||||
@JvmStatic
|
||||
@WorkerThread
|
||||
fun forRecipient(recipientId: RecipientId): Job {
|
||||
return forRecipients(setOf(recipientId)).first()
|
||||
}
|
||||
|
||||
/**
|
||||
* Works for any RecipientId, whether it's an individual, group, or yourself.
|
||||
*
|
||||
* @return A list of length 2 or less. Two iff you are in the recipients.
|
||||
* @return A list of length 2 or less. Two iff you are in the recipients. Could be empty for groups with no other members.
|
||||
*/
|
||||
@JvmStatic
|
||||
@WorkerThread
|
||||
|
|
|
@ -223,7 +223,7 @@ object DataMessageProcessor {
|
|||
if (SignalDatabase.recipients.setProfileKey(senderRecipient.id, messageProfileKey)) {
|
||||
log(timestamp, "Profile key on message from " + senderRecipient.id + " didn't match our local store. It has been updated.")
|
||||
SignalDatabase.runPostSuccessfulTransaction {
|
||||
ApplicationDependencies.getJobManager().add(RetrieveProfileJob.forRecipient(senderRecipient.id))
|
||||
RetrieveProfileJob.enqueue(senderRecipient.id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -69,7 +69,7 @@ class EditProfileViewModel extends ViewModel {
|
|||
|
||||
SignalExecutors.BOUNDED.execute(() -> {
|
||||
onRecipientChanged(Recipient.self().fresh());
|
||||
ApplicationDependencies.getJobManager().add(RetrieveProfileJob.forRecipient(Recipient.self().getId()));
|
||||
RetrieveProfileJob.enqueue(Recipient.self().getId());
|
||||
});
|
||||
|
||||
Recipient.self().live().observeForever(observer);
|
||||
|
|
Loading…
Add table
Reference in a new issue