You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Merge pull request #590 from matrix-org/rxl881/stickers
Add event type for stickers [WIP]
This commit is contained in:
@@ -1321,6 +1321,32 @@ MatrixClient.prototype.sendImageMessage = function(roomId, url, info, text, call
|
|||||||
return this.sendMessage(roomId, content, callback);
|
return this.sendMessage(roomId, content, callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} roomId
|
||||||
|
* @param {string} url
|
||||||
|
* @param {Object} info
|
||||||
|
* @param {string} text
|
||||||
|
* @param {module:client.callback} callback Optional.
|
||||||
|
* @return {module:client.Promise} Resolves: TODO
|
||||||
|
* @return {module:http-api.MatrixError} Rejects: with an error response.
|
||||||
|
*/
|
||||||
|
MatrixClient.prototype.sendStickerMessage = function(roomId, url, info, text, callback) {
|
||||||
|
if (utils.isFunction(text)) {
|
||||||
|
callback = text; text = undefined;
|
||||||
|
}
|
||||||
|
if (!text) {
|
||||||
|
text = "Sticker";
|
||||||
|
}
|
||||||
|
const content = {
|
||||||
|
url: url,
|
||||||
|
info: info,
|
||||||
|
body: text,
|
||||||
|
};
|
||||||
|
return this.sendEvent(
|
||||||
|
roomId, "m.room.sticker", content, callback, undefined,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} roomId
|
* @param {string} roomId
|
||||||
* @param {string} body
|
* @param {string} body
|
||||||
|
|||||||
@@ -97,11 +97,12 @@ FilterComponent.prototype._checkFields =
|
|||||||
};
|
};
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
Object.keys(literal_keys).forEach(function(name) {
|
for (let n=0; n < Object.keys(literal_keys).length; n++) {
|
||||||
|
const name = Object.keys(literal_keys)[n];
|
||||||
const match_func = literal_keys[name];
|
const match_func = literal_keys[name];
|
||||||
const not_name = "not_" + name;
|
const not_name = "not_" + name;
|
||||||
const disallowed_values = self[not_name];
|
const disallowed_values = self[not_name];
|
||||||
if (disallowed_values.map(match_func)) {
|
if (disallowed_values.filter(match_func).length > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +112,7 @@ FilterComponent.prototype._checkFields =
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
const contains_url_filter = this.filter_json.contains_url;
|
const contains_url_filter = this.filter_json.contains_url;
|
||||||
if (contains_url_filter !== undefined) {
|
if (contains_url_filter !== undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user