[Merge] lp:~phablet-team/history-service/notify-group-changes-in-conversation into lp:history-service/staging

Gustavo Pichorim Boiko gustavo.boiko at canonical.com
Thu Oct 20 07:39:09 UTC 2016


Added one more informational comment.

Diff comments:

> === modified file 'daemon/historydaemon.cpp'
> --- daemon/historydaemon.cpp	2016-10-13 18:20:38 +0000
> +++ daemon/historydaemon.cpp	2016-10-13 18:20:38 +0000
> @@ -568,9 +581,31 @@
>                                           properties,
>                                           matchFlagsForChannel(channel),
>                                           true);
> +
> +            // write information event including all initial invitees
> +            QStringList inviteesAliases;
> +            Q_FOREACH(const Tp::ContactPtr contact, channel->groupRemotePendingContacts(false)) {
> +                inviteesAliases << contact->alias();
> +            }
> +            if (inviteesAliases.length() > 0) {
> +                QString pluralLabel = inviteesAliases.length() > 1 ? " were " : " was ";
> +                QString invitees = inviteesAliases.join(", ");
> +                QString inviteesText = QString("%1").arg(invitees) + pluralLabel + "invited to the group";

As this is being removed in a subsequent merge proposal, it doesn't have to be fixed, but just for information, there is a better way of doing that:
ngettext("%1 was invited to the group", "%1 were invited to the group", inviteesAliases.length);
 
Some languages have multiple plural forms.

> +                // FIXME: this is a hack. we need proper information event support
> +                writeInformationEvent(thread, inviteesText);
> +            }
> +
> +            // update participants only if the thread is not available previously. Otherwise we'll wait for membersChanged event
> +            // for reflect in conversation information events for modified participants.
> +            updateRoomParticipants(channel, thread);
> +        }
> +
> +        // write an entry saying you joined the group if 'joined' flag in thread is false and modify that flag.
> +        if (!thread[History::FieldChatRoomInfo].toMap()["Joined"].toBool()) {
>              // FIXME: this is a hack. we need proper information event support
> -            // write an entry saying you joined the group
>              writeInformationEvent(thread, "You joined the group.");
> +            // update backend
> +            updateRoomProperties(channel, QVariantMap{{"Joined", true}});
>          }
>  
>          Tp::AbstractInterface *room_interface = channel->optionalInterface<Tp::Client::ChannelInterfaceRoomInterface>();


-- 
https://code.launchpad.net/~phablet-team/history-service/notify-group-changes-in-conversation/+merge/308428
Your team Ubuntu Phablet Team is subscribed to branch lp:~phablet-team/history-service/include-message-when-group-cancelled.



More information about the Ubuntu-reviews mailing list