Skip to content

Commit

Permalink
Merge pull request #132 from bomzheg/feature/add-admin-audit
Browse files Browse the repository at this point in the history
add admin url to report message
  • Loading branch information
bomzheg authored Nov 14, 2023
2 parents 9fce1d8 + 374f8a4 commit bae9b78
Showing 4 changed files with 15 additions and 63 deletions.
7 changes: 5 additions & 2 deletions app/handlers/moderator.py
Original file line number Diff line number Diff line change
@@ -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__)
@@ -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


@@ -341,9 +342,11 @@ 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(
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
6 changes: 5 additions & 1 deletion app/infrastructure/database/models/user.py
Original file line number Diff line number Diff line change
@@ -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):
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)

0 comments on commit bae9b78

Please sign in to comment.