mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-23 11:15:44 +00:00
Ignore empty profile fetches in RefreshOwnProfileJob.
This commit is contained in:
@@ -114,6 +114,15 @@ public class RefreshOwnProfileJob extends BaseJob {
|
||||
ProfileAndCredential profileAndCredential = ProfileUtil.retrieveProfileSync(context, self, getRequestType(self), false);
|
||||
SignalServiceProfile profile = profileAndCredential.getProfile();
|
||||
|
||||
if (Util.isEmpty(profile.getName()) &&
|
||||
Util.isEmpty(profile.getAvatar()) &&
|
||||
Util.isEmpty(profile.getAbout()) &&
|
||||
Util.isEmpty(profile.getAboutEmoji()))
|
||||
{
|
||||
Log.w(TAG, "The profile we retrieved was empty! Ignoring it.");
|
||||
return;
|
||||
}
|
||||
|
||||
setProfileName(profile.getName());
|
||||
setProfileAbout(profile.getAbout(), profile.getAboutEmoji());
|
||||
setProfileAvatar(profile.getAvatar());
|
||||
@@ -155,8 +164,13 @@ public class RefreshOwnProfileJob extends BaseJob {
|
||||
String plaintextName = ProfileUtil.decryptString(profileKey, encryptedName);
|
||||
ProfileName profileName = ProfileName.fromSerialized(plaintextName);
|
||||
|
||||
Log.d(TAG, "Saving " + (!Util.isEmpty(plaintextName) ? "non-" : "") + "empty name.");
|
||||
SignalDatabase.recipients().setProfileName(Recipient.self().getId(), profileName);
|
||||
if (!profileName.isEmpty()) {
|
||||
Log.d(TAG, "Saving non-empty name.");
|
||||
SignalDatabase.recipients().setProfileName(Recipient.self().getId(), profileName);
|
||||
} else {
|
||||
Log.w(TAG, "Ignoring empty name.");
|
||||
}
|
||||
|
||||
} catch (InvalidCiphertextException | IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
|
||||
@@ -151,6 +151,7 @@ public class RecipientUtil {
|
||||
if (!isBlockable(recipient)) {
|
||||
throw new AssertionError("Recipient is not blockable!");
|
||||
}
|
||||
Log.w(TAG, "Blocking " + recipient.getId() + " (group: " + recipient.isGroup() + ")");
|
||||
|
||||
recipient = recipient.resolve();
|
||||
|
||||
@@ -177,6 +178,7 @@ public class RecipientUtil {
|
||||
if (!isBlockable(recipient)) {
|
||||
throw new AssertionError("Recipient is not blockable!");
|
||||
}
|
||||
Log.i(TAG, "Unblocking " + recipient.getId() + " (group: " + recipient.isGroup() + ")");
|
||||
|
||||
SignalDatabase.recipients().setBlocked(recipient.getId(), false);
|
||||
SignalDatabase.recipients().setProfileSharing(recipient.getId(), true);
|
||||
|
||||
@@ -81,7 +81,6 @@ public final class ProfileUtil {
|
||||
ApplicationDependencies.getJobManager()
|
||||
.startChain(new RefreshAttributesJob())
|
||||
.then(new ProfileUploadJob())
|
||||
.then(new RefreshOwnProfileJob())
|
||||
.then(new MultiDeviceProfileKeyUpdateJob())
|
||||
.then(gv2UpdateJobs)
|
||||
.enqueue();
|
||||
|
||||
Reference in New Issue
Block a user