File tree 2 files changed +27
-4
lines changed
2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -147,6 +147,28 @@ pub(super) async fn handle_input(
147
147
. await
148
148
. context ( "zulip message update failed" ) ?;
149
149
150
+ // after renaming the zulip topic, post an additional comment under the old topic with a url to the new, renamed topic
151
+ // this is necessary due to the lack of topic permalinks, see https://github.com/zulip/zulip/issues/15290
152
+ let new_topic_url = crate :: zulip:: Recipient :: Stream {
153
+ id : config. zulip_stream ,
154
+ topic : & new_topic,
155
+ } . url ( ) ;
156
+ let breadcrumb_comment = format ! (
157
+ "The associated GitHub issue has been renamed. Please see the [renamed Zulip topic]({})." ,
158
+ new_topic_url
159
+ ) ;
160
+ let zulip_send_breadcrumb_req = crate :: zulip:: MessageApiRequest {
161
+ recipient : crate :: zulip:: Recipient :: Stream {
162
+ id : config. zulip_stream ,
163
+ topic : & prev_topic,
164
+ } ,
165
+ content : & breadcrumb_comment,
166
+ } ;
167
+ zulip_send_breadcrumb_req
168
+ . send ( & ctx. github . raw ( ) )
169
+ . await
170
+ . context ( "zulip post failed" ) ?;
171
+
150
172
return Ok ( ( ) ) ;
151
173
}
152
174
} ;
Original file line number Diff line number Diff line change @@ -393,6 +393,10 @@ impl Recipient<'_> {
393
393
Recipient :: Private { id, .. } => format ! ( "pm-with/{}-xxx" , id) ,
394
394
}
395
395
}
396
+
397
+ pub fn url ( & self ) -> String {
398
+ format ! ( "https://rust-lang.zulipchat.com/#narrow/{}" , self . narrow( ) )
399
+ }
396
400
}
397
401
398
402
#[ cfg( test) ]
@@ -430,10 +434,7 @@ pub struct MessageApiRequest<'a> {
430
434
431
435
impl < ' a > MessageApiRequest < ' a > {
432
436
pub fn url ( & self ) -> String {
433
- format ! (
434
- "https://rust-lang.zulipchat.com/#narrow/{}" ,
435
- self . recipient. narrow( )
436
- )
437
+ self . recipient . url ( )
437
438
}
438
439
439
440
pub async fn send ( & self , client : & reqwest:: Client ) -> anyhow:: Result < reqwest:: Response > {
You can’t perform that action at this time.
0 commit comments