Skip to content

Commit 045fdca

Browse files
authored
protocol: add retention update types (keybase#10225)
1 parent 392c9d4 commit 045fdca

7 files changed

Lines changed: 90 additions & 0 deletions

File tree

‎go/chat/types/types.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ var PushMembershipUpdate = "chat.membershipUpdate"
1919
var PushTLFFinalize = "chat.tlffinalize"
2020
var PushTLFResolve = "chat.tlfresolve"
2121
var PushTeamChannels = "chat.teamchannels"
22+
var PushConvRetention = "chat.convretention"
23+
var PushTeamRetention = "chat.teamretention"
2224

2325
type NameInfo struct {
2426
ID chat1.TLFID

‎go/protocol/chat1/extras.go‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,3 +794,7 @@ func (p RetentionPolicy) Summary() string {
794794
return fmt.Sprintf("{%v}", typ)
795795
}
796796
}
797+
798+
func TeamIDToTLFID(teamID keybase1.TeamID) (TLFID, error) {
799+
return MakeTLFID(teamID.String())
800+
}

‎go/protocol/chat1/gregor.go‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,34 @@ func (o TeamChannelUpdate) DeepCopy() TeamChannelUpdate {
338338
}
339339
}
340340

341+
type ConvRetentionUpdate struct {
342+
InboxVers InboxVers `codec:"inboxVers" json:"inboxVers"`
343+
ConvID ConversationID `codec:"convID" json:"convID"`
344+
Policy RetentionPolicy `codec:"policy" json:"policy"`
345+
}
346+
347+
func (o ConvRetentionUpdate) DeepCopy() ConvRetentionUpdate {
348+
return ConvRetentionUpdate{
349+
InboxVers: o.InboxVers.DeepCopy(),
350+
ConvID: o.ConvID.DeepCopy(),
351+
Policy: o.Policy.DeepCopy(),
352+
}
353+
}
354+
355+
type TeamRetentionUpdate struct {
356+
InboxVers InboxVers `codec:"inboxVers" json:"inboxVers"`
357+
TeamID keybase1.TeamID `codec:"teamID" json:"teamID"`
358+
Policy RetentionPolicy `codec:"policy" json:"policy"`
359+
}
360+
361+
func (o TeamRetentionUpdate) DeepCopy() TeamRetentionUpdate {
362+
return TeamRetentionUpdate{
363+
InboxVers: o.InboxVers.DeepCopy(),
364+
TeamID: o.TeamID.DeepCopy(),
365+
Policy: o.Policy.DeepCopy(),
366+
}
367+
}
368+
341369
type GregorInterface interface {
342370
}
343371

‎protocol/avdl/chat1/gregor.avdl‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,16 @@ protocol gregor {
110110
record TeamChannelUpdate {
111111
TLFID teamID;
112112
}
113+
114+
record ConvRetentionUpdate {
115+
InboxVers inboxVers;
116+
ConversationID convID;
117+
RetentionPolicy policy;
118+
}
119+
120+
record TeamRetentionUpdate {
121+
InboxVers inboxVers;
122+
keybase1.TeamID teamID;
123+
RetentionPolicy policy;
124+
}
113125
}

‎protocol/js/rpc-chat-gen.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ export type ChatUiChatThreadCachedRpcParam = $ReadOnly<{thread?: ?String, incomi
619619

620620
export type ChatUiChatThreadFullRpcParam = $ReadOnly<{thread: String, incomingCallMap?: IncomingCallMapType, waitingHandler?: WaitingHandlerType}>
621621

622+
export type ConvRetentionUpdate = $ReadOnly<{inboxVers: InboxVers, convID: ConversationID, policy: RetentionPolicy}>
623+
622624
export type ConvTypingUpdate = $ReadOnly<{convID: ConversationID, typers?: ?Array<TyperInfo>}>
623625

624626
export type Conversation = $ReadOnly<{metadata: ConversationMetadata, readerInfo?: ?ConversationReaderInfo, notifications?: ?ConversationNotificationInfo, maxMsgs?: ?Array<MessageBoxed>, maxMsgSummaries?: ?Array<MessageSummary>, creatorInfo?: ?ConversationCreatorInfo, expunge: Expunge, convRetention?: ?RetentionPolicy, teamRetention?: ?RetentionPolicy}>
@@ -1228,6 +1230,8 @@ export type TLFResolveUpdate = $ReadOnly<{convID: ConversationID, inboxVers: Inb
12281230

12291231
export type TeamChannelUpdate = $ReadOnly<{teamID: TLFID}>
12301232

1233+
export type TeamRetentionUpdate = $ReadOnly<{inboxVers: InboxVers, teamID: Keybase1.TeamID, policy: RetentionPolicy}>
1234+
12311235
export type TeamType =
12321236
| 0 // NONE_0
12331237
| 1 // SIMPLE_1

‎protocol/json/chat1/gregor.json‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,42 @@
358358
"name": "teamID"
359359
}
360360
]
361+
},
362+
{
363+
"type": "record",
364+
"name": "ConvRetentionUpdate",
365+
"fields": [
366+
{
367+
"type": "InboxVers",
368+
"name": "inboxVers"
369+
},
370+
{
371+
"type": "ConversationID",
372+
"name": "convID"
373+
},
374+
{
375+
"type": "RetentionPolicy",
376+
"name": "policy"
377+
}
378+
]
379+
},
380+
{
381+
"type": "record",
382+
"name": "TeamRetentionUpdate",
383+
"fields": [
384+
{
385+
"type": "InboxVers",
386+
"name": "inboxVers"
387+
},
388+
{
389+
"type": "keybase1.TeamID",
390+
"name": "teamID"
391+
},
392+
{
393+
"type": "RetentionPolicy",
394+
"name": "policy"
395+
}
396+
]
361397
}
362398
],
363399
"messages": {},

‎shared/constants/types/rpc-chat-gen.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ export type ChatUiChatThreadCachedRpcParam = $ReadOnly<{thread?: ?String, incomi
619619

620620
export type ChatUiChatThreadFullRpcParam = $ReadOnly<{thread: String, incomingCallMap?: IncomingCallMapType, waitingHandler?: WaitingHandlerType}>
621621

622+
export type ConvRetentionUpdate = $ReadOnly<{inboxVers: InboxVers, convID: ConversationID, policy: RetentionPolicy}>
623+
622624
export type ConvTypingUpdate = $ReadOnly<{convID: ConversationID, typers?: ?Array<TyperInfo>}>
623625

624626
export type Conversation = $ReadOnly<{metadata: ConversationMetadata, readerInfo?: ?ConversationReaderInfo, notifications?: ?ConversationNotificationInfo, maxMsgs?: ?Array<MessageBoxed>, maxMsgSummaries?: ?Array<MessageSummary>, creatorInfo?: ?ConversationCreatorInfo, expunge: Expunge, convRetention?: ?RetentionPolicy, teamRetention?: ?RetentionPolicy}>
@@ -1228,6 +1230,8 @@ export type TLFResolveUpdate = $ReadOnly<{convID: ConversationID, inboxVers: Inb
12281230

12291231
export type TeamChannelUpdate = $ReadOnly<{teamID: TLFID}>
12301232

1233+
export type TeamRetentionUpdate = $ReadOnly<{inboxVers: InboxVers, teamID: Keybase1.TeamID, policy: RetentionPolicy}>
1234+
12311235
export type TeamType =
12321236
| 0 // NONE_0
12331237
| 1 // SIMPLE_1

0 commit comments

Comments
 (0)