From ab3b6497f99ccd35e1be8db9e8867efdb164a79e Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Tue, 11 Oct 2016 19:16:35 +0530 Subject: [PATCH 001/252] Disable "syntax highlighting" in MD mode (RTE) --- src/RichText.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/RichText.js b/src/RichText.js index b1793d0ddf..e662c22d6a 100644 --- a/src/RichText.js +++ b/src/RichText.js @@ -146,9 +146,9 @@ export function getScopedMDDecorators(scope: any): CompositeDecorator { ) }); - markdownDecorators.push(emojiDecorator); - - return markdownDecorators; + // markdownDecorators.push(emojiDecorator); + // TODO Consider renabling "syntax highlighting" when we can do it properly + return [emojiDecorator]; } /** From f2ad4bee8b5243766616cab150ea86e18660035f Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Tue, 11 Oct 2016 19:17:57 +0530 Subject: [PATCH 002/252] Disable force completion for RoomProvider (RTE) --- src/autocomplete/RoomProvider.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/autocomplete/RoomProvider.js b/src/autocomplete/RoomProvider.js index 8d1e555e56..b589425b20 100644 --- a/src/autocomplete/RoomProvider.js +++ b/src/autocomplete/RoomProvider.js @@ -66,8 +66,4 @@ export default class RoomProvider extends AutocompleteProvider { {completions} ; } - - shouldForceComplete(): boolean { - return true; - } } From f4c0baaa2f02b5650597eddbe2f2b75344b9e8e3 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Wed, 30 Nov 2016 22:46:33 +0530 Subject: [PATCH 003/252] refactor MessageComposerInput: bind -> class props --- package.json | 2 +- .../views/rooms/MessageComposerInput.js | 156 ++++++++---------- 2 files changed, 73 insertions(+), 85 deletions(-) diff --git a/package.json b/package.json index a07e2236aa..1e5ee29d2d 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "browser-request": "^0.3.3", "classnames": "^2.1.2", "commonmark": "^0.27.0", - "draft-js": "^0.8.1", + "draft-js": "^0.9.1", "draft-js-export-html": "^0.5.0", "draft-js-export-markdown": "^0.2.0", "emojione": "2.2.3", diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 61dd1e1b1c..9ae420fde4 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -59,6 +59,29 @@ function stateToMarkdown(state) { * The textInput part of the MessageComposer */ export default class MessageComposerInput extends React.Component { + static propTypes = { + tabComplete: React.PropTypes.any, + + // a callback which is called when the height of the composer is + // changed due to a change in content. + onResize: React.PropTypes.func, + + // js-sdk Room object + room: React.PropTypes.object.isRequired, + + // called with current plaintext content (as a string) whenever it changes + onContentChanged: React.PropTypes.func, + + onUpArrow: React.PropTypes.func, + + onDownArrow: React.PropTypes.func, + + // attempts to confirm currently selected completion, returns whether actually confirmed + tryComplete: React.PropTypes.func, + + onInputStateChanged: React.PropTypes.func, + }; + static getKeyBinding(e: SyntheticKeyboardEvent): string { // C-m => Toggles between rich text and markdown modes if (e.keyCode === KEY_M && KeyBindingUtil.isCtrlKeyCommand(e)) { @@ -81,17 +104,6 @@ export default class MessageComposerInput extends React.Component { constructor(props, context) { super(props, context); - this.onAction = this.onAction.bind(this); - this.handleReturn = this.handleReturn.bind(this); - this.handleKeyCommand = this.handleKeyCommand.bind(this); - this.onEditorContentChanged = this.onEditorContentChanged.bind(this); - this.setEditorState = this.setEditorState.bind(this); - this.onUpArrow = this.onUpArrow.bind(this); - this.onDownArrow = this.onDownArrow.bind(this); - this.onTab = this.onTab.bind(this); - this.onEscape = this.onEscape.bind(this); - this.setDisplayedCompletion = this.setDisplayedCompletion.bind(this); - this.onMarkdownToggleClicked = this.onMarkdownToggleClicked.bind(this); const isRichtextEnabled = UserSettingsStore.getSyncedSetting('MessageComposerInput.isRichTextEnabled', true); @@ -120,7 +132,7 @@ export default class MessageComposerInput extends React.Component { */ createEditorState(richText: boolean, contentState: ?ContentState): EditorState { let decorators = richText ? RichText.getScopedRTDecorators(this.props) : - RichText.getScopedMDDecorators(this.props), + RichText.getScopedMDDecorators(this.props), compositeDecorator = new CompositeDecorator(decorators); let editorState = null; @@ -147,7 +159,7 @@ export default class MessageComposerInput extends React.Component { // The textarea element to set text to. element: null, - init: function(element, roomId) { + init: function (element, roomId) { this.roomId = roomId; this.element = element; this.position = -1; @@ -162,7 +174,7 @@ export default class MessageComposerInput extends React.Component { } }, - push: function(text) { + push: function (text) { // store a message in the sent history this.data.unshift(text); window.sessionStorage.setItem( @@ -175,7 +187,7 @@ export default class MessageComposerInput extends React.Component { }, // move in the history. Returns true if we managed to move. - next: function(offset) { + next: function (offset) { if (this.position === -1) { // user is going into the history, save the current line. this.originalText = this.element.value; @@ -208,7 +220,7 @@ export default class MessageComposerInput extends React.Component { return true; }, - saveLastTextEntry: function() { + saveLastTextEntry: function () { // save the currently entered text in order to restore it later. // NB: This isn't 'originalText' because we want to restore // sent history items too! @@ -216,7 +228,7 @@ export default class MessageComposerInput extends React.Component { window.sessionStorage.setItem("mx_messagecomposer_input_" + this.roomId, contentJSON); }, - setLastTextEntry: function() { + setLastTextEntry: function () { let contentJSON = window.sessionStorage.getItem("mx_messagecomposer_input_" + this.roomId); if (contentJSON) { let content = convertFromRaw(JSON.parse(contentJSON)); @@ -248,7 +260,7 @@ export default class MessageComposerInput extends React.Component { } } - onAction(payload) { + onAction = payload => { let editor = this.refs.editor; let contentState = this.state.editorState.getCurrentContent(); @@ -270,7 +282,7 @@ export default class MessageComposerInput extends React.Component { this.onEditorContentChanged(editorState); editor.focus(); } - break; + break; case 'quote': { let {body, formatted_body} = payload.event.getContent(); @@ -297,9 +309,9 @@ export default class MessageComposerInput extends React.Component { editor.focus(); } } - break; + break; } - } + }; onTypingActivity() { this.isTyping = true; @@ -320,7 +332,7 @@ export default class MessageComposerInput extends React.Component { startUserTypingTimer() { this.stopUserTypingTimer(); var self = this; - this.userTypingTimer = setTimeout(function() { + this.userTypingTimer = setTimeout(function () { self.isTyping = false; self.sendTyping(self.isTyping); self.userTypingTimer = null; @@ -337,7 +349,7 @@ export default class MessageComposerInput extends React.Component { startServerTypingTimer() { if (!this.serverTypingTimer) { var self = this; - this.serverTypingTimer = setTimeout(function() { + this.serverTypingTimer = setTimeout(function () { if (self.isTyping) { self.sendTyping(self.isTyping); self.startServerTypingTimer(); @@ -368,7 +380,7 @@ export default class MessageComposerInput extends React.Component { } // Called by Draft to change editor contents, and by setEditorState - onEditorContentChanged(editorState: EditorState, didRespondToUserInput: boolean = true) { + onEditorContentChanged = (editorState: EditorState, didRespondToUserInput: boolean = true) => { editorState = RichText.attachImmutableEntitiesToEmoji(editorState); const contentChanged = Q.defer(); @@ -392,11 +404,11 @@ export default class MessageComposerInput extends React.Component { this.props.onContentChanged(textContent, selection); } return contentChanged.promise; - } + }; - setEditorState(editorState: EditorState) { + setEditorState = (editorState: EditorState) => { return this.onEditorContentChanged(editorState, false); - } + }; enableRichtext(enabled: boolean) { let contentState = null; @@ -420,7 +432,7 @@ export default class MessageComposerInput extends React.Component { }); } - handleKeyCommand(command: string): boolean { + handleKeyCommand = (command: string): boolean => { if (command === 'toggle-mode') { this.enableRichtext(!this.state.isRichtextEnabled); return true; @@ -451,7 +463,7 @@ export default class MessageComposerInput extends React.Component { 'code': text => `\`${text}\``, 'blockquote': text => text.split('\n').map(line => `> ${line}\n`).join(''), 'unordered-list-item': text => text.split('\n').map(line => `- ${line}\n`).join(''), - 'ordered-list-item': text => text.split('\n').map((line, i) => `${i+1}. ${line}\n`).join(''), + 'ordered-list-item': text => text.split('\n').map((line, i) => `${i + 1}. ${line}\n`).join(''), }[command]; if (modifyFn) { @@ -473,9 +485,9 @@ export default class MessageComposerInput extends React.Component { } return false; - } + }; - handleReturn(ev) { + handleReturn = ev => { if (ev.shiftKey) { this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState)); return true; @@ -497,9 +509,9 @@ export default class MessageComposerInput extends React.Component { }); } if (cmd.promise) { - cmd.promise.then(function() { + cmd.promise.then(function () { console.log("Command success."); - }, function(err) { + }, function (err) { console.error("Command failure: %s", err); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); Modal.createDialog(ErrorDialog, { @@ -567,45 +579,44 @@ export default class MessageComposerInput extends React.Component { this.autocomplete.hide(); return true; - } + }; - async onUpArrow(e) { + onUpArrow = async e => { const completion = this.autocomplete.onUpArrow(); if (completion != null) { e.preventDefault(); } return await this.setDisplayedCompletion(completion); - } + }; - async onDownArrow(e) { + onDownArrow = async e => { const completion = this.autocomplete.onDownArrow(); e.preventDefault(); return await this.setDisplayedCompletion(completion); - } + }; // tab and shift-tab are mapped to down and up arrow respectively - async onTab(e) { + onTab = async e => { e.preventDefault(); // we *never* want tab's default to happen, but we do want up/down sometimes const didTab = await (e.shiftKey ? this.onUpArrow : this.onDownArrow)(e); if (!didTab && this.autocomplete) { - this.autocomplete.forceComplete().then(() => { - this.onDownArrow(e); - }); + await this.autocomplete.forceComplete(); + this.onDownArrow(e); } - } + }; - onEscape(e) { + onEscape = e => { e.preventDefault(); if (this.autocomplete) { this.autocomplete.onEscape(e); } this.setDisplayedCompletion(null); // restore originalEditorState - } + }; /* If passed null, restores the original editor content from state.originalEditorState. * If passed a non-null displayedCompletion, modifies state.originalEditorState to compute new state.editorState. */ - async setDisplayedCompletion(displayedCompletion: ?Completion): boolean { + setDisplayedCompletion = async (displayedCompletion: ?Completion): boolean => { const activeEditorState = this.state.originalEditorState || this.state.editorState; if (displayedCompletion == null) { @@ -633,21 +644,21 @@ export default class MessageComposerInput extends React.Component { // for some reason, doing this right away does not update the editor :( setTimeout(() => this.refs.editor.focus(), 50); return true; - } + }; onFormatButtonClicked(name: "bold" | "italic" | "strike" | "code" | "underline" | "quote" | "bullet" | "numbullet", e) { e.preventDefault(); // don't steal focus from the editor! const command = { - code: 'code-block', - quote: 'blockquote', - bullet: 'unordered-list-item', - numbullet: 'ordered-list-item', - }[name] || name; + code: 'code-block', + quote: 'blockquote', + bullet: 'unordered-list-item', + numbullet: 'ordered-list-item', + }[name] || name; this.handleKeyCommand(command); } /* returns inline style and block type of current SelectionState so MessageComposer can render formatting - buttons. */ + buttons. */ getSelectionInfo(editorState: EditorState) { const styleName = { BOLD: 'bold', @@ -658,8 +669,8 @@ export default class MessageComposerInput extends React.Component { const originalStyle = editorState.getCurrentInlineStyle().toArray(); const style = originalStyle - .map(style => styleName[style] || null) - .filter(styleName => !!styleName); + .map(style => styleName[style] || null) + .filter(styleName => !!styleName); const blockName = { 'code-block': 'code', @@ -678,10 +689,10 @@ export default class MessageComposerInput extends React.Component { }; } - onMarkdownToggleClicked(e) { + onMarkdownToggleClicked = e => { e.preventDefault(); // don't steal focus from the editor! this.handleKeyCommand('toggle-mode'); - } + }; render() { const activeEditorState = this.state.originalEditorState || this.state.editorState; @@ -698,7 +709,7 @@ export default class MessageComposerInput extends React.Component { } const className = classNames('mx_MessageComposer_input', { - mx_MessageComposer_input_empty: hidePlaceholder, + mx_MessageComposer_input_empty: hidePlaceholder, }); const content = activeEditorState.getCurrentContent(); @@ -713,13 +724,13 @@ export default class MessageComposerInput extends React.Component { ref={(e) => this.autocomplete = e} onConfirm={this.setDisplayedCompletion} query={contentText} - selection={selection} /> + selection={selection}/>
+ src={`img/button-md-${!this.state.isRichtextEnabled}.png`}/> + spellCheck={true}/>
); } } - -MessageComposerInput.propTypes = { - tabComplete: React.PropTypes.any, - - // a callback which is called when the height of the composer is - // changed due to a change in content. - onResize: React.PropTypes.func, - - // js-sdk Room object - room: React.PropTypes.object.isRequired, - - // called with current plaintext content (as a string) whenever it changes - onContentChanged: React.PropTypes.func, - - onUpArrow: React.PropTypes.func, - - onDownArrow: React.PropTypes.func, - - // attempts to confirm currently selected completion, returns whether actually confirmed - tryComplete: React.PropTypes.func, - - onInputStateChanged: React.PropTypes.func, -}; From edd5903ed7e6bd6522eea588e752e59f45623d7e Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Wed, 30 Nov 2016 23:12:03 +0530 Subject: [PATCH 004/252] autocomplete: add space after completing room name --- src/autocomplete/RoomProvider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/autocomplete/RoomProvider.js b/src/autocomplete/RoomProvider.js index b589425b20..85f94926d9 100644 --- a/src/autocomplete/RoomProvider.js +++ b/src/autocomplete/RoomProvider.js @@ -38,7 +38,7 @@ export default class RoomProvider extends AutocompleteProvider { completions = this.fuse.search(command[0]).map(room => { let displayAlias = getDisplayAliasForRoom(room.room) || room.roomId; return { - completion: displayAlias, + completion: displayAlias + ' ', component: ( } title={room.name} description={displayAlias} /> ), From 78641a80ddf7a6fa2cb951fa526249406a814495 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Thu, 1 Dec 2016 12:06:57 +0530 Subject: [PATCH 005/252] autocomplete: replace Fuse.js with liblevenshtein --- package.json | 2 +- src/autocomplete/AutocompleteProvider.js | 2 +- src/autocomplete/CommandProvider.js | 6 +- src/autocomplete/EmojiProvider.js | 6 +- src/autocomplete/FuzzyMatcher.js | 74 ++++++++++++++++++++++++ src/autocomplete/RoomProvider.js | 14 ++--- src/autocomplete/UserProvider.js | 8 +-- 7 files changed, 92 insertions(+), 20 deletions(-) create mode 100644 src/autocomplete/FuzzyMatcher.js diff --git a/package.json b/package.json index 1e5ee29d2d..1015eb3fe9 100644 --- a/package.json +++ b/package.json @@ -55,10 +55,10 @@ "file-saver": "^1.3.3", "filesize": "^3.1.2", "flux": "^2.0.3", - "fuse.js": "^2.2.0", "glob": "^5.0.14", "highlight.js": "^8.9.1", "isomorphic-fetch": "^2.2.1", + "liblevenshtein": "^2.0.4", "linkifyjs": "^2.1.3", "lodash": "^4.13.1", "matrix-js-sdk": "matrix-org/matrix-js-sdk#develop", diff --git a/src/autocomplete/AutocompleteProvider.js b/src/autocomplete/AutocompleteProvider.js index 5c90990295..c361dd295b 100644 --- a/src/autocomplete/AutocompleteProvider.js +++ b/src/autocomplete/AutocompleteProvider.js @@ -2,7 +2,7 @@ import React from 'react'; import type {Completion, SelectionRange} from './Autocompleter'; export default class AutocompleteProvider { - constructor(commandRegex?: RegExp, fuseOpts?: any) { + constructor(commandRegex?: RegExp) { if (commandRegex) { if (!commandRegex.global) { throw new Error('commandRegex must have global flag set'); diff --git a/src/autocomplete/CommandProvider.js b/src/autocomplete/CommandProvider.js index 60171bc72f..8f98bf1aa5 100644 --- a/src/autocomplete/CommandProvider.js +++ b/src/autocomplete/CommandProvider.js @@ -1,6 +1,6 @@ import React from 'react'; import AutocompleteProvider from './AutocompleteProvider'; -import Fuse from 'fuse.js'; +import FuzzyMatcher from './FuzzyMatcher'; import {TextualCompletion} from './Components'; const COMMANDS = [ @@ -53,7 +53,7 @@ let instance = null; export default class CommandProvider extends AutocompleteProvider { constructor() { super(COMMAND_RE); - this.fuse = new Fuse(COMMANDS, { + this.matcher = new FuzzyMatcher(COMMANDS, { keys: ['command', 'args', 'description'], }); } @@ -62,7 +62,7 @@ export default class CommandProvider extends AutocompleteProvider { let completions = []; let {command, range} = this.getCurrentCommand(query, selection); if (command) { - completions = this.fuse.search(command[0]).map(result => { + completions = this.matcher.match(command[0]).map(result => { return { completion: result.command + ' ', component: ( { + completions = this.matcher.match(command[0]).map(result => { const shortname = EMOJI_SHORTNAMES[result]; const unicode = shortnameToUnicode(shortname); return { diff --git a/src/autocomplete/FuzzyMatcher.js b/src/autocomplete/FuzzyMatcher.js new file mode 100644 index 0000000000..c02ee9bbc0 --- /dev/null +++ b/src/autocomplete/FuzzyMatcher.js @@ -0,0 +1,74 @@ +import Levenshtein from 'liblevenshtein'; +import _at from 'lodash/at'; +import _flatMap from 'lodash/flatMap'; +import _sortBy from 'lodash/sortBy'; +import _sortedUniq from 'lodash/sortedUniq'; +import _keys from 'lodash/keys'; + +class KeyMap { + keys: Array; + objectMap: {[String]: Array}; + priorityMap: {[String]: number} +} + +const DEFAULT_RESULT_COUNT = 10; +const DEFAULT_DISTANCE = 5; + +export default class FuzzyMatcher { + /** + * Given an array of objects and keys, returns a KeyMap + * Keys can refer to object properties by name and as in JavaScript (for nested properties) + * + * To use, simply presort objects by required criteria, run through this function and create a FuzzyMatcher with the + * resulting KeyMap. + * + * TODO: Handle arrays and objects (Fuse did this, RoomProvider uses it) + */ + static valuesToKeyMap(objects: Array, keys: Array): KeyMap { + const keyMap = new KeyMap(); + const map = {}; + const priorities = {}; + + objects.forEach((object, i) => { + const keyValues = _at(object, keys); + console.log(object, keyValues, keys); + for (const keyValue of keyValues) { + if (!map.hasOwnProperty(keyValue)) { + map[keyValue] = []; + } + map[keyValue].push(object); + } + priorities[object] = i; + }); + + keyMap.objectMap = map; + keyMap.priorityMap = priorities; + keyMap.keys = _sortBy(_keys(map), [value => priorities[value]]); + return keyMap; + } + + constructor(objects: Array, options: {[Object]: Object} = {}) { + this.options = options; + this.keys = options.keys; + this.setObjects(objects); + } + + setObjects(objects: Array) { + this.keyMap = FuzzyMatcher.valuesToKeyMap(objects, this.keys); + console.log(this.keyMap.keys); + this.matcher = new Levenshtein.Builder() + .dictionary(this.keyMap.keys, true) + .algorithm('transposition') + .sort_candidates(false) + .case_insensitive_sort(true) + .include_distance(false) + .maximum_candidates(this.options.resultCount || DEFAULT_RESULT_COUNT) // result count 0 doesn't make much sense + .build(); + } + + match(query: String): Array { + const candidates = this.matcher.transduce(query, this.options.distance || DEFAULT_DISTANCE); + return _sortedUniq(_sortBy(_flatMap(candidates, candidate => this.keyMap.objectMap[candidate]), + candidate => this.keyMap.priorityMap[candidate])); + } +} diff --git a/src/autocomplete/RoomProvider.js b/src/autocomplete/RoomProvider.js index 85f94926d9..8659b8501f 100644 --- a/src/autocomplete/RoomProvider.js +++ b/src/autocomplete/RoomProvider.js @@ -1,7 +1,7 @@ import React from 'react'; import AutocompleteProvider from './AutocompleteProvider'; import MatrixClientPeg from '../MatrixClientPeg'; -import Fuse from 'fuse.js'; +import FuzzyMatcher from './FuzzyMatcher'; import {PillCompletion} from './Components'; import {getDisplayAliasForRoom} from '../Rooms'; import sdk from '../index'; @@ -12,11 +12,9 @@ let instance = null; export default class RoomProvider extends AutocompleteProvider { constructor() { - super(ROOM_REGEX, { - keys: ['displayName', 'userId'], - }); - this.fuse = new Fuse([], { - keys: ['name', 'roomId', 'aliases'], + super(ROOM_REGEX); + this.matcher = new FuzzyMatcher([], { + keys: ['name', 'aliases'], }); } @@ -28,14 +26,14 @@ export default class RoomProvider extends AutocompleteProvider { const {command, range} = this.getCurrentCommand(query, selection, force); if (command) { // the only reason we need to do this is because Fuse only matches on properties - this.fuse.set(client.getRooms().filter(room => !!room).map(room => { + this.matcher.setObjects(client.getRooms().filter(room => !!room).map(room => { return { room: room, name: room.name, aliases: room.getAliases(), }; })); - completions = this.fuse.search(command[0]).map(room => { + completions = this.matcher.match(command[0]).map(room => { let displayAlias = getDisplayAliasForRoom(room.room) || room.roomId; return { completion: displayAlias + ' ', diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index 4d40fbdf94..b65439181c 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -1,9 +1,9 @@ import React from 'react'; import AutocompleteProvider from './AutocompleteProvider'; import Q from 'q'; -import Fuse from 'fuse.js'; import {PillCompletion} from './Components'; import sdk from '../index'; +import FuzzyMatcher from './FuzzyMatcher'; const USER_REGEX = /@\S*/g; @@ -15,7 +15,7 @@ export default class UserProvider extends AutocompleteProvider { keys: ['name', 'userId'], }); this.users = []; - this.fuse = new Fuse([], { + this.matcher = new FuzzyMatcher([], { keys: ['name', 'userId'], }); } @@ -26,8 +26,7 @@ export default class UserProvider extends AutocompleteProvider { let completions = []; let {command, range} = this.getCurrentCommand(query, selection, force); if (command) { - this.fuse.set(this.users); - completions = this.fuse.search(command[0]).map(user => { + completions = this.matcher.match(command[0]).map(user => { let displayName = (user.name || user.userId || '').replace(' (IRC)', ''); // FIXME when groups are done let completion = displayName; if (range.start === 0) { @@ -56,6 +55,7 @@ export default class UserProvider extends AutocompleteProvider { setUserList(users) { this.users = users; + this.matcher.setObjects(this.users); } static getInstance(): UserProvider { From 48376a32c251d463d525541c1edc0a4370300e04 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 30 Dec 2016 19:42:36 +0530 Subject: [PATCH 006/252] refactor: MessageComposer.setEditorState to overridden setState The old approach led to a confusing proliferation of repeated setState calls. --- .../views/rooms/MessageComposerInput.js | 97 +++++++++++-------- 1 file changed, 58 insertions(+), 39 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 9ae420fde4..b830d52239 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -232,7 +232,9 @@ export default class MessageComposerInput extends React.Component { let contentJSON = window.sessionStorage.getItem("mx_messagecomposer_input_" + this.roomId); if (contentJSON) { let content = convertFromRaw(JSON.parse(contentJSON)); - component.setEditorState(component.createEditorState(component.state.isRichtextEnabled, content)); + component.setState({ + editorState: component.createEditorState(component.state.isRichtextEnabled, content) + }); } }, }; @@ -379,36 +381,54 @@ export default class MessageComposerInput extends React.Component { } } - // Called by Draft to change editor contents, and by setEditorState - onEditorContentChanged = (editorState: EditorState, didRespondToUserInput: boolean = true) => { + // Called by Draft to change editor contents + onEditorContentChanged = (editorState: EditorState) => { editorState = RichText.attachImmutableEntitiesToEmoji(editorState); - const contentChanged = Q.defer(); - /* If a modification was made, set originalEditorState to null, since newState is now our original */ + /* Since a modification was made, set originalEditorState to null, since newState is now our original */ this.setState({ editorState, - originalEditorState: didRespondToUserInput ? null : this.state.originalEditorState, - }, () => contentChanged.resolve()); - - if (editorState.getCurrentContent().hasText()) { - this.onTypingActivity(); - } else { - this.onFinishedTyping(); - } - - if (this.props.onContentChanged) { - const textContent = editorState.getCurrentContent().getPlainText(); - const selection = RichText.selectionStateToTextOffsets(editorState.getSelection(), - editorState.getCurrentContent().getBlocksAsArray()); - - this.props.onContentChanged(textContent, selection); - } - return contentChanged.promise; + originalEditorState: null, + }); }; - setEditorState = (editorState: EditorState) => { - return this.onEditorContentChanged(editorState, false); - }; + /** + * We're overriding setState here because it's the most convenient way to monitor changes to the editorState. + * Doing it using a separate function that calls setState is a possibility (and was the old approach), but that + * approach requires a callback and an extra setState whenever trying to set multiple state properties. + * + * @param state + * @param callback + */ + setState(state, callback) { + if (state.editorState != null) { + state.editorState = RichText.attachImmutableEntitiesToEmoji(state.editorState); + + if (state.editorState.getCurrentContent().hasText()) { + this.onTypingActivity(); + } else { + this.onFinishedTyping(); + } + + if (!state.hasOwnProperty('originalEditorState')) { + state.originalEditorState = null; + } + } + + super.setState(state, (state, props, context) => { + if (callback != null) { + callback(state, props, context); + } + + if (this.props.onContentChanged) { + const textContent = state.editorState.getCurrentContent().getPlainText(); + const selection = RichText.selectionStateToTextOffsets(state.editorState.getSelection(), + state.editorState.getCurrentContent().getBlocksAsArray()); + + this.props.onContentChanged(textContent, selection); + } + }); + } enableRichtext(enabled: boolean) { let contentState = null; @@ -423,13 +443,11 @@ export default class MessageComposerInput extends React.Component { contentState = ContentState.createFromText(markdown); } - this.setEditorState(this.createEditorState(enabled, contentState)).then(() => { - this.setState({ - isRichtextEnabled: enabled, - }); - - UserSettingsStore.setSyncedSetting('MessageComposerInput.isRichTextEnabled', enabled); + this.setState({ + editorState: this.createEditorState(enabled, contentState), + isRichtextEnabled: enabled, }); + UserSettingsStore.setSyncedSetting('MessageComposerInput.isRichTextEnabled', enabled); } handleKeyCommand = (command: string): boolean => { @@ -446,10 +464,14 @@ export default class MessageComposerInput extends React.Component { const blockCommands = ['code-block', 'blockquote', 'unordered-list-item', 'ordered-list-item']; if (blockCommands.includes(command)) { - this.setEditorState(RichUtils.toggleBlockType(this.state.editorState, command)); + this.setState({ + editorState: RichUtils.toggleBlockType(this.state.editorState, command) + }); } else if (command === 'strike') { // this is the only inline style not handled by Draft by default - this.setEditorState(RichUtils.toggleInlineStyle(this.state.editorState, 'STRIKETHROUGH')); + this.setState({ + editorState: RichUtils.toggleInlineStyle(this.state.editorState, 'STRIKETHROUGH') + }); } } else { let contentState = this.state.editorState.getCurrentContent(), @@ -480,7 +502,7 @@ export default class MessageComposerInput extends React.Component { } if (newState != null) { - this.setEditorState(newState); + this.setState({editorState: newState}); return true; } @@ -621,7 +643,7 @@ export default class MessageComposerInput extends React.Component { if (displayedCompletion == null) { if (this.state.originalEditorState) { - this.setEditorState(this.state.originalEditorState); + this.setState({editorState: this.state.originalEditorState}); } return false; } @@ -636,10 +658,7 @@ export default class MessageComposerInput extends React.Component { let editorState = EditorState.push(activeEditorState, contentState, 'insert-characters'); editorState = EditorState.forceSelection(editorState, contentState.getSelectionAfter()); - const originalEditorState = activeEditorState; - - await this.setEditorState(editorState); - this.setState({originalEditorState}); + this.setState({editorState, originalEditorState: activeEditorState}); // for some reason, doing this right away does not update the editor :( setTimeout(() => this.refs.editor.focus(), 50); From aaac06c6d3f98473a58ab9a839b754e0787ce30b Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 10 Feb 2017 01:33:06 +0530 Subject: [PATCH 007/252] run eslint --fix over MessageComposerInput --- .../views/rooms/MessageComposerInput.js | 119 +++++++++--------- 1 file changed, 58 insertions(+), 61 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index b830d52239..b83e5d8dbf 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -159,12 +159,12 @@ export default class MessageComposerInput extends React.Component { // The textarea element to set text to. element: null, - init: function (element, roomId) { + init: function(element, roomId) { this.roomId = roomId; this.element = element; this.position = -1; - var storedData = window.sessionStorage.getItem( - "mx_messagecomposer_history_" + roomId + const storedData = window.sessionStorage.getItem( + "mx_messagecomposer_history_" + roomId, ); if (storedData) { this.data = JSON.parse(storedData); @@ -174,12 +174,12 @@ export default class MessageComposerInput extends React.Component { } }, - push: function (text) { + push: function(text) { // store a message in the sent history this.data.unshift(text); window.sessionStorage.setItem( "mx_messagecomposer_history_" + this.roomId, - JSON.stringify(this.data) + JSON.stringify(this.data), ); // reset history position this.position = -1; @@ -187,12 +187,11 @@ export default class MessageComposerInput extends React.Component { }, // move in the history. Returns true if we managed to move. - next: function (offset) { + next: function(offset) { if (this.position === -1) { // user is going into the history, save the current line. this.originalText = this.element.value; - } - else { + } else { // user may have modified this line in the history; remember it. this.data[this.position] = this.element.value; } @@ -203,7 +202,7 @@ export default class MessageComposerInput extends React.Component { } // retrieve the next item (bounded). - var newPosition = this.position + offset; + let newPosition = this.position + offset; newPosition = Math.max(-1, newPosition); newPosition = Math.min(newPosition, this.data.length - 1); this.position = newPosition; @@ -211,8 +210,7 @@ export default class MessageComposerInput extends React.Component { if (this.position !== -1) { // show the message this.element.value = this.data[this.position]; - } - else if (this.originalText !== undefined) { + } else if (this.originalText !== undefined) { // restore the original text the user was typing. this.element.value = this.originalText; } @@ -220,20 +218,20 @@ export default class MessageComposerInput extends React.Component { return true; }, - saveLastTextEntry: function () { + saveLastTextEntry: function() { // save the currently entered text in order to restore it later. // NB: This isn't 'originalText' because we want to restore // sent history items too! - let contentJSON = JSON.stringify(convertToRaw(component.state.editorState.getCurrentContent())); + const contentJSON = JSON.stringify(convertToRaw(component.state.editorState.getCurrentContent())); window.sessionStorage.setItem("mx_messagecomposer_input_" + this.roomId, contentJSON); }, - setLastTextEntry: function () { - let contentJSON = window.sessionStorage.getItem("mx_messagecomposer_input_" + this.roomId); + setLastTextEntry: function() { + const contentJSON = window.sessionStorage.getItem("mx_messagecomposer_input_" + this.roomId); if (contentJSON) { - let content = convertFromRaw(JSON.parse(contentJSON)); + const content = convertFromRaw(JSON.parse(contentJSON)); component.setState({ - editorState: component.createEditorState(component.state.isRichtextEnabled, content) + editorState: component.createEditorState(component.state.isRichtextEnabled, content), }); } }, @@ -244,7 +242,7 @@ export default class MessageComposerInput extends React.Component { this.dispatcherRef = dis.register(this.onAction); this.sentHistory.init( this.refs.editor, - this.props.room.roomId + this.props.room.roomId, ); } @@ -262,8 +260,8 @@ export default class MessageComposerInput extends React.Component { } } - onAction = payload => { - let editor = this.refs.editor; + onAction = (payload) => { + const editor = this.refs.editor; let contentState = this.state.editorState.getCurrentContent(); switch (payload.action) { @@ -277,7 +275,7 @@ export default class MessageComposerInput extends React.Component { contentState = Modifier.replaceText( contentState, this.state.editorState.getSelection(), - `${payload.displayname}: ` + `${payload.displayname}: `, ); let editorState = EditorState.push(this.state.editorState, contentState, 'insert-characters'); editorState = EditorState.forceSelection(editorState, contentState.getSelectionAfter()); @@ -306,7 +304,7 @@ export default class MessageComposerInput extends React.Component { if (this.state.isRichtextEnabled) { contentState = Modifier.setBlockType(contentState, startSelection, 'blockquote'); } - let editorState = EditorState.push(this.state.editorState, contentState, 'insert-characters'); + const editorState = EditorState.push(this.state.editorState, contentState, 'insert-characters'); this.onEditorContentChanged(editorState); editor.focus(); } @@ -333,8 +331,8 @@ export default class MessageComposerInput extends React.Component { startUserTypingTimer() { this.stopUserTypingTimer(); - var self = this; - this.userTypingTimer = setTimeout(function () { + const self = this; + this.userTypingTimer = setTimeout(function() { self.isTyping = false; self.sendTyping(self.isTyping); self.userTypingTimer = null; @@ -350,8 +348,8 @@ export default class MessageComposerInput extends React.Component { startServerTypingTimer() { if (!this.serverTypingTimer) { - var self = this; - this.serverTypingTimer = setTimeout(function () { + const self = this; + this.serverTypingTimer = setTimeout(function() { if (self.isTyping) { self.sendTyping(self.isTyping); self.startServerTypingTimer(); @@ -370,7 +368,7 @@ export default class MessageComposerInput extends React.Component { sendTyping(isTyping) { MatrixClientPeg.get().sendTyping( this.props.room.roomId, - this.isTyping, TYPING_SERVER_TIMEOUT + this.isTyping, TYPING_SERVER_TIMEOUT, ).done(); } @@ -465,34 +463,34 @@ export default class MessageComposerInput extends React.Component { if (blockCommands.includes(command)) { this.setState({ - editorState: RichUtils.toggleBlockType(this.state.editorState, command) + editorState: RichUtils.toggleBlockType(this.state.editorState, command), }); } else if (command === 'strike') { // this is the only inline style not handled by Draft by default this.setState({ - editorState: RichUtils.toggleInlineStyle(this.state.editorState, 'STRIKETHROUGH') + editorState: RichUtils.toggleInlineStyle(this.state.editorState, 'STRIKETHROUGH'), }); } } else { let contentState = this.state.editorState.getCurrentContent(), selection = this.state.editorState.getSelection(); - let modifyFn = { - 'bold': text => `**${text}**`, - 'italic': text => `*${text}*`, - 'underline': text => `_${text}_`, // there's actually no valid underline in Markdown, but *shrug* - 'strike': text => `~~${text}~~`, - 'code': text => `\`${text}\``, - 'blockquote': text => text.split('\n').map(line => `> ${line}\n`).join(''), - 'unordered-list-item': text => text.split('\n').map(line => `- ${line}\n`).join(''), - 'ordered-list-item': text => text.split('\n').map((line, i) => `${i + 1}. ${line}\n`).join(''), + const modifyFn = { + 'bold': (text) => `**${text}**`, + 'italic': (text) => `*${text}*`, + 'underline': (text) => `_${text}_`, // there's actually no valid underline in Markdown, but *shrug* + 'strike': (text) => `~~${text}~~`, + 'code': (text) => `\`${text}\``, + 'blockquote': (text) => text.split('\n').map((line) => `> ${line}\n`).join(''), + 'unordered-list-item': (text) => text.split('\n').map((line) => `- ${line}\n`).join(''), + 'ordered-list-item': (text) => text.split('\n').map((line, i) => `${i + 1}. ${line}\n`).join(''), }[command]; if (modifyFn) { newState = EditorState.push( this.state.editorState, RichText.modifyText(contentState, selection, modifyFn), - 'insert-characters' + 'insert-characters', ); } } @@ -509,7 +507,7 @@ export default class MessageComposerInput extends React.Component { return false; }; - handleReturn = ev => { + handleReturn = (ev) => { if (ev.shiftKey) { this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState)); return true; @@ -523,31 +521,30 @@ export default class MessageComposerInput extends React.Component { let contentText = contentState.getPlainText(), contentHTML; - var cmd = SlashCommands.processInput(this.props.room.roomId, contentText); + const cmd = SlashCommands.processInput(this.props.room.roomId, contentText); if (cmd) { if (!cmd.error) { this.setState({ - editorState: this.createEditorState() + editorState: this.createEditorState(), }); } if (cmd.promise) { - cmd.promise.then(function () { + cmd.promise.then(function() { console.log("Command success."); - }, function (err) { + }, function(err) { console.error("Command failure: %s", err); - var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); Modal.createDialog(ErrorDialog, { title: "Server error", - description: err.message + description: err.message, }); }); - } - else if (cmd.error) { + } else if (cmd.error) { console.error(cmd.error); - var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); Modal.createDialog(ErrorDialog, { title: "Command error", - description: cmd.error + description: cmd.error, }); } return true; @@ -555,7 +552,7 @@ export default class MessageComposerInput extends React.Component { if (this.state.isRichtextEnabled) { contentHTML = HtmlUtils.stripParagraphs( - RichText.contentStateToHTML(contentState) + RichText.contentStateToHTML(contentState), ); } else { const md = new Markdown(contentText); @@ -582,7 +579,7 @@ export default class MessageComposerInput extends React.Component { let sendMessagePromise; if (contentHTML) { sendMessagePromise = sendHtmlFn.call( - this.client, this.props.room.roomId, contentText, contentHTML + this.client, this.props.room.roomId, contentText, contentHTML, ); } else { sendMessagePromise = sendTextFn.call(this.client, this.props.room.roomId, contentText); @@ -603,7 +600,7 @@ export default class MessageComposerInput extends React.Component { return true; }; - onUpArrow = async e => { + onUpArrow = async (e) => { const completion = this.autocomplete.onUpArrow(); if (completion != null) { e.preventDefault(); @@ -611,14 +608,14 @@ export default class MessageComposerInput extends React.Component { return await this.setDisplayedCompletion(completion); }; - onDownArrow = async e => { + onDownArrow = async (e) => { const completion = this.autocomplete.onDownArrow(); e.preventDefault(); return await this.setDisplayedCompletion(completion); }; // tab and shift-tab are mapped to down and up arrow respectively - onTab = async e => { + onTab = async (e) => { e.preventDefault(); // we *never* want tab's default to happen, but we do want up/down sometimes const didTab = await (e.shiftKey ? this.onUpArrow : this.onDownArrow)(e); if (!didTab && this.autocomplete) { @@ -627,7 +624,7 @@ export default class MessageComposerInput extends React.Component { } }; - onEscape = e => { + onEscape = (e) => { e.preventDefault(); if (this.autocomplete) { this.autocomplete.onEscape(e); @@ -650,10 +647,10 @@ export default class MessageComposerInput extends React.Component { const {range = {}, completion = ''} = displayedCompletion; - let contentState = Modifier.replaceText( + const contentState = Modifier.replaceText( activeEditorState.getCurrentContent(), RichText.textOffsetsToSelectionState(range, activeEditorState.getCurrentContent().getBlocksAsArray()), - completion + completion, ); let editorState = EditorState.push(activeEditorState, contentState, 'insert-characters'); @@ -688,8 +685,8 @@ export default class MessageComposerInput extends React.Component { const originalStyle = editorState.getCurrentInlineStyle().toArray(); const style = originalStyle - .map(style => styleName[style] || null) - .filter(styleName => !!styleName); + .map((style) => styleName[style] || null) + .filter((styleName) => !!styleName); const blockName = { 'code-block': 'code', @@ -708,7 +705,7 @@ export default class MessageComposerInput extends React.Component { }; } - onMarkdownToggleClicked = e => { + onMarkdownToggleClicked = (e) => { e.preventDefault(); // don't steal focus from the editor! this.handleKeyCommand('toggle-mode'); }; From 46d30c378d647cce7187ae128562170ea9e28726 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 10 Feb 2017 02:06:06 +0530 Subject: [PATCH 008/252] fix tab focus issue in MessageComposerInput onTab was incorrectly implemented causing forceComplete instead of focusing the editor --- src/components/views/rooms/Autocomplete.js | 6 ++++++ .../views/rooms/MessageComposerInput.js | 21 ++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/views/rooms/Autocomplete.js b/src/components/views/rooms/Autocomplete.js index 9be91e068a..9a3a04376d 100644 --- a/src/components/views/rooms/Autocomplete.js +++ b/src/components/views/rooms/Autocomplete.js @@ -149,6 +149,7 @@ export default class Autocomplete extends React.Component { const done = Q.defer(); this.setState({ forceComplete: true, + hide: false, }, () => { this.complete(this.props.query, this.props.selection).then(() => { done.resolve(); @@ -185,6 +186,11 @@ export default class Autocomplete extends React.Component { } } + setState(state, func) { + super.setState(state, func); + console.log(state); + } + render() { const EmojiText = sdk.getComponent('views.elements.EmojiText'); diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index b83e5d8dbf..c0d19987c7 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -400,7 +400,8 @@ export default class MessageComposerInput extends React.Component { */ setState(state, callback) { if (state.editorState != null) { - state.editorState = RichText.attachImmutableEntitiesToEmoji(state.editorState); + state.editorState = RichText.attachImmutableEntitiesToEmoji( + state.editorState); if (state.editorState.getCurrentContent().hasText()) { this.onTypingActivity(); @@ -413,15 +414,17 @@ export default class MessageComposerInput extends React.Component { } } - super.setState(state, (state, props, context) => { + super.setState(state, () => { if (callback != null) { - callback(state, props, context); + callback(); } if (this.props.onContentChanged) { - const textContent = state.editorState.getCurrentContent().getPlainText(); - const selection = RichText.selectionStateToTextOffsets(state.editorState.getSelection(), - state.editorState.getCurrentContent().getBlocksAsArray()); + const textContent = this.state.editorState + .getCurrentContent().getPlainText(); + const selection = RichText.selectionStateToTextOffsets( + this.state.editorState.getSelection(), + this.state.editorState.getCurrentContent().getBlocksAsArray()); this.props.onContentChanged(textContent, selection); } @@ -616,11 +619,13 @@ export default class MessageComposerInput extends React.Component { // tab and shift-tab are mapped to down and up arrow respectively onTab = async (e) => { + console.log('onTab'); e.preventDefault(); // we *never* want tab's default to happen, but we do want up/down sometimes - const didTab = await (e.shiftKey ? this.onUpArrow : this.onDownArrow)(e); - if (!didTab && this.autocomplete) { + if (this.autocomplete.state.completionList.length === 0) { await this.autocomplete.forceComplete(); this.onDownArrow(e); + } else { + await (e.shiftKey ? this.onUpArrow : this.onDownArrow)(e); } }; From 5fbe06ed91497eeff46e395f1e38164d99475d6d Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 10 Feb 2017 03:40:57 +0530 Subject: [PATCH 009/252] force editor rerender when we swap editorStates --- src/components/views/rooms/Autocomplete.js | 23 +++++++++---------- .../views/rooms/MessageComposerInput.js | 19 +++++++++++---- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/components/views/rooms/Autocomplete.js b/src/components/views/rooms/Autocomplete.js index 9a3a04376d..c06786a80c 100644 --- a/src/components/views/rooms/Autocomplete.js +++ b/src/components/views/rooms/Autocomplete.js @@ -58,7 +58,7 @@ export default class Autocomplete extends React.Component { return; } - const completionList = flatMap(completions, provider => provider.completions); + const completionList = flatMap(completions, (provider) => provider.completions); // Reset selection when completion list becomes empty. let selectionOffset = COMPOSER_SELECTED; @@ -69,7 +69,7 @@ export default class Autocomplete extends React.Component { const currentSelection = this.state.selectionOffset === 0 ? null : this.state.completionList[this.state.selectionOffset - 1].completion; selectionOffset = completionList.findIndex( - completion => completion.completion === currentSelection); + (completion) => completion.completion === currentSelection); if (selectionOffset === -1) { selectionOffset = COMPOSER_SELECTED; } else { @@ -82,8 +82,8 @@ export default class Autocomplete extends React.Component { let hide = this.state.hide; // These are lists of booleans that indicate whether whether the corresponding provider had a matching pattern - const oldMatches = this.state.completions.map(completion => !!completion.command.command), - newMatches = completions.map(completion => !!completion.command.command); + const oldMatches = this.state.completions.map((completion) => !!completion.command.command), + newMatches = completions.map((completion) => !!completion.command.command); // So, essentially, we re-show autocomplete if any provider finds a new pattern or stops finding an old one if (!isEqual(oldMatches, newMatches)) { @@ -170,7 +170,7 @@ export default class Autocomplete extends React.Component { } setSelection(selectionOffset: number) { - this.setState({selectionOffset}); + this.setState({selectionOffset, hide: false}); } componentDidUpdate() { @@ -195,17 +195,16 @@ export default class Autocomplete extends React.Component { const EmojiText = sdk.getComponent('views.elements.EmojiText'); let position = 1; - let renderedCompletions = this.state.completions.map((completionResult, i) => { - let completions = completionResult.completions.map((completion, i) => { - + const renderedCompletions = this.state.completions.map((completionResult, i) => { + const completions = completionResult.completions.map((completion, i) => { const className = classNames('mx_Autocomplete_Completion', { 'selected': position === this.state.selectionOffset, }); - let componentPosition = position; + const componentPosition = position; position++; - let onMouseOver = () => this.setSelection(componentPosition); - let onClick = () => { + const onMouseOver = () => this.setSelection(componentPosition); + const onClick = () => { this.setSelection(componentPosition); this.onCompletionClicked(); }; @@ -226,7 +225,7 @@ export default class Autocomplete extends React.Component { {completionResult.provider.renderCompletions(completions)} ) : null; - }).filter(completion => !!completion); + }).filter((completion) => !!completion); return !this.state.hide && renderedCompletions.length > 0 ? (
this.container = e}> diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index c0d19987c7..7908d7f375 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -414,6 +414,8 @@ export default class MessageComposerInput extends React.Component { } } + console.log(state); + super.setState(state, () => { if (callback != null) { callback(); @@ -425,7 +427,7 @@ export default class MessageComposerInput extends React.Component { const selection = RichText.selectionStateToTextOffsets( this.state.editorState.getSelection(), this.state.editorState.getCurrentContent().getBlocksAsArray()); - + console.log(textContent); this.props.onContentChanged(textContent, selection); } }); @@ -629,12 +631,12 @@ export default class MessageComposerInput extends React.Component { } }; - onEscape = (e) => { + onEscape = async (e) => { e.preventDefault(); if (this.autocomplete) { this.autocomplete.onEscape(e); } - this.setDisplayedCompletion(null); // restore originalEditorState + await this.setDisplayedCompletion(null); // restore originalEditorState }; /* If passed null, restores the original editor content from state.originalEditorState. @@ -645,7 +647,14 @@ export default class MessageComposerInput extends React.Component { if (displayedCompletion == null) { if (this.state.originalEditorState) { - this.setState({editorState: this.state.originalEditorState}); + console.log('setting editorState to originalEditorState'); + let editorState = this.state.originalEditorState; + // This is a workaround from https://github.com/facebook/draft-js/issues/458 + // Due to the way we swap editorStates, Draft does not rerender at times + editorState = EditorState.forceSelection(editorState, + editorState.getSelection()); + this.setState({editorState}); + } return false; } @@ -663,7 +672,7 @@ export default class MessageComposerInput extends React.Component { this.setState({editorState, originalEditorState: activeEditorState}); // for some reason, doing this right away does not update the editor :( - setTimeout(() => this.refs.editor.focus(), 50); + // setTimeout(() => this.refs.editor.focus(), 50); return true; }; From c7d065276222cb5cb6506adccfae9ce249256201 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 10 Feb 2017 04:26:36 +0530 Subject: [PATCH 010/252] actually sort autocomplete results by distance --- src/autocomplete/FuzzyMatcher.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/autocomplete/FuzzyMatcher.js b/src/autocomplete/FuzzyMatcher.js index c02ee9bbc0..bd19fc53e8 100644 --- a/src/autocomplete/FuzzyMatcher.js +++ b/src/autocomplete/FuzzyMatcher.js @@ -61,14 +61,24 @@ export default class FuzzyMatcher { .algorithm('transposition') .sort_candidates(false) .case_insensitive_sort(true) - .include_distance(false) + .include_distance(true) .maximum_candidates(this.options.resultCount || DEFAULT_RESULT_COUNT) // result count 0 doesn't make much sense .build(); } match(query: String): Array { const candidates = this.matcher.transduce(query, this.options.distance || DEFAULT_DISTANCE); - return _sortedUniq(_sortBy(_flatMap(candidates, candidate => this.keyMap.objectMap[candidate]), - candidate => this.keyMap.priorityMap[candidate])); + // TODO FIXME This is hideous. Clean up when possible. + const val = _sortedUniq(_sortBy(_flatMap(candidates, candidate => { + return this.keyMap.objectMap[candidate[0]].map(value => { + return { + distance: candidate[1], + ...value, + }; + }); + }), + [candidate => candidate.distance, candidate => this.keyMap.priorityMap[candidate]])); + console.log(val); + return val; } } From 0653343319f72f3e4dff3d0f5fc6f11ad29ee991 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 10 Feb 2017 22:34:52 +0530 Subject: [PATCH 011/252] order User completions by last spoken --- .flowconfig | 6 +++ src/autocomplete/FuzzyMatcher.js | 7 ++- src/autocomplete/QueryMatcher.js | 62 +++++++++++++++++++++++++++ src/autocomplete/UserProvider.js | 35 +++++++++++++-- src/components/structures/RoomView.js | 15 ++----- 5 files changed, 109 insertions(+), 16 deletions(-) create mode 100644 .flowconfig create mode 100644 src/autocomplete/QueryMatcher.js diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 0000000000..81770c6585 --- /dev/null +++ b/.flowconfig @@ -0,0 +1,6 @@ +[include] +src/**/*.js +test/**/*.js + +[ignore] +node_modules/ diff --git a/src/autocomplete/FuzzyMatcher.js b/src/autocomplete/FuzzyMatcher.js index bd19fc53e8..c22e2a1101 100644 --- a/src/autocomplete/FuzzyMatcher.js +++ b/src/autocomplete/FuzzyMatcher.js @@ -14,7 +14,12 @@ class KeyMap { const DEFAULT_RESULT_COUNT = 10; const DEFAULT_DISTANCE = 5; -export default class FuzzyMatcher { +// FIXME Until Fuzzy matching works better, we use prefix matching. + +import PrefixMatcher from './QueryMatcher'; +export default PrefixMatcher; + +class FuzzyMatcher { /** * Given an array of objects and keys, returns a KeyMap * Keys can refer to object properties by name and as in JavaScript (for nested properties) diff --git a/src/autocomplete/QueryMatcher.js b/src/autocomplete/QueryMatcher.js new file mode 100644 index 0000000000..b4c27a7179 --- /dev/null +++ b/src/autocomplete/QueryMatcher.js @@ -0,0 +1,62 @@ +//@flow + +import _at from 'lodash/at'; +import _flatMap from 'lodash/flatMap'; +import _sortBy from 'lodash/sortBy'; +import _sortedUniq from 'lodash/sortedUniq'; +import _keys from 'lodash/keys'; + +class KeyMap { + keys: Array; + objectMap: {[String]: Array}; + priorityMap = new Map(); +} + +export default class QueryMatcher { + /** + * Given an array of objects and keys, returns a KeyMap + * Keys can refer to object properties by name and as in JavaScript (for nested properties) + * + * To use, simply presort objects by required criteria, run through this function and create a QueryMatcher with the + * resulting KeyMap. + * + * TODO: Handle arrays and objects (Fuse did this, RoomProvider uses it) + */ + static valuesToKeyMap(objects: Array, keys: Array): KeyMap { + const keyMap = new KeyMap(); + const map = {}; + + objects.forEach((object, i) => { + const keyValues = _at(object, keys); + for (const keyValue of keyValues) { + if (!map.hasOwnProperty(keyValue)) { + map[keyValue] = []; + } + map[keyValue].push(object); + } + keyMap.priorityMap.set(object, i); + }); + + keyMap.objectMap = map; + keyMap.keys = _keys(map); + return keyMap; + } + + constructor(objects: Array, options: {[Object]: Object} = {}) { + this.options = options; + this.keys = options.keys; + this.setObjects(objects); + } + + setObjects(objects: Array) { + this.keyMap = QueryMatcher.valuesToKeyMap(objects, this.keys); + } + + match(query: String): Array { + query = query.toLowerCase().replace(/[^\w]/g, ''); + const results = _sortedUniq(_sortBy(_flatMap(this.keyMap.keys, (key) => { + return key.toLowerCase().replace(/[^\w]/g, '').indexOf(query) >= 0 ? this.keyMap.objectMap[key] : []; + }), (candidate) => this.keyMap.priorityMap.get(candidate))); + return results; + } +} diff --git a/src/autocomplete/UserProvider.js b/src/autocomplete/UserProvider.js index b65439181c..589dfec9fa 100644 --- a/src/autocomplete/UserProvider.js +++ b/src/autocomplete/UserProvider.js @@ -1,20 +1,27 @@ +//@flow import React from 'react'; import AutocompleteProvider from './AutocompleteProvider'; import Q from 'q'; import {PillCompletion} from './Components'; import sdk from '../index'; import FuzzyMatcher from './FuzzyMatcher'; +import _pull from 'lodash/pull'; +import _sortBy from 'lodash/sortBy'; +import MatrixClientPeg from '../MatrixClientPeg'; + +import type {Room, RoomMember} from 'matrix-js-sdk'; const USER_REGEX = /@\S*/g; let instance = null; export default class UserProvider extends AutocompleteProvider { + users: Array = []; + constructor() { super(USER_REGEX, { keys: ['name', 'userId'], }); - this.users = []; this.matcher = new FuzzyMatcher([], { keys: ['name', 'userId'], }); @@ -53,8 +60,30 @@ export default class UserProvider extends AutocompleteProvider { return '👥 Users'; } - setUserList(users) { - this.users = users; + setUserListFromRoom(room: Room) { + const events = room.getLiveTimeline().getEvents(); + const lastSpoken = {}; + + for(const event of events) { + lastSpoken[event.getSender()] = event.getTs(); + } + + const currentUserId = MatrixClientPeg.get().credentials.userId; + this.users = room.getJoinedMembers().filter((member) => { + if (member.userId !== currentUserId) return true; + }); + + this.users = _sortBy(this.users, (user) => 1E20 - lastSpoken[user.userId] || 1E20); + + this.matcher.setObjects(this.users); + } + + onUserSpoke(user: RoomMember) { + if(user.userId === MatrixClientPeg.get().credentials.userId) return; + + // Probably unsafe to compare by reference here? + _pull(this.users, user); + this.users.splice(0, 0, user); this.matcher.setObjects(this.users); } diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 696d15f84a..936d88c0ee 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -225,7 +225,7 @@ module.exports = React.createClass({ MatrixClientPeg.get().credentials.userId, 'join' ); - this._updateAutoComplete(); + UserProvider.getInstance().setUserListFromRoom(this.state.room); this.tabComplete.loadEntries(this.state.room); } @@ -479,8 +479,7 @@ module.exports = React.createClass({ // and that has probably just changed if (ev.sender) { this.tabComplete.onMemberSpoke(ev.sender); - // nb. we don't need to update the new autocomplete here since - // its results are currently ordered purely by search score. + UserProvider.getInstance().onUserSpoke(ev.sender); } }, @@ -658,7 +657,7 @@ module.exports = React.createClass({ // refresh the tab complete list this.tabComplete.loadEntries(this.state.room); - this._updateAutoComplete(); + UserProvider.getInstance().setUserListFromRoom(this.state.room); // if we are now a member of the room, where we were not before, that // means we have finished joining a room we were previously peeking @@ -1437,14 +1436,6 @@ module.exports = React.createClass({ } }, - _updateAutoComplete: function() { - const myUserId = MatrixClientPeg.get().credentials.userId; - const members = this.state.room.getJoinedMembers().filter(function(member) { - if (member.userId !== myUserId) return true; - }); - UserProvider.getInstance().setUserList(members); - }, - render: function() { var RoomHeader = sdk.getComponent('rooms.RoomHeader'); var MessageComposer = sdk.getComponent('rooms.MessageComposer'); From e65744abdce812b649302f887779c1866f3746c6 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 10 Feb 2017 23:35:13 +0530 Subject: [PATCH 012/252] fix EmojiProvider for new QueryMatcher --- src/autocomplete/EmojiProvider.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/autocomplete/EmojiProvider.js b/src/autocomplete/EmojiProvider.js index 52bc47e7b6..e613f41c52 100644 --- a/src/autocomplete/EmojiProvider.js +++ b/src/autocomplete/EmojiProvider.js @@ -7,14 +7,20 @@ import {PillCompletion} from './Components'; import type {SelectionRange, Completion} from './Autocompleter'; const EMOJI_REGEX = /:\w*:?/g; -const EMOJI_SHORTNAMES = Object.keys(emojioneList); +const EMOJI_SHORTNAMES = Object.keys(emojioneList).map(shortname => { + return { + shortname, + }; +}); let instance = null; export default class EmojiProvider extends AutocompleteProvider { constructor() { super(EMOJI_REGEX); - this.matcher = new FuzzyMatcher(EMOJI_SHORTNAMES); + this.matcher = new FuzzyMatcher(EMOJI_SHORTNAMES, { + keys: 'shortname', + }); } async getCompletions(query: string, selection: SelectionRange) { @@ -24,7 +30,7 @@ export default class EmojiProvider extends AutocompleteProvider { let {command, range} = this.getCurrentCommand(query, selection); if (command) { completions = this.matcher.match(command[0]).map(result => { - const shortname = EMOJI_SHORTNAMES[result]; + const {shortname} = result; const unicode = shortnameToUnicode(shortname); return { completion: unicode, From 2d39b2533487a266ddce7bf2a3e8c80681afc146 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 10 Feb 2017 23:44:04 +0530 Subject: [PATCH 013/252] turn off force complete when editor content changes --- src/components/views/rooms/Autocomplete.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/Autocomplete.js b/src/components/views/rooms/Autocomplete.js index c06786a80c..bd43b3a85e 100644 --- a/src/components/views/rooms/Autocomplete.js +++ b/src/components/views/rooms/Autocomplete.js @@ -75,11 +75,11 @@ export default class Autocomplete extends React.Component { } else { selectionOffset++; // selectionOffset is 1-indexed! } - } else { - // If no completions were returned, we should turn off force completion. - forceComplete = false; } + // If no completions were returned, we should turn off force completion. + forceComplete = false; + let hide = this.state.hide; // These are lists of booleans that indicate whether whether the corresponding provider had a matching pattern const oldMatches = this.state.completions.map((completion) => !!completion.command.command), From 32dd89774e78a907215ef3e317faac9e0400206c Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Mon, 20 Feb 2017 19:26:40 +0530 Subject: [PATCH 014/252] add support for autocomplete delay --- src/UserSettingsStore.js | 4 ++-- src/autocomplete/Autocompleter.js | 2 +- src/components/structures/UserSettings.js | 9 +++++++++ src/components/views/rooms/Autocomplete.js | 15 ++++++++++++--- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/UserSettingsStore.js b/src/UserSettingsStore.js index 66a872958c..0ee78b4f2e 100644 --- a/src/UserSettingsStore.js +++ b/src/UserSettingsStore.js @@ -139,7 +139,7 @@ module.exports = { getSyncedSetting: function(type, defaultValue = null) { var settings = this.getSyncedSettings(); - return settings.hasOwnProperty(type) ? settings[type] : null; + return settings.hasOwnProperty(type) ? settings[type] : defaultValue; }, setSyncedSetting: function(type, value) { @@ -156,7 +156,7 @@ module.exports = { getLocalSetting: function(type, defaultValue = null) { var settings = this.getLocalSettings(); - return settings.hasOwnProperty(type) ? settings[type] : null; + return settings.hasOwnProperty(type) ? settings[type] : defaultValue; }, setLocalSetting: function(type, value) { diff --git a/src/autocomplete/Autocompleter.js b/src/autocomplete/Autocompleter.js index 1bf1b1dc14..2906a5a0f7 100644 --- a/src/autocomplete/Autocompleter.js +++ b/src/autocomplete/Autocompleter.js @@ -43,7 +43,7 @@ export async function getCompletions(query: string, selection: SelectionRange, f PROVIDERS.map(provider => { return Q(provider.getCompletions(query, selection, force)) .timeout(PROVIDER_COMPLETION_TIMEOUT); - }) + }), ); return completionsList diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 10ffbca0d3..5ab69e1a15 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -508,6 +508,15 @@ module.exports = React.createClass({ { this._renderUrlPreviewSelector() } { SETTINGS_LABELS.map( this._renderSyncedSetting ) } { THEMES.map( this._renderThemeSelector ) } + + + + + + + +
Autocomplete Delay (ms): UserSettingsStore.setLocalSetting('autocompleteDelay', +e.target.value)} />
); diff --git a/src/components/views/rooms/Autocomplete.js b/src/components/views/rooms/Autocomplete.js index bd43b3a85e..09b13e8076 100644 --- a/src/components/views/rooms/Autocomplete.js +++ b/src/components/views/rooms/Autocomplete.js @@ -6,6 +6,7 @@ import isEqual from 'lodash/isEqual'; import sdk from '../../../index'; import type {Completion, SelectionRange} from '../../../autocomplete/Autocompleter'; import Q from 'q'; +import UserSettingsStore from '../../../UserSettingsStore'; import {getCompletions} from '../../../autocomplete/Autocompleter'; @@ -77,9 +78,6 @@ export default class Autocomplete extends React.Component { } } - // If no completions were returned, we should turn off force completion. - forceComplete = false; - let hide = this.state.hide; // These are lists of booleans that indicate whether whether the corresponding provider had a matching pattern const oldMatches = this.state.completions.map((completion) => !!completion.command.command), @@ -90,6 +88,17 @@ export default class Autocomplete extends React.Component { hide = false; } + const autocompleteDelay = UserSettingsStore.getSyncedSetting('autocompleteDelay', 200); + + // We had no completions before, but do now, so we should apply our display delay here + if (this.state.completionList.length === 0 && completionList.length > 0 && + !forceComplete && autocompleteDelay > 0) { + await Q.delay(autocompleteDelay); + } + + // Force complete is turned off each time since we can't edit the query in that case + forceComplete = false; + this.setState({ completions, completionList, From 3a07fc1601ae8b6e35cc45632403650b4e8ece17 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Wed, 22 Feb 2017 02:51:57 +0530 Subject: [PATCH 015/252] fix code-block for markdown mode --- src/components/views/rooms/MessageComposerInput.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 7908d7f375..af5627273c 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -485,7 +485,7 @@ export default class MessageComposerInput extends React.Component { 'italic': (text) => `*${text}*`, 'underline': (text) => `_${text}_`, // there's actually no valid underline in Markdown, but *shrug* 'strike': (text) => `~~${text}~~`, - 'code': (text) => `\`${text}\``, + 'code-block': (text) => `\`\`\`\n${text}\n\`\`\``, 'blockquote': (text) => text.split('\n').map((line) => `> ${line}\n`).join(''), 'unordered-list-item': (text) => text.split('\n').map((line) => `- ${line}\n`).join(''), 'ordered-list-item': (text) => text.split('\n').map((line, i) => `${i + 1}. ${line}\n`).join(''), From feac919c0a527f440d23bfaf25099659eb31e675 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Wed, 22 Feb 2017 03:10:15 +0530 Subject: [PATCH 016/252] fix rendering of UNDERLINE inline style in RTE --- src/RichText.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/RichText.js b/src/RichText.js index e662c22d6a..219af472e8 100644 --- a/src/RichText.js +++ b/src/RichText.js @@ -30,7 +30,15 @@ const USERNAME_REGEX = /@\S+:\S+/g; const ROOM_REGEX = /#\S+:\S+/g; const EMOJI_REGEX = new RegExp(emojione.unicodeRegexp, 'g'); -export const contentStateToHTML = stateToHTML; +export const contentStateToHTML = (contentState: ContentState) => { + return stateToHTML(contentState, { + inlineStyles: { + UNDERLINE: { + element: 'u' + } + } + }); +}; export function HTMLtoContentState(html: string): ContentState { return ContentState.createFromBlockArray(convertFromHTML(html)); From 9946cadc2d3fe62c71959ceb89ed915961cdebb9 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Tue, 7 Mar 2017 04:08:06 +0530 Subject: [PATCH 017/252] autocomplete: fix RoomProvider regression --- src/autocomplete/RoomProvider.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/autocomplete/RoomProvider.js b/src/autocomplete/RoomProvider.js index 8659b8501f..726d28db88 100644 --- a/src/autocomplete/RoomProvider.js +++ b/src/autocomplete/RoomProvider.js @@ -14,7 +14,7 @@ export default class RoomProvider extends AutocompleteProvider { constructor() { super(ROOM_REGEX); this.matcher = new FuzzyMatcher([], { - keys: ['name', 'aliases'], + keys: ['name', 'roomId', 'aliases'], }); } @@ -26,7 +26,7 @@ export default class RoomProvider extends AutocompleteProvider { const {command, range} = this.getCurrentCommand(query, selection, force); if (command) { // the only reason we need to do this is because Fuse only matches on properties - this.matcher.setObjects(client.getRooms().filter(room => !!room).map(room => { + this.matcher.setObjects(client.getRooms().filter(room => !!room && !!getDisplayAliasForRoom(room)).map(room => { return { room: room, name: room.name, From f5b52fb48844c22d61dff3475b3519bd5dd4acd6 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Tue, 7 Mar 2017 04:15:28 +0530 Subject: [PATCH 018/252] rte: change list behaviour in markdown mode --- src/components/views/rooms/MessageComposerInput.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index af5627273c..5d9496e78d 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -487,8 +487,8 @@ export default class MessageComposerInput extends React.Component { 'strike': (text) => `~~${text}~~`, 'code-block': (text) => `\`\`\`\n${text}\n\`\`\``, 'blockquote': (text) => text.split('\n').map((line) => `> ${line}\n`).join(''), - 'unordered-list-item': (text) => text.split('\n').map((line) => `- ${line}\n`).join(''), - 'ordered-list-item': (text) => text.split('\n').map((line, i) => `${i + 1}. ${line}\n`).join(''), + 'unordered-list-item': (text) => text.split('\n').map((line) => `\n- ${line}`).join(''), + 'ordered-list-item': (text) => text.split('\n').map((line, i) => `\n${i + 1}. ${line}`).join(''), }[command]; if (modifyFn) { From 79f481f81e8b9d1d11535f91f5b8da5d19006d7e Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Tue, 7 Mar 2017 04:39:38 +0530 Subject: [PATCH 019/252] rte: special return handling for some block types --- src/components/views/rooms/MessageComposerInput.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 5d9496e78d..e3063babb1 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -513,9 +513,16 @@ export default class MessageComposerInput extends React.Component { }; handleReturn = (ev) => { - if (ev.shiftKey) { - this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState)); - return true; + const currentBlockType = RichUtils.getCurrentBlockType(this.state.editorState); + // If we're in any of these three types of blocks, shift enter should insert soft newlines + // And just enter should end the block + if(['blockquote', 'unordered-list-item', 'ordered-list-item'].includes(currentBlockType)) { + if(ev.shiftKey) { + this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState)); + return true; + } + + return false; } const contentState = this.state.editorState.getCurrentContent(); From b977b559de6e369adbb55fd3de5a929c01c394c6 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Tue, 7 Mar 2017 04:46:55 +0530 Subject: [PATCH 020/252] autocomplete: add missing commands to CommandProvider --- src/autocomplete/CommandProvider.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/autocomplete/CommandProvider.js b/src/autocomplete/CommandProvider.js index 8f98bf1aa5..a30af5674d 100644 --- a/src/autocomplete/CommandProvider.js +++ b/src/autocomplete/CommandProvider.js @@ -9,11 +9,21 @@ const COMMANDS = [ args: '', description: 'Displays action', }, + { + command: '/part', + args: '[#alias:domain]', + description: 'Leave room', + }, { command: '/ban', args: ' [reason]', description: 'Bans user with given id', }, + { + command: '/unban', + args: '', + description: 'Unbans user with given id', + }, { command: '/deop', args: '', @@ -43,6 +53,11 @@ const COMMANDS = [ command: '/ddg', args: '', description: 'Searches DuckDuckGo for results', + }, + { + command: '/op', + args: ' []', + description: 'Define the power level of a user', } ]; From 6004f6d6107dbdafcd70295715040cef6c4a3109 Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 10 Mar 2017 20:34:31 +0530 Subject: [PATCH 021/252] rte: fix history --- .eslintrc.js | 2 +- src/ComposerHistoryManager.js | 63 +++++++ src/RichText.js | 10 ++ .../views/rooms/MessageComposerInput.js | 155 ++++-------------- 4 files changed, 108 insertions(+), 122 deletions(-) create mode 100644 src/ComposerHistoryManager.js diff --git a/.eslintrc.js b/.eslintrc.js index 6cd0e1015e..74790a2964 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -64,7 +64,7 @@ module.exports = { // to JSX. ignorePattern: '^\\s*<', ignoreComments: true, - code: 90, + code: 120, }], "valid-jsdoc": ["warn"], "new-cap": ["warn"], diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js new file mode 100644 index 0000000000..5f9cf04e6f --- /dev/null +++ b/src/ComposerHistoryManager.js @@ -0,0 +1,63 @@ +//@flow + +import {ContentState} from 'draft-js'; +import * as RichText from './RichText'; +import Markdown from './Markdown'; +import _flow from 'lodash/flow'; +import _clamp from 'lodash/clamp'; + +type MessageFormat = 'html' | 'markdown'; + +class HistoryItem { + message: string = ''; + format: MessageFormat = 'html'; + + constructor(message: string, format: MessageFormat) { + this.message = message; + this.format = format; + } + + toContentState(format: MessageFormat): ContentState { + let {message} = this; + if (format === 'markdown') { + if (this.format === 'html') { + message = _flow([RichText.HTMLtoContentState, RichText.stateToMarkdown])(message); + } + return ContentState.createFromText(message); + } else { + if (this.format === 'markdown') { + message = new Markdown(message).toHTML(); + } + return RichText.HTMLtoContentState(message); + } + } +} + +export default class ComposerHistoryManager { + history: Array = []; + prefix: string; + lastIndex: number = 0; + currentIndex: number = -1; + + constructor(roomId: string, prefix: string = 'mx_composer_history_') { + this.prefix = prefix + roomId; + + // TODO: Performance issues? + for(; sessionStorage.getItem(`${this.prefix}[${this.lastIndex}]`); this.lastIndex++, this.currentIndex++) { + history.push(JSON.parse(sessionStorage.getItem(`${this.prefix}[${this.lastIndex}]`))); + } + } + + addItem(message: string, format: MessageFormat) { + const item = new HistoryItem(message, format); + this.history.push(item); + this.currentIndex = this.lastIndex; + sessionStorage.setItem(`${this.prefix}[${this.lastIndex++}]`, JSON.stringify(item)); + } + + getItem(offset: number, format: MessageFormat): ?ContentState { + this.currentIndex = _clamp(this.currentIndex + offset, 0, this.lastIndex - 1); + const item = this.history[this.currentIndex]; + return item ? item.toContentState(format) : null; + } +} diff --git a/src/RichText.js b/src/RichText.js index 219af472e8..6edde23129 100644 --- a/src/RichText.js +++ b/src/RichText.js @@ -16,6 +16,7 @@ import * as sdk from './index'; import * as emojione from 'emojione'; import {stateToHTML} from 'draft-js-export-html'; import {SelectionRange} from "./autocomplete/Autocompleter"; +import {stateToMarkdown as __stateToMarkdown} from 'draft-js-export-markdown'; const MARKDOWN_REGEX = { LINK: /(?:\[([^\]]+)\]\(([^\)]+)\))|\<(\w+:\/\/[^\>]+)\>/g, @@ -30,6 +31,15 @@ const USERNAME_REGEX = /@\S+:\S+/g; const ROOM_REGEX = /#\S+:\S+/g; const EMOJI_REGEX = new RegExp(emojione.unicodeRegexp, 'g'); +const ZWS_CODE = 8203; +const ZWS = String.fromCharCode(ZWS_CODE); // zero width space +export function stateToMarkdown(state) { + return __stateToMarkdown(state) + .replace( + ZWS, // draft-js-export-markdown adds these + ''); // this is *not* a zero width space, trust me :) +} + export const contentStateToHTML = (contentState: ContentState) => { return stateToHTML(contentState, { inlineStyles: { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index e3063babb1..33f184c446 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -20,7 +20,6 @@ import {Editor, EditorState, RichUtils, CompositeDecorator, convertFromRaw, convertToRaw, Modifier, EditorChangeType, getDefaultKeyBinding, KeyBindingUtil, ContentState, ContentBlock, SelectionState} from 'draft-js'; -import {stateToMarkdown as __stateToMarkdown} from 'draft-js-export-markdown'; import classNames from 'classnames'; import escape from 'lodash/escape'; import Q from 'q'; @@ -40,21 +39,13 @@ import * as HtmlUtils from '../../../HtmlUtils'; import Autocomplete from './Autocomplete'; import {Completion} from "../../../autocomplete/Autocompleter"; import Markdown from '../../../Markdown'; +import ComposerHistoryManager from '../../../ComposerHistoryManager'; import {onSendMessageFailed} from './MessageComposerInputOld'; const TYPING_USER_TIMEOUT = 10000, TYPING_SERVER_TIMEOUT = 30000; const KEY_M = 77; -const ZWS_CODE = 8203; -const ZWS = String.fromCharCode(ZWS_CODE); // zero width space -function stateToMarkdown(state) { - return __stateToMarkdown(state) - .replace( - ZWS, // draft-js-export-markdown adds these - ''); // this is *not* a zero width space, trust me :) -} - /* * The textInput part of the MessageComposer */ @@ -101,6 +92,7 @@ export default class MessageComposerInput extends React.Component { client: MatrixClient; autocomplete: Autocomplete; + historyManager: ComposerHistoryManager; constructor(props, context) { super(props, context); @@ -145,110 +137,13 @@ export default class MessageComposerInput extends React.Component { return EditorState.moveFocusToEnd(editorState); } - componentWillMount() { - const component = this; - this.sentHistory = { - // The list of typed messages. Index 0 is more recent - data: [], - // The position in data currently displayed - position: -1, - // The room the history is for. - roomId: null, - // The original text before they hit UP - originalText: null, - // The textarea element to set text to. - element: null, - - init: function(element, roomId) { - this.roomId = roomId; - this.element = element; - this.position = -1; - const storedData = window.sessionStorage.getItem( - "mx_messagecomposer_history_" + roomId, - ); - if (storedData) { - this.data = JSON.parse(storedData); - } - if (this.roomId) { - this.setLastTextEntry(); - } - }, - - push: function(text) { - // store a message in the sent history - this.data.unshift(text); - window.sessionStorage.setItem( - "mx_messagecomposer_history_" + this.roomId, - JSON.stringify(this.data), - ); - // reset history position - this.position = -1; - this.originalText = null; - }, - - // move in the history. Returns true if we managed to move. - next: function(offset) { - if (this.position === -1) { - // user is going into the history, save the current line. - this.originalText = this.element.value; - } else { - // user may have modified this line in the history; remember it. - this.data[this.position] = this.element.value; - } - - if (offset > 0 && this.position === (this.data.length - 1)) { - // we've run out of history - return false; - } - - // retrieve the next item (bounded). - let newPosition = this.position + offset; - newPosition = Math.max(-1, newPosition); - newPosition = Math.min(newPosition, this.data.length - 1); - this.position = newPosition; - - if (this.position !== -1) { - // show the message - this.element.value = this.data[this.position]; - } else if (this.originalText !== undefined) { - // restore the original text the user was typing. - this.element.value = this.originalText; - } - - return true; - }, - - saveLastTextEntry: function() { - // save the currently entered text in order to restore it later. - // NB: This isn't 'originalText' because we want to restore - // sent history items too! - const contentJSON = JSON.stringify(convertToRaw(component.state.editorState.getCurrentContent())); - window.sessionStorage.setItem("mx_messagecomposer_input_" + this.roomId, contentJSON); - }, - - setLastTextEntry: function() { - const contentJSON = window.sessionStorage.getItem("mx_messagecomposer_input_" + this.roomId); - if (contentJSON) { - const content = convertFromRaw(JSON.parse(contentJSON)); - component.setState({ - editorState: component.createEditorState(component.state.isRichtextEnabled, content), - }); - } - }, - }; - } - componentDidMount() { this.dispatcherRef = dis.register(this.onAction); - this.sentHistory.init( - this.refs.editor, - this.props.room.roomId, - ); + this.historyManager = new ComposerHistoryManager(this.props.room.roomId); } componentWillUnmount() { dis.unregister(this.dispatcherRef); - this.sentHistory.saveLastTextEntry(); } componentWillUpdate(nextProps, nextState) { @@ -290,7 +185,7 @@ export default class MessageComposerInput extends React.Component { if (formatted_body) { let content = RichText.HTMLtoContentState(`
${formatted_body}
`); if (!this.state.isRichtextEnabled) { - content = ContentState.createFromText(stateToMarkdown(content)); + content = ContentState.createFromText(RichText.stateToMarkdown(content)); } const blockMap = content.getBlockMap(); @@ -414,8 +309,6 @@ export default class MessageComposerInput extends React.Component { } } - console.log(state); - super.setState(state, () => { if (callback != null) { callback(); @@ -434,12 +327,14 @@ export default class MessageComposerInput extends React.Component { } enableRichtext(enabled: boolean) { + if (enabled === this.state.isRichtextEnabled) return; + let contentState = null; if (enabled) { const md = new Markdown(this.state.editorState.getCurrentContent().getPlainText()); contentState = RichText.HTMLtoContentState(md.toHTML()); } else { - let markdown = stateToMarkdown(this.state.editorState.getCurrentContent()); + let markdown = RichText.stateToMarkdown(this.state.editorState.getCurrentContent()); if (markdown[markdown.length - 1] === '\n') { markdown = markdown.substring(0, markdown.length - 1); // stateToMarkdown tacks on an extra newline (?!?) } @@ -513,15 +408,15 @@ export default class MessageComposerInput extends React.Component { }; handleReturn = (ev) => { + if(ev.shiftKey) { + this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState)); + return true; + } + const currentBlockType = RichUtils.getCurrentBlockType(this.state.editorState); // If we're in any of these three types of blocks, shift enter should insert soft newlines // And just enter should end the block if(['blockquote', 'unordered-list-item', 'ordered-list-item'].includes(currentBlockType)) { - if(ev.shiftKey) { - this.onEditorContentChanged(RichUtils.insertSoftNewline(this.state.editorState)); - return true; - } - return false; } @@ -586,8 +481,10 @@ export default class MessageComposerInput extends React.Component { sendTextFn = this.client.sendEmoteMessage; } - // XXX: We don't actually seem to use this history? - this.sentHistory.push(contentHTML || contentText); + this.historyManager.addItem( + this.state.isRichtextEnabled ? contentHTML : contentState.getPlainText(), + this.state.isRichtextEnabled ? 'html' : 'markdown'); + let sendMessagePromise; if (contentHTML) { sendMessagePromise = sendHtmlFn.call( @@ -614,14 +511,30 @@ export default class MessageComposerInput extends React.Component { onUpArrow = async (e) => { const completion = this.autocomplete.onUpArrow(); - if (completion != null) { - e.preventDefault(); + if (completion == null) { + const newContent = this.historyManager.getItem(-1, this.state.isRichtextEnabled ? 'html' : 'markdown'); + if (!newContent) return false; + const editorState = EditorState.push(this.state.editorState, + newContent, + 'insert-characters'); + this.setState({editorState}); + return true; } + e.preventDefault(); return await this.setDisplayedCompletion(completion); }; onDownArrow = async (e) => { const completion = this.autocomplete.onDownArrow(); + if (completion == null) { + const newContent = this.historyManager.getItem(+1, this.state.isRichtextEnabled ? 'html' : 'markdown'); + if (!newContent) return false; + const editorState = EditorState.push(this.state.editorState, + newContent, + 'insert-characters'); + this.setState({editorState}); + return true; + } e.preventDefault(); return await this.setDisplayedCompletion(completion); }; From 8dc7f8efe29c2bd796f17c21c41c89a4d6fd858f Mon Sep 17 00:00:00 2001 From: Aviral Dasgupta Date: Fri, 10 Mar 2017 21:10:27 +0530 Subject: [PATCH 022/252] rte: remove logging and fix new history --- src/ComposerHistoryManager.js | 10 ++++++++-- src/components/views/rooms/Autocomplete.js | 1 - src/components/views/rooms/MessageComposerInput.js | 3 --- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ComposerHistoryManager.js b/src/ComposerHistoryManager.js index 5f9cf04e6f..face75ea8a 100644 --- a/src/ComposerHistoryManager.js +++ b/src/ComposerHistoryManager.js @@ -44,14 +44,20 @@ export default class ComposerHistoryManager { // TODO: Performance issues? for(; sessionStorage.getItem(`${this.prefix}[${this.lastIndex}]`); this.lastIndex++, this.currentIndex++) { - history.push(JSON.parse(sessionStorage.getItem(`${this.prefix}[${this.lastIndex}]`))); + this.history.push( + Object.assign( + new HistoryItem(), + JSON.parse(sessionStorage.getItem(`${this.prefix}[${this.lastIndex}]`)), + ), + ); } + this.currentIndex--; } addItem(message: string, format: MessageFormat) { const item = new HistoryItem(message, format); this.history.push(item); - this.currentIndex = this.lastIndex; + this.currentIndex = this.lastIndex + 1; sessionStorage.setItem(`${this.prefix}[${this.lastIndex++}]`, JSON.stringify(item)); } diff --git a/src/components/views/rooms/Autocomplete.js b/src/components/views/rooms/Autocomplete.js index 09b13e8076..5329cde8f2 100644 --- a/src/components/views/rooms/Autocomplete.js +++ b/src/components/views/rooms/Autocomplete.js @@ -197,7 +197,6 @@ export default class Autocomplete extends React.Component { setState(state, func) { super.setState(state, func); - console.log(state); } render() { diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 33f184c446..2a0a62ebf7 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -320,7 +320,6 @@ export default class MessageComposerInput extends React.Component { const selection = RichText.selectionStateToTextOffsets( this.state.editorState.getSelection(), this.state.editorState.getCurrentContent().getBlocksAsArray()); - console.log(textContent); this.props.onContentChanged(textContent, selection); } }); @@ -541,7 +540,6 @@ export default class MessageComposerInput extends React.Component { // tab and shift-tab are mapped to down and up arrow respectively onTab = async (e) => { - console.log('onTab'); e.preventDefault(); // we *never* want tab's default to happen, but we do want up/down sometimes if (this.autocomplete.state.completionList.length === 0) { await this.autocomplete.forceComplete(); @@ -567,7 +565,6 @@ export default class MessageComposerInput extends React.Component { if (displayedCompletion == null) { if (this.state.originalEditorState) { - console.log('setting editorState to originalEditorState'); let editorState = this.state.originalEditorState; // This is a workaround from https://github.com/facebook/draft-js/issues/458 // Due to the way we swap editorStates, Draft does not rerender at times From f5a23c14df83c8c8bc91c0daa7ded05c73fbb71c Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 8 May 2017 17:32:26 +0100 Subject: [PATCH 023/252] Remove redundant bind --- src/components/views/rooms/MessageComposerInput.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 2d16b202d1..7d52d87dbf 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -101,7 +101,6 @@ export default class MessageComposerInput extends React.Component { this.handleKeyCommand = this.handleKeyCommand.bind(this); this.handlePastedFiles = this.handlePastedFiles.bind(this); this.onEditorContentChanged = this.onEditorContentChanged.bind(this); - this.setEditorState = this.setEditorState.bind(this); this.onUpArrow = this.onUpArrow.bind(this); this.onDownArrow = this.onDownArrow.bind(this); this.onTab = this.onTab.bind(this); From d5bc24d9f76fbcef01263f99f39cdc788de7cde7 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 19 May 2017 09:54:29 +0100 Subject: [PATCH 024/252] Initial implementation of KeyRequestHandler, KeyShareDialog etc --- src/KeyRequestHandler.js | 89 ++++++++++ src/components/structures/MatrixChat.js | 6 + .../views/dialogs/KeyShareDialog.js | 164 ++++++++++++++++++ 3 files changed, 259 insertions(+) create mode 100644 src/KeyRequestHandler.js create mode 100644 src/components/views/dialogs/KeyShareDialog.js diff --git a/src/KeyRequestHandler.js b/src/KeyRequestHandler.js new file mode 100644 index 0000000000..90ff00d47e --- /dev/null +++ b/src/KeyRequestHandler.js @@ -0,0 +1,89 @@ +/* +Copyright 2017 Vector Creations Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import sdk from './index'; +import Modal from './Modal'; + +export default class KeyRequestHandler { + constructor(matrixClient) { + this._matrixClient = matrixClient; + + this._isDialogOpen = false; + + // userId -> deviceId -> [keyRequest] + this._pendingKeyRequests = {}; + } + + + handleKeyRequest(keyRequest) { + const userId = keyRequest.userId; + const deviceId = keyRequest.deviceId; + + if (!this._pendingKeyRequests[userId]) { + this._pendingKeyRequests[userId] = {}; + } + if (!this._pendingKeyRequests[userId][deviceId]) { + this._pendingKeyRequests[userId][deviceId] = []; + } + this._pendingKeyRequests[userId][deviceId].push(keyRequest); + + if (this._isDialogOpen) { + // ignore for now + console.log("Key request, but we already have a dialog open"); + return; + } + + this._processNextRequest(); + } + + _processNextRequest() { + const userId = Object.keys(this._pendingKeyRequests)[0]; + if (!userId) { + return; + } + const deviceId = Object.keys(this._pendingKeyRequests[userId])[0]; + if (!deviceId) { + return; + } + console.log(`Starting KeyShareDialog for ${userId}:${deviceId}`); + + const finished = (r) => { + this._isDialogOpen = false; + + if (r) { + for (const req of this._pendingKeyRequests[userId][deviceId]) { + req.share(); + } + } + delete this._pendingKeyRequests[userId][deviceId]; + if (Object.keys(this._pendingKeyRequests[userId]).length === 0) { + delete this._pendingKeyRequests[userId]; + } + + this._processNextRequest(); + }; + + const KeyShareDialog = sdk.getComponent("dialogs.KeyShareDialog"); + Modal.createDialog(KeyShareDialog, { + matrixClient: this._matrixClient, + userId: userId, + deviceId: deviceId, + onFinished: finished, + }); + this._isDialogOpen = true; + } +} + diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index f53128fba9..544213edc6 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -38,6 +38,7 @@ import PageTypes from '../../PageTypes'; import createRoom from "../../createRoom"; import * as UDEHandler from '../../UnknownDeviceErrorHandler'; +import KeyRequestHandler from '../../KeyRequestHandler'; import { _t } from '../../languageHandler'; module.exports = React.createClass({ @@ -914,6 +915,11 @@ module.exports = React.createClass({ } } }); + + const krh = new KeyRequestHandler(cli); + cli.on("crypto.roomKeyRequest", (req) => { + krh.handleKeyRequest(req); + }); }, showScreen: function(screen, params) { diff --git a/src/components/views/dialogs/KeyShareDialog.js b/src/components/views/dialogs/KeyShareDialog.js new file mode 100644 index 0000000000..5b66944dbc --- /dev/null +++ b/src/components/views/dialogs/KeyShareDialog.js @@ -0,0 +1,164 @@ +/* +Copyright 2017 Vector Creations Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import Modal from '../../../Modal'; +import React from 'react'; +import sdk from '../../../index'; + +import { _t } from '../../../languageHandler'; + +export default React.createClass({ + propTypes: { + matrixClient: React.PropTypes.object.isRequired, + userId: React.PropTypes.string.isRequired, + deviceId: React.PropTypes.string.isRequired, + onFinished: React.PropTypes.func.isRequired, + }, + + getInitialState: function() { + return { + deviceInfo: null, + wasNewDevice: false, + }; + }, + + componentDidMount: function() { + this._unmounted = false; + const userId = this.props.userId; + const deviceId = this.props.deviceId; + + // give the client a chance to refresh the device list + this.props.matrixClient.downloadKeys([userId], false).then((r) => { + if (this._unmounted) { return; } + + const deviceInfo = r[userId][deviceId]; + + if(!deviceInfo) { + console.warn(`No details found for device ${userId}:${deviceId}`); + + this.props.onFinished(false); + return; + } + + const wasNewDevice = !deviceInfo.isKnown(); + + this.setState({ + deviceInfo: deviceInfo, + wasNewDevice: wasNewDevice, + }); + + // if the device was new before, it's not any more. + if (wasNewDevice) { + this.props.matrixClient.setDeviceKnown( + userId, + deviceId, + true, + ); + } + }).done(); + }, + + componentWillUnmount: function() { + this._unmounted = true; + }, + + + _onVerifyClicked: function() { + const DeviceVerifyDialog = sdk.getComponent('views.dialogs.DeviceVerifyDialog'); + + console.log("KeyShareDialog: Starting verify dialog"); + Modal.createDialog(DeviceVerifyDialog, { + userId: this.props.userId, + device: this.state.deviceInfo, + onFinished: (verified) => { + if (verified) { + // can automatically share the keys now. + this.props.onFinished(true); + } + }, + }); + }, + + _onShareClicked: function() { + console.log("KeyShareDialog: User clicked 'share'"); + this.props.onFinished(true); + }, + + _onIgnoreClicked: function() { + console.log("KeyShareDialog: User clicked 'ignore'"); + this.props.onFinished(false); + }, + + _renderContent: function() { + const displayName = this.state.deviceInfo.getDisplayName() || + this.state.deviceInfo.deviceId; + + let text; + if (this.state.wasNewDevice) { + text = "You added a new device '%(displayName)s', which is" + + " requesting encryption keys."; + } else { + text = "Your unverified device '%(displayName)s' is requesting" + + " encryption keys."; + } + text = _t(text, {displayName: displayName}); + + return ( +
+

{text}

+ +
+ + + +
+
+ ); + }, + + render: function() { + const BaseDialog = sdk.getComponent('views.dialogs.BaseDialog'); + const Spinner = sdk.getComponent('views.elements.Spinner'); + + let content; + + if (this.state.deviceInfo) { + content = this._renderContent(); + } else { + content = ( +
+

{_t('Loading device info...')}

+ +
+ ); + } + + return ( + + {content} + + ); + }, +}); From 7d55f3e75d55edef5a0303ab8c0f8909cce2d57e Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 1 Jun 2017 17:49:24 +0100 Subject: [PATCH 025/252] handle room key request cancellations --- src/KeyRequestHandler.js | 55 ++++++++++++++++++++++--- src/components/structures/MatrixChat.js | 3 ++ 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/KeyRequestHandler.js b/src/KeyRequestHandler.js index 90ff00d47e..fbb869d468 100644 --- a/src/KeyRequestHandler.js +++ b/src/KeyRequestHandler.js @@ -21,16 +21,18 @@ export default class KeyRequestHandler { constructor(matrixClient) { this._matrixClient = matrixClient; - this._isDialogOpen = false; + // the user/device for which we currently have a dialog open + this._currentUser = null; + this._currentDevice = null; // userId -> deviceId -> [keyRequest] this._pendingKeyRequests = {}; } - handleKeyRequest(keyRequest) { const userId = keyRequest.userId; const deviceId = keyRequest.deviceId; + const requestId = keyRequest.requestId; if (!this._pendingKeyRequests[userId]) { this._pendingKeyRequests[userId] = {}; @@ -38,9 +40,17 @@ export default class KeyRequestHandler { if (!this._pendingKeyRequests[userId][deviceId]) { this._pendingKeyRequests[userId][deviceId] = []; } - this._pendingKeyRequests[userId][deviceId].push(keyRequest); - if (this._isDialogOpen) { + // check if we already have this request + const requests = this._pendingKeyRequests[userId][deviceId]; + if (requests.find((r) => r.requestId === requestId)) { + console.log("Already have this key request, ignoring"); + return; + } + + requests.push(keyRequest); + + if (this._currentUser) { // ignore for now console.log("Key request, but we already have a dialog open"); return; @@ -49,6 +59,37 @@ export default class KeyRequestHandler { this._processNextRequest(); } + handleKeyRequestCancellation(cancellation) { + // see if we can find the request in the queue + const userId = cancellation.userId; + const deviceId = cancellation.deviceId; + const requestId = cancellation.requestId; + + if (userId === this._currentUser && deviceId === this._currentDevice) { + console.log( + "room key request cancellation for the user we currently have a" + + " dialog open for", + ); + // TODO: update the dialog. For now, we just ignore the + // cancellation. + return; + } + + if (!this._pendingKeyRequests[userId]) { + return; + } + const requests = this._pendingKeyRequests[userId][deviceId]; + if (!requests) { + return; + } + const idx = requests.findIndex((r) => r.requestId === requestId); + if (idx < 0) { + return; + } + console.log("Forgetting room key request"); + requests.splice(idx, 1); + } + _processNextRequest() { const userId = Object.keys(this._pendingKeyRequests)[0]; if (!userId) { @@ -61,7 +102,8 @@ export default class KeyRequestHandler { console.log(`Starting KeyShareDialog for ${userId}:${deviceId}`); const finished = (r) => { - this._isDialogOpen = false; + this._currentUser = null; + this._currentDevice = null; if (r) { for (const req of this._pendingKeyRequests[userId][deviceId]) { @@ -83,7 +125,8 @@ export default class KeyRequestHandler { deviceId: deviceId, onFinished: finished, }); - this._isDialogOpen = true; + this._currentUser = userId; + this._currentDevice = deviceId; } } diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 544213edc6..afb3c57818 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -920,6 +920,9 @@ module.exports = React.createClass({ cli.on("crypto.roomKeyRequest", (req) => { krh.handleKeyRequest(req); }); + cli.on("crypto.roomKeyRequestCancellation", (req) => { + krh.handleKeyRequestCancellation(req); + }); }, showScreen: function(screen, params) { From 21277557f80a725ac0ee0175633d198ecbae263a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 2 Jun 2017 10:10:40 +0100 Subject: [PATCH 026/252] Add translations for new dialog --- src/i18n/strings/en_EN.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 95baf1f50e..6e7648f00d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -779,5 +779,10 @@ "Disable URL previews for this room (affects only you)": "Disable URL previews for this room (affects only you)", "$senderDisplayName changed the room avatar to ": "$senderDisplayName changed the room avatar to ", "%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s removed the room avatar.", - "%(senderDisplayName)s changed the avatar for %(roomName)s": "%(senderDisplayName)s changed the avatar for %(roomName)s" + "%(senderDisplayName)s changed the avatar for %(roomName)s": "%(senderDisplayName)s changed the avatar for %(roomName)s", + "Start verification": "Start verification", + "Share without verifying": "Share without verifying", + "Ignore request": "Ignore request", + "You added a new device '%(displayName)s', which is requesting encryption keys.": "You added a new device '%(displayName)s', which is requesting encryption keys.", + "Your unverified device '%(displayName)s' is requesting encryption keys.": "Your unverified device '%(displayName)s' is requesting encryption keys." } From 0f4dc5c0725ca92179b556a0cff4831a5d20d20d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 3 Jun 2017 15:10:05 +0100 Subject: [PATCH 027/252] first iter of manual update control Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/LoggedInView.js | 13 +++++++------ src/components/structures/MatrixChat.js | 5 +++++ src/components/structures/UserSettings.js | 23 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index e2fdeb4687..f42c752bb9 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -182,6 +182,7 @@ export default React.createClass({ const MatrixToolbar = sdk.getComponent('globals.MatrixToolbar'); const GuestWarningBar = sdk.getComponent('globals.GuestWarningBar'); const NewVersionBar = sdk.getComponent('globals.NewVersionBar'); + const UpdateCheckBar = sdk.getComponent('globals.UpdateCheckBar'); let page_element; let right_panel = ''; @@ -249,16 +250,16 @@ export default React.createClass({ break; } - var topBar; + let topBar; if (this.props.hasNewVersion) { topBar = ; - } - else if (this.props.matrixClient.isGuest()) { + } else if (this.props.checkingForUpdate) { + topBar = ; + } else if (this.props.matrixClient.isGuest()) { topBar = ; - } - else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) { + } else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) { topBar = ; } diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 0dedc02270..706f7d35dd 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -127,6 +127,7 @@ module.exports = React.createClass({ newVersion: null, hasNewVersion: false, newVersionReleaseNotes: null, + checkingForUpdate: false, // The username to default to when upgrading an account from a guest upgradeUsername: null, @@ -527,6 +528,9 @@ module.exports = React.createClass({ payload.releaseNotes, ); break; + case 'check_updates': + this.setState({ checkingForUpdate: payload.value }); + break; } }, @@ -1107,6 +1111,7 @@ module.exports = React.createClass({ newVersion: latest, hasNewVersion: current !== latest, newVersionReleaseNotes: releaseNotes, + checkingForUpdate: false, }); }, diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 89debcb461..e914f64859 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -854,6 +854,27 @@ module.exports = React.createClass({ ; }, + _onCheckUpdates: function() { + dis.dispatch({ + action: 'check_updates', + value: true, + }); + }, + + _renderCheckUpdate: function() { + const platform = PlatformPeg.get(); + if ('canSelfUpdate' in platform && platform.canSelfUpdate()) { + return
+

Updates

+
+ + Check for update + +
+
; + } + }, + _renderBulkOptions: function() { const invitedRooms = MatrixClientPeg.get().getRooms().filter((r) => { return r.hasMembershipState(this._me, "invite"); @@ -1246,6 +1267,8 @@ module.exports = React.createClass({ + {this._renderCheckUpdate()} + {this._renderClearCache()} {this._renderDeactivateAccount()} From 98e99d542b6bdbd0818ba9d92512dee93571b254 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sat, 3 Jun 2017 15:48:33 +0100 Subject: [PATCH 028/252] i18n things Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 6 +++--- src/i18n/strings/en_EN.json | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index e914f64859..5af1ed42c6 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -865,10 +865,10 @@ module.exports = React.createClass({ const platform = PlatformPeg.get(); if ('canSelfUpdate' in platform && platform.canSelfUpdate()) { return
-

Updates

+

{_t('Updates')}

- - Check for update + + {_t('Check for update')}
; diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 92c6b74444..b9f3c6b36d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -822,6 +822,8 @@ "Online": "Online", "Idle": "Idle", "Offline": "Offline", + "Updates": "Updates", + "Check for update": "Check for update", "Disable URL previews for this room (affects only you)": "Disable URL previews for this room (affects only you)", "$senderDisplayName changed the room avatar to ": "$senderDisplayName changed the room avatar to ", "%(senderDisplayName)s removed the room avatar.": "%(senderDisplayName)s removed the room avatar.", From 7a9784fd6ef39e4fc214e8416456b9d92cb9f7e8 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 5 Jun 2017 17:26:25 +0100 Subject: [PATCH 029/252] KeyRequestHandler: clear redundant users/devices on cancellations ... otherwise _processNextRequest will get confused --- src/KeyRequestHandler.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/KeyRequestHandler.js b/src/KeyRequestHandler.js index fbb869d468..4354fba269 100644 --- a/src/KeyRequestHandler.js +++ b/src/KeyRequestHandler.js @@ -88,6 +88,12 @@ export default class KeyRequestHandler { } console.log("Forgetting room key request"); requests.splice(idx, 1); + if (requests.length === 0) { + delete this._pendingKeyRequests[userId][deviceId]; + if (Object.keys(this._pendingKeyRequests[userId]).length === 0) { + delete this._pendingKeyRequests[userId]; + } + } } _processNextRequest() { From 32e3ea0601355fc366fddee43194f9c7b1492238 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 5 Jun 2017 17:58:11 +0100 Subject: [PATCH 030/252] Address review comments --- src/KeyRequestHandler.js | 4 ++-- src/components/views/dialogs/KeyShareDialog.js | 10 +++++++++- src/i18n/strings/en_EN.json | 4 +++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/KeyRequestHandler.js b/src/KeyRequestHandler.js index 4354fba269..1da4922153 100644 --- a/src/KeyRequestHandler.js +++ b/src/KeyRequestHandler.js @@ -26,7 +26,7 @@ export default class KeyRequestHandler { this._currentDevice = null; // userId -> deviceId -> [keyRequest] - this._pendingKeyRequests = {}; + this._pendingKeyRequests = Object.create(null); } handleKeyRequest(keyRequest) { @@ -35,7 +35,7 @@ export default class KeyRequestHandler { const requestId = keyRequest.requestId; if (!this._pendingKeyRequests[userId]) { - this._pendingKeyRequests[userId] = {}; + this._pendingKeyRequests[userId] = Object.create(null); } if (!this._pendingKeyRequests[userId][deviceId]) { this._pendingKeyRequests[userId][deviceId] = []; diff --git a/src/components/views/dialogs/KeyShareDialog.js b/src/components/views/dialogs/KeyShareDialog.js index 5b66944dbc..61391d281c 100644 --- a/src/components/views/dialogs/KeyShareDialog.js +++ b/src/components/views/dialogs/KeyShareDialog.js @@ -20,6 +20,14 @@ import sdk from '../../../index'; import { _t } from '../../../languageHandler'; +/** + * Dialog which asks the user whether they want to share their keys with + * an unverified device. + * + * onFinished is called with `true` if the key should be shared, `false` if it + * should not, and `undefined` if the dialog is cancelled. (In other words: + * truthy: do the key share. falsy: don't share the keys). + */ export default React.createClass({ propTypes: { matrixClient: React.PropTypes.object.isRequired, @@ -155,7 +163,7 @@ export default React.createClass({ return ( {content} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 7421ccad76..f6c044deac 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -809,5 +809,7 @@ "Share without verifying": "Share without verifying", "Ignore request": "Ignore request", "You added a new device '%(displayName)s', which is requesting encryption keys.": "You added a new device '%(displayName)s', which is requesting encryption keys.", - "Your unverified device '%(displayName)s' is requesting encryption keys.": "Your unverified device '%(displayName)s' is requesting encryption keys." + "Your unverified device '%(displayName)s' is requesting encryption keys.": "Your unverified device '%(displayName)s' is requesting encryption keys.", + "Encryption key request": "Encryption key request" + } From 3d59d72aaa4a8128b82c1d9d999b5bb3a3a6b71a Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Wed, 7 Jun 2017 04:49:41 +0100 Subject: [PATCH 031/252] Fixed pagination infinite loop caused by long messages Signed-off-by: Oliver Hunt --- src/components/structures/ScrollPanel.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index a652bcc827..f035efee92 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -352,13 +352,14 @@ module.exports = React.createClass({ const tile = tiles[backwards ? i : tiles.length - 1 - i]; // Subtract height of tile as if it were unpaginated excessHeight -= tile.clientHeight; + //If removing the tile would lead to future pagination, break before setting scroll token + if (tile.clientHeight > excessHeight) { + break; + } // The tile may not have a scroll token, so guard it if (tile.dataset.scrollTokens) { markerScrollToken = tile.dataset.scrollTokens.split(',')[0]; } - if (tile.clientHeight > excessHeight) { - break; - } } if (markerScrollToken) { From 6ead97c7a6979bda915dc09aae23924b22f639b3 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 11 Jun 2017 19:12:40 +0100 Subject: [PATCH 032/252] change interface to UpdateCheckBar and change launching mechanism Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/LoggedInView.js | 2 +- src/components/structures/MatrixChat.js | 4 ++-- src/components/structures/UserSettings.js | 11 ++--------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index f42c752bb9..f916e28024 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -256,7 +256,7 @@ export default React.createClass({ releaseNotes={this.props.newVersionReleaseNotes} />; } else if (this.props.checkingForUpdate) { - topBar = ; + topBar = ; } else if (this.props.matrixClient.isGuest()) { topBar = ; } else if (Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) { diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 706f7d35dd..6294201e13 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -127,7 +127,7 @@ module.exports = React.createClass({ newVersion: null, hasNewVersion: false, newVersionReleaseNotes: null, - checkingForUpdate: false, + checkingForUpdate: null, // The username to default to when upgrading an account from a guest upgradeUsername: null, @@ -1111,7 +1111,7 @@ module.exports = React.createClass({ newVersion: latest, hasNewVersion: current !== latest, newVersionReleaseNotes: releaseNotes, - checkingForUpdate: false, + checkingForUpdate: null, }); }, diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 5af1ed42c6..a2d9df4900 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -854,20 +854,13 @@ module.exports = React.createClass({ ; }, - _onCheckUpdates: function() { - dis.dispatch({ - action: 'check_updates', - value: true, - }); - }, - _renderCheckUpdate: function() { const platform = PlatformPeg.get(); - if ('canSelfUpdate' in platform && platform.canSelfUpdate()) { + if ('canSelfUpdate' in platform && platform.canSelfUpdate() && 'startUpdateCheck' in platform) { return

{_t('Updates')}

- + {_t('Check for update')}
From ccad1013a71161df34870346d8292b43425979ce Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 11 Jun 2017 23:42:22 +0100 Subject: [PATCH 033/252] don't return null in case it breaks things Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 52e2c7b0e4..7edeafe889 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -863,6 +863,7 @@ module.exports = React.createClass({
; } + return
; }, _renderBulkOptions: function() { From 4124a8dcffe40287c3c2537d7cc2bbe3713d1f7a Mon Sep 17 00:00:00 2001 From: Oliver Hunt Date: Mon, 12 Jun 2017 06:19:12 +0100 Subject: [PATCH 034/252] Save scroll state immediately before updating Signed-off-by: Oliver Hunt --- src/components/structures/ScrollPanel.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index a652bcc827..1f324d059f 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -160,6 +160,10 @@ module.exports = React.createClass({ this.checkFillState(); }, + componentWillUpdate: function(nextProps, nextState) { + this._saveScrollState(); + }, + componentDidUpdate: function() { // after adding event tiles, we may need to tweak the scroll (either to // keep at the bottom of the timeline, or to maintain the view after From a6cdab81074c092abbe800b3af7d80e2d2265e9c Mon Sep 17 00:00:00 2001 From: Tom Tryfonidis Date: Tue, 13 Jun 2017 10:44:25 +0000 Subject: [PATCH 035/252] Translated using Weblate (Greek) Currently translated at 96.0% (868 of 904 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/el/ --- src/i18n/strings/el.json | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/i18n/strings/el.json b/src/i18n/strings/el.json index b4ec26f722..e757c05f81 100644 --- a/src/i18n/strings/el.json +++ b/src/i18n/strings/el.json @@ -34,7 +34,7 @@ "Account": "Λογαριασμός", "Add a topic": "Προσθήκη θέματος", "Add email address": "Προσθήκη διεύθυνσης ηλ. αλληλογραφίας", - "Add phone number": "Προσθήκη αριθμού τηλεφώνου", + "Add phone number": "Προσθήκη αριθμού", "Admin": "Διαχειριστής", "VoIP": "VoIP", "No Microphones detected": "Δεν εντοπίστηκε μικρόφωνο", @@ -180,7 +180,7 @@ "%(names)s and %(lastPerson)s are typing": "%(names)s και %(lastPerson)s γράφουν", "%(names)s and one other are typing": "%(names)s και ένας ακόμα γράφουν", "%(names)s and %(count)s others are typing": "%(names)s και %(count)s άλλοι γράφουν", - "Anyone who knows the room's link, including guests": "Οποιοσδήποτε γνωρίζει τον σύνδεσμο του δωματίου, συμπεριλαμβάνωντας τους επισκέπτες", + "Anyone who knows the room's link, including guests": "Οποιοσδήποτε γνωρίζει τον σύνδεσμο του δωματίου, συμπεριλαμβανομένων των επισκεπτών", "Blacklisted": "Στη μαύρη λίστα", "Can't load user settings": "Δεν είναι δυνατή η φόρτωση των ρυθμίσεων χρήστη", "Change Password": "Αλλαγή κωδικού πρόσβασης", @@ -188,8 +188,8 @@ "%(senderName)s changed their profile picture.": "Ο %(senderName)s άλλαξε τη φωτογραφία του προφίλ του.", "%(senderDisplayName)s changed the room name to %(roomName)s.": "Ο %(senderDisplayName)s άλλαξε το όνομα του δωματίου σε %(roomName)s.", "%(senderDisplayName)s changed the topic to \"%(topic)s\".": "Ο %(senderDisplayName)s άλλαξε το θέμα σε \"%(topic)s\".", - "Clear Cache and Reload": "Καθάρισε την μνήμη και Ανανέωσε", - "Clear Cache": "Καθάρισε την μνήμη", + "Clear Cache and Reload": "Εκκαθάριση μνήμης και ανανέωση", + "Clear Cache": "Εκκαθάριση μνήμης", "Bans user with given id": "Αποκλεισμός χρήστη με το συγκεκριμένο αναγνωριστικό", "%(senderDisplayName)s removed the room name.": "Ο %(senderDisplayName)s διέγραψε το όνομα του δωματίου.", "Changes your display nickname": "Αλλάζει το ψευδώνυμο χρήστη", @@ -232,7 +232,7 @@ "Email address (optional)": "Ηλεκτρονική διεύθυνση (προαιρετικό)", "Email, name or matrix ID": "Ηλεκτρονική διεύθυνση, όνομα ή matrix ID", "Emoji": "Εικονίδια", - "enabled": "ενεργό", + "enabled": "ενεργή", "Encrypted messages will not be visible on clients that do not yet implement encryption": "Τα κρυπτογραφημένα μηνύματα δεν θα είναι ορατά σε εφαρμογές που δεν παρέχουν τη δυνατότητα κρυπτογράφησης", "Encrypted room": "Κρυπτογραφημένο δωμάτιο", "%(senderName)s ended the call.": "%(senderName)s τερμάτισε την κλήση.", @@ -275,7 +275,7 @@ "Incorrect username and/or password.": "Λανθασμένο όνομα χρήστη και/ή κωδικός.", "Incorrect verification code": "Λανθασμένος κωδικός επαλήθευσης", "Interface Language": "Γλώσσα διεπαφής", - "Invalid Email Address": "Μη έγκυρη διεύθυνση ηλ. αλληλογραφίας", + "Invalid Email Address": "Μη έγκυρη διεύθυνση ηλεκτρονικής αλληλογραφίας", "Invite new room members": "Προσκαλέστε νέα μέλη", "Invited": "Προσκλήθηκε", "Invites": "Προσκλήσεις", @@ -284,7 +284,7 @@ "Sign in with": "Συνδεθείτε με", "joined and left": "συνδέθηκε και έφυγε", "joined": "συνδέθηκε", - "%(targetName)s joined the room.": "ο χρήστης %(targetName)s συνδέθηκε στο δωμάτιο.", + "%(targetName)s joined the room.": "ο %(targetName)s συνδέθηκε στο δωμάτιο.", "Jump to first unread message.": "Πηγαίνετε στο πρώτο μη αναγνωσμένο μήνυμα.", "%(senderName)s kicked %(targetName)s.": "Ο %(senderName)s έδιωξε τον χρήστη %(targetName)s.", "Kick": "Διώξε", @@ -297,12 +297,12 @@ "Level": "Επίπεδο", "List this room in %(domain)s's room directory?": "Να εμφανίζεται το δωμάτιο στο γενικό ευρετήριο του διακομιστή %(domain)s;", "Local addresses for this room:": "Τοπική διεύθυνση για το δωμάτιο:", - "Logged in as:": "Συνδέθηκες ως:", + "Logged in as:": "Συνδεθήκατε ως:", "Login as guest": "Σύνδεση ως επισκέπτης", "Logout": "Αποσύνδεση", "Low priority": "Χαμηλής προτεραιότητας", - "matrix-react-sdk version:": "έκδοση matrix-react-sdk:", - "Members only": "Μέλη μόνο", + "matrix-react-sdk version:": "Έκδοση matrix-react-sdk:", + "Members only": "Μόνο μέλη", "Message not sent due to unknown devices being present": "Το μήνυμα δεν στάλθηκε γιατί υπάρχουν άγνωστες συσκευές", "Mobile phone number": "Αριθμός κινητού τηλεφώνου", "Click here to fix": "Κάνε κλικ εδώ για διόρθωση", @@ -342,8 +342,8 @@ "Rooms": "Δωμάτια", "Save": "Αποθήκευση", "Search failed": "Η αναζήτηση απέτυχε", - "Send an encrypted message": "Στείλε ένα κρυπτογραφημένο μήνυμα", - "Send a message (unencrypted)": "Στείλε ένα μήνυμα (απλό)", + "Send an encrypted message": "Στείλτε ένα κρυπτογραφημένο μήνυμα", + "Send a message (unencrypted)": "Στείλτε ένα μήνυμα (μη κρυπτογραφημένο)", "sent an image": "έστειλε μια εικόνα", "sent a video": "έστειλε ένα βίντεο", "Server error": "Σφάλμα διακομιστή", @@ -472,7 +472,7 @@ "The file '%(fileName)s' failed to upload": "Απέτυχε η αποστολή του αρχείου '%(fileName)s'", "There was a problem logging in.": "Υπήρξε ένα πρόβλημα κατά την σύνδεση.", "This room has no local addresses": "Αυτό το δωμάτιο δεν έχει τοπικές διευθύνσεις", - "This doesn't appear to be a valid email address": "Δεν μοιάζει με μια έγκυρη διεύθυνση ηλ. αλληλογραφίας", + "This doesn't appear to be a valid email address": "Δεν μοιάζει με μια έγκυρη διεύθυνση ηλεκτρονικής αλληλογραφίας", "This phone number is already in use": "Αυτός ο αριθμός τηλεφώνου είναι ήδη σε χρήση", "This room": "Αυτό το δωμάτιο", "This room's internal ID is": "Το εσωτερικό αναγνωριστικό του δωματίου είναι", @@ -514,7 +514,7 @@ "Upload file": "Αποστολή αρχείου", "Upload new:": "Αποστολή νέου:", "Usage": "Χρήση", - "Use with caution": "Να χρησιμοποιείται με προσοχή", + "Use with caution": "Χρησιμοποιήστε τα με προσοχή", "User ID": "Αναγνωριστικό χρήστη", "User Interface": "Διεπαφή χρήστη", "%(user)s is a": "Ο %(user)s είναι", @@ -602,7 +602,7 @@ "Device name": "Όνομα συσκευής", "Device Name": "Όνομα συσκευής", "Device key": "Κλειδί συσκευής", - "Verify device": "Επαλήθευση συσκευής", + "Verify device": "Επιβεβαίωση συσκευής", "Unable to restore session": "Αδυναμία επαναφοράς συνεδρίας", "Continue anyway": "Συνέχεια οπωσδήποτε", "Unknown devices": "Άγνωστες συσκευές", @@ -628,7 +628,7 @@ "Error decrypting video": "Σφάλμα κατά την αποκρυπτογράφηση του βίντεο", "Add an Integration": "Προσθήκη ενσωμάτωσης", "URL Previews": "Προεπισκόπηση συνδέσμων", - "Enable URL previews for this room (affects only you)": "Ενεργοποίηση της προεπισκόπησης συνδέσμων γι' αυτό το δωμάτιο (επηρεάζει μόνο εσάς)", + "Enable URL previews for this room (affects only you)": "Ενεργοποίηση της προεπισκόπησης συνδέσμων για αυτό το δωμάτιο (επηρεάζει μόνο εσάς)", "Drop file here to upload": "Αποθέστε εδώ για αποστολή", "for %(amount)ss": "για %(amount)ss", "for %(amount)sm": "για %(amount)sm", @@ -680,7 +680,7 @@ "Never send encrypted messages to unverified devices from this device": "Να μη γίνει ποτέ αποστολή κρυπτογραφημένων μηνυμάτων σε ανεπιβεβαίωτες συσκευές από αυτή τη συσκευή", "Never send encrypted messages to unverified devices in this room": "Να μη γίνει ποτέ αποστολή κρυπτογραφημένων μηνυμάτων σε ανεπιβεβαίωτες συσκευές σε αυτό το δωμάτιο", "Never send encrypted messages to unverified devices in this room from this device": "Να μη γίνει ποτέ αποστολή κρυπτογραφημένων μηνυμάτων σε ανεπιβεβαίωτες συσκευές, σε αυτό το δωμάτιο, από αυτή τη συσκευή", - "New Composer & Autocomplete": "Νέος συνθέτης και αυτόματη συμπλήρωση", + "New Composer & Autocomplete": "Νέος επεξεργαστής κειμένου και αυτόματη συμπλήρωση", "not set": "δεν έχει οριστεί", "not specified": "μη καθορισμένο", "NOT verified": "ΧΩΡΙΣ επαλήθευση", @@ -785,7 +785,7 @@ "You are registering with %(SelectedTeamName)s": "Εγγραφείτε με %(SelectedTeamName)s", "Removed or unknown message type": "Αφαιρέθηκε ή άγνωστος τύπος μηνύματος", "Disable URL previews by default for participants in this room": "Απενεργοποίηση της προεπισκόπησης συνδέσμων για όλους τους συμμετέχοντες στο δωμάτιο", - "Disable URL previews for this room (affects only you)": "Ενεργοποίηση της προεπισκόπησης συνδέσμων για αυτό το δωμάτιο (επηρεάζει μόνο εσάς)", + "Disable URL previews for this room (affects only you)": "Απενεργοποίηση της προεπισκόπησης συνδέσμων για αυτό το δωμάτιο (επηρεάζει μόνο εσάς)", " (unsupported)": " (μη υποστηριζόμενο)", "$senderDisplayName changed the room avatar to ": "Ο $senderDisplayName άλλαξε την εικόνα του δωματίου σε ", "Missing Media Permissions, click here to request.": "Λείπουν τα δικαιώματα πολύμεσων, κάντε κλικ για να ζητήσετε.", From 70fd9b0283d70d572ebad6346a1fc6a559cb2d79 Mon Sep 17 00:00:00 2001 From: Krombel Date: Tue, 13 Jun 2017 11:01:17 +0000 Subject: [PATCH 036/252] Translated using Weblate (German) Currently translated at 100.0% (904 of 904 strings) Translation: Riot Web/matrix-react-sdk Translate-URL: https://translate.riot.im/projects/riot-web/matrix-react-sdk/de/ --- src/i18n/strings/de_DE.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/i18n/strings/de_DE.json b/src/i18n/strings/de_DE.json index 78a71e8de6..06d0408728 100644 --- a/src/i18n/strings/de_DE.json +++ b/src/i18n/strings/de_DE.json @@ -615,8 +615,8 @@ "%(actionVerb)s this person?": "Diese Person %(actionVerb)s?", "This room has no local addresses": "Dieser Raum hat keine lokale Adresse", "This room is private or inaccessible to guests. You may be able to join if you register": "Dieser Raum ist privat oder für Gäste nicht zugänglich. Du kannst jedoch eventuell beitreten, wenn du dich registrierst", - "Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.": "Versuchte einen spezifischen Punkt in der Raum-Chronik zu laden, aber du hast keine Berechtigung die angeforderte Nachricht anzuzeigen.", - "Tried to load a specific point in this room's timeline, but was unable to find it.": "Der Versuch, einen spezifischen Punkt im Chatverlauf zu laden, ist fehlgeschlagen. Der Punkt konnte nicht gefunden werden.", + "Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.": "Es wurde versucht, einen bestimmten Punkt im Chatverlauf dieses Raumes zu laden. Dir fehlt jedoch die Berechtigung, die betreffende Nachricht zu sehen.", + "Tried to load a specific point in this room's timeline, but was unable to find it.": "Es wurde versucht, einen bestimmten Punkt im Chatverlauf dieses Raumes zu laden, der Punkt konnte jedoch nicht gefunden werden.", "Turn Markdown off": "Markdown deaktiveren", "Turn Markdown on": "Markdown einschalten", "Unable to load device list": "Geräteliste konnte nicht geladen werden", @@ -885,8 +885,6 @@ "Failed to fetch avatar URL": "Abrufen der Avatar-URL fehlgeschlagen", "The phone number entered looks invalid": "Die eingegebene Telefonnummer scheint ungültig zu sein", "This room is private or inaccessible to guests. You may be able to join if you register.": "Dieser Raum ist privat oder für Gäste nicht betretbar. Du kannst evtl. beitreten wenn du dich registrierst.", - "Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.": "Es wurde versucht, einen bestimmten Punkt im Chatverlauf dieses Raumes zu laden. Dir fehlt jedoch die Berechtigung, die betreffende Nachricht zu sehen.", - "Tried to load a specific point in this room's timeline, but was unable to find it.": "Es wurde versucht, einen bestimmten Punkt im Chatverlauf dieses Raumes zu laden, der Punkt konnte jedoch nicht gefunden werden.", "Uploading %(filename)s and %(count)s others.zero": "%(filename)s wird hochgeladen", "Uploading %(filename)s and %(count)s others.one": "%(filename)s und %(count)s weitere Dateien werden hochgeladen", "Uploading %(filename)s and %(count)s others.other": "%(filename)s und %(count)s weitere Dateien werden hochgeladen", @@ -967,5 +965,12 @@ "Your home server does not support device management.": "Dein Heimserver unterstützt kein Geräte-Management.", "(~%(count)s results).one": "(~%(count)s Ergebnis)", "(~%(count)s results).other": "(~%(count)s Ergebnis)", - "Device Name": "Geräte-Name" + "Device Name": "Geräte-Name", + "(could not connect media)": "(Medienverbindung nicht herstellbar)", + "(no answer)": "(keine Antwort)", + "(unknown failure: %(reason)s)": "(unbekannter Fehler: %(reason)s)", + "Your browser does not support the required cryptography extensions": "Dein Browser unterstützt die benötigten Kryptografie-Erweiterungen nicht", + "Not a valid Riot keyfile": "Keine valide Riot-Schlüsseldatei", + "Authentication check failed: incorrect password?": "Authentifizierung fehlgeschlagen: Falsches Passwort?", + "Disable Peer-to-Peer for 1:1 calls": "Deaktiviere direkte Verbindung für 1-zu-1-Anrufe" } From 939f6d07984cd51241357a5e61bf76bd46179fcf Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 13 Jun 2017 12:46:49 +0100 Subject: [PATCH 037/252] Factor createMatrixClient out from MatrixClientPeg ... so that it can be used elsewhere. --- src/MatrixClientPeg.js | 21 ++----------- src/utils/createMatrixClient.js | 55 +++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 19 deletions(-) create mode 100644 src/utils/createMatrixClient.js diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index 94e55a8d8a..47370e2142 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -16,12 +16,10 @@ limitations under the License. 'use strict'; -import Matrix from 'matrix-js-sdk'; import utils from 'matrix-js-sdk/lib/utils'; import EventTimeline from 'matrix-js-sdk/lib/models/event-timeline'; import EventTimelineSet from 'matrix-js-sdk/lib/models/event-timeline-set'; - -const localStorage = window.localStorage; +import createMatrixClient from './utils/createMatrixClient'; interface MatrixClientCreds { homeserverUrl: string, @@ -129,22 +127,7 @@ class MatrixClientPeg { timelineSupport: true, }; - if (localStorage) { - opts.sessionStore = new Matrix.WebStorageSessionStore(localStorage); - } - if (window.indexedDB && localStorage) { - // FIXME: bodge to remove old database. Remove this after a few weeks. - window.indexedDB.deleteDatabase("matrix-js-sdk:default"); - - opts.store = new Matrix.IndexedDBStore({ - indexedDB: window.indexedDB, - dbName: "riot-web-sync", - localStorage: localStorage, - workerScript: this.indexedDbWorkerScript, - }); - } - - this.matrixClient = Matrix.createClient(opts); + this.matrixClient = createMatrixClient(opts); // we're going to add eventlisteners for each matrix event tile, so the // potential number of event listeners is quite high. diff --git a/src/utils/createMatrixClient.js b/src/utils/createMatrixClient.js new file mode 100644 index 0000000000..5effd63f2a --- /dev/null +++ b/src/utils/createMatrixClient.js @@ -0,0 +1,55 @@ +/* +Copyright 2017 Vector Creations Ltd + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import Matrix from 'matrix-js-sdk'; + +const localStorage = window.localStorage; + +/** + * Create a new matrix client, with the persistent stores set up appropriately + * (using localstorage/indexeddb, etc) + * + * @param {Object} opts options to pass to Matrix.createClient. This will be + * extended with `sessionStore` and `store` members. + * + * @param {string} indexedDbWorkerScript Optional URL for a web worker script + * for IndexedDB store operations. If not given, indexeddb ops are done on + * the main thread. + * + * @returns {MatrixClient} the newly-created MatrixClient + */ +export default function createMatrixClient(opts, indexedDbWorkerScript) { + const storeOpts = {}; + + if (localStorage) { + storeOpts.sessionStore = new Matrix.WebStorageSessionStore(localStorage); + } + if (window.indexedDB && localStorage) { + // FIXME: bodge to remove old database. Remove this after a few weeks. + window.indexedDB.deleteDatabase("matrix-js-sdk:default"); + + storeOpts.store = new Matrix.IndexedDBStore({ + indexedDB: window.indexedDB, + dbName: "riot-web-sync", + localStorage: localStorage, + workerScript: indexedDbWorkerScript, + }); + } + + opts = Object.assign(storeOpts, opts); + + return Matrix.createClient(opts); +} From 68e1a7be7424d2d43caf71f5e5c05d52b9e7c07a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 31 May 2017 17:28:46 +0100 Subject: [PATCH 038/252] Clear persistent storage on login and logout Make sure that we don't end up with sensitive data sitting around in the stores from a previous session. --- src/Lifecycle.js | 107 +++++++++++++++--------- src/components/structures/MatrixChat.js | 2 + 2 files changed, 71 insertions(+), 38 deletions(-) diff --git a/src/Lifecycle.js b/src/Lifecycle.js index 54014a0166..9b806ba8b7 100644 --- a/src/Lifecycle.js +++ b/src/Lifecycle.js @@ -19,6 +19,7 @@ import q from 'q'; import Matrix from 'matrix-js-sdk'; import MatrixClientPeg from './MatrixClientPeg'; +import createMatrixClient from './utils/createMatrixClient'; import Analytics from './Analytics'; import Notifier from './Notifier'; import UserActivity from './UserActivity'; @@ -48,7 +49,7 @@ import { _t } from './languageHandler'; * * 4. it attempts to auto-register as a guest user. * - * If any of steps 1-4 are successful, it will call {setLoggedIn}, which in + * If any of steps 1-4 are successful, it will call {_doSetLoggedIn}, which in * turn will raise on_logged_in and will_start_client events. * * @param {object} opts @@ -105,14 +106,13 @@ export function loadSession(opts) { fragmentQueryParams.guest_access_token ) { console.log("Using guest access credentials"); - setLoggedIn({ + return _doSetLoggedIn({ userId: fragmentQueryParams.guest_user_id, accessToken: fragmentQueryParams.guest_access_token, homeserverUrl: guestHsUrl, identityServerUrl: guestIsUrl, guest: true, - }); - return q(); + }, true); } return _restoreFromLocalStorage().then((success) => { @@ -141,14 +141,14 @@ function _loginWithToken(queryParams, defaultDeviceDisplayName) { }, ).then(function(data) { console.log("Logged in with token"); - setLoggedIn({ + return _doSetLoggedIn({ userId: data.user_id, deviceId: data.device_id, accessToken: data.access_token, homeserverUrl: queryParams.homeserver, identityServerUrl: queryParams.identityServer, guest: false, - }); + }, true); }, (err) => { console.error("Failed to log in with login token: " + err + " " + err.data); @@ -172,14 +172,14 @@ function _registerAsGuest(hsUrl, isUrl, defaultDeviceDisplayName) { }, }).then((creds) => { console.log("Registered as guest: %s", creds.user_id); - setLoggedIn({ + return _doSetLoggedIn({ userId: creds.user_id, deviceId: creds.device_id, accessToken: creds.access_token, homeserverUrl: hsUrl, identityServerUrl: isUrl, guest: true, - }); + }, true); }, (err) => { console.error("Failed to register as guest: " + err + " " + err.data); }); @@ -216,15 +216,14 @@ function _restoreFromLocalStorage() { if (accessToken && userId && hsUrl) { console.log("Restoring session for %s", userId); try { - setLoggedIn({ + return _doSetLoggedIn({ userId: userId, deviceId: deviceId, accessToken: accessToken, homeserverUrl: hsUrl, identityServerUrl: isUrl, guest: isGuest, - }); - return q(true); + }, false).then(() => true); } catch (e) { return _handleRestoreFailure(e); } @@ -245,7 +244,7 @@ function _handleRestoreFailure(e) { + ' This is a once off; sorry for the inconvenience.', ); - _clearLocalStorage(); + _clearStorage(); return q.reject(new Error( _t('Unable to restore previous session') + ': ' + msg, @@ -266,7 +265,7 @@ function _handleRestoreFailure(e) { return def.promise.then((success) => { if (success) { // user clicked continue. - _clearLocalStorage(); + _clearStorage(); return false; } @@ -281,13 +280,32 @@ export function initRtsClient(url) { } /** - * Transitions to a logged-in state using the given credentials + * Transitions to a logged-in state using the given credentials. + * + * Starts the matrix client and all other react-sdk services that + * listen for events while a session is logged in. + * + * Also stops the old MatrixClient and clears old credentials/etc out of + * storage before starting the new client. + * * @param {MatrixClientCreds} credentials The credentials to use */ export function setLoggedIn(credentials) { - credentials.guest = Boolean(credentials.guest); + stopMatrixClient(); + _doSetLoggedIn(credentials, true); +} - Analytics.setGuest(credentials.guest); +/** + * fires on_logging_in, optionally clears localstorage, persists new credentials + * to localstorage, starts the new client. + * + * @param {MatrixClientCreds} credentials + * @param {Boolean} clearStorage + * + * returns a Promise which resolves once the client has been started + */ +async function _doSetLoggedIn(credentials, clearStorage) { + credentials.guest = Boolean(credentials.guest); console.log( "setLoggedIn: mxid:", credentials.userId, @@ -295,12 +313,19 @@ export function setLoggedIn(credentials) { "guest:", credentials.guest, "hs:", credentials.homeserverUrl, ); + // This is dispatched to indicate that the user is still in the process of logging in // because `teamPromise` may take some time to resolve, breaking the assumption that // `setLoggedIn` takes an "instant" to complete, and dispatch `on_logged_in` a few ms // later than MatrixChat might assume. dis.dispatch({action: 'on_logging_in'}); + if (clearStorage) { + await _clearStorage(); + } + + Analytics.setGuest(credentials.guest); + // Resolves by default let teamPromise = Promise.resolve(null); @@ -349,9 +374,6 @@ export function setLoggedIn(credentials) { console.warn("No local storage available: can't persist session!"); } - // stop any running clients before we create a new one with these new credentials - stopMatrixClient(); - MatrixClientPeg.replaceUsingCreds(credentials); teamPromise.then((teamToken) => { @@ -400,7 +422,7 @@ export function logout() { * Starts the matrix client and all other react-sdk services that * listen for events while a session is logged in. */ -export function startMatrixClient() { +function startMatrixClient() { // dispatch this before starting the matrix client: it's used // to add listeners for the 'sync' event so otherwise we'd have // a race condition (and we need to dispatch synchronously for this @@ -416,34 +438,44 @@ export function startMatrixClient() { } /* - * Stops a running client and all related services, used after - * a session has been logged out / ended. + * Stops a running client and all related services, and clears persistent + * storage. Used after a session has been logged out. */ export function onLoggedOut() { - _clearLocalStorage(); stopMatrixClient(); + _clearStorage().done(); dis.dispatch({action: 'on_logged_out'}); } -function _clearLocalStorage() { +/** + * @returns {Promise} promise which resolves once the stores have been cleared + */ +function _clearStorage() { Analytics.logout(); - if (!window.localStorage) { - return; - } - const hsUrl = window.localStorage.getItem("mx_hs_url"); - const isUrl = window.localStorage.getItem("mx_is_url"); - window.localStorage.clear(); - // preserve our HS & IS URLs for convenience - // N.B. we cache them in hsUrl/isUrl and can't really inline them - // as getCurrentHsUrl() may call through to localStorage. - // NB. We do clear the device ID (as well as all the settings) - if (hsUrl) window.localStorage.setItem("mx_hs_url", hsUrl); - if (isUrl) window.localStorage.setItem("mx_is_url", isUrl); + if (window.localStorage) { + const hsUrl = window.localStorage.getItem("mx_hs_url"); + const isUrl = window.localStorage.getItem("mx_is_url"); + window.localStorage.clear(); + + // preserve our HS & IS URLs for convenience + // N.B. we cache them in hsUrl/isUrl and can't really inline them + // as getCurrentHsUrl() may call through to localStorage. + // NB. We do clear the device ID (as well as all the settings) + if (hsUrl) window.localStorage.setItem("mx_hs_url", hsUrl); + if (isUrl) window.localStorage.setItem("mx_is_url", isUrl); + } + + // create a temporary client to clear out the persistent stores. + const cli = createMatrixClient({ + // we'll never make any requests, so can pass a bogus HS URL + baseUrl: "", + }); + return cli.clearStores(); } /** - * Stop all the background processes related to the current client + * Stop all the background processes related to the current client. */ export function stopMatrixClient() { Notifier.stop(); @@ -454,7 +486,6 @@ export function stopMatrixClient() { if (cli) { cli.stopClient(); cli.removeAllListeners(); - cli.store.deleteAllData(); MatrixClientPeg.unset(); } } diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js index 1065fa9f9f..71a82d0920 100644 --- a/src/components/structures/MatrixChat.js +++ b/src/components/structures/MatrixChat.js @@ -1228,6 +1228,8 @@ module.exports = React.createClass({ onReturnToGuestClick: function() { // reanimate our guest login if (this.state.guestCreds) { + // TODO: this is probably a bit broken - we don't want to be + // clearing storage when we reanimate the guest creds. Lifecycle.setLoggedIn(this.state.guestCreds); this.setState({guestCreds: null}); } From 35620311b338a1f66325ca686bad0809f71a2807 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 13 Jun 2017 10:15:29 +0100 Subject: [PATCH 039/252] Fix regressions with starting a 1-1. --- src/components/views/dialogs/ChatInviteDialog.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index 2f635fd670..e331432228 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -24,6 +24,7 @@ import DMRoomMap from '../../../utils/DMRoomMap'; import Modal from '../../../Modal'; import AccessibleButton from '../elements/AccessibleButton'; import q from 'q'; +import dis from '../../../dispatcher'; const TRUNCATE_QUERY_LIST = 40; const QUERY_USER_DIRECTORY_DEBOUNCE_MS = 200; @@ -102,7 +103,7 @@ module.exports = React.createClass({ const ChatCreateOrReuseDialog = sdk.getComponent( "views.dialogs.ChatCreateOrReuseDialog", ); - Modal.createDialog(ChatCreateOrReuseDialog, { + const close = Modal.createDialog(ChatCreateOrReuseDialog, { userId: userId, onFinished: (success) => { this.props.onFinished(success); @@ -112,14 +113,16 @@ module.exports = React.createClass({ action: 'start_chat', user_id: userId, }); + close(true); }, onExistingRoomSelected: (roomId) => { dis.dispatch({ action: 'view_room', - user_id: roomId, + room_id: roomId, }); + close(true); }, - }); + }).close; } else { this._startChat(inviteList); } From 33f5d81d18790877e5524157ea5d2f3ed467c669 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 13 Jun 2017 11:03:22 +0100 Subject: [PATCH 040/252] Only process user_directory response if it's for the current query --- src/components/views/dialogs/ChatInviteDialog.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/views/dialogs/ChatInviteDialog.js b/src/components/views/dialogs/ChatInviteDialog.js index e331432228..9a14cb91d3 100644 --- a/src/components/views/dialogs/ChatInviteDialog.js +++ b/src/components/views/dialogs/ChatInviteDialog.js @@ -241,6 +241,11 @@ module.exports = React.createClass({ MatrixClientPeg.get().searchUserDirectory({ term: query, }).then((resp) => { + // The query might have changed since we sent the request, so ignore + // responses for anything other than the latest query. + if (this.state.query !== query) { + return; + } this._processResults(resp.results, query); }).catch((err) => { console.error('Error whilst searching user directory: ', err); From 24f1bd14609ede66b814a97020124cae488a95a0 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 13 Jun 2017 10:37:45 +0100 Subject: [PATCH 041/252] Merge new translations Merge remote-tracking branch 'weblate/develop' into develop --- src/i18n/strings/el.json | 665 +++++++++++++++++++++++++++++++----- src/i18n/strings/en_US.json | 75 +++- src/i18n/strings/fr.json | 95 +++++- src/i18n/strings/nl.json | 59 +++- src/i18n/strings/sv.json | 9 +- 5 files changed, 795 insertions(+), 108 deletions(-) diff --git a/src/i18n/strings/el.json b/src/i18n/strings/el.json index a38dddb35b..c55fca9b0c 100644 --- a/src/i18n/strings/el.json +++ b/src/i18n/strings/el.json @@ -32,34 +32,34 @@ "%(targetName)s accepted an invitation.": "%(targetName)s δέχτηκε την πρόσκληση.", "%(targetName)s accepted the invitation for %(displayName)s.": "%(targetName)s δέχτηκες την πρόσκληση για %(displayName)s.", "Account": "Λογαριασμός", - "Add a topic": "Πρόσθεσε μια περιγραφή", - "Add email address": "Πρόσθεσε ένα email", - "Add phone number": "Πρόσθεσε έναν αριθμό τηλεφώνου", + "Add a topic": "Προσθήκη θέματος", + "Add email address": "Προσθήκη διεύθυνσης ηλ. αλληλογραφίας", + "Add phone number": "Προσθήκη αριθμού τηλεφώνου", "Admin": "Διαχειριστής", "VoIP": "VoIP", "No Microphones detected": "Δεν εντοπίστηκε μικρόφωνο", "No Webcams detected": "Δεν εντοπίστηκε κάμερα", - "Default Device": "Προεπιλεγμένη Συσκευή", + "Default Device": "Προεπιλεγμένη συσκευή", "Microphone": "Μικρόφωνο", "Camera": "Κάμερα", "Advanced": "Προχωρημένα", "Algorithm": "Αλγόριθμος", - "Hide removed messages": "Κρύψε διαγραμμένα μηνύματα", + "Hide removed messages": "Απόκρυψη διαγραμμένων μηνυμάτων", "Authentication": "Πιστοποίηση", "and": "και", "An email has been sent to": "Ένα email στάλθηκε σε", - "A new password must be entered.": "Ο νέος κωδικός πρέπει να εισαχθεί.", - "%(senderName)s answered the call.": "Ο χρήστης %(senderName)s απάντησε.", - "An error has occurred.": "Ένα σφάλμα προέκυψε", + "A new password must be entered.": "Ο νέος κωδικός πρόσβασης πρέπει να εισαχθεί.", + "%(senderName)s answered the call.": "Ο χρήστης %(senderName)s απάντησε την κλήση.", + "An error has occurred.": "Παρουσιάστηκε ένα σφάλμα.", "Anyone": "Oποιοσδήποτε", - "Are you sure?": "Είσαι σίγουρος;", - "Are you sure you want to leave the room '%(roomName)s'?": "Είσαι σίγουρος οτι θές να φύγεις από το δωμάτιο '%(roomName)s';", - "Are you sure you want to reject the invitation?": "Είσαι σίγουρος οτι θες να απορρίψεις την πρόσκληση;", - "Are you sure you want to upload the following files?": "Είσαι σίγουρος οτι θές να ανεβάσεις τα ακόλουθα αρχεία;", + "Are you sure?": "Είστε σίγουροι;", + "Are you sure you want to leave the room '%(roomName)s'?": "Είστε σίγουροι ότι θέλετε να αποχωρήσετε από το δωμάτιο '%(roomName)s';", + "Are you sure you want to reject the invitation?": "Είστε σίγουροι ότι θέλετε να απορρίψετε την πρόσκληση;", + "Are you sure you want to upload the following files?": "Είστε σίγουροι ότι θέλετε να αποστείλετε τα ακόλουθα αρχεία;", "Attachment": "Επισύναψη", "%(senderName)s banned %(targetName)s.": "Ο χρήστης %(senderName)s έδιωξε τον χρήστη %(targetName)s.", "Autoplay GIFs and videos": "Αυτόματη αναπαραγωγή GIFs και βίντεο", - "Bug Report": "Αναφορά Σφάλματος", + "Bug Report": "Αναφορά σφάλματος", "anyone": "οποιοσδήποτε", "Anyone who knows the room's link, apart from guests": "Oποιοσδήποτε", "all room members, from the point they joined": "όλα τα μέλη του δωματίου, από τη στιγμή που συνδέθηκαν", @@ -106,7 +106,7 @@ "es-uy": "Ισπανικά (Ουρουγουάη)", "es-ve": "Ισπανικά (Βενεζουέλα)", "et": "Εσθονικά", - "eu": "Βασκική (βασκική)", + "eu": "Βασκική (Βασκική)", "fa": "Φάρσι", "fi": "Φινλανδικά", "fo": "Φαρόε", @@ -159,7 +159,7 @@ "ur": "Ουρντού", "ve": "Venda", "vi": "Βιετναμέζικα", - "xh": "Xhosa", + "xh": "Ξόσα", "zh-cn": "Κινέζικα (ΛΔΚ)", "zh-hk": "Κινέζικα (ΕΔΠ Χονγκ Κονγκ)", "zh-sg": "Κινέζικα (Σιγκαπούρη)", @@ -169,8 +169,8 @@ "lv": "Λετονικά", "A registered account is required for this action": "Ένας εγγεγραμμένος λογαριασμός απαιτείται για αυτή την ενέργεια", "A text message has been sent to +%(msisdn)s. Please enter the verification code it contains": "Ένα μήνυμα στάλθηκε στο +%(msisdn)s. Παρακαλώ γράψε τον κωδικό επαλήθευσης που περιέχει", - "Access Token:": "Κωδικός Πρόσβασης:", - "Always show message timestamps": "Δείχνε πάντα ένδειξη ώρας στα μηνύματα", + "Access Token:": "Κωδικός πρόσβασης:", + "Always show message timestamps": "Εμφάνιση πάντα της ένδειξης ώρας στα μηνύματα", "all room members": "όλα τα μέλη του δωματίου", "all room members, from the point they are invited": "όλα τα μέλη του δωματίου, από τη στιγμή που προσκλήθηκαν", "an address": "μία διεύθηνση", @@ -181,58 +181,58 @@ "%(names)s and %(lastPerson)s are typing": "%(names)s και %(lastPerson)s γράφουν", "%(names)s and one other are typing": "%(names)s και ένας ακόμα γράφουν", "%(names)s and %(count)s others are typing": "%(names)s και %(count)s άλλοι γράφουν", - "Anyone who knows the room's link, including guests": "Οποιοσδήποτε γνωρίζει τον σύνδεδμο του δωματίου, συμπεριλαμβάνωντας τους επισκέπτες", + "Anyone who knows the room's link, including guests": "Οποιοσδήποτε γνωρίζει τον σύνδεσμο του δωματίου, συμπεριλαμβάνωντας τους επισκέπτες", "Blacklisted": "Στη μαύρη λίστα", "Can't load user settings": "Δεν είναι δυνατή η φόρτωση των ρυθμίσεων χρήστη", - "Change Password": "Αλλαγή Κωδικού", - "%(senderName)s changed their display name from %(oldDisplayName)s to %(displayName)s.": "ο χρήστης %(senderName)s άλλαξε το όνομά του από %(oldDisplayName)s σε %(displayName)s.", - "%(senderName)s changed their profile picture.": "ο χρήστης %(senderName)s άλλαξε τη φωτογραφία του προφίλ του.", - "%(senderDisplayName)s changed the room name to %(roomName)s.": "Ο χρήστης %(senderDisplayName)s άλλαξε το όνομα του δωματίου σε %(roomName)s.", - "%(senderDisplayName)s changed the topic to \"%(topic)s\".": "Ο χρήστης %(senderDisplayName)s άλλαξε το θέμα σε \"%(topic)s\".", + "Change Password": "Αλλαγή κωδικού πρόσβασης", + "%(senderName)s changed their display name from %(oldDisplayName)s to %(displayName)s.": "Ο %(senderName)s άλλαξε το όνομά του από %(oldDisplayName)s σε %(displayName)s.", + "%(senderName)s changed their profile picture.": "Ο %(senderName)s άλλαξε τη φωτογραφία του προφίλ του.", + "%(senderDisplayName)s changed the room name to %(roomName)s.": "Ο %(senderDisplayName)s άλλαξε το όνομα του δωματίου σε %(roomName)s.", + "%(senderDisplayName)s changed the topic to \"%(topic)s\".": "Ο %(senderDisplayName)s άλλαξε το θέμα σε \"%(topic)s\".", "Clear Cache and Reload": "Καθάρισε την μνήμη και Ανανέωσε", "Clear Cache": "Καθάρισε την μνήμη", - "Bans user with given id": "Διώχνει τον χρήστη με το συγκεκριμένο id", - "%(senderDisplayName)s removed the room name.": "Ο χρήστης %(senderDisplayName)s διέγραψε το όνομα του δωματίου.", - "Changes your display nickname": "Αλλάζει το όνομα χρήστη", + "Bans user with given id": "Αποκλεισμός χρήστη με το συγκεκριμένο αναγνωριστικό", + "%(senderDisplayName)s removed the room name.": "Ο %(senderDisplayName)s διέγραψε το όνομα του δωματίου.", + "Changes your display nickname": "Αλλάζει το ψευδώνυμο χρήστη", "Click here": "Κάνε κλικ εδώ", "Drop here %(toAction)s": "Απόθεση εδώ %(toAction)s", "Conference call failed.": "Η κλήση συνδιάσκεψης απέτυχε.", "powered by Matrix": "βασισμένο στο πρωτόκολλο Matrix", - "Confirm password": "Επιβεβαίωση κωδικού", - "Confirm your new password": "Επιβεβαίωση του νέου κωδικού", + "Confirm password": "Επιβεβαίωση κωδικού πρόσβασης", + "Confirm your new password": "Επιβεβαίωση του νέου κωδικού πρόσβασης", "Continue": "Συνέχεια", "Create an account": "Δημιουργία λογαριασμού", - "Create Room": "Δημιουργία Δωματίου", + "Create Room": "Δημιουργία δωματίου", "Cryptography": "Κρυπτογραφία", - "Current password": "Τωρινός κωδικός", + "Current password": "Τωρινός κωδικός πρόσβασης", "Curve25519 identity key": "Κλειδί ταυτότητας Curve25519", "Custom level": "Προσαρμοσμένο επίπεδο", "/ddg is not a command": "/ddg δεν αναγνωρίζεται ως εντολή", - "Deactivate Account": "Απενεργοποίηση Λογαριασμού", + "Deactivate Account": "Απενεργοποίηση λογαριασμού", "Deactivate my account": "Απενεργοποίηση του λογαριασμού μου", "decline": "απόρριψη", - "Decrypt %(text)s": "Αποκρυπτογράφησε %(text)s", + "Decrypt %(text)s": "Αποκρυπτογράφηση %(text)s", "Decryption error": "Σφάλμα αποκρυπτογράφησης", "(default: %(userName)s)": "(προεπιλογή: %(userName)s)", "Delete": "Διαγραφή", "Default": "Προεπιλογή", "Device already verified!": "Η συσκευή έχει ήδη επαληθευτεί!", - "Device ID": "ID Συσκευής", - "Device ID:": "ID Συσκευής:", - "device id: ": "id συσκευής: ", - "Device key:": "Κλειδί Συσκευής:", + "Device ID": "Αναγνωριστικό συσκευής", + "Device ID:": "Αναγνωριστικό συσκευής:", + "device id: ": "αναγνωριστικό συσκευής: ", + "Device key:": "Κλειδί συσκευής:", "Devices": "Συσκευές", "Direct Chat": "Απευθείας συνομιλία", "Direct chats": "Απευθείας συνομιλίες", "disabled": "ανενεργό", - "Disinvite": "Ανακάλεσε πρόσκληση", + "Disinvite": "Ανάκληση πρόσκλησης", "Display name": "Όνομα χρήστη", - "Download %(text)s": "Κατέβασε %(text)s", + "Download %(text)s": "Λήψη %(text)s", "Ed25519 fingerprint": "Αποτύπωμα Ed25519", - "Email": "Ηλ. Αλληλογραφία", - "Email address": "Διεύθυνση email", - "Email address (optional)": "Διεύθυνση email (προαιρετικό)", - "Email, name or matrix ID": "Email, όνομα ή matrix ID", + "Email": "Ηλεκτρονική διεύθυνση", + "Email address": "Ηλεκτρονική διεύθυνση", + "Email address (optional)": "Ηλεκτρονική διεύθυνση (προαιρετικό)", + "Email, name or matrix ID": "Ηλεκτρονική διεύθυνση, όνομα ή matrix ID", "Emoji": "Εικονίδια", "enabled": "ενεργό", "Encrypted messages will not be visible on clients that do not yet implement encryption": "Τα κρυπτογραφημένα μηνύματα δεν θα είναι ορατά σε εφαρμογές που δεν παρέχουν τη δυνατότητα κρυπτογράφησης", @@ -240,10 +240,10 @@ "%(senderName)s ended the call.": "%(senderName)s τερμάτισε την κλήση.", "End-to-end encryption information": "Πληροφορίες σχετικά με τη κρυπτογράφηση από άκρο σε άκρο (End-to-end encryption)", "Error decrypting attachment": "Σφάλμα κατά την αποκρυπτογράφηση της επισύναψης", - "Event information": "Πληροφορίες μηνύματος", - "Existing Call": "Υπάρχουσα Κλήση", + "Event information": "Πληροφορίες συμβάντος", + "Existing Call": "Υπάρχουσα κλήση", "Export": "Εξαγωγή", - "Export E2E room keys": "Εξαγωγή κλειδιών κρυπτογραφίας για το δωμάτιο", + "Export E2E room keys": "Εξαγωγή κλειδιών κρυπτογράφησης για το δωμάτιο", "Failed to change password. Is your password correct?": "Δεν ήταν δυνατή η αλλαγή του κωδικού πρόσβασης. Είναι σωστός ο κωδικός πρόσβασης;", "Failed to delete device": "Δεν ήταν δυνατή η διαγραφή της συσκευής", "Failed to join room": "Δεν ήταν δυνατή η σύνδεση στο δωμάτιο", @@ -253,46 +253,46 @@ "Failed to reject invite": "Δεν ήταν δυνατή η απόρριψη της πρόσκλησης", "Failed to reject invitation": "Δεν ήταν δυνατή η απόρριψη της πρόσκλησης", "Failed to save settings": "Δεν ήταν δυνατή η αποθήκευση των ρυθμίσεων", - "Failed to send email": "Δεν ήταν δυνατή η απστολή email", + "Failed to send email": "Δεν ήταν δυνατή η αποστολή ηλ. αλληλογραφίας", "Failed to verify email address: make sure you clicked the link in the email": "Δεν ήταν δυνατή η επαλήθευση του email: βεβαιωθείτε οτι κάνατε κλικ στον σύνδεσμο που σας στάλθηκε", "Favourite": "Αγαπημένο", "favourite": "αγαπημένο", "Favourites": "Αγαπημένα", "Fill screen": "Γέμισε την οθόνη", - "Filter room members": "Φίλτραρε τα μέλη", - "Forget room": "Διέγραψε το δωμάτιο", - "Forgot your password?": "Ξέχασες τον κωδικό σου;", - "For security, this session has been signed out. Please sign in again.": "Για λόγους ασφαλείας, αυτή η συνεδρία έχει τερματιστεί. Παρακαλώ συνδεθείτε ξανά.", - "For security, logging out will delete any end-to-end encryption keys from this browser. If you want to be able to decrypt your conversation history from future Riot sessions, please export your room keys for safe-keeping.": "Για λόγους ασφαλείας, τα κλειδιά κρυπτογράφησης θα διαγράφονται από τον φυλλομετρητή κατά την αποσύνδεση σας. Εάν επιθυμείτε να αποκρυπτογραφήσετε τις συνομιλίες σας στο μέλλον, εξάγετε τα κλειδιά σας και κρατήστε τα ασφαλή.", + "Filter room members": "Φιλτράρισμα μελών", + "Forget room": "Αγνόηση δωματίου", + "Forgot your password?": "Ξεχάσατε τoν κωδικό πρόσβασης σας;", + "For security, this session has been signed out. Please sign in again.": "Για λόγους ασφαλείας, αυτή η συνεδρία έχει τερματιστεί. Παρακαλούμε συνδεθείτε ξανά.", + "For security, logging out will delete any end-to-end encryption keys from this browser. If you want to be able to decrypt your conversation history from future Riot sessions, please export your room keys for safe-keeping.": "Για λόγους ασφαλείας, τα κλειδιά κρυπτογράφησης θα διαγράφονται από τον περιηγητή κατά την αποσύνδεση σας. Εάν επιθυμείτε να αποκρυπτογραφήσετε τις συνομιλίες σας στο μέλλον, εξάγετε τα κλειδιά σας και κρατήστε τα ασφαλή.", "Found a bug?": "Βρήκατε κάποιο πρόβλημα;", "Guest users can't upload files. Please register to upload.": "Οι επισκέπτες δεν μπορούν να ανεβάσουν αρχεία. Παρακαλώ εγγραφείτε πρώτα.", "had": "είχε", - "Hangup": "Κλείσε", + "Hangup": "Κλείσιμο", "Historical": "Ιστορικό", "Homeserver is": "Ο διακομιστής είναι", - "Identity Server is": "Διακομιστής Ταυτοποίησης", - "I have verified my email address": "Έχω επαληθεύσει το email μου", + "Identity Server is": "Ο διακομιστής ταυτοποίησης είναι", + "I have verified my email address": "Έχω επαληθεύσει την διεύθυνση ηλ. αλληλογραφίας", "Import": "Εισαγωγή", - "Import E2E room keys": "Εισαγωγή κλειδιών κρυπτογράφησης", + "Import E2E room keys": "Εισαγωγή κλειδιών E2E", "Incorrect username and/or password.": "Λανθασμένο όνομα χρήστη και/ή κωδικός.", "Incorrect verification code": "Λανθασμένος κωδικός επαλήθευσης", - "Interface Language": "Γλώσσα Διεπαφής", - "Invalid Email Address": "Μη έγκυρο email", - "Invite new room members": "Προσκάλεσε νέα μέλη", + "Interface Language": "Γλώσσα διεπαφής", + "Invalid Email Address": "Μη έγκυρη διεύθυνση ηλ. αλληλογραφίας", + "Invite new room members": "Προσκαλέστε νέα μέλη", "Invited": "Προσκλήθηκε", "Invites": "Προσκλήσεις", "is a": "είναι ένα", - "%(displayName)s is typing": "ο χρήστης %(displayName)s γράφει", - "Sign in with": "Συνδέσου με", - "joined and left": "μπήκε και βγήκε", - "joined": "μπήκε", + "%(displayName)s is typing": "Ο χρήστης %(displayName)s γράφει", + "Sign in with": "Συνδεθείτε με", + "joined and left": "συνδέθηκε και έφυγε", + "joined": "συνδέθηκε", "%(targetName)s joined the room.": "ο χρήστης %(targetName)s συνδέθηκε στο δωμάτιο.", - "Jump to first unread message.": "Πήγαινε στο πρώτο μη αναγνωσμένο μήνυμα.", - "%(senderName)s kicked %(targetName)s.": "Ο χρήστης %(senderName)s έδιωξε τον χρήστη %(targetName)s.", + "Jump to first unread message.": "Πηγαίνετε στο πρώτο μη αναγνωσμένο μήνυμα.", + "%(senderName)s kicked %(targetName)s.": "Ο %(senderName)s έδιωξε τον χρήστη %(targetName)s.", "Kick": "Διώξε", "Kicks user with given id": "Διώχνει χρήστες με το συγκεκριμένο id", "Labs": "Πειραματικά", - "Leave room": "Φύγε από το δωμάτιο", + "Leave room": "Αποχώρηση από το δωμάτιο", "left and rejoined": "έφυγε και ξανασυνδέθηκε", "left": "έφυγε", "%(targetName)s left the room.": "Ο χρήστης %(targetName)s έφυγε από το δωμάτιο.", @@ -300,7 +300,7 @@ "List this room in %(domain)s's room directory?": "Να εμφανίζεται το δωμάτιο στο γενικό ευρετήριο του διακομιστή %(domain)s;", "Local addresses for this room:": "Τοπική διεύθυνση για το δωμάτιο:", "Logged in as:": "Συνδέθηκες ως:", - "Login as guest": "Συνδέσου ως επισκέπτης", + "Login as guest": "Σύνδεση ως επισκέπτης", "Logout": "Αποσύνδεση", "Low priority": "Χαμηλής προτεραιότητας", "matrix-react-sdk version:": "έκδοση matrix-react-sdk:", @@ -313,34 +313,34 @@ "Conference calls are not supported in encrypted rooms": "Οι κλήσεις συνδιάσκεψης δεν είναι υποστηρίζονται σε κρυπτογραφημένα δωμάτια", "Conference calls are not supported in this client": "Οι κλήσεις συνδιάσκεψης δεν είναι υποστηρίζονται από την εφαρμογή", "Enable encryption": "Ενεργοποίηση κρυπτογραφίας", - "Enter Code": "Κωδικός", + "Enter Code": "Εισαγωγή κωδικού πρόσβασης", "Failed to send request.": "Δεν ήταν δυνατή η αποστολή αιτήματος.", - "Failed to upload file": "Δεν ήταν δυνατό το ανέβασμα αρχείου", + "Failed to upload file": "Δεν ήταν δυνατή η αποστολή του αρχείου", "Failure to create room": "Δεν ήταν δυνατή η δημιουργία δωματίου", - "Join Room": "Συνδέσου", + "Join Room": "Είσοδος σε δωμάτιο", "Moderator": "Συντονιστής", "my Matrix ID": "το Matrix ID μου", "Name": "Όνομα", "New address (e.g. #foo:%(localDomain)s)": "Νέα διεύθυνση (e.g. #όνομα:%(localDomain)s)", - "New password": "Νέος κωδικός", - "New passwords don't match": "Οι νέοι κωδικοί είναι διαφορετικοί", - "New passwords must match each other.": "Οι νέοι κωδικόι πρέπει να ταιριάζουν.", + "New password": "Νέος κωδικός πρόσβασης", + "New passwords don't match": "Οι νέοι κωδικοί πρόσβασης είναι διαφορετικοί", + "New passwords must match each other.": "Οι νέοι κωδικοί πρόσβασης πρέπει να ταιριάζουν.", "none": "κανένα", - "(not supported by this browser)": "(δεν υποστηρίζεται από τον browser)", + "(not supported by this browser)": "(δεν υποστηρίζεται από τον περιηγητή)", "": "<δεν υποστηρίζεται>", - "No more results": "Δεν υπάρχουν άλλα αποτελέσματα", + "No more results": "Δεν υπάρχουν αποτελέσματα", "No results": "Κανένα αποτέλεσμα", "OK": "Εντάξει", - "olm version:": "έκδοση olm:", - "Password": "Κωδικός", - "Password:": "Κωδικός:", - "Passwords can't be empty": "", + "olm version:": "Έκδοση olm:", + "Password": "Κωδικός πρόσβασης", + "Password:": "Κωδικός πρόσβασης:", + "Passwords can't be empty": "Οι κωδικοί πρόσβασης δεν γίνετε να είναι κενοί", "People": "Άτομα", "Phone": "Τηλέφωνο", "Register": "Εγγραφή", - "riot-web version:": "έκδοση riot-web:", - "Room Colour": "Χρώμα Δωματίου", - "Room name (optional)": "Όνομα Δωματίου (προαιρετικό)", + "riot-web version:": "Έκδοση riot-web:", + "Room Colour": "Χρώμα δωματίου", + "Room name (optional)": "Όνομα δωματίου (προαιρετικό)", "Rooms": "Δωμάτια", "Save": "Αποθήκευση", "Search failed": "Η αναζήτηση απέτυχε", @@ -349,15 +349,15 @@ "sent an image": "έστειλε μια εικόνα", "sent a video": "έστειλε ένα βίντεο", "Server error": "Σφάλμα διακομιστή", - "Signed Out": "Αποσυνδέθηκες", + "Signed Out": "Αποσυνδέθηκε", "Sign in": "Συνδέση", "Sign out": "Αποσύνδεση", "since they joined": "από τη στιγμή που συνδέθηκαν", "since they were invited": "από τη στιγμή που προσκλήθηκαν", "Someone": "Κάποιος", - "Start a chat": "Ξεκίνα μια συνομιλία", - "This email address is already in use": "Το email χρησιμοποιείται", - "This email address was not found": "Η διεύθηνση email δεν βρέθηκε", + "Start a chat": "Έναρξη συνομιλίας", + "This email address is already in use": "Η διεύθυνση ηλ. αλληλογραφίας χρησιμοποιείται ήδη", + "This email address was not found": "Δεν βρέθηκε η διεύθυνση ηλ. αλληλογραφίας", "Success": "Επιτυχία", "Start Chat": "Συνομιλία", "Cancel": "Ακύρωση", @@ -375,7 +375,7 @@ "italic": "πλάγια", "underline": "υπογράμμιση", "code": "κώδικας", - "quote": "αναφορά", + "quote": "παράθεση", "%(oneUser)sleft %(repeats)s times": "%(oneUser)s έφυγε %(repeats)s φορές", "%(severalUsers)sleft": "%(severalUsers)s έφυγαν", "%(oneUser)sleft": "%(oneUser)s έφυγε", @@ -387,5 +387,496 @@ "Create new room": "Δημιουργία νέου δωματίου", "Room directory": "Ευρετήριο", "Start chat": "Έναρξη συνομιλίας", - "Welcome page": "Αρχική σελίδα" + "Welcome page": "Αρχική σελίδα", + "a room": "ένα δωμάτιο", + "Accept": "Αποδοχή", + "Active call (%(roomName)s)": "Ενεργή κλήση (%(roomName)s)", + "Add": "Προσθήκη", + "Admin tools": "Εργαλεία διαχειριστή", + "And %(count)s more...": "Και %(count)s περισσότερα...", + "No media permissions": "Χωρίς δικαιώματα πολυμέσων", + "Alias (optional)": "Ψευδώνυμο (προαιρετικό)", + "Ban": "Αποκλεισμός", + "Banned users": "Αποκλεισμένοι χρήστες", + "Bulk Options": "Μαζικές επιλογές", + "Call Timeout": "Λήξη χρόνου κλήσης", + "Click here to join the discussion!": "Κλικ εδώ για να συμμετάσχετε στην συζήτηση!", + "Click to mute audio": "Κάντε κλικ για σίγαση του ήχου", + "Click to mute video": "Κάντε κλικ για σίγαση του βίντεο", + "click to reveal": "κάντε κλικ για εμφάνιση", + "Click to unmute video": "Κάντε κλικ για άρση σίγασης του βίντεο", + "Click to unmute audio": "Κάντε κλικ για άρση σίγασης του ήχου", + "%(count)s new messages.one": "%(count)s νέο μήνυμα", + "%(count)s new messages.other": "%(count)s νέα μηνύματα", + "Custom": "Προσαρμοσμένο", + "Decline": "Απόρριψη", + "Disable Notifications": "Απενεργοποίηση ειδοποιήσεων", + "Disable markdown formatting": "Απενεργοποίηση μορφοποίησης markdown", + "Drop File Here": "Αποθέστε εδώ το αρχείο", + "Enable Notifications": "Ενεργοποίηση ειδοποιήσεων", + "Encryption is enabled in this room": "Η κρυπτογράφηση είναι ενεργοποιημένη σε αυτό το δωμάτιο", + "Encryption is not enabled in this room": "Η κρυπτογράφηση είναι απενεργοποιημένη σε αυτό το δωμάτιο", + "Enter passphrase": "Εισαγωγή συνθηματικού", + "Failed to set avatar.": "Δεν ήταν δυνατό ο ορισμός της προσωπικής εικόνας.", + "Failed to set display name": "Δεν ήταν δυνατό ο ορισμός του ονόματος εμφάνισης", + "Failed to set up conference call": "Δεν ήταν δυνατή η ρύθμιση κλήσης συνδιάσκεψης", + "Failed to toggle moderator status": "Δεν ήταν δυνατή η εναλλαγή κατάστασης του συντονιστή", + "Failed to upload profile picture!": "Δεν ήταν δυνατή η αποστολή της εικόνας προφίλ!", + "Hide read receipts": "Απόκρυψη αποδείξεων ανάγνωσης", + "Home": "Αρχική", + "Last seen": "Τελευταία εμφάνιση", + "Level:": "Επίπεδο:", + "Manage Integrations": "Διαχείριση ενσωματώσεων", + "Markdown is disabled": "Το Markdown είναι απενεργοποιημένο", + "Markdown is enabled": "Το Markdown είναι ενεργοποιημένο", + "Missing room_id in request": "Λείπει το room_id στο αίτημα", + "Permissions": "Δικαιώματα", + "Power level must be positive integer.": "Το επίπεδο δύναμης πρέπει να είναι ένας θετικός ακέραιος.", + "Privacy warning": "Προειδοποίηση ιδιωτικότητας", + "Private Chat": "Προσωπική συνομιλία", + "Privileged Users": "Προνομιούχοι χρήστες", + "Profile": "Προφίλ", + "Public Chat": "Δημόσια συνομιλία", + "Reason": "Αιτία", + "Reason: %(reasonText)s": "Αιτία: %(reasonText)s", + "Revoke Moderator": "Ανάκληση συντονιστή", + "Registration required": "Απαιτείται εγγραφή", + "rejected": "απορρίφθηκε", + "%(targetName)s rejected the invitation.": "Ο %(targetName)s απέρριψε την πρόσκληση.", + "Reject invitation": "Απόρριψη πρόσκλησης", + "Remote addresses for this room:": "Απομακρυσμένες διευθύνσεις για το δωμάτιο:", + "Remove Contact Information?": "Αφαίρεση πληροφοριών επαφής;", + "Remove %(threePid)s?": "Αφαίρεση %(threePid)s;", + "Report it": "Αναφορά", + "restore": "επαναφορά", + "Results from DuckDuckGo": "Αποτελέσματα από DuckDuckGo", + "Return to app": "Επιστροφή στην εφαρμογή", + "Return to login screen": "Επιστροφή στην οθόνη σύνδεσης", + "Room %(roomId)s not visible": "Το δωμάτιο %(roomId)s δεν είναι ορατό", + "%(roomName)s does not exist.": "Το %(roomName)s δεν υπάρχει.", + "Searches DuckDuckGo for results": "Γίνεται αναζήτηση στο DuckDuckGo για αποτελέσματα", + "Searching known users": "Αναζήτηση γνωστών χρηστών", + "Seen by %(userName)s at %(dateTime)s": "Διαβάστηκε από %(userName)s στις %(dateTime)s", + "Send anyway": "Αποστολή ούτως ή άλλως", + "Send Invites": "Αποστολή προσκλήσεων", + "Send Reset Email": "Αποστολή μηνύματος επαναφοράς", + "%(senderDisplayName)s sent an image.": "Ο %(senderDisplayName)s έστειλε μια φωτογραφία.", + "Server may be unavailable or overloaded": "Ο διακομιστής μπορεί να είναι μη διαθέσιμος ή υπερφορτωμένος", + "Session ID": "Αναγνωριστικό συνεδρίας", + "%(senderName)s set a profile picture.": "Ο %(senderName)s όρισε τη φωτογραφία του προφίλ του.", + "Set": "Ορισμός", + "Start authentication": "Έναρξη πιστοποίησης", + "Submit": "Υποβολή", + "Tagged as: ": "Με ετικέτα:", + "The default role for new room members is": "Ο προεπιλεγμένος ρόλος για νέα μέλη είναι", + "The main address for this room is": "Η κύρια διεύθυνση για το δωμάτιο είναι", + "%(actionVerb)s this person?": "%(actionVerb)s αυτού του ατόμου;", + "The file '%(fileName)s' failed to upload": "Απέτυχε η αποστολή του αρχείου '%(fileName)s'", + "There was a problem logging in.": "Υπήρξε ένα πρόβλημα κατά την σύνδεση.", + "This room has no local addresses": "Αυτό το δωμάτιο δεν έχει τοπικές διευθύνσεις", + "This doesn't appear to be a valid email address": "Δεν μοιάζει με μια έγκυρη διεύθυνση ηλ. αλληλογραφίας", + "This phone number is already in use": "Αυτός ο αριθμός τηλεφώνου είναι ήδη σε χρήση", + "This room": "Αυτό το δωμάτιο", + "This room's internal ID is": "Το εσωτερικό αναγνωριστικό του δωματίου είναι", + "times": "φορές", + "To ban users": "Για αποκλεισμό χρηστών", + "to browse the directory": "για περιήγηση στο ευρετήριο", + "To configure the room": "Για ρύθμιση του δωματίου", + "To invite users into the room": "Για πρόσκληση χρηστών στο δωμάτιο", + "To remove other users' messages": "Για αφαίρεση μηνυμάτων άλλων χρηστών", + "to restore": "για επαναφορά", + "To send events of type": "Για αποστολή συμβάντων τύπου", + "To send messages": "Για αποστολή μηνυμάτων", + "Turn Markdown off": "Απενεργοποίηση Markdown", + "Turn Markdown on": "Ενεργοποίηση Markdown", + "Unable to add email address": "Αδυναμία προσθήκης διεύθυνσης ηλ. αλληλογραφίας", + "Unable to remove contact information": "Αδυναμία αφαίρεσης πληροφοριών επαφής", + "Unable to restore previous session": "Αδυναμία επαναφοράς της προηγούμενης συνεδρίας", + "Unable to verify email address.": "Αδυναμία επιβεβαίωσης διεύθυνσης ηλ. αλληλογραφίας.", + "Unban": "Άρση αποκλεισμού", + "%(senderName)s unbanned %(targetName)s.": "Ο χρήστης %(senderName)s έδιωξε τον χρήστη %(targetName)s.", + "Unable to enable Notifications": "Αδυναμία ενεργοποίησης των ειδοποιήσεων", + "Unable to load device list": "Αδυναμία φόρτωσης της λίστας συσκευών", + "Unencrypted room": "Μη κρυπτογραφημένο δωμάτιο", + "unencrypted": "μη κρυπτογραφημένο", + "Unencrypted message": "Μη κρυπτογραφημένο μήνυμα", + "unknown caller": "άγνωστος καλών", + "Unknown command": "Άγνωστη εντολή", + "unknown device": "άγνωστη συσκευή", + "Unknown room %(roomId)s": "Άγνωστο δωμάτιο %(roomId)s", + "unknown": "άγνωστο", + "Unmute": "Άρση σίγασης", + "Unnamed Room": "Ανώνυμο δωμάτιο", + "Unrecognised command:": "Μη αναγνωρίσιμη εντολή:", + "Unrecognised room alias:": "Μη αναγνωρίσιμο ψευδώνυμο:", + "Unverified": "Ανεπιβεβαίωτο", + "Upload avatar": "Αποστολή προσωπικής εικόνας", + "Upload Failed": "Απέτυχε η αποστολή", + "Upload Files": "Αποστολή αρχείων", + "Upload file": "Αποστολή αρχείου", + "Upload new:": "Αποστολή νέου:", + "Usage": "Χρήση", + "Use with caution": "Να χρησιμοποιείται με προσοχή", + "User ID": "Αναγνωριστικό χρήστη", + "User Interface": "Διεπαφή χρήστη", + "%(user)s is a": "Ο %(user)s είναι", + "User name": "Όνομα χρήστη", + "Username invalid: %(errMessage)s": "Μη έγκυρο όνομα χρήστη: %(errMessage)s", + "Users": "Χρήστες", + "User": "Χρήστης", + "Video call": "Βιντεοκλήση", + "Voice call": "Φωνητική κλήση", + "Warning!": "Προειδοποίηση!", + "Who would you like to communicate with?": "Με ποιον θα θέλατε να επικοινωνήσετε;", + "You are already in a call.": "Είστε ήδη σε μια κλήση.", + "You have no visible notifications": "Δεν έχετε ορατές ειδοποιήσεις", + "you must be a": "πρέπει να είστε", + "You must register to use this functionality": "Πρέπει να εγγραφείτε για να χρησιμοποιήσετε αυτή την λειτουργία", + "You need to be logged in.": "Πρέπει να είστε συνδεδεμένος.", + "You need to enter a user name.": "Πρέπει να εισάγετε ένα όνομα χρήστη.", + "Your password has been reset": "Ο κωδικός πρόσβασης σας έχει επαναφερθεί", + "Sun": "Κυρ", + "Mon": "Δευ", + "Tue": "Τρί", + "Wed": "Τετ", + "Thu": "Πέμ", + "Fri": "Παρ", + "Sat": "Σάβ", + "Jan": "Ιαν", + "Feb": "Φεβ", + "Mar": "Μάρ", + "Apr": "Απρ", + "May": "Μάι", + "Jun": "Ιούν", + "Jul": "Ιούλ", + "Aug": "Αύγ", + "Sep": "Σεπ", + "Oct": "Οκτ", + "Nov": "Νοέ", + "Dec": "Δεκ", + "%(weekDayName)s, %(monthName)s %(day)s %(time)s": "%(weekDayName)s, %(monthName)s %(day)s %(time)s", + "%(weekDayName)s %(time)s": "%(weekDayName)s %(time)s", + "Set a display name:": "Ορισμός ονόματος εμφάνισης:", + "Set a Display Name": "Ορισμός ονόματος εμφάνισης", + "Upload an avatar:": "Αποστολή προσωπικής εικόνας:", + "This server does not support authentication with a phone number.": "Αυτός ο διακομιστής δεν υποστηρίζει πιστοποίηση με αριθμό τηλεφώνου.", + "Missing password.": "Λείπει ο κωδικός πρόσβασης.", + "Passwords don't match.": "Δεν ταιριάζουν οι κωδικοί πρόσβασης.", + "This doesn't look like a valid email address.": "Δεν μοιάζει με μια έγκυρη διεύθυνση ηλ. αλληλογραφίας.", + "An unknown error occurred.": "Προέκυψε ένα άγνωστο σφάλμα.", + "I already have an account": "Έχω ήδη λογαριασμό", + "An error occurred: %(error_string)s": "Προέκυψε ένα σφάλμα: %(error_string)s", + "Topic": "Θέμα", + "Make Moderator": "Ορισμός συντονιστή", + "Encrypt room": "Κρυπτογράφηση δωματίου", + "Room": "Δωμάτιο", + "Auto-complete": "Αυτόματη συμπλήρωση", + "(~%(count)s results).one": "(~%(count)s αποτέλεσμα)", + "(~%(count)s results).other": "(~%(count)s αποτελέσματα)", + "Active call": "Ενεργή κλήση", + "strike": "επιγράμμιση", + "bullet": "κουκκίδα", + "%(severalUsers)sjoined %(repeats)s times": "%(severalUsers)s συνδέθηκαν %(repeats)s φορές", + "%(oneUser)sjoined %(repeats)s times": "%(oneUser)s συνδέθηκε %(repeats)s φορές", + "%(severalUsers)sjoined": "%(severalUsers)s συνδέθηκαν", + "%(oneUser)sjoined": "%(oneUser)s συνδέθηκε", + "were invited": "προσκλήθηκαν", + "was invited": "προσκλήθηκε", + "were banned": "αποκλείστηκαν", + "was banned": "αποκλείστηκε", + "were kicked": "διώχτηκαν", + "was kicked": "διώχτηκε", + "New Password": "Νέος κωδικός πρόσβασης", + "Start automatically after system login": "Αυτόματη έναρξη μετά τη σύνδεση", + "Options": "Επιλογές", + "Passphrases must match": "Δεν ταιριάζουν τα συνθηματικά", + "Passphrase must not be empty": "Το συνθηματικό δεν πρέπει να είναι κενό", + "Export room keys": "Εξαγωγή κλειδιών δωματίου", + "Confirm passphrase": "Επιβεβαίωση συνθηματικού", + "Import room keys": "Εισαγωγή κλειδιών δωματίου", + "File to import": "Αρχείο για εισαγωγή", + "Start new chat": "Έναρξη νέας συνομιλίας", + "Guest users can't invite users. Please register.": "Οι επισκέπτες δεν έχουν τη δυνατότητα να προσκαλέσουν άλλους χρήστες. Παρακαλούμε εγγραφείτε πρώτα.", + "Confirm Removal": "Επιβεβαίωση αφαίρεσης", + "Unknown error": "Άγνωστο σφάλμα", + "Incorrect password": "Λανθασμένος κωδικός πρόσβασης", + "To continue, please enter your password.": "Για να συνεχίσετε, παρακαλούμε πληκτρολογήστε τον κωδικό πρόσβασής σας.", + "Device name": "Όνομα συσκευής", + "Device Name": "Όνομα συσκευής", + "Device key": "Κλειδί συσκευής", + "Verify device": "Επαλήθευση συσκευής", + "Unable to restore session": "Αδυναμία επαναφοράς συνεδρίας", + "Continue anyway": "Συνέχεια οπωσδήποτε", + "Unknown devices": "Άγνωστες συσκευές", + "Unknown Address": "Άγνωστη διεύθυνση", + "Blacklist": "Μαύρη λίστα", + "Verify...": "Επαλήθευση...", + "ex. @bob:example.com": "π.χ @bob:example.com", + "Add User": "Προσθήκη χρήστη", + "Sign in with CAS": "Σύνδεση με CAS", + "You can use the custom server options to sign into other Matrix servers by specifying a different Home server URL.": "Μπορείτε να χρησιμοποιήσετε τις προσαρμοσμένες ρυθμίσεις για να εισέλθετε σε άλλους διακομιστές Matrix επιλέγοντας μια διαφορετική διεύθυνση για το διακομιστή.", + "Token incorrect": "Εσφαλμένο διακριτικό", + "A text message has been sent to": "Ένα μήνυμα στάλθηκε στο", + "Please enter the code it contains:": "Παρακαλούμε εισάγετε τον κωδικό που περιέχει:", + "Default server": "Προεπιλεγμένος διακομιστής", + "Custom server": "Προσαρμοσμένος διακομιστής", + "Home server URL": "Διεύθυνση διακομιστή", + "Identity server URL": "Διεύθυνση διακομιστή ταυτοποίησης", + "What does this mean?": "Τι σημαίνει αυτό;", + "Error decrypting audio": "Σφάλμα κατά την αποκρυπτογράφηση του ήχου", + "Error decrypting image": "Σφάλμα κατά την αποκρυπτογράφηση της εικόνας", + "Image '%(Body)s' cannot be displayed.": "Η εικόνα '%(Body)s' δεν μπορεί να εμφανιστεί.", + "This image cannot be displayed.": "Αυτή η εικόνα δεν μπορεί να εμφανιστεί.", + "Error decrypting video": "Σφάλμα κατά την αποκρυπτογράφηση του βίντεο", + "Add an Integration": "Προσθήκη ενσωμάτωσης", + "URL Previews": "Προεπισκόπηση συνδέσμων", + "Enable URL previews for this room (affects only you)": "Ενεργοποίηση της προεπισκόπησης συνδέσμων γι' αυτό το δωμάτιο (επηρεάζει μόνο εσάς)", + "Drop file here to upload": "Αποθέστε εδώ για αποστολή", + "for %(amount)ss": "για %(amount)ss", + "for %(amount)sm": "για %(amount)sm", + "for %(amount)sh": "για %(amount)sh", + "for %(amount)sd": "για %(amount)sd", + "Online": "Σε σύνδεση", + "Idle": "Αδρανής", + "Offline": "Εκτός σύνδεσης", + "Start chatting": "Έναρξη συνομιλίας", + "Start Chatting": "Έναρξη συνομιλίας", + "Click on the button below to start chatting!": "Κάντε κλικ στο κουμπί παρακάτω για να ξεκινήσετε μια συνομιλία!", + "%(senderDisplayName)s removed the room avatar.": "Ο %(senderDisplayName)s διέγραψε την προσωπική εικόνα του δωματίου.", + "%(senderDisplayName)s changed the avatar for %(roomName)s": "Ο %(senderDisplayName)s άλλαξε την προσωπική εικόνα του %(roomName)s", + "Username available": "Διαθέσιμο όνομα χρήστη", + "Username not available": "Μη διαθέσιμο όνομα χρήστη", + "Something went wrong!": "Κάτι πήγε στραβά!", + "Could not connect to the integration server": "Αδυναμία σύνδεσης στον διακομιστή ενσωμάτωσης", + "Create a new chat or reuse an existing one": "Δημιουργία νέας συνομιλίας ή επαναχρησιμοποίηση μιας υπάρχουσας", + "Don't send typing notifications": "Να μη γίνετε αποστολή ειδοποιήσεων πληκτρολόγησης", + "Encrypted by a verified device": "Κρυπτογραφημένο από μια επιβεβαιωμένη συσκευή", + "Encrypted by an unverified device": "Κρυπτογραφημένο από μια ανεπιβεβαίωτη συσκευή", + "Error: Problem communicating with the given homeserver.": "Σφάλμα: πρόβλημα κατά την επικοινωνία με τον ορισμένο διακομιστή.", + "Failed to ban user": "Δεν ήταν δυνατό ο αποκλεισμός του χρήστη", + "Failed to change power level": "Δεν ήταν δυνατή η αλλαγή του επιπέδου δύναμης", + "Failed to fetch avatar URL": "Δεν ήταν δυνατή η ανάκτηση της διεύθυνσης εικόνας", + "Failed to lookup current room": "Δεν ήταν δυνατή η εύρεση του τρέχοντος δωματίου", + "Failed to unban": "Δεν ήταν δυνατή η άρση του αποκλεισμού", + "%(userId)s from %(fromPowerLevel)s to %(toPowerLevel)s": "%(userId)s από %(fromPowerLevel)s σε %(toPowerLevel)s", + "Guest access is disabled on this Home Server.": "Έχει απενεργοποιηθεί η πρόσβαση στους επισκέπτες σε αυτόν τον διακομιστή.", + "Guests can't set avatars. Please register.": "Οι επισκέπτες δεν μπορούν να ορίσουν προσωπικές εικόνες. Παρακαλούμε εγγραφείτε.", + "Guest users can't create new rooms. Please register to create room and start a chat.": "Οι επισκέπτες δεν μπορούν να δημιουργήσουν νέα δωμάτια. Παρακαλούμε εγγραφείτε για να δημιουργήσετε ένα δωμάτιο και να ξεκινήσετε μια συνομιλία.", + "Guests can't use labs features. Please register.": "Οι επισκέπτες δεν μπορούν να χρησιμοποιήσουν τα πειραματικά χαρακτηριστικά. Παρακαλούμε εγγραφείτε.", + "Guests cannot join this room even if explicitly invited.": "Οι επισκέπτες δεν μπορούν να συνδεθούν στο δωμάτιο ακόμη και αν έχουν καλεστεί.", + "Hide Text Formatting Toolbar": "Απόκρυψη εργαλειοθήκης μορφοποίησης κειμένου", + "Incoming call from %(name)s": "Εισερχόμενη κλήση από %(name)s", + "Incoming video call from %(name)s": "Εισερχόμενη βιντεοκλήση από %(name)s", + "Incoming voice call from %(name)s": "Εισερχόμενη φωνητική κλήση από %(name)s", + "Invalid alias format": "Μη έγκυρη μορφή ψευδώνυμου", + "Invalid address format": "Μη έγκυρη μορφή διεύθυνσης", + "Invalid file%(extra)s": "Μη έγκυρο αρχείο %(extra)s", + "%(senderName)s invited %(targetName)s.": "Ο %(senderName)s προσκάλεσε τον %(targetName)s.", + "Invites user with given id to current room": "Προσκαλεί τον χρήστη με το δοσμένο αναγνωριστικό στο τρέχον δωμάτιο", + "'%(alias)s' is not a valid format for an address": "Το '%(alias)s' δεν είναι μια έγκυρη μορφή διεύθυνσης", + "'%(alias)s' is not a valid format for an alias": "Το '%(alias)s' δεν είναι μια έγκυρη μορφή ψευδώνυμου", + "%(senderName)s made future room history visible to": "Ο %(senderName)s έκανε το μελλοντικό ιστορικό του δωματίου δημόσιο", + "Missing user_id in request": "Λείπει το user_id στο αίτημα", + "Mobile phone number (optional)": "Αριθμός κινητού τηλεφώνου (προαιρετικό)", + "Must be viewing a room": "Πρέπει να βλέπετε ένα δωμάτιο", + "Never send encrypted messages to unverified devices from this device": "Να μη γίνει ποτέ αποστολή κρυπτογραφημένων μηνυμάτων σε ανεπιβεβαίωτες συσκευές από αυτή τη συσκευή", + "Never send encrypted messages to unverified devices in this room": "Να μη γίνει ποτέ αποστολή κρυπτογραφημένων μηνυμάτων σε ανεπιβεβαίωτες συσκευές σε αυτό το δωμάτιο", + "Never send encrypted messages to unverified devices in this room from this device": "Να μη γίνει ποτέ αποστολή κρυπτογραφημένων μηνυμάτων σε ανεπιβεβαίωτες συσκευές, σε αυτό το δωμάτιο, από αυτή τη συσκευή", + "New Composer & Autocomplete": "Νέος συνθέτης και αυτόματη συμπλήρωση", + "not set": "δεν έχει οριστεί", + "not specified": "μη καθορισμένο", + "NOT verified": "ΧΩΡΙΣ επαλήθευση", + "No devices with registered encryption keys": "Καθόλου συσκευές με εγγεγραμένα κλειδιά κρυπτογράφησης", + "No display name": "Χωρίς όνομα", + "No users have specific privileges in this room": "Κανένας χρήστης δεν έχει συγκεκριμένα δικαιώματα σε αυτό το δωμάτιο", + "Once encryption is enabled for a room it cannot be turned off again (for now)": "Μόλις ενεργοποιηθεί η κρυπτογράφηση για ένα δωμάτιο, δεν μπορεί να απενεργοποιηθεί ξανά (για τώρα)", + "Once you've followed the link it contains, click below": "Μόλις ακολουθήσετε τον σύνδεσμο που περιέχει, κάντε κλικ παρακάτω", + "Only people who have been invited": "Μόνο άτομα που έχουν προσκληθεί", + "Otherwise, click here to send a bug report.": "Διαφορετικά, κάντε κλικ εδώ για να αποστείλετε μια αναφορά σφάλματος.", + "%(senderName)s placed a %(callType)s call.": "Ο %(senderName)s πραγματοποίησε μια %(callType)s κλήση.", + "Please check your email and click on the link it contains. Once this is done, click continue.": "Παρακαλούμε ελέγξτε την ηλεκτρονική σας αλληλογραφία και κάντε κλικ στον σύνδεσμο που περιέχει. Μόλις γίνει αυτό, κάντε κλίκ στο κουμπί συνέχεια.", + "Press": "Πατήστε", + "Refer a friend to Riot:": "Πείτε για το Riot σε έναν φίλο σας:", + "Rejoin": "Επανασύνδεση", + "%(senderName)s removed their profile picture.": "Ο %(senderName)s αφαίρεσε τη φωτογραφία του προφίλ του.", + "%(senderName)s requested a VoIP conference.": "Ο %(senderName)s αιτήθηκε μια συνδιάσκεψη VoIP.", + "Riot does not have permission to send you notifications - please check your browser settings": "Το Riot δεν έχει δικαιώματα για αποστολή ειδοποιήσεων - παρακαλούμε ελέγξτε τις ρυθμίσεις του περιηγητή σας", + "Riot was not given permission to send notifications - please try again": "Δεν δόθηκαν δικαιώματα στο Riot να αποστείλει ειδοποιήσεις - παρακαλούμε προσπαθήστε ξανά", + "Room contains unknown devices": "Το δωμάτιο περιέχει άγνωστες συσκευές", + "%(roomName)s is not accessible at this time.": "Το %(roomName)s δεν είναι προσβάσιμο αυτή τη στιγμή.", + "Scroll to bottom of page": "Μετάβαση στο τέλος της σελίδας", + "Scroll to unread messages": "Μεταβείτε στα μη αναγνωσμένα μηνύματα", + "Sender device information": "Πληροφορίες συσκευής αποστολέα", + "Server may be unavailable, overloaded, or search timed out :(": "Ο διακομιστής μπορεί να είναι μη διαθέσιμος, υπερφορτωμένος, ή να έχει λήξει η αναζήτηση :(", + "Server may be unavailable, overloaded, or the file too big": "Ο διακομιστής μπορεί να είναι μη διαθέσιμος, υπερφορτωμένος, ή το αρχείο να είναι πολύ μεγάλο", + "Server may be unavailable, overloaded, or you hit a bug.": "Ο διακομιστής μπορεί να είναι μη διαθέσιμος, υπερφορτωμένος, ή να πέσατε σε ένα σφάλμα.", + "Server unavailable, overloaded, or something else went wrong.": "Ο διακομιστής μπορεί να είναι μη διαθέσιμος, υπερφορτωμένος, ή κάτι άλλο να πήγε στραβά.", + "Show panel": "Εμφάνιση καρτέλας", + "Show Text Formatting Toolbar": "Εμφάνιση της εργαλειοθήκης μορφοποίησης κειμένου", + "Some of your messages have not been sent.": "Μερικά από τα μηνύματα σας δεν έχουν αποσταλεί.", + "This room is not recognised.": "Αυτό το δωμάτιο δεν αναγνωρίζεται.", + "to favourite": "στα αγαπημένα", + "To kick users": "Για να διώξετε χρήστες", + "to make a room or": "για δημιουργία ενός δωματίου ή", + "to start a chat with someone": "για να ξεκινήσετε μια συνομιλία με κάποιον", + "Unable to capture screen": "Αδυναμία σύλληψης οθόνης", + "Unknown (user, device) pair:": "Άγνωστο ζεύγος (χρήστη, συσκευής):", + "Uploading %(filename)s and %(count)s others.zero": "Γίνεται αποστολή του %(filename)s", + "Uploading %(filename)s and %(count)s others.other": "Γίνεται αποστολή του %(filename)s και %(count)s υπολοίπων", + "uploaded a file": "ανέβασε ένα αρχείο", + "%(userName)s (power %(powerLevelNumber)s)": "%(userName)s (δύναμη %(powerLevelNumber)s)", + "Verification Pending": "Εκκρεμεί επιβεβαίωση", + "Verification": "Επιβεβαίωση", + "verified": "επαληθεύτηκε", + "Verified": "Επαληθεύτηκε", + "Verified key": "Επιβεβαιωμένο κλειδί", + "VoIP conference finished.": "Ολοκληρώθηκε η συνδιάσκεψη VoIP.", + "VoIP conference started.": "Ξεκίνησησε η συνδιάσκεψη VoIP.", + "VoIP is unsupported": "Δεν υποστηρίζεται το VoIP", + "(warning: cannot be disabled again!)": "(προειδοποίηση: δεν μπορεί να απενεργοποιηθεί ξανά)", + "WARNING: Device already verified, but keys do NOT MATCH!": "ΠΡΟΕΙΔΟΠΟΙΗΣΗ: Η συσκευή έχει επαληθευτεί, αλλά τα κλειδιά ΔΕΝ ΤΑΙΡΙΑΖΟΥΝ!", + "Who can access this room?": "Ποιος μπορεί να προσπελάσει αυτό το δωμάτιο;", + "Who can read history?": "Ποιος μπορεί να διαβάσει το ιστορικό;", + "Who would you like to add to this room?": "Ποιον θέλετε να προσθέσετε σε αυτό το δωμάτιο;", + "%(senderName)s withdrew %(targetName)s's invitation.": "Ο %(senderName)s ανακάλεσε την πρόσκληση του %(targetName)s.", + "You're not in any rooms yet! Press": "Δεν είστε ακόμη σε κάνενα δωμάτιο! Πατήστε", + "You cannot place a call with yourself.": "Δεν μπορείτε να καλέσετε τον ευατό σας.", + "You cannot place VoIP calls in this browser.": "Δεν μπορείτε να πραγματοποιήσετε κλήσεις VoIP με αυτόν τον περιηγητή.", + "You do not have permission to post to this room": "Δεν έχετε δικαιώματα για να δημοσιεύσετε σε αυτό το δωμάτιο", + "You have been banned from %(roomName)s by %(userName)s.": "Έχετε αποκλειστεί από το δωμάτιο %(roomName)s από τον %(userName)s.", + "You have been invited to join this room by %(inviterName)s": "Έχετε προσκληθεί να συνδεθείτε στο δωμάτιο από τον %(inviterName)s", + "You seem to be in a call, are you sure you want to quit?": "Φαίνεται ότι είστε σε μια κλήση, είστε βέβαιοι ότι θέλετε να αποχωρήσετε;", + "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s": "%(weekDayName)s, %(monthName)s %(day)s %(fullYear)s %(time)s", + "This doesn't look like a valid phone number.": "Δεν μοιάζει με έναν έγκυρο αριθμό τηλεφώνου.", + "Make this room private": "Κάντε το δωμάτιο ιδιωτικό", + "There are no visible files in this room": "Δεν υπάρχουν ορατά αρχεία σε αυτό το δωμάτιο", + "Connectivity to the server has been lost.": "Χάθηκε η συνδεσιμότητα στον διακομιστή.", + "%(severalUsers)sleft %(repeats)s times": "%(severalUsers)s έφυγαν %(repeats)s φορές", + "%(severalUsers)srejected their invitations %(repeats)s times": "Οι %(severalUsers)s απέρριψαν τις προσκλήσεις τους %(repeats)s φορές", + "%(oneUser)srejected their invitation %(repeats)s times": "Ο %(oneUser)s απέρριψε την πρόσκληση του %(repeats)s φορές", + "%(severalUsers)srejected their invitations": "Οι %(severalUsers)s απέρριψαν τις προσκλήσεις τους", + "%(oneUser)srejected their invitation": "Ο %(oneUser)s απέρριψε την πρόσκληση", + "were invited %(repeats)s times": "προσκλήθηκαν %(repeats)s φορές", + "was invited %(repeats)s times": "προσκλήθηκε %(repeats)s φορές", + "were banned %(repeats)s times": "αποκλείστηκαν %(repeats)s φορές", + "was banned %(repeats)s times": "αποκλείστηκε %(repeats)s φορές", + "were kicked %(repeats)s times": "διώχθηκαν %(repeats)s φορές", + "was kicked %(repeats)s times": "διώχθηκε %(repeats)s φορές", + "%(severalUsers)schanged their name %(repeats)s times": "%(severalUsers)s άλλαξαν το όνομα τους %(repeats)s φορές", + "%(oneUser)schanged their name %(repeats)s times": "Ο %(oneUser)s άλλαξε το όνομα του %(repeats)s φορές", + "%(severalUsers)schanged their name": "Οι %(severalUsers)s άλλαξαν το όνομα τους", + "%(oneUser)schanged their name": "Ο %(oneUser)s άλλαξε το όνομα του", + "%(severalUsers)schanged their avatar %(repeats)s times": "Οι %(severalUsers)s άλλαξαν την προσωπική τους φωτογραφία %(repeats)s φορές", + "%(oneUser)schanged their avatar %(repeats)s times": "Ο %(oneUser)s άλλαξε την προσωπική του εικόνα %(repeats)s φορές", + "%(severalUsers)schanged their avatar": "Οι %(severalUsers)s άλλαξαν την προσωπική τους εικόνα", + "%(oneUser)schanged their avatar": "Ο %(oneUser)s άλλαξε την προσωπική του εικόνα", + "Please select the destination room for this message": "Παρακαλούμε επιλέξτε ένα δωμάτιο προορισμού για αυτό το μήνυμα", + "Desktop specific": "Μόνο για επιφάνεια εργασίας", + "Analytics": "Αναλυτικά στοιχεία", + "Opt out of analytics": "Αποκλείστε τα αναλυτικά στοιχεία", + "Riot collects anonymous analytics to allow us to improve the application.": "Το Riot συλλέγει ανώνυμα δεδομένα επιτρέποντας μας να βελτιώσουμε την εφαρμογή.", + "Failed to invite": "Δεν ήταν δυνατή η πρόσκληση", + "Failed to invite user": "Δεν ήταν δυνατή η πρόσκληση του χρήστη", + "This action is irreversible.": "Αυτή η ενέργεια είναι μη αναστρέψιμη.", + "In future this verification process will be more sophisticated.": "Στο μέλλον η διαδικασία επαλήθευσης θα είναι πιο εξελιγμένη.", + "I verify that the keys match": "Επιβεβαιώνω πως ταιριάζουν τα κλειδιά", + "\"%(RoomName)s\" contains devices that you haven't seen before.": "Το \"%(RoomName)s\" περιέχει συσκευές που δεν έχετε ξαναδεί.", + "This Home Server would like to make sure you are not a robot": "Ο διακομιστής θέλει να σιγουρευτεί ότι δεν είσαστε ρομπότ", + "Please check your email to continue registration.": "Παρακαλούμε ελέγξτε την ηλεκτρονική σας αλληλογραφία για να συνεχίσετε με την εγγραφή.", + "If you don't specify an email address, you won't be able to reset your password. Are you sure?": "Αν δεν ορίσετε μια διεύθυνση ηλεκτρονικής αλληλογραφίας, δεν θα θα μπορείτε να επαναφέρετε τον κωδικό πρόσβασης σας. Είστε σίγουροι;", + "You are registering with %(SelectedTeamName)s": "Εγγραφείτε με %(SelectedTeamName)s", + "Removed or unknown message type": "Αφαιρέθηκε ή άγνωστος τύπος μηνύματος", + "Disable URL previews by default for participants in this room": "Απενεργοποίηση της προεπισκόπησης συνδέσμων για όλους τους συμμετέχοντες στο δωμάτιο", + "Disable URL previews for this room (affects only you)": "Ενεργοποίηση της προεπισκόπησης συνδέσμων για αυτό το δωμάτιο (επηρεάζει μόνο εσάς)", + " (unsupported)": " (μη υποστηριζόμενο)", + "$senderDisplayName changed the room avatar to ": "Ο $senderDisplayName άλλαξε την εικόνα του δωματίου σε ", + "Missing Media Permissions, click here to request.": "Λείπουν τα δικαιώματα πολύμεσων, κάντε κλικ για να ζητήσετε.", + "You may need to manually permit Riot to access your microphone/webcam": "Μπορεί να χρειαστεί να ορίσετε χειροκίνητα την πρόσβαση του Riot στο μικρόφωνο/κάμερα", + "Can't connect to homeserver - please check your connectivity, ensure your homeserver's SSL certificate is trusted, and that a browser extension is not blocking requests.": "Δεν είναι δυνατή η σύνδεση στον διακομιστή - παρακαλούμε ελέγξτε την συνδεσιμότητα, βεβαιωθείτε ότι το πιστοποιητικό SSL του διακομιστή είναι έμπιστο και ότι κάποιο πρόσθετο περιηγητή δεν αποτρέπει τα αιτήματα.", + "Can't connect to homeserver via HTTP when an HTTPS URL is in your browser bar. Either use HTTPS or enable unsafe scripts.": "Δεν είναι δυνατή η σύνδεση στον διακομιστή μέσω HTTP όταν μια διεύθυνση HTTPS βρίσκεται στην μπάρα του περιηγητή. Είτε χρησιμοποιήστε HTTPS ή ενεργοποιήστε τα μη ασφαλή σενάρια εντολών.", + "%(senderName)s changed the power level of %(powerLevelDiffText)s.": "Ο %(senderName)s άλλαξε το επίπεδο δύναμης του %(powerLevelDiffText)s.", + "Changes to who can read history will only apply to future messages in this room": "Οι αλλαγές που αφορούν την ορατότητα του ιστορικού θα εφαρμοστούν μόνο στα μελλοντικά μηνύματα του δωματίου", + "Conference calling is in development and may not be reliable.": "Η κλήση συνδιάσκεψης είναι υπό ανάπτυξη και μπορεί να μην είναι αξιόπιστη.", + "Devices will not yet be able to decrypt history from before they joined the room": "Οι συσκευές δεν θα είναι σε θέση να αποκρυπτογραφήσουν το ιστορικό πριν από την είσοδο τους στο δωμάτιο", + "End-to-end encryption is in beta and may not be reliable": "Η κρυπτογράφηση από άκρο σε άκρο είναι σε δοκιμαστικό στάδιο και μπορεί να μην είναι αξιόπιστη", + "%(senderName)s removed their display name (%(oldDisplayName)s).": "Ο %(senderName)s αφαίρεσε το όνομα εμφάνισης του (%(oldDisplayName)s).", + "%(senderName)s sent an invitation to %(targetDisplayName)s to join the room.": "Ο %(senderName)s έστειλε μια πρόσκληση στον %(targetDisplayName)s για να συνδεθεί στο δωμάτιο.", + "%(senderName)s set their display name to %(displayName)s.": "Ο %(senderName)s όρισε το όνομα του σε %(displayName)s.", + "Sorry, this homeserver is using a login which is not recognised ": "Συγγνώμη, ο διακομιστής χρησιμοποιεί έναν τρόπο σύνδεσης που δεν αναγνωρίζεται", + "tag as %(tagName)s": "ετικέτα ως %(tagName)s", + "tag direct chat": "προσθήκη ετικέτας στην απευθείας συνομιλία", + "The phone number entered looks invalid": "Ο αριθμός που καταχωρίσατε δεν είναι έγκυρος", + "This action cannot be performed by a guest user. Please register to be able to do this.": "Αυτή η ενέργεια δεν μπορεί να εκτελεστεί από έναν επισκέπτη. Παρακαλούμε εγγραφείτε για να μπορέσετε να το κάνετε.", + "The email address linked to your account must be entered.": "Πρέπει να εισηχθεί η διεύθυνση ηλ. αλληλογραφίας που είναι συνδεδεμένη με τον λογαριασμό σας.", + "The file '%(fileName)s' exceeds this home server's size limit for uploads": "Το αρχείο '%(fileName)s' υπερβαίνει το όριο μεγέθους του διακομιστή για αποστολές", + "The remote side failed to pick up": "Η απομακρυσμένη πλευρά απέτυχε να συλλέξει", + "This Home Server does not support login using email address.": "Ο διακομιστής δεν υποστηρίζει σύνδεση με διευθύνσεις ηλ. αλληλογραφίας.", + "This invitation was sent to an email address which is not associated with this account:": "Η πρόσκληση στάλθηκε σε μια διεύθυνση που δεν έχει συσχετιστεί με αυτόν τον λογαριασμό:", + "These are experimental features that may break in unexpected ways": "Αυτά είναι πειραματικά χαρακτηριστικά και μπορεί να καταρρεύσουν με απροσδόκητους τρόπους", + "The visibility of existing history will be unchanged": "Η ορατότητα του υπάρχοντος ιστορικού θα παραμείνει αμετάβλητη", + "This is a preview of this room. Room interactions have been disabled": "Αυτή είναι μια προεπισκόπηση του δωματίου. Οι αλληλεπιδράσεις δωματίου έχουν απενεργοποιηθεί", + "This room is not accessible by remote Matrix servers": "Αυτό το δωμάτιο δεν είναι προσβάσιμο από απομακρυσμένους διακομιστές Matrix", + "to demote": "για υποβίβαση", + "To reset your password, enter the email address linked to your account": "Για να επαναφέρετε τον κωδικό πρόσβασης σας, πληκτρολογήστε τη διεύθυνση ηλ. αλληλογραφίας όπου είναι συνδεδεμένη με τον λογαριασμό σας", + "to tag as %(tagName)s": "για να οριστεί ετικέτα ως %(tagName)s", + "to tag direct chat": "για να οριστεί ετικέτα σε απευθείας συνομιλία", + "%(senderName)s turned on end-to-end encryption (algorithm %(algorithm)s).": "Ο %(senderName)s ενεργοποίησε την από άκρο σε άκρο κρυπτογράφηση (algorithm %(algorithm)s).", + "Undecryptable": "Μη αποκρυπτογραφημένο", + "Uploading %(filename)s and %(count)s others.one": "Γίνεται αποστολή του %(filename)s και %(count)s υπολοίπα", + "Would you like to accept or decline this invitation?": "Θα θέλατε να δεχθείτε ή να απορρίψετε την πρόσκληση;", + "You already have existing direct chats with this user:": "Έχετε ήδη απευθείας συνομιλίες με τον χρήστη:", + "You are trying to access %(roomName)s.": "Προσπαθείτε να έχετε πρόσβαση στο %(roomName)s.", + "You have been kicked from %(roomName)s by %(userName)s.": "Έχετε διωχθεί από το δωμάτιο %(roomName)s από τον %(userName)s.", + "You have been logged out of all devices and will no longer receive push notifications. To re-enable notifications, sign in again on each device": "Έχετε αποσυνδεθεί από όλες τις συσκευές και δεν θα λαμβάνετε πλέον ειδοποιήσεις push. Για να ενεργοποιήσετε τις ειδοποιήσεις, συνδεθείτε ξανά σε κάθε συσκευή", + "You have disabled URL previews by default.": "Έχετε απενεργοποιημένη από προεπιλογή την προεπισκόπηση συνδέσμων.", + "You have enabled URL previews by default.": "Έχετε ενεργοποιημένη από προεπιλογή την προεπισκόπηση συνδέσμων.", + "You have entered an invalid contact. Try using their Matrix ID or email address.": "Έχετε πληκτρολογήσει μια άκυρη επαφή. Χρησιμοποιήστε το Matrix ID ή την ηλεκτρονική διεύθυνση αλληλογραφίας τους.", + "You may wish to login with a different account, or add this email to this account.": "Μπορεί να θέλετε να συνδεθείτε με διαφορετικό λογαριασμό, ή να προσθέσετε αυτή τη διεύθυνση ηλεκτρονικής αλληλογραφίας σε αυτόν τον λογαριασμό.", + "You need to be able to invite users to do that.": "Για να το κάνετε αυτό πρέπει να έχετε τη δυνατότητα να προσκαλέσετε χρήστες.", + "You seem to be uploading files, are you sure you want to quit?": "Φαίνεται ότι αποστέλετε αρχεία, είστε βέβαιοι ότι θέλετε να αποχωρήσετε;", + "You should not yet trust it to secure data": "Δεν πρέπει να το εμπιστεύεστε για να ασφαλίσετε δεδομένα", + "Your home server does not support device management.": "Ο διακομιστής δεν υποστηρίζει διαχείριση συσκευών.", + "Password too short (min %(MIN_PASSWORD_LENGTH)s).": "Ο κωδικός πρόσβασης είναι πολύ μικρός (ελ. %(MIN_PASSWORD_LENGTH)s).", + "User names may only contain letters, numbers, dots, hyphens and underscores.": "Τα ονόματα μπορεί να περιέχουν μόνο γράμματα, αριθμούς, τελείες, πάνω και κάτω παύλα.", + "Share message history with new users": "Διαμοιρασμός ιστορικού μηνυμάτων με τους νέους χρήστες", + "numbullet": "απαρίθμηση", + "%(severalUsers)sleft and rejoined %(repeats)s times": "%(severalUsers)s έφυγαν και ξανασυνδέθηκαν %(repeats)s φορές", + "%(oneUser)sleft and rejoined %(repeats)s times": "%(severalUsers)s έφυγε και ξανασυνδέθηκε %(repeats)s φορές", + "%(severalUsers)sleft and rejoined": "%(severalUsers)s έφυγαν και ξανασυνδέθηκαν", + "%(oneUser)sleft and rejoined": "%(severalUsers)s έφυγε και ξανασυνδέθηκε", + "%(severalUsers)shad their invitations withdrawn %(repeats)s times": "Οι %(severalUsers)s απέσυραν τις προσκλήσεις τους %(repeats)s φορές", + "%(oneUser)shad their invitation withdrawn %(repeats)s times": "Ο %(severalUsers)s απέσυρε την πρόσκληση του %(repeats)s φορές", + "%(severalUsers)shad their invitations withdrawn": "Οι %(severalUsers)s απέσυραν τις προσκλήσεις τους", + "%(oneUser)shad their invitation withdrawn": "Ο %(severalUsers)s απέσυρε την πρόσκληση του", + "You must join the room to see its files": "Πρέπει να συνδεθείτε στο δωμάτιο για να δείτε τα αρχεία του", + "Reject all %(invitedRooms)s invites": "Απόρριψη όλων των προσκλήσεων %(invitedRooms)s", + "Failed to invite the following users to the %(roomName)s room:": "Δεν ήταν δυνατή η πρόσκληση των χρηστών στο δωμάτιο %(roomName)s:", + "changing room on a RoomView is not supported": "Δεν υποστηρίζεται η αλλαγή δωματίου σε RoomView", + "demote": "υποβίβαση", + "Deops user with given id": "Deop χρήστη με το συγκεκριμένο αναγνωριστικό", + "Disable inline URL previews by default": "Απενεργοποίηση προεπισκόπησης συνδέσμων από προεπιλογή", + "Drop here to tag %(section)s": "Απόθεση εδώ για ορισμό ετικέτας στο %(section)s", + "Join as voice or video.": "Συμμετάσχετε με φωνή ή βίντεο.", + "Joins room with given alias": "Συνδέεστε στο δωμάτιο με δοσμένο ψευδώνυμο", + "Setting a user name will create a fresh account": "Ορίζοντας ένα όνομα χρήστη θα δημιουργήσει ένα νέο λογαριασμό", + "Show timestamps in 12 hour format (e.g. 2:30pm)": "Εμφάνιση χρονικών σημάνσεων σε 12ωρη μορφή ώρας (π.χ. 2:30 μ.μ.)", + "since the point in time of selecting this option": "από το χρονικό σημείο επιλογής αυτής της ρύθμισης", + "The signing key you provided matches the signing key you received from %(userId)s's device %(deviceId)s. Device marked as verified.": "Το κλειδί υπογραφής που δώσατε αντιστοιχεί στο κλειδί υπογραφής που λάβατε από τη συσκευή %(userId)s %(deviceId)s. Η συσκευή έχει επισημανθεί ως επιβεβαιωμένη.", + "To link to a room it must have an address.": "Για να συνδεθείτε σε ένα δωμάτιο πρέπει να έχετε μια διεύθυνση.", + "You need to log back in to generate end-to-end encryption keys for this device and submit the public key to your homeserver. This is a once off; sorry for the inconvenience.": "Πρέπει να συνδεθείτε ξανά για να δημιουργήσετε τα κλειδιά κρυπτογράφησης από άκρο σε άκρο για αυτήν τη συσκευή και να υποβάλετε το δημόσιο κλειδί στον διακομιστή σας. Αυτό θα χρειαστεί να γίνει μόνο μια φορά.", + "Your email address does not appear to be associated with a Matrix ID on this Homeserver.": "Η διεύθυνση ηλεκτρονικής αλληλογραφίας σας δεν φαίνεται να συσχετίζεται με Matrix ID σε αυτόν τον διακομιστή.", + "Your password was successfully changed. You will not receive push notifications on other devices until you log back in to them": "Ο κωδικός πρόσβασής σας άλλαξε επιτυχώς. Δεν θα λάβετε ειδοποιήσεις push σε άλλες συσκευές μέχρι να συνδεθείτε ξανά σε αυτές", + "You will not be able to undo this change as you are promoting the user to have the same power level as yourself.": "Δεν θα μπορέσετε να αναιρέσετε αυτήν την αλλαγή καθώς προωθείτε τον χρήστη να έχει το ίδιο επίπεδο δύναμης με τον εαυτό σας.", + "Sent messages will be stored until your connection has returned.": "Τα απεσταλμένα μηνύματα θα αποθηκευτούν μέχρι να αακτηθεί η σύνδεσή σας.", + "Resend all or cancel all now. You can also select individual messages to resend or cancel.": "Αποστολή ξανά όλων ή ακύρωση όλων τώρα. Μπορείτε επίσης να επιλέξετε μεμονωμένα μηνύματα για να τα στείλετε ξανά ή να ακυρώσετε.", + "Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.": "Είστε βέβαιοι ότι θέλετε να καταργήσετε (διαγράψετε) αυτό το συμβάν; Σημειώστε ότι αν διαγράψετε το όνομα δωματίου ή αλλάξετε το θέμα, θα μπορούσε να αναιρέσει την αλλαγή.", + "This allows you to use this app with an existing Matrix account on a different home server.": "Αυτό σας επιτρέπει να χρησιμοποιήσετε την εφαρμογή με έναν υπάρχον λογαριασμό Matrix σε έναν διαφορετικό διακομιστή.", + "You can also set a custom identity server but this will typically prevent interaction with users based on email address.": "Μπορείτε επίσης να ορίσετε έναν προσαρμοσμένο διακομιστή ταυτοποίησης, αλλά αυτό συνήθως θα αποτρέψει την αλληλεπίδραση με τους χρήστες που βασίζονται στην ηλεκτρονική διεύθυνση αλληλογραφίας.", + "URL previews are %(globalDisableUrlPreview)s by default for participants in this room.": "Η προεπισκόπηση συνδέσμων είναι %(globalDisableUrlPreview)s από προεπιλογή για τους συμμετέχοντες του δωματίου.", + "Ongoing conference call%(supportedText)s. %(joinText)s": "Κλήση συνδιάσκεψης σε εξέλιξη %(supportedText)s. %(joinText)s", + "This will be your account name on the homeserver, or you can pick a different server.": "Αυτό θα είναι το όνομα του λογαριασμού σας στον διακομιστή , ή μπορείτε να επιλέξετε διαφορετικό διακομιστή.", + "If you already have a Matrix account you can log in instead.": "Αν έχετε ήδη λογαριασμό Matrix μπορείτε να συνδεθείτε.", + "Failed to load timeline position": "Δεν ήταν δυνατή η φόρτωση της θέσης του χρονολόγιου", + "Tried to load a specific point in this room's timeline, but you do not have permission to view the message in question.": "Προσπαθήσατε να φορτώσετε ένα συγκεκριμένο σημείο στο χρονολόγιο του δωματίου, αλλά δεν έχετε δικαίωμα να δείτε το εν λόγω μήνυμα.", + "Tried to load a specific point in this room's timeline, but was unable to find it.": "Προσπαθήσατε να φορτώσετε ένα συγκεκριμένο σημείο στο χρονολόγιο του δωματίου, αλλά δεν καταφέρατε να το βρείτε." } diff --git a/src/i18n/strings/en_US.json b/src/i18n/strings/en_US.json index d857ff06cb..8c8d0ed6d0 100644 --- a/src/i18n/strings/en_US.json +++ b/src/i18n/strings/en_US.json @@ -841,5 +841,78 @@ "Decline": "Decline", "Disable markdown formatting": "Disable markdown formatting", "Disable Notifications": "Disable Notifications", - "Enable Notifications": "Enable Notifications" + "Enable Notifications": "Enable Notifications", + "Create new room": "Create new room", + "Room directory": "Room directory", + "Start chat": "Start chat", + "Welcome page": "Welcome page", + "Create a new chat or reuse an existing one": "Create a new chat or reuse an existing one", + "Drop File Here": "Drop File Here", + "Encrypted by a verified device": "Encrypted by a verified device", + "Encrypted by an unverified device": "Encrypted by an unverified device", + "Encryption is enabled in this room": "Encryption is enabled in this room", + "Encryption is not enabled in this room": "Encryption is not enabled in this room", + "Error: Problem communicating with the given homeserver.": "Error: Problem communicating with the given homeserver.", + "Failed to fetch avatar URL": "Failed to fetch avatar URL", + "Failed to upload profile picture!": "Failed to upload profile picture!", + "Home": "Home", + "Incoming call from %(name)s": "Incoming call from %(name)s", + "Incoming video call from %(name)s": "Incoming video call from %(name)s", + "Incoming voice call from %(name)s": "Incoming voice call from %(name)s", + "Join as voice or video.": "Join as voice or video.", + "Last seen": "Last seen", + "Level:": "Level:", + "No display name": "No display name", + "Otherwise, click here to send a bug report.": "Otherwise, click here to send a bug report.", + "Private Chat": "Private Chat", + "Public Chat": "Public Chat", + "Reason: %(reasonText)s": "Reason: %(reasonText)s", + "Rejoin": "Rejoin", + "Room contains unknown devices": "Room contains unknown devices", + "%(roomName)s does not exist.": "%(roomName)s does not exist.", + "%(roomName)s is not accessible at this time.": "%(roomName)s is not accessible at this time.", + "Searching known users": "Searching known users", + "Seen by %(userName)s at %(dateTime)s": "Seen by %(userName)s at %(dateTime)s", + "Send anyway": "Send anyway", + "Set": "Set", + "Show Text Formatting Toolbar": "Show Text Formatting Toolbar", + "Start authentication": "Start authentication", + "The phone number entered looks invalid": "The phone number entered looks invalid", + "This invitation was sent to an email address which is not associated with this account:": "This invitation was sent to an email address which is not associated with this account:", + "This room": "This room", + "To link to a room it must have an address.": "To link to a room it must have an address.", + "Unable to ascertain that the address this invite was sent to matches one associated with your account.": "Unable to ascertain that the address this invite was sent to matches one associated with your account.", + "Undecryptable": "Undecryptable", + "Unencrypted message": "Unencrypted message", + "unknown caller": "unknown caller", + "Unnamed Room": "Unnamed Room", + "Unverified": "Unverified", + "Uploading %(filename)s and %(count)s others.zero": "Uploading %(filename)s", + "Uploading %(filename)s and %(count)s others.one": "Uploading %(filename)s and %(count)s other", + "Uploading %(filename)s and %(count)s others.other": "Uploading %(filename)s and %(count)s others", + "Upload new:": "Upload new:", + "%(user)s is a": "%(user)s is a", + "%(userName)s (power %(powerLevelNumber)s)": "%(userName)s (power %(powerLevelNumber)s)", + "Username invalid: %(errMessage)s": "Username invalid: %(errMessage)s", + "Verified": "Verified", + "Would you like to accept or decline this invitation?": "Would you like to accept or decline this invitation?", + "You already have existing direct chats with this user:": "You already have existing direct chats with this user:", + "You have been banned from %(roomName)s by %(userName)s.": "You have been banned from %(roomName)s by %(userName)s.", + "You have been kicked from %(roomName)s by %(userName)s.": "You have been kicked from %(roomName)s by %(userName)s.", + "You may wish to login with a different account, or add this email to this account.": "You may wish to login with a different account, or add this email to this account.", + "You must register to use this functionality": "You must register to use this functionality", + "Your home server does not support device management.": "Your home server does not support device management.", + "Resend all or cancel all now. You can also select individual messages to resend or cancel.": "Resend all or cancel all now. You can also select individual messages to resend or cancel.", + "(~%(count)s results).one": "(~%(count)s result)", + "(~%(count)s results).other": "(~%(count)s results)", + "New Password": "New Password", + "Device Name": "Device Name", + "Start chatting": "Start chatting", + "Start Chatting": "Start Chatting", + "Click on the button below to start chatting!": "Click on the button below to start chatting!", + "Username available": "Username available", + "Username not available": "Username not available", + "Something went wrong!": "Something went wrong!", + "This will be your account name on the homeserver, or you can pick a different server.": "This will be your account name on the homeserver, or you can pick a different server.", + "If you already have a Matrix account you can log in instead.": "If you already have a Matrix account you can log in instead." } diff --git a/src/i18n/strings/fr.json b/src/i18n/strings/fr.json index 4b074b63ea..9f867e2013 100644 --- a/src/i18n/strings/fr.json +++ b/src/i18n/strings/fr.json @@ -129,7 +129,7 @@ "Don't send typing notifications": "Ne pas envoyer les notifications de saisie", "Download %(text)s": "Télécharger %(text)s", "Drop here %(toAction)s": "Déposer ici %(toAction)s", - "Drop here to tag %(section)s": "Déposer ici pour marque comme %(section)s", + "Drop here to tag %(section)s": "Déposer ici pour marquer comme %(section)s", "Ed25519 fingerprint": "Empreinte Ed25519", "Email Address": "Adresse e-mail", "Email, name or matrix ID": "E-mail, nom ou identifiant Matrix", @@ -282,7 +282,7 @@ "Email": "E-mail", "Failed to unban": "Échec de l'amnistie", "Failed to upload file": "Échec du téléchargement", - "Failed to verify email address: make sure you clicked the link in the email": "Échec de la vérification de l’adresse e-mail: vérifiez que vous avez bien cliqué sur le lien dans l’e-mail", + "Failed to verify email address: make sure you clicked the link in the email": "Échec de la vérification de l’adresse e-mail : vérifiez que vous avez bien cliqué sur le lien dans l’e-mail", "Failure to create room": "Échec de la création du salon", "favourite": "favoris", "Favourites": "Favoris", @@ -290,7 +290,7 @@ "Filter room members": "Filtrer les membres par nom", "Forget room": "Oublier le salon", "Forgot your password?": "Mot de passe perdu ?", - "For security, this session has been signed out. Please sign in again.": "Par sécurité, la session a expiré. Merci de vous authentifer à nouveau.", + "For security, this session has been signed out. Please sign in again.": "Par sécurité, la session a expiré. Merci de vous authentifier à nouveau.", "Found a bug?": "Trouvé un problème ?", "%(userId)s from %(fromPowerLevel)s to %(toPowerLevel)s": "%(userId)s de %(fromPowerLevel)s à %(toPowerLevel)s", "Guest users can't create new rooms. Please register to create room and start a chat.": "Les visiteurs ne peuvent créer de nouveaux salons. Merci de vous enregistrer pour commencer une discussion.", @@ -298,7 +298,7 @@ "had": "avait", "Hangup": "Raccrocher", "Hide read receipts": "Cacher les accusés de réception", - "Hide Text Formatting Toolbar": "Cacher la barre de formattage de texte", + "Hide Text Formatting Toolbar": "Cacher la barre de formatage de texte", "Historical": "Historique", "Homeserver is": "Le homeserver est", "Identity Server is": "Le serveur d'identité est", @@ -325,8 +325,8 @@ "%(targetName)s joined the room.": "%(targetName)s a joint le salon.", "Joins room with given alias": "Joint le salon avec l'alias défini", "%(senderName)s kicked %(targetName)s.": "%(senderName)s a expulsé %(targetName)s.", - "Kick": "Expluser", - "Kicks user with given id": "Expulse l'utilisateur and l'ID donné", + "Kick": "Expulser", + "Kicks user with given id": "Expulse l'utilisateur avec l'ID donné", "Labs": "Laboratoire", "Leave room": "Quitter le salon", "left and rejoined": "a quitté et rejoint", @@ -453,7 +453,7 @@ "Show timestamps in 12 hour format (e.g. 2:30pm)": "Afficher l’heure au format am/pm (par ex. 2:30pm)", "Signed Out": "Déconnecté", "Sign in": "S'identifier", - "Sign out": "Se Déconnecter", + "Sign out": "Se déconnecter", "since the point in time of selecting this option": "depuis le moment où cette option a été sélectionnée", "since they joined": "depuis qu’ils ont rejoint le salon", "since they were invited": "depuis qu’ils ont été invités", @@ -498,7 +498,7 @@ "To link to a room it must have": "Pour avoir un lien vers un salon, il doit avoir", "to make a room or": "pour créer un salon ou", "To remove other users' messages": "Pour supprimer les messages des autres utilisateurs", - "To reset your password, enter the email address linked to your account": "Pour réinitialiser votre mot de passe, merci d’entrer l’adresse email liée à votre compte", + "To reset your password, enter the email address linked to your account": "Pour réinitialiser votre mot de passe, merci d’entrer l’adresse e-mail liée à votre compte", "to restore": "pour restaurer", "To send events of type": "Pour envoyer des évènements du type", "To send messages": "Pour envoyer des messages", @@ -527,7 +527,7 @@ "Unknown room %(roomId)s": "Salon inconnu %(roomId)s", "unknown": "inconnu", "Unmute": "Activer le son", - "uploaded a file": "télécharger un fichier", + "uploaded a file": "téléchargé un fichier", "Upload avatar": "Télécharger une photo de profil", "Upload Failed": "Erreur lors du téléchargement", "Upload Files": "Télécharger les fichiers", @@ -547,7 +547,7 @@ "VoIP conference finished.": "Conférence audio terminée.", "VoIP conference started.": "Conférence audio démarrée.", "VoIP is unsupported": "Appels voix non supportés", - "(warning: cannot be disabled again!)": "(attention: ne peut être désactivé !)", + "(warning: cannot be disabled again!)": "(attention : ne peut être désactivé !)", "Warning!": "Attention !", "Who can access this room?": "Qui peut accéder au salon ?", "Who can read history?": "Qui peut lire l'historique ?", @@ -562,13 +562,13 @@ "You cannot place VoIP calls in this browser.": "Vous ne pouvez pas passer d'appel voix dans cet explorateur.", "You do not have permission to post to this room": "Vous n’avez pas la permission de poster dans ce salon", "You have been invited to join this room by %(inviterName)s": "Vous avez été invité à joindre ce salon par %(inviterName)s", - "You have been logged out of all devices and will no longer receive push notifications. To re-enable notifications, sign in again on each device": "Vous avez été déconnecté de tous vos appareils et ne recevrez plus de notifications. Pour réactiver les notificationsm identifiez vous à nouveau sur tous les appareils", + "You have been logged out of all devices and will no longer receive push notifications. To re-enable notifications, sign in again on each device": "Vous avez été déconnecté de tous vos appareils et ne recevrez plus de notifications. Pour réactiver les notifications, identifiez vous à nouveau sur tous les appareils", "You have no visible notifications": "Vous n'avez pas de notifications visibles", "you must be a": "vous devez être un", "You need to be able to invite users to do that.": "Vous devez être capable d’inviter des utilisateurs pour faire ça.", "You need to be logged in.": "Vous devez être connecté.", "You need to enter a user name.": "Vous devez entrer un nom d’utilisateur.", - "You need to log back in to generate end-to-end encryption keys for this device and submit the public key to your homeserver. This is a once off; sorry for the inconvenience.": "Vous devez vous connecter à nouveau pour générer les clés d’encryption pour cet appareil, et soumettre la clé publique à votre homeserver. Cette action ne se reproduira pas; veuillez nous excuser pour la gêne occasionnée.", + "You need to log back in to generate end-to-end encryption keys for this device and submit the public key to your homeserver. This is a once off; sorry for the inconvenience.": "Vous devez vous connecter à nouveau pour générer les clés d’encryption pour cet appareil, et soumettre la clé publique à votre homeserver. Cette action ne se reproduira pas ; veuillez nous excuser pour la gêne occasionnée.", "Your email address does not appear to be associated with a Matrix ID on this Homeserver.": "Votre adresse e-mail ne semble pas associée à un identifiant Matrix sur ce homeserver.", "Your password has been reset": "Votre mot de passe a été réinitialisé", "Your password was successfully changed. You will not receive push notifications on other devices until you log back in to them": "Votre mot de passe a été mis à jour avec succès. Vous ne recevrez plus de notification sur vos appareils jusqu’à ce que vous vous identifiez à nouveau", @@ -647,7 +647,7 @@ "%(oneUser)sleft and rejoined %(repeats)s times": "%(oneUser)sa quitté et à nouveau joint le salon %(repeats)s fois", "%(severalUsers)sleft and rejoined": "%(severalUsers)sont quitté et à nouveau joint le salon", "%(oneUser)sleft and rejoined": "%(oneUser)sa quitté et à nouveau joint le salon", - "%(severalUsers)srejected their invitations %(repeats)s times": "%(severalUsers)sotn rejeté leurs invitations %(repeats)s fois", + "%(severalUsers)srejected their invitations %(repeats)s times": "%(severalUsers)sont rejeté leurs invitations %(repeats)s fois", "%(oneUser)srejected their invitation %(repeats)s times": "%(oneUser)sa rejeté son invitation %(repeats)s fois", "%(severalUsers)srejected their invitations": "%(severalUsers)sont rejeté leurs invitations", "%(oneUser)srejected their invitation": "%(oneUser)sa rejeté son invitation", @@ -699,7 +699,7 @@ "Failed to invite user": "Echec lors de l'invitation de l'utilisateur", "Failed to invite the following users to the %(roomName)s room:": "Echec lors de l’invitation des utilisateurs suivants dans le salon %(roomName)s :", "Confirm Removal": "Confirmer la suppression", - "Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.": "Êtes vous sûr de vouloir supprimer cet événement ? Notez que si vous supprimez le changement de nom d’un salon ou la mise a jour du sujet d’un salon, il est possible que le changement soit annulé.", + "Are you sure you wish to remove (delete) this event? Note that if you delete a room name or topic change, it could undo the change.": "Êtes vous sûr de vouloir supprimer cet événement ? Notez que si vous supprimez le changement de nom d’un salon ou la mise à jour du sujet d’un salon, il est possible que le changement soit annulé.", "Unknown error": "Erreur inconnue", "Incorrect password": "Mot de passe incorrect", "This will make your account permanently unusable. You will not be able to re-register the same user ID.": "Ceci rendra votre compte inutilisable de manière permanente. Vous ne pourrez pas enregistrer à nouveau le même identifiant utilisateur.", @@ -831,7 +831,7 @@ "%(count)s new messages.one": "%(count)s nouveau message", "%(count)s new messages.other": "%(count)s nouveaux messages", "Disable markdown formatting": "Désactiver le formattage markdown", - "Error: Problem communicating with the given homeserver.": "Erreur: Problème de communication avec le homeserveur.", + "Error: Problem communicating with the given homeserver.": "Erreur : Problème de communication avec le homeserveur.", "Failed to fetch avatar URL": "Échec lors de la récupération de l’URL de l’avatar", "The phone number entered looks invalid": "Le numéro de téléphone entré semble être invalide", "This room is private or inaccessible to guests. You may be able to join if you register.": "Ce salon est privé ou interdits aux visiteurs. Vous pourrez peut-être le joindre si vous vous enregistrez.", @@ -854,5 +854,68 @@ "Username not available": "Nom d'utilisateur indisponible", "Something went wrong!": "Quelque chose s’est mal passé !", "This will be your account name on the homeserver, or you can pick a different server.": "Cela sera le nom de votre compte sur le serveur , ou vous pouvez sélectionner un autre serveur.", - "If you already have a Matrix account you can log in instead.": "Si vous avez déjà un compte Matrix vous pouvez vous identifier à la place." + "If you already have a Matrix account you can log in instead.": "Si vous avez déjà un compte Matrix vous pouvez vous identifier à la place.", + "a room": "un salon", + "Accept": "Accepter", + "Active call (%(roomName)s)": "Appel en cours (%(roomName)s)", + "Admin tools": "Outils d'administration", + "Alias (optional)": "Alias (optionnel)", + "Can't connect to homeserver - please check your connectivity, ensure your homeserver's SSL certificate is trusted, and that a browser extension is not blocking requests.": "Impossible de se connecter au homeserver - veuillez vérifier votre connexion, assurez vous que vous faite confiance au certificat SSL de votre homeserver, et qu'aucune extension de navigateur ne bloque de requêtes.", + "Click here to join the discussion!": "Cliquer ici pour joindre la discussion !", + "Close": "Fermer", + "Custom": "Personnaliser", + "Decline": "Décliner", + "Disable Notifications": "Désactiver les Notifications", + "Drop File Here": "Déposer le Fichier Ici", + "Enable Notifications": "Activer les Notifications", + "Failed to upload profile picture!": "Échec du téléchargement de la photo de profil !", + "Incoming call from %(name)s": "Appel entrant de %(name)s", + "Incoming video call from %(name)s": "Appel vidéo entrant de %(name)s", + "Incoming voice call from %(name)s": "Appel audio entrant de %(name)s", + "No display name": "Pas de nom d'affichage", + "Otherwise, click here to send a bug report.": "Sinon, cliquer ici pour envoyer un rapport d'erreur.", + "Private Chat": "Conversation Privée", + "Public Chat": "Conversation Publique", + "Reason: %(reasonText)s": "Raison: %(reasonText)s", + "Rejoin": "Rejoindre", + "Room contains unknown devices": "Le salon contient des appareils inconnus", + "%(roomName)s does not exist.": "%(roomName)s n'existe pas.", + "%(roomName)s is not accessible at this time.": "%(roomName)s n'est pas accessible pour le moment.", + "Seen by %(userName)s at %(dateTime)s": "Vu par %(userName)s à %(dateTime)s", + "Send anyway": "Envoyer quand même", + "Show Text Formatting Toolbar": "Afficher la barre de formatage de texte", + "Start authentication": "Démarrer une authentification", + "This invitation was sent to an email address which is not associated with this account:": "Cette invitation a été envoyée à une adresse e-mail qui n'est pas associée avec ce compte :", + "This room": "Ce salon", + "Unable to ascertain that the address this invite was sent to matches one associated with your account.": "Impossible de vérifier que l'adresse à qui cette invitation a été envoyée correspond à celle associée à votre compte.", + "Undecryptable": "Indécryptable", + "Unencrypted message": "Message non-encrypté", + "unknown caller": "appelant inconnu", + "Unnamed Room": "Salon sans nom", + "Unverified": "Non verifié", + "%(user)s is a": "%(user)s est un(e)", + "Username invalid: %(errMessage)s": "Nom d'utilisateur invalide : %(errMessage)s", + "Verified": "Verifié", + "Would you like to accept or decline this invitation?": "Souhaitez-vous accepter ou refuser cette invitation ?", + "You have been banned from %(roomName)s by %(userName)s.": "Vous avez été bannis de %(roomName)s par %(userName)s.", + "You have been kicked from %(roomName)s by %(userName)s.": "Vous avez été expulsé de %(roomName)s by %(userName)s.", + "You may wish to login with a different account, or add this email to this account.": "Vous souhaiteriez peut-être vous identifier avec un autre compte, ou ajouter cette e-mail à votre compte.", + "Your home server does not support device management.": "Votre home server ne supporte pas la gestion d'appareils.", + "(~%(count)s results).one": "(~%(count)s résultat)", + "(~%(count)s results).other": "(~%(count)s résultats)", + "Device Name": "Nom de l'appareil", + "Encrypted by a verified device": "Encrypté par un appareil verifié", + "Encrypted by an unverified device": "Encrypté par un appareil non verifié", + "Encryption is enabled in this room": "L'encryption est activée sur ce salon", + "Encryption is not enabled in this room": "L'encryption n'est pas activée sur ce salon", + "Home": "Accueil", + "To link to a room it must have an address.": "Pour ajouter un lien à un salon celui-ci doit avoir une adresse.", + "Upload new:": "Télécharger un nouveau :", + "And %(count)s more...": "Et %(count)s autres...", + "Join as voice or video.": "Joindre avec audio ou vidéo.", + "Last seen": "Dernier vu", + "Level:": "Niveau :", + "Searching known users": "En recherche d'utilisateurs connus", + "Set": "Définit", + "%(userName)s (power %(powerLevelNumber)s)": "%(userName)s (pouvoir %(powerLevelNumber)s)" } diff --git a/src/i18n/strings/nl.json b/src/i18n/strings/nl.json index 226706c884..c3c3ac2cfa 100644 --- a/src/i18n/strings/nl.json +++ b/src/i18n/strings/nl.json @@ -1,7 +1,7 @@ { "af": "Afrikaans", "ar-ae": "Arabisch (U.A.E.)", - "Direct Chat": "Privé gesprek", + "Direct Chat": "Privégesprek", "ar-bh": "Arabisch (Bahrain)", "ar-dz": "Arabisch (Algerije)", "ar-eg": "Arabisch (Egypte)", @@ -60,7 +60,7 @@ "es-ve": "Spaans (Venezuela)", "et": "Estlands", "eu": "Baskisch (Bask)", - "fa": "Farsi", + "fa": "Perzisch (Farsi)", "fi": "Fins", "fo": "Faeroesisch", "fr-be": "Frans (België)", @@ -199,5 +199,58 @@ "Confirm your new password": "Bevestig je nieuwe wachtwoord", "Continue": "Doorgaan", "Could not connect to the integration server": "Mislukt om te verbinden met de integratie server", - "Cancel": "Annuleer" + "Cancel": "Annuleren", + "a room": "een ruimte", + "Accept": "Accepteren", + "Active call (%(roomName)s)": "Actief gesprek (%(roomName)s)", + "Add": "Toevoegen", + "Add a topic": "Een onderwerp toevoegen", + "Admin tools": "Beheerhulpmiddelen", + "And %(count)s more...": "Nog %(count)s andere...", + "VoIP": "VoiP", + "Missing Media Permissions, click here to request.": "Ontbrekende mediatoestemmingen, klik hier om aan te vragen.", + "No Microphones detected": "Geen microfoons gevonden", + "No Webcams detected": "Geen webcams gevonden", + "No media permissions": "Geen mediatoestemmingen", + "You may need to manually permit Riot to access your microphone/webcam": "U moet Riot wellicht handmatig toestemming geven om uw microfoon/webcam te gebruiken", + "Default Device": "Standaardapparaat", + "Microphone": "Microfoon", + "Camera": "Camera", + "Hide removed messages": "Verwijderde berichten verbergen", + "Alias (optional)": "Alias (optioneel)", + "Anyone": "Iedereen", + "Are you sure you want to leave the room '%(roomName)s'?": "Weet u zeker dat u de ruimte '%(roomName)s' wil verlaten?", + "Are you sure you want to upload the following files?": "Weet u zeker dat u de volgende bestanden wil uploaden?", + "Click here to join the discussion!": "Klik hier om mee te doen aan de discussie!", + "Close": "Sluiten", + "%(count)s new messages.one": "%(count)s nieuw bericht", + "Create new room": "Een nieuwe kamer maken", + "Custom Server Options": "Aangepaste serverinstellingen", + "Dismiss": "Afwijzen", + "Drop here %(toAction)s": "%(toAction)s hier naartoe verplaatsen", + "Error": "Fout", + "Failed to forget room %(errCode)s": "Kamer vergeten mislukt %(errCode)s", + "Failed to join the room": "Kamer binnengaan mislukt", + "Favourite": "Favoriet", + "Mute": "Dempen", + "Notifications": "Meldingen", + "Operation failed": "Actie mislukt", + "Please Register": "Registreer alstublieft", + "powered by Matrix": "mogelijk gemaakt door Matrix", + "Remove": "Verwijderen", + "Room directory": "Kamerlijst", + "Settings": "Instellingen", + "Start chat": "Gesprek starten", + "unknown error code": "onbekende foutcode", + "Sunday": "Zondag", + "Monday": "Maandag", + "Tuesday": "Dinsdag", + "Wednesday": "Woensdag", + "Thursday": "Donderdag", + "Friday": "Vrijdag", + "Saturday": "Zaterdag", + "Welcome page": "Welkomstpagina", + "Search": "Zoeken", + "OK": "OK", + "Failed to change password. Is your password correct?": "Wachtwoord wijzigen mislukt. Is uw wachtwoord juist?" } diff --git a/src/i18n/strings/sv.json b/src/i18n/strings/sv.json index af5e27acc2..a3da858f07 100644 --- a/src/i18n/strings/sv.json +++ b/src/i18n/strings/sv.json @@ -291,5 +291,12 @@ "Failed to upload file": "Det gick inte att ladda upp filen", "Failed to verify email address: make sure you clicked the link in the email": "Det gick inte att bekräfta epostadressen, klicka på länken i epostmeddelandet", "Favourite": "Favorit", - "favourite": "favorit" + "favourite": "favorit", + "a room": "ett rum", + "Accept": "Godkänn", + "Access Token:": "Åtkomsttoken:", + "Active call (%(roomName)s)": "Aktiv samtal (%(roomName)s)", + "Add": "Lägg till", + "Admin tools": "Admin verktyg", + "And %(count)s more...": "Och %(count) till..." } From aab87233c37ab70cb027ff5353a3c4451e2ed48a Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 13 Jun 2017 11:39:37 +0100 Subject: [PATCH 042/252] Add script to copy translations between files So we can fill in missing translations from different dialects Use it to fill in missing strings in pt from pt_BR --- scripts/copy-i18n.py | 46 ++++++++++++++++++++ src/i18n/strings/pt.json | 92 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 137 insertions(+), 1 deletion(-) create mode 100755 scripts/copy-i18n.py diff --git a/scripts/copy-i18n.py b/scripts/copy-i18n.py new file mode 100755 index 0000000000..c3b8d6072e --- /dev/null +++ b/scripts/copy-i18n.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +import json +import sys +import os + +if len(sys.argv) < 3: + print "Usage: %s " % (sys.argv[0],) + print "eg. %s pt_BR.json pt.json" % (sys.argv[0],) + print + print "Adds any translations to that exist in but not " + sys.exit(1) + +srcpath = sys.argv[1] +dstpath = sys.argv[2] +tmppath = dstpath + ".tmp" + +with open(srcpath) as f: + src = json.load(f) + +with open(dstpath) as f: + dst = json.load(f) + +toAdd = {} +for k,v in src.iteritems(): + if k not in dst: + print "Adding %s" % (k,) + toAdd[k] = v + +# don't just json.dumps as we'll probably re-order all the keys (and they're +# not in any given order so we can't just sort_keys). Append them to the end. +with open(dstpath) as ifp: + with open(tmppath, 'w') as ofp: + for line in ifp: + strippedline = line.strip() + if strippedline in ('{', '}'): + ofp.write(line) + elif strippedline.endswith(','): + ofp.write(line) + else: + ofp.write(' '+strippedline) + ofp.write(",\n") + toAddStr = json.dumps(toAdd, indent=4, separators=(',', ': '), ensure_ascii=False, encoding="utf8")[1:-1] + ofp.write(toAddStr.encode('utf8')) + +os.rename(tmppath, dstpath) diff --git a/src/i18n/strings/pt.json b/src/i18n/strings/pt.json index d366fb7e66..e3893fc667 100644 --- a/src/i18n/strings/pt.json +++ b/src/i18n/strings/pt.json @@ -875,5 +875,95 @@ "Tagged as: ": "Marcado como: ", "You have disabled URL previews by default.": "Você desabilitou pré-visualizações de links por padrão.", "You have enabled URL previews by default.": "Você habilitou pré-visualizações de links por padrão.", - "You have entered an invalid contact. Try using their Matrix ID or email address.": "Você inseriu um contato inválido. Tente usar o ID Matrix ou endereço de e-mail da pessoa que está buscando." + "You have entered an invalid contact. Try using their Matrix ID or email address.": "Você inseriu um contato inválido. Tente usar o ID Matrix ou endereço de e-mail da pessoa que está buscando.", + + "You have been banned from %(roomName)s by %(userName)s.": "Você foi expulso(a) da sala %(roomName)s por %(userName)s.", + "Send anyway": "Enviar de qualquer maneira", + "This room": "Esta sala", + "Create new room": "Criar nova sala", + "Click on the button below to start chatting!": "Clique no botão abaixo para começar a conversar!", + "Disable markdown formatting": "Desabilitar formatação MarkDown", + "No display name": "Sem nome público de usuária(o)", + "This will be your account name on the homeserver, or you can pick a different server.": "Este será seu nome de conta no Servidor de Base , ou então você pode escolher um servidor diferente.", + "Uploading %(filename)s and %(count)s others.one": "Enviando o arquivo %(filename)s e %(count)s outros arquivos", + "Hide removed messages": "Ocultar mensagens removidas", + "You may wish to login with a different account, or add this email to this account.": "Você pode querer fazer login com uma conta diferente, ou adicionar este e-mail a esta conta.", + "Welcome page": "Página de boas vindas", + "Upload new:": "Enviar novo:", + "Private Chat": "Conversa privada", + "You must register to use this functionality": "Você deve se registrar para poder usar esta funcionalidade", + "And %(count)s more...": "E mais %(count)s...", + "Start chatting": "Iniciar a conversa", + "Public Chat": "Conversa pública", + "Uploading %(filename)s and %(count)s others.zero": "Enviando o arquivo %(filename)s", + "Room contains unknown devices": "Esta sala contém dispositivos desconhecidos", + "Admin tools": "Ferramentas de administração", + "You have been kicked from %(roomName)s by %(userName)s.": "Você foi removido(a) da sala %(roomName)s por %(userName)s.", + "Undecryptable": "Não é possível descriptografar", + "Incoming video call from %(name)s": "Chamada de vídeo de %(name)s recebida", + "Otherwise, click here to send a bug report.": "Caso contrário, clique aqui para enviar um relatório de erros.", + "To link to a room it must have an address.": "Para produzir um link para uma sala, ela necessita ter um endereço.", + "a room": "uma sala", + "Your home server does not support device management.": "O seu Servidor de Base não suporta o gerenciamento de dispositivos.", + "Searching known users": "Buscando pessoas conhecidas", + "Alias (optional)": "Apelido (opcional)", + "Active call (%(roomName)s)": "Chamada ativa (%(roomName)s)", + "Unable to ascertain that the address this invite was sent to matches one associated with your account.": "Não foi possível garantir que o endereço para o qual este convite foi enviado bate com alqum que está associado com sua conta.", + "Error: Problem communicating with the given homeserver.": "Erro: problema de comunicação com o Servidor de Base fornecido.", + "Failed to upload profile picture!": "Falha ao enviar a imagem de perfil!", + "This invitation was sent to an email address which is not associated with this account:": "Este convite foi enviado para um endereço de e-mail que não é associado a esta conta:", + "Show Text Formatting Toolbar": "Exibir barra de formatação de texto", + "Room directory": "Lista pública de salas", + "Failed to fetch avatar URL": "Falha ao obter a URL da imagem de perfil", + "Incoming call from %(name)s": "Chamada de %(name)s recebida", + "Last seen": "Último uso", + "Drop File Here": "Arraste o arquivo aqui", + "Start Chatting": "Iniciar a conversa", + "Would you like to accept or decline this invitation?": "Você gostaria de aceitar ou recusar este convite?", + "Seen by %(userName)s at %(dateTime)s": "Visto por %(userName)s em %(dateTime)s", + "Verified": "Verificado", + "%(roomName)s does not exist.": "%(roomName)s não existe.", + "Enable Notifications": "Habilitar notificações", + "Username not available": "Nome de usuária(o) indisponível", + "Encrypted by a verified device": "Criptografado por um dispositivo verificado", + "(~%(count)s results).other": "(~%(count)s resultados)", + "unknown caller": "a pessoa que está chamando é desconhecida", + "Start authentication": "Iniciar autenticação", + "(~%(count)s results).one": "(~%(count)s resultado)", + "New Password": "Nova senha", + "Username invalid: %(errMessage)s": "Nome de usuária(o) inválido: %(errMessage)s", + "Disable Notifications": "Desabilitar notificações", + "%(count)s new messages.one": "%(count)s nova mensagem", + "Device Name": "Nome do dispositivo", + "Incoming voice call from %(name)s": "Chamada de voz de %(name)s recebida", + "If you already have a Matrix account you can log in instead.": "Se você já tem uma conta Matrix, pode também fazer login.", + "Can't connect to homeserver - please check your connectivity, ensure your homeserver's SSL certificate is trusted, and that a browser extension is not blocking requests.": "Não foi possível conectar ao Servidor de Base. Por favor, confira sua conectividade à internet, garanta que o certificado SSL do Servidor de Base é confiável, e que uma extensão do navegador não esteja bloqueando as requisições de rede.", + "Encrypted by an unverified device": "Criptografado por um dispositivo não verificado", + "Set": "Definir", + "Unencrypted message": "Mensagem não criptografada", + "Join as voice or video.": "Participar por voz ou por vídeo.", + "Uploading %(filename)s and %(count)s others.other": "Enviando o arquivo %(filename)s e %(count)s outros arquivos", + "Username available": "Nome de usuária(o) disponível", + "Close": "Fechar", + "Level:": "Nível:", + "%(count)s new messages.other": "%(count)s novas mensagens", + "Unverified": "Não verificado", + "Click here to join the discussion!": "Clique aqui para participar da conversa!", + "Decline": "Recusar", + "Custom": "Personalizado", + "Add": "Adicionar", + "%(user)s is a": "%(user)s é um(a)", + "Unnamed Room": "Sala sem nome", + "The phone number entered looks invalid": "O número de telefone inserido parece ser inválido", + "Rejoin": "Voltar a participar da sala", + "Create a new chat or reuse an existing one": "Criar uma nova conversa ou reutilizar alguma já existente", + "Resend all or cancel all now. You can also select individual messages to resend or cancel.": "Reenviar todas ou cancelar todas agora. Você também pode selecionar mensagens individuais que queira reenviar ou cancelar.", + "Reason: %(reasonText)s": "Justificativa: %(reasonText)s", + "Home": "Início", + "Something went wrong!": "Algo deu errado!", + "%(userName)s (power %(powerLevelNumber)s)": "%(userName)s (nível de permissão %(powerLevelNumber)s)", + "Start chat": "Iniciar conversa pessoal", + "You already have existing direct chats with this user:": "Você já tem conversas pessoais com esta pessoa:", + "Accept": "Aceitar", + "%(roomName)s is not accessible at this time.": "%(roomName)s não está acessível neste momento." } From 431b482d18fb8afdc1363319c59352c72d98499c Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 13 Jun 2017 11:54:28 +0100 Subject: [PATCH 043/252] Don't put in spurious newline --- scripts/copy-i18n.py | 7 ++++--- src/i18n/strings/pt.json | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/copy-i18n.py b/scripts/copy-i18n.py index c3b8d6072e..07b1271239 100755 --- a/scripts/copy-i18n.py +++ b/scripts/copy-i18n.py @@ -38,9 +38,10 @@ with open(dstpath) as ifp: elif strippedline.endswith(','): ofp.write(line) else: - ofp.write(' '+strippedline) - ofp.write(",\n") - toAddStr = json.dumps(toAdd, indent=4, separators=(',', ': '), ensure_ascii=False, encoding="utf8")[1:-1] + ofp.write(' '+strippedline+',') + toAddStr = json.dumps(toAdd, indent=4, separators=(',', ': '), ensure_ascii=False, encoding="utf8").strip("{}\n") + ofp.write("\n") ofp.write(toAddStr.encode('utf8')) + ofp.write("\n") os.rename(tmppath, dstpath) diff --git a/src/i18n/strings/pt.json b/src/i18n/strings/pt.json index e3893fc667..9f538eb34a 100644 --- a/src/i18n/strings/pt.json +++ b/src/i18n/strings/pt.json @@ -876,7 +876,6 @@ "You have disabled URL previews by default.": "Você desabilitou pré-visualizações de links por padrão.", "You have enabled URL previews by default.": "Você habilitou pré-visualizações de links por padrão.", "You have entered an invalid contact. Try using their Matrix ID or email address.": "Você inseriu um contato inválido. Tente usar o ID Matrix ou endereço de e-mail da pessoa que está buscando.", - "You have been banned from %(roomName)s by %(userName)s.": "Você foi expulso(a) da sala %(roomName)s por %(userName)s.", "Send anyway": "Enviar de qualquer maneira", "This room": "Esta sala", From 918efe591248f51c97ffc89ecf07a5831628ef6d Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 13 Jun 2017 12:18:48 +0100 Subject: [PATCH 044/252] width and height must be int otherwise synapse cries Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/messages/RoomAvatarEvent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/messages/RoomAvatarEvent.js b/src/components/views/messages/RoomAvatarEvent.js index 525f7b81ee..ed790953dc 100644 --- a/src/components/views/messages/RoomAvatarEvent.js +++ b/src/components/views/messages/RoomAvatarEvent.js @@ -62,8 +62,8 @@ module.exports = React.createClass({ var url = ContentRepo.getHttpUriForMxc( MatrixClientPeg.get().getHomeserverUrl(), ev.getContent().url, - 14 * window.devicePixelRatio, - 14 * window.devicePixelRatio, + Math.ceil(14 * window.devicePixelRatio), + Math.ceil(14 * window.devicePixelRatio), 'crop' ); From 5fd45233fb443b6750b31334435ff873c9a58259 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 13 Jun 2017 17:35:09 +0100 Subject: [PATCH 045/252] DM guessing: prefer oldest joined member In the DM guessing code, prefer the oldest joined member if there's anyone in the rom other than us. Otherwise, fall back to the old behaviour. Fixes https://github.com/vector-im/riot-web/issues/4288 --- src/Rooms.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Rooms.js b/src/Rooms.js index 16b5ab9ee2..3ac7c68533 100644 --- a/src/Rooms.js +++ b/src/Rooms.js @@ -144,7 +144,18 @@ export function guessDMRoomTarget(room, me) { let oldestTs; let oldestUser; - // Pick the user who's been here longest (and isn't us) + // Pick the joined user who's been here longest (and isn't us), + for (const user of room.getJoinedMembers()) { + if (user.userId == me.userId) continue; + + if (oldestTs === undefined || user.events.member.getTs() < oldestTs) { + oldestUser = user; + oldestTs = user.events.member.getTs(); + } + } + if (oldestUser) return oldestUser; + + // if there are no joined members other than us, use the oldest member for (const user of room.currentState.getMembers()) { if (user.userId == me.userId) continue; From f4aadafed95df9c17d9efd093066152354a895a7 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 13 Jun 2017 17:39:20 +0100 Subject: [PATCH 046/252] remove mx_filterFlipColor from verified e2e icon so its not purple :/ Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomSettings.js b/src/components/views/rooms/RoomSettings.js index 9a3236cdb9..171af4764b 100644 --- a/src/components/views/rooms/RoomSettings.js +++ b/src/components/views/rooms/RoomSettings.js @@ -594,7 +594,7 @@ module.exports = React.createClass({