Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cli.joinRoom(currentRoomId).done((room) => {
let trackedRoomsJSON = localStorage.getItem('mx_tracked_rooms');
if (!trackedRoomsJSON) {
trackedRooms = [room.roomId];
} else {
trackedRooms = JSON.parse(trackedRoomsJSON);
if (trackedRooms.indexOf(room.roomId) === -1) {
trackedRooms.push(room.roomId);
}
}
localStorage.setItem('mx_tracked_rooms', JSON.stringify(trackedRooms));
// Fudge a filter into the syncApi
let f = new matrixSdk.Filter(creds.user_id);
f.setDefinition({
"account_data": {
"not_types": [
"*"
],
},
"room": {
"rooms": trackedRooms,
"account_data": {
"limit": 0,
},
"state": {
"types": [
"m.room.aliases",
"m.room.canonical_alias",
"m.room.member",
updateTimelineSet: function(roomId) {
const client = MatrixClientPeg.get();
const room = client.getRoom(roomId);
this.noRoom = !room;
if (room) {
const filter = new Matrix.Filter(client.credentials.userId);
filter.setDefinition(
{
"room": {
"timeline": {
"contains_url": true,
"types": [
"m.room.message",
],
},
},
},
);
// FIXME: we shouldn't be doing this every time we change room - see comment above.
client.getOrCreateFilter("FILTER_FILES_" + client.credentials.userId, filter).then(
(filterId)=>{
export const createFileFilter = () => {
fileFilter = new Matrix.Filter(client.credentials.userId)
fileFilter.setDefinition(
{
room: {
timeline: {
contains_url: true,
types: [
'm.room.message',
],
},
},
},
)
client.getOrCreateFilter('FILTER_FILES_' + client.credentials.userId, fileFilter).then(
(filterId: string) => {
fileFilter.filterId = filterId