@@ -77,6 +77,7 @@ type TopicArgs = {
7777 zulipFeatureLevel : number ,
7878 dispatch : Dispatch ,
7979 _ : GetText ,
80+ startEditTopic : ( streamId : number , topic : string ) => void ,
8081 ...
8182} ;
8283
@@ -169,6 +170,14 @@ const deleteMessage = {
169170 } ,
170171} ;
171172
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+
172181const markTopicAsRead = {
173182 title : 'Mark topic as read' ,
174183 errorMessage : 'Failed to mark topic as read' ,
@@ -502,9 +511,18 @@ export const constructTopicActionButtons = (args: {|
502511
503512 const buttons = [ ] ;
504513 const unreadCount = getUnreadCountForTopic ( unread , streamId , topic ) ;
514+ const isAdmin = roleIsAtLeast ( ownUserRole , Role . Admin ) ;
505515 if ( unreadCount > 0 ) {
506516 buttons . push ( markTopicAsRead ) ;
507517 }
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 ( isAdmin ) {
524+ buttons . push ( editTopic ) ;
525+ }
508526 if ( isTopicMuted ( streamId , topic , mute ) ) {
509527 buttons . push ( unmuteTopic ) ;
510528 } else {
@@ -515,7 +533,7 @@ export const constructTopicActionButtons = (args: {|
515533 } else {
516534 buttons . push ( unresolveTopic ) ;
517535 }
518- if ( roleIsAtLeast ( ownUserRole , Role . Admin ) ) {
536+ if ( isAdmin ) {
519537 buttons . push ( deleteTopic ) ;
520538 }
521539 const sub = subscriptions . get ( streamId ) ;
@@ -666,6 +684,7 @@ export const showTopicActionSheet = (args: {|
666684 showActionSheetWithOptions : ShowActionSheetWithOptions ,
667685 callbacks : { |
668686 dispatch : Dispatch ,
687+ startEditTopic : ( streamId : number , topic : string ) => void ,
669688 _ : GetText ,
670689 | } ,
671690 backgroundData : $ReadOnly < {
0 commit comments