{{ badge.dateissued * 1000 | coreFormatDate :'strftimedatetimeshort' }}
-{{ badge.dateissued * 1000 | coreFormatDate :'strftimedatetimeshort' }}
+{{ day.mday }}
diff --git a/src/addons/calendar/components/upcoming-events/addon-calendar-upcoming-events.html b/src/addons/calendar/components/upcoming-events/addon-calendar-upcoming-events.html index f86b22a2c..0f91e2f50 100644 --- a/src/addons/calendar/components/upcoming-events/addon-calendar-upcoming-events.html +++ b/src/addons/calendar/components/upcoming-events/addon-calendar-upcoming-events.html @@ -4,7 +4,7 @@{{ 'core.coursenogroups' | translate }}
+
{{ 'addon.messages.numparticipants' | translate:{$a: conversation!.membercount} }}
+{{ 'addon.messages.selfconversation' | translate }}
+{{ 'addon.messages.selfconversationdefaultmessage' | translate }}
++ {{ 'addon.messages.unabletomessage' | translate }} +
+{{ 'addon.messages.youhaveblockeduser' | translate }}
++ {{ 'addon.messages.isnotinyourcontacts' | translate: {$a: otherMember.fullname} }} +
+{{ 'addon.messages.requirecontacttomessage' | translate: {$a: otherMember.fullname} }}
+{{ 'addon.messages.userwouldliketocontactyou' | translate: {$a: otherMember.fullname} }}
+{{ 'addon.messages.contactrequestsent' | translate }}
++ {{ 'addon.messages.yourcontactrequestpending' | translate: {$a: otherMember.fullname} }} +
+{{ 'addon.messages.nofavourites' | translate }}
{{ 'addon.messages.nogroupconversations' | translate }}
{{ 'addon.messages.noindividualconversations' | translate }}
' + text + '
' : text; + + try { + if (onlineMessages.indexOf(wrappedText) != -1) { + // Message already sent, ignore it to prevent duplicates. + } else if (conversationId) { + await AddonMessages.instance.sendMessageToConversationOnline(conversationId, text, siteId); + } else if (userId) { + await AddonMessages.instance.sendMessageOnline(userId, text, siteId); + } + } catch (error) { + if (!CoreUtils.instance.isWebServiceError(error)) { + // Error sending, stop execution. + if (CoreApp.instance.isOnline()) { + // App is online, unmark deviceoffline if marked. + AddonMessagesOffline.instance.setMessagesDeviceOffline(messages, false); + } + + throw error; + } + + // Error returned by WS. Store the error to show a warning but keep sending messages. + if (errors.indexOf(error) == -1) { + errors.push(error); + } + } + + // Message was sent, delete it from local DB. + if (conversationId) { + await AddonMessagesOffline.instance.deleteConversationMessage(conversationId, text, message.timecreated, siteId); + } else if (userId) { + await AddonMessagesOffline.instance.deleteMessage(userId, text, message.timecreated, siteId); + } + + // In some Moodle versions, wait 1 second to make sure timecreated is different. + // This is because there was a bug where messages with the same timecreated had a wrong order. + if (!groupMessagingEnabled && i < messages.length - 1) { + await CoreUtils.instance.wait(1000); + } + } + + await this.handleSyncErrors(conversationId, userId, errors, result.warnings); + + // All done, return the warnings. + return result; + } + + /** + * Get messages sent by current user after a certain time. + * + * @param time Time in seconds. + * @param conversationId Conversation ID. + * @param userId User ID talking to (if no conversation ID). + * @param siteId Site ID. + * @return Promise resolved with the messages texts. + */ + protected async getMessagesSentAfter( + time: number, + conversationId?: number, + userId?: number, + siteId?: string, + ): Promise