From 37d1d6080f445d17da4dc643a24946337363e4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 31 Aug 2021 14:15:04 +0200 Subject: [PATCH 1/5] Make trailing `:` into a setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- .../views/settings/tabs/user/PreferencesUserSettingsTab.tsx | 1 + src/editor/parts.ts | 5 ++++- src/i18n/strings/en_EN.json | 1 + src/settings/Settings.tsx | 5 +++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx index 21c3ab24ecc..d317ce3c7e4 100644 --- a/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx +++ b/src/components/views/settings/tabs/user/PreferencesUserSettingsTab.tsx @@ -159,6 +159,7 @@ export default class PreferencesUserSettingsTab extends React.Component Date: Tue, 1 Mar 2022 21:03:39 +0100 Subject: [PATCH 2/5] Make traling comma opt-out MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/settings/Settings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx index 4229239232f..a57a88ab282 100644 --- a/src/settings/Settings.tsx +++ b/src/settings/Settings.tsx @@ -432,7 +432,7 @@ export const SETTINGS: {[setting: string]: ISetting} = { "MessageComposerInput.insertTrailingComma": { supportedLevels: LEVELS_ACCOUNT_SETTINGS, displayName: _td('Insert a trailing colon after user mentions at the start of a message'), - default: false, + default: true, }, // TODO: Wire up appropriately to UI (FTUE notifications) "Notifications.alwaysShowBadgeCounts": { From 76412111988b006a67b175543988a94fbd29836a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 1 Mar 2022 21:13:13 +0100 Subject: [PATCH 3/5] Write `insertTrailingComma` when reading for future opt-in setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/settings/handlers/AccountSettingsHandler.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/settings/handlers/AccountSettingsHandler.ts b/src/settings/handlers/AccountSettingsHandler.ts index 2b0c980a1a9..e823fff59fa 100644 --- a/src/settings/handlers/AccountSettingsHandler.ts +++ b/src/settings/handlers/AccountSettingsHandler.ts @@ -123,6 +123,19 @@ export default class AccountSettingsHandler extends MatrixClientBackedSettingsHa return content[settingName]; } + if (settingName === "MessageComposerInput.insertTrailingComma") { + const content = this.getSettings() || {}; + const value = content[settingName]; + if (value === null || value === undefined) { + // Write true as it is the default. This will give us the option + // of making this opt-in in the future, without affecting old + // users + this.setValue(settingName, roomId, true); + return true; + } + return value; + } + const settings = this.getSettings() || {}; let preferredValue = settings[settingName]; From 25d636ccc1f0d89518095bce5c61b105fc7af497 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Thu, 3 Mar 2022 14:50:43 -0700 Subject: [PATCH 4/5] Update src/editor/parts.ts --- src/editor/parts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor/parts.ts b/src/editor/parts.ts index 09b39de0ce3..c7bac651f3b 100644 --- a/src/editor/parts.ts +++ b/src/editor/parts.ts @@ -652,7 +652,7 @@ export class PartCreator { ): [UserPillPart, PlainPart] { const pill = this.userPill(displayName, userId); const postfix = this.plain( - insertTrailingCharacter && SettingsStore.getValue("MessageComposerInput.insertTrailingComma") ? ": " : " ", + insertTrailingCharacter && (SettingsStore.getValue("MessageComposerInput.insertTrailingComma") ? ": " : " "), ); return [pill, postfix]; } From 1b6b59df4b53036c5d0aaebf5ab883e9f82090a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 4 Mar 2022 06:34:25 +0100 Subject: [PATCH 5/5] Fix line length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/editor/parts.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/editor/parts.ts b/src/editor/parts.ts index c7bac651f3b..000080a09c5 100644 --- a/src/editor/parts.ts +++ b/src/editor/parts.ts @@ -652,7 +652,8 @@ export class PartCreator { ): [UserPillPart, PlainPart] { const pill = this.userPill(displayName, userId); const postfix = this.plain( - insertTrailingCharacter && (SettingsStore.getValue("MessageComposerInput.insertTrailingComma") ? ": " : " "), + insertTrailingCharacter && + (SettingsStore.getValue("MessageComposerInput.insertTrailingComma") ? ": " : " "), ); return [pill, postfix]; }