Skip to content

Commit

Permalink
Try to use own action
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbrand committed Oct 20, 2023
1 parent 80e010f commit 5ea37e9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/xmpp-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker/xmpp-notify/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
30 changes: 15 additions & 15 deletions src/headless/plugins/chat/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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': ''
}
}
Expand All @@ -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));
Expand All @@ -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});
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5ea37e9

Please sign in to comment.