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

send_work_weixin_msg detail_url #5821

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from seahub.auth.models import SocialAuthUser
from seahub.seadoc.models import SeadocNotification
from seahub.tags.models import FileUUIDMap
from seahub.notifications.utils import format_sdoc_notice
from seahub.notifications.utils import format_sdoc_notice, gen_sdoc_smart_link

from seahub.dingtalk.utils import dingtalk_get_orgapp_token, dingtalk_get_userid_by_unionid_new
from seahub.dingtalk.settings import DINGTALK_MESSAGE_SEND_TO_CONVERSATION_URL, \
Expand Down Expand Up @@ -115,7 +115,7 @@ def send_dingtalk_msg(self, user_id, title, content):
if resp_json.get('errcode') != 0:
self.log_info(resp_json)

def send_work_weixin_msg(self, uid, title, content):
def send_work_weixin_msg(self, uid, title, content, detail_url=''):

self.log_info('Send wechat msg to user: %s, msg: %s' % (uid, content))

Expand All @@ -126,7 +126,7 @@ def send_work_weixin_msg(self, uid, title, content):
'textcard': {
'title': title,
'description': content,
'url': self.detail_url,
'url': detail_url or self.detail_url,
},
}

Expand Down Expand Up @@ -266,7 +266,10 @@ def do_action(self):
content = ''.join([wrap_div_for_work_weixin(x.format_msg()) for x in should_send])
sdoc_content = ''.join([wrap_div_for_work_weixin(format_sdoc_notice(sdoc_queryset, item)) for item in sdoc_should_send])
content = ''.join([content, sdoc_content])
self.send_work_weixin_msg(work_weixin_email_uid_dict[email], title, content)
detail_url = ''
if sdoc_should_send:
detail_url = gen_sdoc_smart_link(sdoc_should_send[0].doc_uuid)
self.send_work_weixin_msg(work_weixin_email_uid_dict[email], title, content, detail_url)
has_sent = True

translation.activate(cur_language)
Expand Down
Loading