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
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
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
def remove_markdown(text): return utils.remove_markdown(text)
def _get_name(tg_user: TgUser) -> str: return remove_markdown(tg_user.full_name if tg_user.username is None else tg_user.username)