about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/settings/exports_controller.rb16
-rw-r--r--app/models/account.rb2
-rw-r--r--app/services/search_service.rb1
-rw-r--r--app/views/doorkeeper/authorized_applications/index.html.haml23
-rw-r--r--app/views/settings/exports/show.html.haml2
-rw-r--r--config/locales/doorkeeper.en.yml2
-rw-r--r--config/locales/en.yml3
-rw-r--r--config/navigation.rb3
-rw-r--r--config/routes.rb1
9 files changed, 49 insertions, 4 deletions
diff --git a/app/controllers/settings/exports_controller.rb b/app/controllers/settings/exports_controller.rb
new file mode 100644
index 000000000..d4ecb6e8a
--- /dev/null
+++ b/app/controllers/settings/exports_controller.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class Settings::ExportsController < ApplicationController
+  layout 'admin'
+
+  before_action :authenticate_user!
+  before_action :set_account
+
+  def show; end
+
+  private
+
+  def set_account
+    @account = current_user.account
+  end
+end
diff --git a/app/models/account.rb b/app/models/account.rb
index 469695acd..a93a0668a 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -52,7 +52,7 @@ class Account < ApplicationRecord
   # PuSH subscriptions
   has_many :subscriptions, dependent: :destroy
 
-  pg_search_scope :search_for, against: { username: 'A', domain: 'B' },
+  pg_search_scope :search_for, against: { display_name: 'A', username: 'B', domain: 'C' },
                                using: { tsearch: { prefix: true } }
 
   scope :remote, -> { where.not(domain: nil) }
diff --git a/app/services/search_service.rb b/app/services/search_service.rb
index 04de8a134..6f740e149 100644
--- a/app/services/search_service.rb
+++ b/app/services/search_service.rb
@@ -5,6 +5,7 @@ class SearchService < BaseService
     return if query.blank? || query.start_with?('#')
 
     username, domain = query.gsub(/\A@/, '').split('@')
+    domain = nil if TagManager.instance.local_domain?(domain)
 
     if domain.nil?
       exact_match = Account.find_local(username)
diff --git a/app/views/doorkeeper/authorized_applications/index.html.haml b/app/views/doorkeeper/authorized_applications/index.html.haml
new file mode 100644
index 000000000..d4719881c
--- /dev/null
+++ b/app/views/doorkeeper/authorized_applications/index.html.haml
@@ -0,0 +1,23 @@
+- content_for :page_title do
+  = t('doorkeeper.authorized_applications.index.title')
+
+%table.table
+  %thead
+    %tr
+      %th= t('doorkeeper.authorized_applications.index.application')
+      %th= t('doorkeeper.authorized_applications.index.scopes')
+      %th= t('doorkeeper.authorized_applications.index.created_at')
+      %th
+  %tbody
+    - @applications.each do |application|
+      %tr
+        %td
+          - if application.website.blank?
+            = application.name
+          - else
+            = link_to application.name, application.website
+        %th= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('<br />').html_safe
+        %td= l application.created_at
+        %td
+          - unless application.superapp?
+            = table_link_to 'times', t('doorkeeper.authorized_applications.buttons.revoke'), oauth_authorized_application_path(application), method: :delete, data: { confirm: t('doorkeeper.authorized_applications.confirmations.revoke') }
diff --git a/app/views/settings/exports/show.html.haml b/app/views/settings/exports/show.html.haml
new file mode 100644
index 000000000..d9006efdb
--- /dev/null
+++ b/app/views/settings/exports/show.html.haml
@@ -0,0 +1,2 @@
+- content_for :page_title do
+  = t('settings.export')
diff --git a/config/locales/doorkeeper.en.yml b/config/locales/doorkeeper.en.yml
index aaf5df6fc..97dd9c049 100644
--- a/config/locales/doorkeeper.en.yml
+++ b/config/locales/doorkeeper.en.yml
@@ -65,7 +65,7 @@ en:
         revoke: Are you sure?
       index:
         application: Application
-        created_at: Created At
+        created_at: Authorized
         date_format: "%Y-%m-%d %H:%M:%S"
         title: Your authorized applications
     errors:
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e7d39327e..6da30acda 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -94,6 +94,7 @@ en:
   settings:
     back: Back to Mastodon
     edit_profile: Edit profile
+    export: Data export
     preferences: Preferences
     settings: Settings
     two_factor_auth: Two-factor Authentication
@@ -118,7 +119,7 @@ en:
     disable: Disable
     enable: Enable
     instructions_html: "<strong>Scan this QR code into Google Authenticator or a similiar app on your phone</strong>. From now on, that app will generate tokens that you will have to enter when logging in."
-    plaintext_secret_html: "Plain-text secret: <samp>%{secret}</samp>"
+    plaintext_secret_html: 'Plain-text secret: <samp>%{secret}</samp>'
     warning: If you cannot configure an authenticator app right now, you should click "disable" or you won't be able to login.
   users:
     invalid_email: The e-mail address is invalid
diff --git a/config/navigation.rb b/config/navigation.rb
index 0d43a9f73..fd2659923 100644
--- a/config/navigation.rb
+++ b/config/navigation.rb
@@ -9,7 +9,8 @@ SimpleNavigation::Configuration.run do |navigation|
       settings.item :preferences, safe_join([fa_icon('sliders fw'), t('settings.preferences')]), settings_preferences_url
       settings.item :password, safe_join([fa_icon('cog fw'), t('auth.change_password')]), edit_user_registration_url
       settings.item :two_factor_auth, safe_join([fa_icon('mobile fw'), t('settings.two_factor_auth')]), settings_two_factor_auth_url
-      # settings.item :authorized_apps, safe_join([fa_icon('list fw'), 'Authorized Apps']), oauth_authorized_applications_url
+      # settings.item :export, safe_join([fa_icon('cloud-download fw'), t('settings.export')]), settings_export_url
+      settings.item :authorized_apps, safe_join([fa_icon('list fw'), 'Authorized Apps']), oauth_authorized_applications_url
     end
 
     primary.item :admin, safe_join([fa_icon('cogs fw'), 'Administration']), admin_accounts_url, if: proc { current_user.admin? } do |admin|
diff --git a/config/routes.rb b/config/routes.rb
index 70e252409..870d8afd4 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -46,6 +46,7 @@ Rails.application.routes.draw do
   namespace :settings do
     resource :profile, only: [:show, :update]
     resource :preferences, only: [:show, :update]
+    resource :export, only: [:show]
 
     resource :two_factor_auth, only: [:show] do
       member do