Update group with remaining options, after creating it

This commit is contained in:
AsamK 2021-05-15 18:26:45 +02:00
parent ea633efc9c
commit 81ee2c2d2b
3 changed files with 25 additions and 18 deletions

View file

@ -1060,7 +1060,7 @@ public class Manager implements Closeable {
result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second()); result = sendUpdateGroupV2Message(group, groupGroupChangePair.first(), groupGroupChangePair.second());
} }
if (result == null || name != null || description != null || avatarFile != null) { if (name != null || description != null || avatarFile != null) {
var groupGroupChangePair = groupV2Helper.updateGroup(group, name, description, avatarFile); var groupGroupChangePair = groupV2Helper.updateGroup(group, name, description, avatarFile);
if (avatarFile != null) { if (avatarFile != null) {
avatarStore.storeGroupAvatar(group.getGroupId(), avatarStore.storeGroupAvatar(group.getGroupId(),

View file

@ -98,9 +98,13 @@ public class UpdateGroupCommand implements DbusCommand, LocalCommand {
groupMembers, groupMembers,
groupAvatar == null ? null : new File(groupAvatar)); groupAvatar == null ? null : new File(groupAvatar));
ErrorUtils.handleTimestampAndSendMessageResults(writer, 0, results.second()); ErrorUtils.handleTimestampAndSendMessageResults(writer, 0, results.second());
final var newGroupId = results.first(); groupId = results.first();
writer.println("Created new group: \"{}\"", newGroupId.toBase64()); writer.println("Created new group: \"{}\"", groupId.toBase64());
} else { groupName = null;
groupMembers = null;
groupAvatar = null;
}
var results = m.updateGroup(groupId, var results = m.updateGroup(groupId,
groupName, groupName,
groupDescription, groupDescription,
@ -114,6 +118,7 @@ public class UpdateGroupCommand implements DbusCommand, LocalCommand {
groupEditDetailsPermission != null ? groupEditDetailsPermission.toManager() : null, groupEditDetailsPermission != null ? groupEditDetailsPermission.toManager() : null,
groupAvatar == null ? null : new File(groupAvatar), groupAvatar == null ? null : new File(groupAvatar),
groupExpiration); groupExpiration);
if (results != null) {
ErrorUtils.handleTimestampAndSendMessageResults(writer, results.first(), results.second()); ErrorUtils.handleTimestampAndSendMessageResults(writer, results.first(), results.second());
} }
} catch (AttachmentInvalidException e) { } catch (AttachmentInvalidException e) {

View file

@ -355,7 +355,9 @@ public class DbusSignalImpl implements Signal {
null, null,
avatar == null ? null : new File(avatar), avatar == null ? null : new File(avatar),
null); null);
if (results != null) {
checkSendMessageResults(results.first(), results.second()); checkSendMessageResults(results.first(), results.second());
}
return groupId; return groupId;
} }
} catch (IOException e) { } catch (IOException e) {