From 98604f84daabdabd43218bf69de6fb606493bbcd Mon Sep 17 00:00:00 2001 From: Mantas Masalskis Date: Sun, 6 Feb 2022 21:36:30 +0100 Subject: [PATCH] Fixes #3245 - Rename Third-Party login: Office 365 to Microsoft 365 --- .../_profile/linked_accounts.coffee | 4 +- app/assets/stylesheets/svg-dimensions.css | 5 +- app/assets/stylesheets/zammad.scss | 7 ++- ..._issue_3245_office_365_microsoft_rename.rb | 15 ++++++ db/seeds/settings.rb | 4 +- i18n/zammad.pot | 12 +++-- public/assets/images/icons.svg | 15 ++++-- .../assets/images/icons/microsoft-button.svg | 12 +++++ .../assets/images/icons/office365-button.svg | 12 ----- public/assets/images/package.json | 3 ++ ...e_3245_office_365_microsoft_rename_spec.rb | 51 +++++++++++++++++++ spec/system/settings/security_spec.rb | 4 +- 12 files changed, 113 insertions(+), 31 deletions(-) create mode 100644 db/migrate/20211028094326_issue_3245_office_365_microsoft_rename.rb create mode 100644 public/assets/images/icons/microsoft-button.svg delete mode 100644 public/assets/images/icons/office365-button.svg create mode 100644 spec/db/migrate/issue_3245_office_365_microsoft_rename_spec.rb diff --git a/app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee b/app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee index f16c6e4b1..2a444dc01 100644 --- a/app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee +++ b/app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee @@ -88,9 +88,9 @@ App.Config.set('auth_provider_all', { class: 'gitlab' microsoft_office365: url: '/auth/microsoft_office365' - name: __('Office 365') + name: __('Microsoft') config: 'auth_microsoft_office365' - class: 'office365' + class: 'microsoft' google_oauth2: url: '/auth/google_oauth2' name: __('Google') diff --git a/app/assets/stylesheets/svg-dimensions.css b/app/assets/stylesheets/svg-dimensions.css index c651bd31b..dae5b70ec 100644 --- a/app/assets/stylesheets/svg-dimensions.css +++ b/app/assets/stylesheets/svg-dimensions.css @@ -75,6 +75,7 @@ .icon-magnifier { width: 15px; height: 15px; } .icon-marker { width: 17px; height: 19px; } .icon-message { width: 24px; height: 24px; } +.icon-microsoft-button { width: 29px; height: 24px; } .icon-minus-small { width: 16px; height: 16px; } .icon-minus { width: 20px; height: 20px; } .icon-mood-bad { width: 60px; height: 59px; } @@ -86,7 +87,7 @@ .icon-mute { width: 16px; height: 16px; } .icon-not-signed { width: 14px; height: 14px; } .icon-note { width: 16px; height: 16px; } -.icon-office365-button { width: 29px; height: 24px; } +.icon-oauth2-button { width: 29px; height: 24px; } .icon-one-ticket { width: 48px; height: 10px; } .icon-organization { width: 16px; height: 16px; } .icon-outbound-calls { width: 17px; height: 17px; } @@ -116,7 +117,7 @@ .icon-sms { width: 17px; height: 17px; } .icon-spinner-small { width: 15px; height: 15px; } .icon-split { width: 16px; height: 17px; } -.icon-sso-button { width: 29px; height: 24px; } +.icon-sso-button { width: 96.57px; height: 79.92px; } .icon-status-modified-outer-circle { width: 16px; height: 16px; } .icon-status { width: 16px; height: 16px; } .icon-stopwatch { width: 77px; height: 83px; } diff --git a/app/assets/stylesheets/zammad.scss b/app/assets/stylesheets/zammad.scss index 5030a1770..e47ccaa2c 100644 --- a/app/assets/stylesheets/zammad.scss +++ b/app/assets/stylesheets/zammad.scss @@ -3542,6 +3542,8 @@ ol.tabs li { border: none; text-align: initial; + @extend %clickable; + &.auth-provider--wide { padding-right: 25px; } @@ -3575,8 +3577,9 @@ ol.tabs li { background: hsl(10, 78%, 53%); } - &.auth-provider--office365 { - background: hsl(15, 100%, 47%); + &.auth-provider--microsoft { + background: hsl(0, 0%, 93%); + color: hsl(0, 0%, 46%) !important; } &.auth-provider--weibo { diff --git a/db/migrate/20211028094326_issue_3245_office_365_microsoft_rename.rb b/db/migrate/20211028094326_issue_3245_office_365_microsoft_rename.rb new file mode 100644 index 000000000..55aaf1f2b --- /dev/null +++ b/db/migrate/20211028094326_issue_3245_office_365_microsoft_rename.rb @@ -0,0 +1,15 @@ +# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ + +class Issue3245Office365MicrosoftRename < ActiveRecord::Migration[6.0] + def up + return if !Setting.exists?(name: 'system_init_done') + + setting = Setting.find_by name: 'auth_microsoft_office365' + + setting.preferences[:title_i18n][0] = 'Microsoft' + setting.preferences[:description_i18n][0] = 'Microsoft' + setting.save! + rescue => e + Rails.logger.error e + end +end diff --git a/db/seeds/settings.rb b/db/seeds/settings.rb index d167b6179..31a644114 100644 --- a/db/seeds/settings.rb +++ b/db/seeds/settings.rb @@ -1679,8 +1679,8 @@ Setting.create_if_not_exists( preferences: { controller: 'SettingsAreaSwitch', sub: ['auth_microsoft_office365_credentials'], - title_i18n: ['Office 365'], # rubocop:disable Zammad/DetectTranslatableString - description_i18n: ['Office 365', 'Microsoft Application Registration Portal', 'https://portal.azure.com'], # rubocop:disable Zammad/DetectTranslatableString + title_i18n: ['Microsoft'], + description_i18n: ['Microsoft', __('Microsoft Application Registration Portal'), 'https://portal.azure.com'], permission: ['admin.security'], }, state: false, diff --git a/i18n/zammad.pot b/i18n/zammad.pot index fc08bb4fd..2a29b6575 100644 --- a/i18n/zammad.pot +++ b/i18n/zammad.pot @@ -5819,12 +5819,20 @@ msgstr "" msgid "Method (AJAX endpoint)" msgstr "" +#: app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee +msgid "Microsoft" +msgstr "" + #: app/assets/javascripts/app/controllers/_channel/microsoft365.coffee #: app/assets/javascripts/app/views/microsoft365/index.jst.eco #: app/assets/javascripts/app/views/microsoft365/list.jst.eco msgid "Microsoft 365" msgstr "" +#: db/seeds/settings.rb +msgid "Microsoft Application Registration Portal" +msgstr "" + #: app/assets/javascripts/app/views/import/freshdesk.jst.eco #: app/assets/javascripts/app/views/import/kayako.jst.eco #: app/assets/javascripts/app/views/import/otrs.jst.eco @@ -6711,10 +6719,6 @@ msgstr "" msgid "October" msgstr "" -#: app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee -msgid "Office 365" -msgstr "" - #: db/seeds/settings.rb msgid "Office 365 App Credentials" msgstr "" diff --git a/public/assets/images/icons.svg b/public/assets/images/icons.svg index 34d8e364f..c72f4aac5 100644 --- a/public/assets/images/icons.svg +++ b/public/assets/images/icons.svg @@ -523,6 +523,16 @@ message + + + microsoft-button + + + + + + + minus-small @@ -588,11 +598,6 @@ oauth2-button - - - office365-button - - one-ticket diff --git a/public/assets/images/icons/microsoft-button.svg b/public/assets/images/icons/microsoft-button.svg new file mode 100644 index 000000000..ef5c1434f --- /dev/null +++ b/public/assets/images/icons/microsoft-button.svg @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="29px" height="24px" viewBox="0 0 29 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>microsoft-button + + + + + + + + + \ No newline at end of file diff --git a/public/assets/images/icons/office365-button.svg b/public/assets/images/icons/office365-button.svg deleted file mode 100644 index 8fe7b1fda..000000000 --- a/public/assets/images/icons/office365-button.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - office365-button - Created with Sketch. - - - - - - - \ No newline at end of file diff --git a/public/assets/images/package.json b/public/assets/images/package.json index ed5407ada..9c0624d14 100644 --- a/public/assets/images/package.json +++ b/public/assets/images/package.json @@ -10,5 +10,8 @@ "gulp-util": "^3.0.4", "gulp-watch": "^4.2.4", "through2": "^0.6.5" + }, + "resolutions": { + "graceful-fs": "^4.2.9" } } diff --git a/spec/db/migrate/issue_3245_office_365_microsoft_rename_spec.rb b/spec/db/migrate/issue_3245_office_365_microsoft_rename_spec.rb new file mode 100644 index 000000000..9b5d9f2f9 --- /dev/null +++ b/spec/db/migrate/issue_3245_office_365_microsoft_rename_spec.rb @@ -0,0 +1,51 @@ +# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/ + +require 'rails_helper' + +RSpec.describe Issue3245Office365MicrosoftRename, type: :db_migration do + it 'renames Office 365 to Microsoft' do + replace_setting_with_old + + migrate + + new_setting = Setting.find_by(name: 'auth_microsoft_office365') + + expect(new_setting.preferences).to include(title_i18n: ['Microsoft'], description_i18n: ['Microsoft', 'Microsoft Application Registration Portal', 'https://portal.azure.com']) + end + + def replace_setting_with_old + Setting + .find_by(name: 'auth_microsoft_office365') + .destroy! + + Setting.create!( + title: 'Authentication via %s', + name: 'auth_microsoft_office365', + area: 'Security::ThirdPartyAuthentication', + description: 'Enables user authentication via %s. Register your app first at [%s](%s).', + options: { + form: [ + { + display: '', + null: true, + name: 'auth_microsoft_office365', + tag: 'boolean', + options: { + true => 'yes', + false => 'no', + }, + }, + ], + }, + preferences: { + controller: 'SettingsAreaSwitch', + sub: ['auth_microsoft_office365_credentials'], + title_i18n: ['Microsoft'], + description_i18n: ['Microsoft', 'Microsoft Application Registration Portal', 'https://portal.azure.com'], + permission: ['admin.security'], + }, + state: false, + frontend: true + ) + end +end diff --git a/spec/system/settings/security_spec.rb b/spec/system/settings/security_spec.rb index 5824f93d1..2e83bf2dd 100644 --- a/spec/system/settings/security_spec.rb +++ b/spec/system/settings/security_spec.rb @@ -132,8 +132,8 @@ RSpec.describe 'Manage > Settings > Security', type: :system do include_examples 'Display callback urls for third-party applications #3622' end - describe 'Authentication via Office 365' do - let(:app_name) { 'Office 365' } + describe 'Authentication via Microsoft' do + let(:app_name) { 'Microsoft' } let(:app_setting) { 'auth_microsoft_office365' } include_examples 'for third-party applications button in login page'