コード例 #1
0
ファイル: models.py プロジェクト: tomasdev611/Prodtool
 def get_problem_snippet(self, snippet_length=100, join_char="\n"):
     # Sometimes we are forced to turn converstation threads into
     # one big lump. When we do that we prefix the individual convos
     # like this:
     # From: Bob Smith
     # Date: 2019-01-01
     # If we've done that we need to whack that
     lines = self.problem.split('\n')
     try:
         if '**From**:' in lines[0] and '**Date**:' in lines[1]:
             lines = lines[2:]
     except IndexError:
         pass
     problem_markdown = "\n".join(lines)
     markdown_less = remove_markdown(problem_markdown,
                                     length=snippet_length,
                                     join_char=join_char)
     if markdown_less:
         snippet = markdown_less
     else:
         # Even though we require a problem it's possible one won't be set.
         # One case we have this is when the user tags a message in Intercom
         # that only has an image in it and no text.
         snippet = "N/A"
     return snippet
コード例 #2
0
ファイル: views.py プロジェクト: tomasdev611/Prodtool
 def get_success_message(self, cleaned_data):
     url = reverse("feedback-item", kwargs={"pk": self.object.id})
     message = format_html(
         "Saved feedback '<a href='{}'>{}</a>'",
         url,
         remove_markdown(cleaned_data["problem"], 100),
     )
     return message
コード例 #3
0
ファイル: views.py プロジェクト: tomasdev611/Prodtool
 def get_success_message(self, cleaned_data):
     tracking.feature_request_edited(self.request.user)
     url = reverse("feature-request-feedback-details",
                   kwargs={"pk": self.object.id})
     message = format_html(
         "Saved feature '<a href='{}'>{}</a>'",
         url,
         remove_markdown(cleaned_data["title"], 100),
     )
     return message
コード例 #4
0
ファイル: filters.py プロジェクト: tomasdev611/Prodtool
def remove_markdown(text):
    return utils.remove_markdown(text)
コード例 #5
0
 def _get_name(tg_user: TgUser) -> str:
     return remove_markdown(tg_user.full_name if tg_user.username is None
                            else tg_user.username)