Skip to content

Commit e76aa06

Browse files
authored
Merge branch 'GrafeasGroup:main' into main
2 parents 0cbe674 + f99bd16 commit e76aa06

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
## [UNRELEASED]
77

88
- Track timestamp of last reddit post processed before sending to mod chat (credit: @crhopkins)
9+
- Add missing backslash in unescaped heading string (credit: @MurdoMaclachlan)
910

1011
## [4.2.4] - 2021-04-05
1112

tor/core/inbox.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
log = logging.getLogger(__name__)
4141

4242

43+
def extract_sub_from_url(url: str) -> str:
44+
"""returns the sub name from the given url without "r/" at the start."""
45+
return url.split("/")[4]
46+
47+
4348
@beeline.traced(name="forward_to_slack")
4449
def forward_to_slack(item: InboxableMixin, cfg: Config) -> None:
4550
username = str(item.author.name)
@@ -66,7 +71,12 @@ def process_reply(reply: Comment, cfg: Config) -> None:
6671
r_body = reply.body.lower() # cache that thing
6772

6873
if "image transcription" in r_body or is_comment_transcription(reply, cfg):
69-
message = i18n["responses"]["general"]["transcript_on_tor_post"]
74+
post_link = reply.submission.url
75+
sub_name = extract_sub_from_url(post_link)
76+
message = i18n["responses"]["general"]["transcript_on_tor_post"].format(
77+
sub_name=sub_name,
78+
post_link=post_link,
79+
)
7080
elif matches := [
7181
match.group()
7282
for match in [regex.search(reply.body) for regex in MOD_SUPPORT_PHRASES]

tor/strings/en_US.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ responses:
184184
[Hey, you're welcome!]({})
185185
transcript_on_tor_post: |
186186
⚠️ Hi there! I might be wrong, but I think you just posted a transcription in reply to me.
187-
The transcription should be made as a **top-level comment** on the post that you're working on transcribing.
188-
For example, if the content is on r\/nicegirls, then the transcription should be commented as a reply to that submission on r\/nicegirls.
187+
The transcription should be made as a **top-level comment** on the [post on r\/{sub_name}]({post_link}).
189188
After you've commented there, come back to me and reply with `done` and I can process it!
190189
191190
Do you need assistance? Reply to me with `help` to summon a moderator!
@@ -331,7 +330,7 @@ formatting_issues:
331330
#Text
332331
333332
334-
To fix this, add a backslash in front of the `#` like so: `#Text`. If you meant for it to render as a heading, please add a space after the `#` to avoid this warning. i.e. `# Text`."
333+
To fix this, add a backslash in front of the `#` like so: `\\#Text`. If you meant for it to render as a heading, please add a space after the `#` to avoid this warning. i.e. `# Text`."
335334
invalid_header: "**Invalid header**: It looks like your header doesn't contain a proper type (Image, Video, or Audio), is missing italics, and/or is not at the start of your transcription. Please make sure your post contains a proper header at the start of your transcription. For example if it's an Image Transcription, it should be the following at the start of your transcription:
336335
337336

0 commit comments

Comments
 (0)