Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to block someone from the profile modal #3578

Merged
merged 13 commits into from
Jan 21, 2025
Merged
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/headless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"pluggable.js": "3.0.1",
"sizzle": "^2.3.5",
"sprintf-js": "^1.1.2",
"strophe.js": "strophe/strophejs#b4f3369ba07dee4f04750de6709ea8ebe8adf9a5",
"strophe.js": "strophe/strophejs#f54d83199ec62272ee8b4987b2e63f188e1b2e29",
"urijs": "^1.19.10"
},
"devDependencies": {}
Expand Down
2 changes: 0 additions & 2 deletions src/headless/plugins/bookmarks/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,8 @@ class Bookmarks extends Collection {
* @param {import('./types').BookmarkAttrs} attrs
*/
onBookmarkError(iq, attrs) {
const { __ } = _converse;
log.error('Error while trying to add bookmark');
log.error(iq);
api.alert('error', __('Error'), [__('Sorry, something went wrong while trying to save your bookmark.')]);
this.get(attrs.jid)?.destroy();
}

Expand Down
6 changes: 6 additions & 0 deletions src/headless/plugins/chat/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class Message extends ModelWithContact(ColorAwareModel(Model)) {
constructor (models, options) {
super(models, options);
this.file = null;

/** @type {import('./types').MessageAttributes} */
this.attributes;
}

async initialize () {
Expand Down Expand Up @@ -209,6 +212,9 @@ class Message extends ModelWithContact(ColorAwareModel(Model)) {
return api.sendIQ(iq);
}

/**
* @param {Element} stanza
*/
getUploadRequestMetadata (stanza) { // eslint-disable-line class-methods-use-this
const headers = sizzle(`slot[xmlns="${Strophe.NS.HTTPUPLOAD}"] put header`, stanza);
// https://xmpp.org/extensions/xep-0363.html#request
Expand Down
7 changes: 6 additions & 1 deletion src/headless/plugins/chat/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,16 @@ class ChatBox extends ModelWithMessages(ModelWithContact(ColorAwareModel(ChatBox
if (to_bare_jid !== _converse.session.get('bare_jid')) {
return false;
}

if (attrs.is_markable) {
if (this.contact && !attrs.is_archived && !attrs.is_carbon) {
if (this.contact &&
!['none', 'to'].includes(this.contact.get('subscription')) &&
!attrs.is_archived &&
!attrs.is_carbon) {
sendMarker(attrs.from, attrs.msgid, 'received');
}
return false;

} else if (attrs.marker_id) {
const message = this.messages.findWhere({'msgid': attrs.marker_id});
const field_name = `marker_${attrs.marker}`;
Expand Down
10 changes: 9 additions & 1 deletion src/headless/plugins/chat/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
import {EncryptionAttrs} from "../../shared/types";

// Represents a XEP-0372 reference
export type Reference = {
begin: number;
end: number;
type: string;
uri: string;
}

export type MessageErrorAttributes = {
is_error: boolean; // Whether an error was received for this message
error: string; // The error name
Expand Down Expand Up @@ -41,7 +49,7 @@ export type MessageAttributes = EncryptionAttrs & MessageErrorAttributes & {
plaintext: string; // The decrypted text of this message, in case it was encrypted.
receipt_id: string; // The `id` attribute of a XEP-0184 <receipt> element
received: string; // An ISO8601 string recording the time that the message was received
references: Array<Object>; // A list of objects representing XEP-0372 references
references: Array<Reference>; // A list of objects representing XEP-0372 references
replace_id: string; // The `id` attribute of a XEP-0308 <replace> element
retracted: string; // An ISO8601 string recording the time that the message was retracted
retracted_id: string; // The `id` attribute of a XEP-424 <retracted> element
Expand Down
Loading
Loading