Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add admin url to report message #132

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/handlers/moderator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from app.services.user_info import get_user_info
from app.utils.exceptions import ModerationError, TimedeltaParseError
from app.utils.log import Logger
from app.utils.view import hidden_link

logger = Logger(__name__)
router = Router(name=__name__)
Expand Down Expand Up @@ -92,7 +93,7 @@ async def get_mentions_admins(
]
random_five_admins = notifiable_admins[:5]
for admin in random_five_admins:
admins_mention += hd.link("⁠", admin.user.url)
admins_mention += hidden_link(admin.user.url)
return admins_mention


Expand Down Expand Up @@ -341,9 +342,10 @@ async def approve_report_handler(
bot=bot,
)
await callback_query.message.edit_text(
"<b>{reporter}</b> получил <b>+{reward_amount}</b> кармы в награду за репорт!".format(
"<b>{reporter}</b> получил <b>+{reward_amount}</b> кармы в награду за репорт!{admin_url}".format(
bomzheg marked this conversation as resolved.
Show resolved Hide resolved
reporter=hd.quote(karma_change_result.karma_event.user_to.fullname),
reward_amount=config.report_karma_award,
admin_url=hidden_link(user.link)
)
)
delete_bot_reply = False
Expand Down
6 changes: 5 additions & 1 deletion app/infrastructure/database/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ async def get_or_create_from_tg_user(cls, user_tg: types.User | dto.TargetUser):

@property
def mention_link(self):
return hd.link(hd.quote(self.fullname), f"tg://user?id={self.tg_id}")
return hd.link(hd.quote(self.fullname), self.link)

@property
def link(self):
return f"tg://user?id={self.tg_id}"

@property
def mention_no_link(self):
Expand Down
60 changes: 0 additions & 60 deletions app/utils/send_text_file.py

This file was deleted.

5 changes: 5 additions & 0 deletions app/utils/view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from aiogram.utils.text_decorations import html_decoration as hd


def hidden_link(url: str) -> str:
return hd.link("&#8288;", url)
Loading