Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit d305f8a

Browse files
author
Weblate
committed
Merge remote-tracking branch 'origin/develop' into develop
2 parents 102a4df + b42dfc5 commit d305f8a

39 files changed

+277
-125
lines changed

.eslintignore.errorfiles

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ src/autocomplete/Autocompleter.js
66
src/autocomplete/Components.js
77
src/autocomplete/DuckDuckGoProvider.js
88
src/autocomplete/EmojiProvider.js
9-
src/autocomplete/RoomProvider.js
109
src/autocomplete/UserProvider.js
1110
src/CallHandler.js
1211
src/component-index.js
@@ -35,7 +34,6 @@ src/components/views/create_room/RoomAlias.js
3534
src/components/views/dialogs/ChatCreateOrReuseDialog.js
3635
src/components/views/dialogs/DeactivateAccountDialog.js
3736
src/components/views/dialogs/InteractiveAuthDialog.js
38-
src/components/views/dialogs/SetMxIdDialog.js
3937
src/components/views/dialogs/UnknownDeviceDialog.js
4038
src/components/views/elements/AccessibleButton.js
4139
src/components/views/elements/ActionButton.js
@@ -89,7 +87,6 @@ src/components/views/rooms/MemberList.js
8987
src/components/views/rooms/MemberTile.js
9088
src/components/views/rooms/MessageComposer.js
9189
src/components/views/rooms/MessageComposerInput.js
92-
src/components/views/rooms/MessageComposerInputOld.js
9390
src/components/views/rooms/PresenceLabel.js
9491
src/components/views/rooms/ReadReceiptMarker.js
9592
src/components/views/rooms/RoomList.js
@@ -100,7 +97,6 @@ src/components/views/rooms/RoomTile.js
10097
src/components/views/rooms/RoomTopicEditor.js
10198
src/components/views/rooms/SearchableEntityList.js
10299
src/components/views/rooms/SearchResultTile.js
103-
src/components/views/rooms/TabCompleteBar.js
104100
src/components/views/rooms/TopUnreadMessagesBar.js
105101
src/components/views/rooms/UserTile.js
106102
src/components/views/settings/AddPhoneNumber.js
@@ -128,8 +124,6 @@ src/Roles.js
128124
src/Rooms.js
129125
src/ScalarAuthClient.js
130126
src/ScalarMessaging.js
131-
src/TabComplete.js
132-
src/TabCompleteEntries.js
133127
src/TextForEvent.js
134128
src/Tinter.js
135129
src/UiEffects.js
@@ -142,7 +136,7 @@ src/utils/Receipt.js
142136
src/Velociraptor.js
143137
src/VelocityBounce.js
144138
src/WhoIsTyping.js
145-
src/wrappers/WithMatrixClient.js
139+
src/wrappers/withMatrixClient.js
146140
test/all-tests.js
147141
test/components/structures/login/Registration-test.js
148142
test/components/structures/MessagePanel-test.js

