From 5ea37e9f7f1a0deca0e7e11823fdbde495c4adce Mon Sep 17 00:00:00 2001 From: JC Brand Date: Fri, 20 Oct 2023 09:02:57 +0200 Subject: [PATCH] Try to use own action --- .github/workflows/xmpp-notify.yml | 6 +++--- docker/xmpp-notify/Dockerfile | 2 +- src/headless/plugins/chat/model.js | 30 +++++++++++++++--------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/xmpp-notify.yml b/.github/workflows/xmpp-notify.yml index 886348a4d7..ae19592432 100644 --- a/.github/workflows/xmpp-notify.yml +++ b/.github/workflows/xmpp-notify.yml @@ -13,7 +13,7 @@ jobs: steps: - name: push_info_step id: push - uses: processone/xmpp-notifier@master + uses: conversejs/converse.js@jcbrand/xmpp-notify if: github.event_name == 'push' with: # Set the secrets as inputs # jid expects the bot's bare jid (user@domain) @@ -28,7 +28,7 @@ jobs: recipient_is_room: true - name: pr_open_info_step id: pull_request_open - uses: processone/xmpp-notifier@master + uses: conversejs/converse.js@jcbrand/xmpp-notify # Will only get triggered when a pull request to master is created if: github.event_name == 'pull_request' && github.event.action == 'opened' with: # Set the secrets as inputs @@ -42,7 +42,7 @@ jobs: recipient_is_room: true - name: pr_edit_info_step id: pull_request_edit - uses: processone/xmpp-notifier@master + uses: conversejs/converse.js@jcbrand/xmpp-notify # Will only get triggered when a pull request to master is created if: github.event_name == 'pull_request' && github.event.action == 'edited' with: # Set the secrets as inputs diff --git a/docker/xmpp-notify/Dockerfile b/docker/xmpp-notify/Dockerfile index 759fff4108..750c24d6e8 100644 --- a/docker/xmpp-notify/Dockerfile +++ b/docker/xmpp-notify/Dockerfile @@ -1,5 +1,5 @@ # Container image that runs your code -FROM golang:1.13 +FROM golang:1.19 # Copies your code file from your action repository to the filesystem path `/` of the container COPY entrypoint.sh /notifier/entrypoint.sh diff --git a/src/headless/plugins/chat/model.js b/src/headless/plugins/chat/model.js index ca00e1525c..58bf3cfbff 100644 --- a/src/headless/plugins/chat/model.js +++ b/src/headless/plugins/chat/model.js @@ -11,11 +11,11 @@ import { filesize } from "filesize"; import { getMediaURLsMetadata } from '../../shared/parsers.js'; import { getOpenPromise } from '@converse/openpromise'; import { initStorage } from '../../utils/storage.js'; -import { isEmptyMessage } from '../../utils/index.js'; -import { isUniView } from '../../utils/session.js'; +import { isEmptyMessage } from '../../utils/core.js'; +import { isUniView } from '../../shared/settings/api.js'; import { parseMessage } from './parsers.js'; import { sendMarker } from '../../shared/actions.js'; -import { isNewMessage } from './utils.js'; +import { PRIVATE_CHAT_TYPE } from '../../shared/constants.js'; const { Strophe, $msg } = converse.env; @@ -38,7 +38,7 @@ class ChatBox extends ModelWithContact { 'num_unread': 0, 'time_opened': this.get('time_opened') || (new Date()).getTime(), 'time_sent': (new Date(0)).toISOString(), - 'type': _converse.PRIVATE_CHAT_TYPE, + 'type': PRIVATE_CHAT_TYPE, 'url': '' } } @@ -62,7 +62,7 @@ class ChatBox extends ModelWithContact { this.initUI(); this.initMessages(); - if (this.get('type') === _converse.PRIVATE_CHAT_TYPE) { + if (this.get('type') === PRIVATE_CHAT_TYPE) { this.presence = _converse.presences.get(jid) || _converse.presences.create({ jid }); await this.setRosterContact(jid); this.presence.on('change:show', item => this.onPresenceChanged(item)); @@ -72,9 +72,9 @@ class ChatBox extends ModelWithContact { await this.fetchMessages(); /** - * Triggered once a {@link _converse.ChatBox} has been created and initialized. + * Triggered once a {@link ChatBox} has been created and initialized. * @event _converse#chatBoxInitialized - * @type { _converse.ChatBox} + * @type { ChatBox} * @example _converse.api.listen.on('chatBoxInitialized', model => { ... }); */ await api.trigger('chatBoxInitialized', this, {'Synchronous': true}); @@ -123,10 +123,10 @@ class ChatBox extends ModelWithContact { afterMessagesFetched () { this.pruneHistoryWhenScrolledDown(); /** - * Triggered whenever a { @link _converse.ChatBox } or ${ @link _converse.ChatRoom } + * Triggered whenever a { @link ChatBox } or ${ @link _converse.ChatRoom } * has fetched its messages from the local cache. * @event _converse#afterMessagesFetched - * @type { _converse.ChatBox| _converse.ChatRoom } + * @type { ChatBox|ChatRoom } * @example _converse.api.listen.on('afterMessagesFetched', (chat) => { ... }); */ api.trigger('afterMessagesFetched', this); @@ -651,7 +651,7 @@ class ChatBox extends ModelWithContact { * @method _converse.ChatBoxView#retractOwnMessage * @param { _converse.Message } message - The message which we're retracting. */ - retractOwnMessage (message) { + retractOwnMessage(message) { this.sendRetractionMessage(message) message.save({ 'retracted': (new Date()).toISOString(), @@ -683,7 +683,7 @@ class ChatBox extends ModelWithContact { 'id': origin_id, 'xmlns': Strophe.NS.FASTEN }).c('retract', {xmlns: Strophe.NS.RETRACT}) - return api.connection.get().send(msg); + return _converse.connection.send(msg); } /** @@ -738,7 +738,7 @@ class ChatBox extends ModelWithContact { sendReceiptStanza (to_jid, id) { const receipt_stanza = $msg({ - 'from': api.connection.get().jid, + 'from': _converse.connection.jid, 'id': u.getUniqueId(), 'to': to_jid, 'type': 'chat', @@ -766,11 +766,11 @@ class ChatBox extends ModelWithContact { * Given a {@link _converse.Message} return the XML stanza that represents it. * @private * @method _converse.ChatBox#createMessageStanza - * @param { Message } message - The message object + * @param { _converse.Message } message - The message object */ async createMessageStanza (message) { const stanza = $msg({ - 'from': api.connection.get().jid, + 'from': _converse.connection.jid, 'to': this.get('jid'), 'type': this.get('message_type'), 'id': message.get('edited') && u.getUniqueId() || message.get('msgid'), @@ -1093,7 +1093,7 @@ class ChatBox extends ModelWithContact { if (!message?.get('body')) { return } - if (isNewMessage(message)) { + if (u.isNewMessage(message)) { if (message.get('sender') === 'me') { // We remove the "scrolled" flag so that the chat area // gets scrolled down. We always want to scroll down