Create views for managing muted words

This commit is contained in:
Karina Kwiatek 2021-12-23 00:03:42 +01:00
parent 6c0e6b1d30
commit 6b626765a8
5 changed files with 29 additions and 0 deletions

View File

@ -224,4 +224,10 @@ class UserController < ApplicationController
@recovery_keys = TotpRecoveryCode.generate_for(current_user) @recovery_keys = TotpRecoveryCode.generate_for(current_user)
render 'settings/security/recovery_keys' render 'settings/security/recovery_keys'
end end
# region Muting
def edit_mute
@rules = MuteRule.where(user: current_user)
end
# endregion
end end

View File

@ -0,0 +1,17 @@
.card
.card-body
%h2 Muted words
%p Muting words (or longer phrases) will prevent questions containing those to appear in your inbox.
%p Note: Filtered questions are discarded completely from your inbox, and won't reappear if you remove a filter later on.
- @rules.each do |rule|
.form-group
.input-group
%input.form-control#new-rule-text{disabled: true, value: rule.muted_phrase}
.input-group-append
%button.btn.btn-danger#new-rule-submit{type: 'button'} Remove
.form-group
%form
.input-group
%input.form-control#new-rule-text{placeholder: 'Add a new muted word...'}
.input-group-append
%button.btn.btn-primary#new-rule-submit{type: 'submit'} Add

View File

@ -5,6 +5,7 @@
= list_group_item t('views.settings.tabs.privacy'), edit_user_privacy_path = list_group_item t('views.settings.tabs.privacy'), edit_user_privacy_path
= list_group_item t('views.settings.tabs.security'), edit_user_security_path = list_group_item t('views.settings.tabs.security'), edit_user_security_path
= list_group_item t('views.settings.tabs.sharing'), services_path = list_group_item t('views.settings.tabs.sharing'), services_path
= list_group_item 'Muted words', edit_user_mute_rules_path
= list_group_item 'Theme', edit_user_theme_path = list_group_item 'Theme', edit_user_theme_path
= list_group_item 'Your Data', user_data_path = list_group_item 'Your Data', user_data_path
= list_group_item 'Export', user_export_path = list_group_item 'Export', user_export_path

View File

@ -0,0 +1,4 @@
= render 'settings/muted'
- provide(:title, generate_title('Muted words'))
- parent_layout 'user/settings'

View File

@ -73,6 +73,7 @@ Rails.application.routes.draw do
match '/settings/security/2fa', to: 'user#update_2fa', via: :patch, as: :update_user_2fa match '/settings/security/2fa', to: 'user#update_2fa', via: :patch, as: :update_user_2fa
match '/settings/security/2fa', to: 'user#destroy_2fa', via: :delete, as: :destroy_user_2fa match '/settings/security/2fa', to: 'user#destroy_2fa', via: :delete, as: :destroy_user_2fa
match '/settings/security/recovery', to: 'user#reset_user_recovery_codes', via: :delete, as: :reset_user_recovery_codes match '/settings/security/recovery', to: 'user#reset_user_recovery_codes', via: :delete, as: :reset_user_recovery_codes
match '/settings/muted', to: 'user#edit_mute', via: :get, as: :edit_user_mute_rules
# resources :services, only: [:index, :destroy] # resources :services, only: [:index, :destroy]
match '/settings/services', to: 'services#index', via: 'get', as: :services match '/settings/services', to: 'services#index', via: 'get', as: :services