CHANGELOG.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,76 @@
1+
Changes in [0.10.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.10.2) (2017-08-24)
2+
=====================================================================================================
3+
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.10.1...v0.10.2)
4+
5+
* Force update on timelinepanel when event decrypted
6+
[\#1334](https://github.com/matrix-org/matrix-react-sdk/pull/1334)
7+
* Dispatch incoming_call synchronously
8+
[\#1337](https://github.com/matrix-org/matrix-react-sdk/pull/1337)
9+
* Fix React crying on machines without internet due to return undefined
10+
[\#1335](https://github.com/matrix-org/matrix-react-sdk/pull/1335)
11+
* Catch the promise rejection if scalar fails
12+
[\#1333](https://github.com/matrix-org/matrix-react-sdk/pull/1333)
13+
* Update from Weblate.
14+
[\#1329](https://github.com/matrix-org/matrix-react-sdk/pull/1329)
15+
16+
Changes in [0.10.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.10.1) (2017-08-23)
17+
=====================================================================================================
18+
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.10.1-rc.1...v0.10.1)
19+
20+
* [No changes]
21+
22+
Changes in [0.10.1-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.10.1-rc.1) (2017-08-22)
23+
===============================================================================================================
24+
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.10.0-rc.2...v0.10.1-rc.1)
25+
26+
* Matthew/multiple widgets
27+
[\#1327](https://github.com/matrix-org/matrix-react-sdk/pull/1327)
28+
* Fix proptypes on UserPickerDialog
29+
[\#1326](https://github.com/matrix-org/matrix-react-sdk/pull/1326)
30+
* AppsDrawer: Remove unnecessary bind
31+
[\#1325](https://github.com/matrix-org/matrix-react-sdk/pull/1325)
32+
* Position add app widget link
33+
[\#1322](https://github.com/matrix-org/matrix-react-sdk/pull/1322)
34+
* Remove app tile beta tag.
35+
[\#1323](https://github.com/matrix-org/matrix-react-sdk/pull/1323)
36+
* Add missing translation.
37+
[\#1324](https://github.com/matrix-org/matrix-react-sdk/pull/1324)
38+
* Note that apps are not E2EE
39+
[\#1319](https://github.com/matrix-org/matrix-react-sdk/pull/1319)
40+
* Only render appTile body (including warnings) if drawer shown.
41+
[\#1321](https://github.com/matrix-org/matrix-react-sdk/pull/1321)
42+
* Timeline improvements
43+
[\#1320](https://github.com/matrix-org/matrix-react-sdk/pull/1320)
44+
* Add a space between widget name and "widget" in widget event tiles
45+
[\#1318](https://github.com/matrix-org/matrix-react-sdk/pull/1318)
46+
* Move manage integrations button from settings page to room header as a
47+
stand-alone component
48+
[\#1286](https://github.com/matrix-org/matrix-react-sdk/pull/1286)
49+
* Don't apply case logic to app names
50+
[\#1316](https://github.com/matrix-org/matrix-react-sdk/pull/1316)
51+
* Stop integ manager opening on every room switch
52+
[\#1315](https://github.com/matrix-org/matrix-react-sdk/pull/1315)
53+
* Add behaviour to toggle app draw on app tile header click
54+
[\#1313](https://github.com/matrix-org/matrix-react-sdk/pull/1313)
55+
* Change OOO so that MELS generation will continue over hidden events
56+
[\#1308](https://github.com/matrix-org/matrix-react-sdk/pull/1308)
57+
* Implement TextualEvent tiles for im.vector.modular.widgets
58+
[\#1312](https://github.com/matrix-org/matrix-react-sdk/pull/1312)
59+
* Don't show widget security warning to the person that added it to the room
60+
[\#1314](https://github.com/matrix-org/matrix-react-sdk/pull/1314)
61+
* remove unused strings introduced by string change
62+
[\#1311](https://github.com/matrix-org/matrix-react-sdk/pull/1311)
63+
* hotfix bad fn signature regression
64+
[\#1310](https://github.com/matrix-org/matrix-react-sdk/pull/1310)
65+
* Show a dialog if the maximum number of widgets allowed has been reached.
66+
[\#1291](https://github.com/matrix-org/matrix-react-sdk/pull/1291)
67+
* Fix Robot translation
68+
[\#1309](https://github.com/matrix-org/matrix-react-sdk/pull/1309)
69+
* Refactor ChatInviteDialog to be UserPickerDialog
70+
[\#1300](https://github.com/matrix-org/matrix-react-sdk/pull/1300)
71+
* Update Link to Translation status
72+
[\#1302](https://github.com/matrix-org/matrix-react-sdk/pull/1302)
73+
174
Changes in [0.9.7](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.9.7) (2017-06-22)
275
===================================================================================================
376
[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.9.6...v0.9.7)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "matrix-react-sdk",
3-
"version": "0.9.7",
3+
"version": "0.10.2",
44
"description": "SDK for matrix.org using React",
55
"author": "matrix.org",
66
"repository": {
@@ -66,7 +66,7 @@
6666
"isomorphic-fetch": "^2.2.1",
6767
"linkifyjs": "^2.1.3",
6868
"lodash": "^4.13.1",
69-
"matrix-js-sdk": "matrix-org/matrix-js-sdk#develop",
69+
"matrix-js-sdk": "0.8.2",
7070
"optimist": "^0.6.1",
7171
"prop-types": "^15.5.8",
7272
"react": "^15.4.0",

src/Notifier.js

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
Copyright 2015, 2016 OpenMarket Ltd
33
Copyright 2017 Vector Creations Ltd
4+
Copyright 2017 New Vector Ltd
45
56
Licensed under the Apache License, Version 2.0 (the "License");
67
you may not use this file except in compliance with the License.
@@ -33,9 +34,16 @@ import Modal from './Modal';
3334
* }
3435
*/
3536

37+
const MAX_PENDING_ENCRYPTED = 20;
38+
3639
const Notifier = {
3740
notifsByRoom: {},
3841

42+
// A list of event IDs that we've received but need to wait until
43+
// they're decrypted until we decide whether to notify for them
44+
// or not
45+
pendingEncryptedEventIds: [],
46+
3947
notificationMessageForEvent: function(ev) {
4048
return TextForEvent.textForEvent(ev);
4149
},
@@ -89,26 +97,28 @@ const Notifier = {
8997
_playAudioNotification: function(ev, room) {
9098
const e = document.getElementById("messageAudio");
9199
if (e) {
92-
e.load();
93100
e.play();
94101
}
95102
},
96103

97104
start: function() {
98-
this.boundOnRoomTimeline = this.onRoomTimeline.bind(this);
105+
this.boundOnEvent = this.onEvent.bind(this);
99106
this.boundOnSyncStateChange = this.onSyncStateChange.bind(this);
100107
this.boundOnRoomReceipt = this.onRoomReceipt.bind(this);
101-
MatrixClientPeg.get().on('Room.timeline', this.boundOnRoomTimeline);
108+
this.boundOnEventDecrypted = this.onEventDecrypted.bind(this);
109+
MatrixClientPeg.get().on('event', this.boundOnEvent);
102110
MatrixClientPeg.get().on('Room.receipt', this.boundOnRoomReceipt);
111+
MatrixClientPeg.get().on('Event.decrypted', this.boundOnEventDecrypted);
103112
MatrixClientPeg.get().on("sync", this.boundOnSyncStateChange);
104113
this.toolbarHidden = false;
105114
this.isSyncing = false;
106115
},
107116

108117
stop: function() {
109118
if (MatrixClientPeg.get() && this.boundOnRoomTimeline) {
110-
MatrixClientPeg.get().removeListener('Room.timeline', this.boundOnRoomTimeline);
119+
MatrixClientPeg.get().removeListener('Event', this.boundOnEvent);
111120
MatrixClientPeg.get().removeListener('Room.receipt', this.boundOnRoomReceipt);
121+
MatrixClientPeg.get().removeListener('Event.decrypted', this.boundOnEventDecrypted);
112122
MatrixClientPeg.get().removeListener('sync', this.boundOnSyncStateChange);
113123
}
114124
this.isSyncing = false;
@@ -237,23 +247,30 @@ const Notifier = {
237247
}
238248
},
239249

240-
onRoomTimeline: function(ev, room, toStartOfTimeline, removed, data) {
241-
if (toStartOfTimeline) return;
242-
if (!room) return;
250+
onEvent: function(ev) {
243251
if (!this.isSyncing) return; // don't alert for any messages initially
244252
if (ev.sender && ev.sender.userId === MatrixClientPeg.get().credentials.userId) return;
245-
if (data.timeline.getTimelineSet() !== room.getUnfilteredTimelineSet()) return;
246253

247-
const actions = MatrixClientPeg.get().getPushActionsForEvent(ev);
248-
if (actions && actions.notify) {
249-
if (this.isEnabled()) {
250-
this._displayPopupNotification(ev, room);
251-
}
252-
if (actions.tweaks.sound && this.isAudioEnabled()) {
253-
PlatformPeg.get().loudNotification(ev, room);
254-
this._playAudioNotification(ev, room);
254+
// If it's an encrypted event and the type is still 'm.room.encrypted',
255+
// it hasn't yet been decrypted, so wait until it is.
256+
if (ev.isBeingDecrypted() || ev.isDecryptionFailure()) {
257+
this.pendingEncryptedEventIds.push(ev.getId());
258+
// don't let the list fill up indefinitely
259+
while (this.pendingEncryptedEventIds.length > MAX_PENDING_ENCRYPTED) {
260+
this.pendingEncryptedEventIds.shift();
255261
}
262+
return;
256263
}
264+
265+
this._evaluateEvent(ev);
266+
},
267+
268+
onEventDecrypted: function(ev) {
269+
const idx = this.pendingEncryptedEventIds.indexOf(ev.getId());
270+
if (idx === -1) return;
271+
272+
this.pendingEncryptedEventIds.splice(idx, 1);
273+
this._evaluateEvent(ev);
257274
},
258275

259276
onRoomReceipt: function(ev, room) {
@@ -273,6 +290,20 @@ const Notifier = {
273290
delete this.notifsByRoom[room.roomId];
274291
}
275292
},
293+
294+
_evaluateEvent: function(ev) {
295+
const room = MatrixClientPeg.get().getRoom(ev.getRoomId());
296+
const actions = MatrixClientPeg.get().getPushActionsForEvent(ev);
297+
if (actions && actions.notify) {
298+
if (this.isEnabled()) {
299+
this._displayPopupNotification(ev, room);
300+
}
301+
if (actions.tweaks.sound && this.isAudioEnabled()) {
302+
PlatformPeg.get().loudNotification(ev, room);
303+
this._playAudioNotification(ev, room);
304+
}
305+
}
306+
}
276307
};
277308

278309
if (!global.mxNotifier) {

src/TextForEvent.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,16 @@ function textForPowerEvent(event) {
244244
}
245245
return _t('%(senderName)s changed the power level of %(powerLevelDiffText)s.', {
246246
senderName: senderName,
247-
powerLevelDiffText: diff.join(", ")
247+
powerLevelDiffText: diff.join(", "),
248248
});
249249
}
250250

251251
function textForWidgetEvent(event) {
252-
const senderName = event.sender ? event.sender.name : event.getSender();
253-
const previousContent = event.getPrevContent() || {};
252+
const senderName = event.getSender();
253+
const {name: prevName, type: prevType, url: prevUrl} = event.getPrevContent();
254254
const {name, type, url} = event.getContent() || {};
255-
let widgetName = name || previousContent.name || type || previousContent.type || '';
255+
256+
let widgetName = name || prevName || type || prevType || '';
256257
// Apply sentence case to widget name
257258
if (widgetName && widgetName.length > 0) {
258259
widgetName = widgetName[0].toUpperCase() + widgetName.slice(1) + ' ';
@@ -261,9 +262,15 @@ function textForWidgetEvent(event) {
261262
// If the widget was removed, its content should be {}, but this is sufficiently
262263
// equivalent to that condition.
263264
if (url) {
264-
return _t('%(widgetName)s widget added by %(senderName)s', {
265-
widgetName, senderName,
266-
});
265+
if (prevUrl) {
266+
return _t('%(widgetName)s widget modified by %(senderName)s', {
267+
widgetName, senderName,
268+
});
269+
} else {
270+
return _t('%(widgetName)s widget added by %(senderName)s', {
271+
widgetName, senderName,
272+
});
273+
}
267274
} else {
268275
return _t('%(widgetName)s widget removed by %(senderName)s', {
269276
widgetName, senderName,

src/components/structures/MatrixChat.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,10 +1068,13 @@ module.exports = React.createClass({
10681068
self.setState({ready: true});
10691069
});
10701070
cli.on('Call.incoming', function(call) {
1071+
// we dispatch this synchronously to make sure that the event
1072+
// handlers on the call are set up immediately (so that if
1073+
// we get an immediate hangup, we don't get a stuck call)
10711074
dis.dispatch({
10721075
action: 'incoming_call',
10731076
call: call,
1074-
});
1077+
}, true);
10751078
});
10761079
cli.on('Session.logged_out', function(call) {
10771080
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");

src/components/structures/MessagePanel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module.exports = React.createClass({
6565
suppressFirstDateSeparator: React.PropTypes.bool,
6666

6767
// whether to show read receipts
68-
manageReadReceipts: React.PropTypes.bool,
68+
showReadReceipts: React.PropTypes.bool,
6969

7070
// true if updates to the event list should cause the scroll panel to
7171
// scroll down when we are at the bottom of the window. See ScrollPanel
@@ -491,7 +491,7 @@ module.exports = React.createClass({
491491
var scrollToken = mxEv.status ? undefined : eventId;
492492

493493
var readReceipts;
494-
if (this.props.manageReadReceipts) {
494+
if (this.props.showReadReceipts) {
495495
readReceipts = this._getReadReceiptsForEvent(mxEv);
496496
}
497497
ret.push(

src/components/structures/RoomView.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ limitations under the License.
2020
// - Drag and drop
2121
// - File uploading - uploadFile()
2222

23+
import shouldHideEvent from "../../shouldHideEvent";
24+
2325
var React = require("react");
2426
var ReactDOM = require("react-dom");
2527
import Promise from 'bluebird';
@@ -143,6 +145,8 @@ module.exports = React.createClass({
143145
MatrixClientPeg.get().on("RoomMember.membership", this.onRoomMemberMembership);
144146
MatrixClientPeg.get().on("accountData", this.onAccountData);
145147

148+
this._syncedSettings = UserSettingsStore.getSyncedSettings();
149+
146150
// Start listening for RoomViewStore updates
147151
this._roomStoreToken = RoomViewStore.addListener(this._onRoomViewStoreUpdate);
148152
this._onRoomViewStoreUpdate(true);
@@ -497,8 +501,7 @@ module.exports = React.createClass({
497501
// update unread count when scrolled up
498502
if (!this.state.searchResults && this.state.atEndOfLiveTimeline) {
499503
// no change
500-
}
501-
else {
504+
} else if (!shouldHideEvent(ev, this._syncedSettings)) {
502505
this.setState((state, props) => {
503506
return {numUnreadMessages: state.numUnreadMessages + 1};
504507
});
@@ -1716,7 +1719,8 @@ module.exports = React.createClass({
17161719
var messagePanel = (
17171720
<TimelinePanel ref={this._gatherTimelinePanelRef}
17181721
timelineSet={this.state.room.getUnfilteredTimelineSet()}
1719-
manageReadReceipts={!UserSettingsStore.getSyncedSetting('hideReadReceipts', false)}
1722+
showReadReceipts={!UserSettingsStore.getSyncedSetting('hideReadReceipts', false)}
1723+
manageReadReceipts={true}
17201724
manageReadMarkers={true}
17211725
hidden={hideMessagePanel}
17221726
highlightedEventId={highlightedEventId}

0 commit comments

Comments
 (0)