Add UI to manage muted users

This commit is contained in:
Andreas Nedbal 2022-12-29 04:38:36 +01:00 committed by Andreas Nedbal
parent 55c473e0f5
commit 0e172bb179
4 changed files with 29 additions and 7 deletions

View File

@ -4,6 +4,7 @@ class Settings::MutesController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
def index def index
@users = current_user.muted_users
@rules = MuteRule.where(user: current_user) @rules = MuteRule.where(user: current_user)
end end

View File

@ -0,0 +1,6 @@
.d-flex.mb-2
%img.avatar-md.mr-2{ src: user.profile_picture.url(:small), loading: :lazy }
%p.align-self-center.m-0= user_screen_name(user, context_user: current_user)
.ml-auto.d-inline-flex
%button.btn.btn-default.align-self-center{ data: { action: :unmute, target: user.screen_name } }
%span.pe-none= t("voc.unmute")

View File

@ -1,8 +1,18 @@
.card .card
.card-body .card-body
%h2= t(".heading") %h2= t(".users.heading")
%p= t(".body") %p= t(".users.body")
%p= t(".note") #users
- @users.each do |user|
= render "settings/mutes/user", user: user
- if @users.empty?
%p.text-muted.text-center= t(".users.none")
.card
.card-body
%h2= t(".terms.heading")
%p= t(".terms.body")
%p= t(".terms.note")
#rules #rules
- @rules.each do |rule| - @rules.each do |rule|
= render "settings/mutes/rule", rule: rule = render "settings/mutes/rule", rule: rule

View File

@ -421,7 +421,12 @@ en:
present: "Here's your export from %{time}" present: "Here's your export from %{time}"
mutes: mutes:
index: index:
title: "Muted Terms" title: "Mutes"
users:
heading: "Muted Users"
body: "Muting users will prevent their questions from showing up in your inbox. Additionally, any interaction from them will not generate a notification for you."
none: "You are not muting anyone."
terms:
heading: "Muted Terms" heading: "Muted Terms"
body: "Muting words (or longer phrases) will prevent questions containing those to appear in your inbox." body: "Muting words (or longer phrases) will prevent questions containing those to appear in your inbox."
note: "Note: Filtered questions are discarded completely from your inbox, and won't reappear if you remove a filter later on." note: "Note: Filtered questions are discarded completely from your inbox, and won't reappear if you remove a filter later on."