diff --git a/assets/vue/components/usergroup/GroupDiscussions.vue b/assets/vue/components/usergroup/GroupDiscussions.vue index 53030ee0a0..a4c2270783 100644 --- a/assets/vue/components/usergroup/GroupDiscussions.vue +++ b/assets/vue/components/usergroup/GroupDiscussions.vue @@ -2,7 +2,7 @@

Discussions

- + {{ t("Create thread") }}
@@ -29,9 +29,11 @@ import { ref, onMounted, computed } from 'vue' import { useRoute } from 'vue-router' import axios from 'axios' +import { useI18n } from "vue-i18n" const route = useRoute() const discussions = ref([]) const groupId = ref(route.params.group_id) +const { t } = useI18n() onMounted(async () => { if (groupId.value) { diff --git a/public/main/inc/lib/message.lib.php b/public/main/inc/lib/message.lib.php index 26b9424853..51b242d4e4 100644 --- a/public/main/inc/lib/message.lib.php +++ b/public/main/inc/lib/message.lib.php @@ -366,7 +366,7 @@ class MessageManager ); // Adding more sense to the message group - $subject = sprintf(get_lang('There is a new message in group %s'), $group_info['name']); + $subject = sprintf(get_lang('There is a new message in group %s'), $group_info['title']); $new_user_list = []; foreach ($user_list as $user_data) { $new_user_list[] = $user_data['id']; diff --git a/public/main/inc/lib/notification.lib.php b/public/main/inc/lib/notification.lib.php index 981973ab89..a46d0eda38 100644 --- a/public/main/inc/lib/notification.lib.php +++ b/public/main/inc/lib/notification.lib.php @@ -171,7 +171,7 @@ class Notification extends Model break; case self::NOTIFICATION_TYPE_GROUP: if (!empty($senderInfo)) { - $senderName = $senderInfo['group_info']['name']; + $senderName = $senderInfo['group_info']['title']; $newTitle .= sprintf(get_lang('You have received a new message in group %s'), $senderName); $senderName = api_get_person_name( $senderInfo['user_info']['firstname'], @@ -397,7 +397,7 @@ class Notification extends Model case self::NOTIFICATION_TYPE_GROUP: $topicPage = isset($_REQUEST['topics_page_nr']) ? (int) $_REQUEST['topics_page_nr'] : 0; if (!empty($senderInfo)) { - $senderName = $senderInfo['group_info']['name']; + $senderName = $senderInfo['group_info']['title']; $newMessageText = sprintf(get_lang('You have received a new message in group %s'), $senderName); $senderName = Display::url( $senderInfoName, @@ -405,7 +405,7 @@ class Notification extends Model ); $newMessageText .= '
'.get_lang('User').': '.$senderName; } - $groupUrl = api_get_path(WEB_CODE_PATH).'social/group_topics.php?id='.$senderInfo['group_info']['id'].'&topic_id='.$senderInfo['group_info']['topic_id'].'&msg_id='.$senderInfo['group_info']['msg_id'].'&topics_page_nr='.$topicPage; + $groupUrl = api_get_path(WEB_PATH).'resources/usergroups/show/'.$senderInfo['group_info']['id']; $linkToNewMessage = Display::url(get_lang('See message'), $groupUrl); break; } @@ -519,6 +519,8 @@ class Notification extends Model /** @var array $decodedResult */ $decodedResult = json_decode($result, true); - return intval($decodedResult['success']); + $return = isset($decodedResult['success']) ? (int) $decodedResult['success'] : 0; + + return $return; } } diff --git a/public/main/social/group_topics.php b/public/main/social/group_topics.php index 3d1c607f35..18f723fc00 100644 --- a/public/main/social/group_topics.php +++ b/public/main/social/group_topics.php @@ -68,7 +68,7 @@ if (isset($_POST['action'])) { if ('edit_message_group' === $_POST['action']) { $edit_message_id = intval($_POST['message_id']); $res = MessageManager::send_message( - 0, + api_get_user_id(), $title, $content, $_FILES, @@ -83,7 +83,7 @@ if (isset($_POST['action'])) { api_not_allowed(true); } $res = MessageManager::send_message( - 0, + api_get_user_id(), $title, $content, $_FILES, @@ -99,6 +99,9 @@ if (isset($_POST['action'])) { if (!$res) { Display::addFlash(Display::return_message(get_lang('Error'), 'error')); } + + header('Location: ' . api_get_path(WEB_PATH).'resources/usergroups/show/'.$group_id); + exit; $topic_id = isset($_GET['topic_id']) ? intval($_GET['topic_id']) : null; if ('add_message_group' === $_POST['action']) { $topic_id = $res; @@ -178,7 +181,7 @@ $(function() { $this_section = SECTION_SOCIAL; $interbreadcrumb[] = ['url' => 'groups.php', 'name' => get_lang('Groups')]; -$interbreadcrumb[] = ['url' => 'group_view.php?id='.$group_id, 'name' => Security::remove_XSS($group_info['name'])]; +$interbreadcrumb[] = ['url' => 'group_view.php?id='.$group_id, 'name' => Security::remove_XSS($group_info['title'])]; $interbreadcrumb[] = ['url' => '#', 'name' => get_lang('Discussions')]; $social_left_content = null; //SocialManager::show_social_menu('member_list', $group_id); diff --git a/public/main/social/message_for_group_form.inc.php b/public/main/social/message_for_group_form.inc.php index 2cbac5b344..412a4a9afb 100644 --- a/public/main/social/message_for_group_form.inc.php +++ b/public/main/social/message_for_group_form.inc.php @@ -36,7 +36,7 @@ if (!empty($group_id) && $allowed_action) { api_not_allowed(true); } - $to_group = $group_info['name']; + $to_group = $group_info['title']; if (!empty($message_id)) { /*$message_info = MessageManager::get_message_by_id($message_id); if ('reply_message_group' === $allowed_action) {