Skip to content

Commit ff516d1

Browse files
committed
WebServices: allow show message
1 parent 24974d5 commit ff516d1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

main/inc/lib/webservices/Rest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class Rest extends WebService
3232
const POST_USER_MESSAGE_UNREAD = 'user_message_unread';
3333
const SAVE_USER_MESSAGE = 'save_user_message';
3434
const GET_MESSAGE_USERS = 'message_users';
35+
const VIEW_MESSAGE = 'view_message';
3536

3637
const GET_USER_COURSES = 'user_courses';
3738
const GET_USER_SESSIONS = 'user_sessions';
@@ -2925,6 +2926,14 @@ public function viewSurveyTool()
29252926
exit;
29262927
}
29272928

2929+
public function viewMessage(int $messageId)
2930+
{
2931+
$url = api_get_path(WEB_CODE_PATH).'messages/view_message.php?'.http_build_query(['id' => $messageId]);
2932+
2933+
header("Location: $url");
2934+
exit;
2935+
}
2936+
29282937
public static function isAllowedByRequest(bool $inpersonate = false): bool
29292938
{
29302939
$username = $_GET['username'] ?? null;

main/webservices/api/v2.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@
151151
$data = $restApi->getMessageUsers($search);
152152
$restResponse->setData($data);
153153
break;
154+
case Rest::VIEW_MESSAGE:
155+
$messageId = isset($_GET['message']) ? (int) $_GET['message'] : 0;
156+
157+
$restApi->viewMessage($messageId);
158+
break;
154159

155160
case Rest::GET_USER_COURSES:
156161
$userId = isset($_REQUEST['user_id']) ? (int) $_REQUEST['user_id'] : 0;

0 commit comments

Comments
 (0)