Remove now unnecessary check for primary device from updateContact

Fixes #1880
This commit is contained in:
AsamK 2025-12-08 17:08:38 +01:00
parent f1de69d7ff
commit eb52380ecf
5 changed files with 3 additions and 11 deletions

View File

@ -271,7 +271,7 @@ public interface Manager extends Closeable {
final String nickGivenName, final String nickGivenName,
final String nickFamilyName, final String nickFamilyName,
final String note final String note
) throws NotPrimaryDeviceException, UnregisteredRecipientException; ) throws UnregisteredRecipientException;
void setContactsBlocked( void setContactsBlocked(
Collection<RecipientIdentifier.Single> recipient, Collection<RecipientIdentifier.Single> recipient,

View File

@ -1138,10 +1138,7 @@ public class ManagerImpl implements Manager {
final String nickGivenName, final String nickGivenName,
final String nickFamilyName, final String nickFamilyName,
final String note final String note
) throws NotPrimaryDeviceException, UnregisteredRecipientException { ) throws UnregisteredRecipientException {
if (!account.isPrimaryDevice()) {
throw new NotPrimaryDeviceException();
}
context.getContactHelper() context.getContactHelper()
.setContactName(context.getRecipientHelper().resolveRecipient(recipient), .setContactName(context.getRecipientHelper().resolveRecipient(recipient),
givenName, givenName,

View File

@ -7,7 +7,6 @@ import org.asamk.signal.commands.exceptions.CommandException;
import org.asamk.signal.commands.exceptions.IOErrorException; import org.asamk.signal.commands.exceptions.IOErrorException;
import org.asamk.signal.commands.exceptions.UserErrorException; import org.asamk.signal.commands.exceptions.UserErrorException;
import org.asamk.signal.manager.Manager; import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
import org.asamk.signal.manager.api.UnregisteredRecipientException; import org.asamk.signal.manager.api.UnregisteredRecipientException;
import org.asamk.signal.output.OutputWriter; import org.asamk.signal.output.OutputWriter;
import org.asamk.signal.util.CommandUtil; import org.asamk.signal.util.CommandUtil;
@ -63,8 +62,6 @@ public class UpdateContactCommand implements JsonRpcLocalCommand {
m.setContactName(recipient, givenName, familyName, nickGivenName, nickFamilyName, note); m.setContactName(recipient, givenName, familyName, nickGivenName, nickFamilyName, note);
} catch (IOException e) { } catch (IOException e) {
throw new IOErrorException("Update contact error: " + e.getMessage(), e); throw new IOErrorException("Update contact error: " + e.getMessage(), e);
} catch (NotPrimaryDeviceException e) {
throw new UserErrorException("This command doesn't work on linked devices.");
} catch (UnregisteredRecipientException e) { } catch (UnregisteredRecipientException e) {
throw new UserErrorException("The user " + e.getSender().getIdentifier() + " is not registered."); throw new UserErrorException("The user " + e.getSender().getIdentifier() + " is not registered.");
} }

View File

@ -563,7 +563,7 @@ public class DbusManagerImpl implements Manager {
final String nickGivenName, final String nickGivenName,
final String nickFamilyName, final String nickFamilyName,
final String note final String note
) throws NotPrimaryDeviceException { ) {
signal.setContactName(recipient.getIdentifier(), givenName); signal.setContactName(recipient.getIdentifier(), givenName);
} }

View File

@ -537,8 +537,6 @@ public class DbusSignalImpl implements Signal, AutoCloseable {
public void setContactName(final String number, final String name) { public void setContactName(final String number, final String name) {
try { try {
m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name, "", null, null, null); m.setContactName(getSingleRecipientIdentifier(number, m.getSelfNumber()), name, "", null, null, null);
} catch (NotPrimaryDeviceException e) {
throw new Error.Failure("This command doesn't work on linked devices.");
} catch (UnregisteredRecipientException e) { } catch (UnregisteredRecipientException e) {
throw new Error.UntrustedIdentity(e.getSender().getIdentifier() + " is not registered."); throw new Error.UntrustedIdentity(e.getSender().getIdentifier() + " is not registered.");
} }