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 nickFamilyName,
final String note
) throws NotPrimaryDeviceException, UnregisteredRecipientException;
) throws UnregisteredRecipientException;
void setContactsBlocked(
Collection<RecipientIdentifier.Single> recipient,

View File

@ -1138,10 +1138,7 @@ public class ManagerImpl implements Manager {
final String nickGivenName,
final String nickFamilyName,
final String note
) throws NotPrimaryDeviceException, UnregisteredRecipientException {
if (!account.isPrimaryDevice()) {
throw new NotPrimaryDeviceException();
}
) throws UnregisteredRecipientException {
context.getContactHelper()
.setContactName(context.getRecipientHelper().resolveRecipient(recipient),
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.UserErrorException;
import org.asamk.signal.manager.Manager;
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
import org.asamk.signal.manager.api.UnregisteredRecipientException;
import org.asamk.signal.output.OutputWriter;
import org.asamk.signal.util.CommandUtil;
@ -63,8 +62,6 @@ public class UpdateContactCommand implements JsonRpcLocalCommand {
m.setContactName(recipient, givenName, familyName, nickGivenName, nickFamilyName, note);
} catch (IOException 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) {
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 nickFamilyName,
final String note
) throws NotPrimaryDeviceException {
) {
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) {
try {
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) {
throw new Error.UntrustedIdentity(e.getSender().getIdentifier() + " is not registered.");
}