@@ -77,6 +77,7 @@ type TopicArgs = {
77
77
zulipFeatureLevel : number ,
78
78
dispatch : Dispatch ,
79
79
_ : GetText ,
80
+ startEditTopic : ( streamId : number , topic : string ) => void ,
80
81
...
81
82
} ;
82
83
@@ -169,6 +170,14 @@ const deleteMessage = {
169
170
} ,
170
171
} ;
171
172
173
+ const editTopic = {
174
+ title : 'Edit topic' ,
175
+ errorMessage : 'Failed to edit topic' ,
176
+ action : ( { streamId, topic, startEditTopic } ) => {
177
+ startEditTopic ( streamId , topic ) ;
178
+ } ,
179
+ } ;
180
+
172
181
const markTopicAsRead = {
173
182
title : 'Mark topic as read' ,
174
183
errorMessage : 'Failed to mark topic as read' ,
@@ -502,9 +511,18 @@ export const constructTopicActionButtons = (args: {|
502
511
503
512
const buttons = [ ] ;
504
513
const unreadCount = getUnreadCountForTopic ( unread , streamId , topic ) ;
514
+ const isAdmin = roleIsAtLeast ( ownUserRole , Role . Admin ) ;
505
515
if ( unreadCount > 0 ) {
506
516
buttons . push ( markTopicAsRead ) ;
507
517
}
518
+ // At present, the permissions for editing the topic of a message are highly complex.
519
+ // Until we move to a better set of policy options, we'll only display the edit topic
520
+ // button to admins.
521
+ // Issue: https://github.com/zulip/zulip/issues/21739
522
+ // Relevant comment: https://github.com/zulip/zulip-mobile/issues/5365#issuecomment-1197093294
523
+ if ( true ) {
524
+ buttons . push ( editTopic ) ;
525
+ }
508
526
if ( isTopicMuted ( streamId , topic , mute ) ) {
509
527
buttons . push ( unmuteTopic ) ;
510
528
} else {
@@ -515,7 +533,7 @@ export const constructTopicActionButtons = (args: {|
515
533
} else {
516
534
buttons . push ( unresolveTopic ) ;
517
535
}
518
- if ( roleIsAtLeast ( ownUserRole , Role . Admin ) ) {
536
+ if ( isAdmin ) {
519
537
buttons . push ( deleteTopic ) ;
520
538
}
521
539
const sub = subscriptions . get ( streamId ) ;
@@ -666,6 +684,7 @@ export const showTopicActionSheet = (args: {|
666
684
showActionSheetWithOptions : ShowActionSheetWithOptions ,
667
685
callbacks : { |
668
686
dispatch : Dispatch ,
687
+ startEditTopic : ( streamId : number , topic : string ) => void ,
669
688
_ : GetText ,
670
689
| } ,
671
690
backgroundData : $ReadOnly < {
0 commit comments