Extend updateProfile command to set family name

This commit is contained in:
AsamK 2021-05-05 19:32:52 +02:00
parent 3d361d54bb
commit b7f05a1c80
5 changed files with 34 additions and 18 deletions

View file

@ -16,7 +16,8 @@ public class UpdateProfileCommand implements LocalCommand {
@Override
public void attachToSubparser(final Subparser subparser) {
subparser.addArgument("--name").help("New profile name");
subparser.addArgument("--given-name", "--name").help("New profile (given) name");
subparser.addArgument("--family-name").help("New profile family name (optional)");
subparser.addArgument("--about").help("New profile about text");
subparser.addArgument("--about-emoji").help("New profile about emoji");
@ -29,7 +30,8 @@ public class UpdateProfileCommand implements LocalCommand {
@Override
public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
var name = ns.getString("name");
var givenName = ns.getString("given_name");
var familyName = ns.getString("family_name");
var about = ns.getString("about");
var aboutEmoji = ns.getString("about_emoji");
var avatarPath = ns.getString("avatar");
@ -40,7 +42,7 @@ public class UpdateProfileCommand implements LocalCommand {
: avatarPath == null ? null : Optional.of(new File(avatarPath));
try {
m.setProfile(name, about, aboutEmoji, avatarFile);
m.setProfile(givenName, familyName, about, aboutEmoji, avatarFile);
} catch (IOException e) {
throw new IOErrorException("Update profile error: " + e.getMessage());
}

View file

@ -372,7 +372,7 @@ public class DbusSignalImpl implements Signal {
Optional<File> avatarFile = removeAvatar
? Optional.absent()
: avatarPath == null ? null : Optional.of(new File(avatarPath));
m.setProfile(name, about, aboutEmoji, avatarFile);
m.setProfile(name, null, about, aboutEmoji, avatarFile);
} catch (IOException e) {
throw new Error.Failure(e.getMessage());
}