@@ -256,13 +256,19 @@ export const getStreamUrl = (
256
256
*/
257
257
// Based on pm_perma_link in static/js/people.js in the zulip/zulip repo.
258
258
// TODO(shared): Share that code.
259
- export const getPmConversationLinkForMessage = ( realm : URL , message : PmMessage | PmOutbox ) : URL => {
259
+ export const getPmConversationLinkForMessage = (
260
+ realm : URL ,
261
+ message : PmMessage | PmOutbox ,
262
+ zulipFeatureLevel : number ,
263
+ ) : URL => {
260
264
const recipientIds = recipientsOfPrivateMessage ( message )
261
265
. map ( r => r . id )
262
266
. sort ( ( a , b ) => a - b ) ;
263
- const suffix = recipientIds . length >= 3 ? 'group' : 'pm' ;
267
+ const suffix = recipientIds . length >= 3 ? 'group' : zulipFeatureLevel >= 177 ? 'dm' : 'pm' ;
264
268
const slug = `${ recipientIds . join ( ',' ) } -${ suffix } ` ;
265
- return new URL ( `#narrow/pm-with/${ slug } ` , realm ) ;
269
+ // TODO(server-7.0): Remove FL 177 condition (here and on `suffix`)
270
+ const operator = zulipFeatureLevel >= 177 ? 'dm' : 'pm-with' ;
271
+ return new URL ( `#narrow/${ operator } /${ slug } ` , realm ) ;
266
272
} ;
267
273
268
274
/**
@@ -272,14 +278,15 @@ export const getMessageUrl = (
272
278
realm : URL ,
273
279
message : Message | Outbox ,
274
280
streamsById : Map < number , Stream > ,
281
+ zulipFeatureLevel : number ,
275
282
) : URL => {
276
283
let result = undefined ;
277
284
278
285
// Build the part that points to the message's conversation…
279
286
if ( message . type === 'stream' ) {
280
287
result = getStreamTopicUrl ( realm , message . stream_id , message . subject , streamsById ) ;
281
288
} else {
282
- result = getPmConversationLinkForMessage ( realm , message ) ;
289
+ result = getPmConversationLinkForMessage ( realm , message , zulipFeatureLevel ) ;
283
290
}
284
291
285
292
// …then add the part that points to the message.
0 commit comments