wireapp / generic-message-proto

Protocol definition for generic messages.
https://www.npmjs.com/package/@wireapp/protocol-messaging
GNU General Public License v3.0
33 stars 25 forks source link

fix: Set default LH status to 'unknown' #48

Closed ffflorian closed 5 years ago

ffflorian commented 5 years ago

The Problem

We want to be able to know if a user turns on/off legal hold or if a user has a client that doesn't know about legal hold at all. The problem is that modern Protobuf libraries (introduced in Protobuf 2) will always render a default value to any optional flag (read Optional Fields And Default Values). In our context it means the following... When a client that knows about legal hold receives a message from a client which does not set a value for it (because it is old and doesn't know the property yet), then the modern client will automatically assign a default value (in our case "legal hold off") which makes it impossible to distinguish whether a client wants to turn legal hold off or does not know about it.

Proposed solution

We will introduce another value (UNKNOWN) which will act as the default value for the legal_hold_status property. This is also a best practice suggested by the Profobuf Language Guide (see Enumerations).