<p></p>
<p><b>@tomhughes</b> commented on this pull request.</p>
<p dir="auto">Just a few initial comments, not a detailed review.</p><hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4284#discussion_r1354513978">app/models/user_mute.rb</a>:</p>
<pre style='color:#555'>> +# updated_at :datetime not null
+#
+# Indexes
+#
+# index_user_mutes_on_appointee_id (appointee_id)
+# index_user_mutes_on_creator_id (creator_id)
+# index_user_mutes_on_creator_id_and_appointee_id (creator_id,appointee_id) UNIQUE
+#
+# Foreign Keys
+#
+# fk_rails_... (appointee_id => users.id)
+# fk_rails_... (creator_id => users.id)
+#
+class UserMute < ApplicationRecord
+ belongs_to :creator, :class_name => "User"
+ belongs_to :appointee, :class_name => "User"
</pre>
<p dir="auto">I think <code class="notranslate">appointee</code> is a pretty odd term to use for the muted user.</p>
<p dir="auto">I mean I could argue for <code class="notranslate">mutor</code> and <code class="notranslate">mutee</code> for the creator and person being muted but that might be taking english a bit far.</p>
<p dir="auto">Maybe <code class="notranslate">subject</code> for the person being muted?</p>
<p dir="auto">On the other side <code class="notranslate">creator</code> isn't terrible but maybe <code class="notranslate">owner</code> is better? Not sure either really captures the concept well though.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4284#discussion_r1354534077">app/models/user_mute.rb</a>:</p>
<pre style='color:#555'>> + belongs_to :appointee, :class_name => "User"
+
+ validates :appointee, :uniqueness => { :scope => :creator_id }
+
+ def self.for_message?(message)
+ sender = message.sender
+
+ !sender.administrator? &&
+ !sender.moderator? &&
+ active_for?(
+ :current_user => message.recipient,
+ :other_user => sender
+ )
+ end
+
+ def self.active_for?(current_user:, other_user:)
</pre>
<p dir="auto">Why use different names for the users in the argument list here? It's the same concept as the member names so why not use the same names?</p>
<p dir="auto">Of course once you do that the question becomes is this method even needed when it's just forwarding the arguments to <code class="notranslate">exists?</code>?</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4284#discussion_r1354558578">db/migrate/20231010201451_create_user_mutes.rb</a>:</p>
<pre style='color:#555'>> @@ -0,0 +1,15 @@
+class CreateUserMutes < ActiveRecord::Migration[7.0]
+ def change
+ create_table :user_mutes do |t|
+ t.references :creator, :null => false
</pre>
<p dir="auto">I think we can add <code class="notranslate">:index => false</code> here as we have a separate index on creator+appointee for uniqueness so also having one on creator is unnecessary.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4284#discussion_r1354540469">config/locales/en.yml</a>:</p>
<pre style='color:#555'>> @@ -2900,6 +2912,23 @@ en:
showing_page: "Page %{page}"
next: "Next »"
previous: "« Previous"
+ user_mutes:
+ index:
+ you_have_muted_n_users:
+ zero: "You haven't muted any Users 🎉"
+ one: "You have muted %{count} User"
+ other: "You have muted %{count} Users"
+ user_mute_explainer: "Private messages of muted users are moved into a separate inbox and you won't receive email notifications."
+ user_mute_admins_and_moderators: "You can mute Admins and Moderators but their private messages cannot."
</pre>
<p dir="auto">That change is of course equivalent to saying "you can mute them but it has no effect" so should we just not allow them to be muted?</p>
<p dir="auto">I guess if their status changes later then the mute would suddenly activate but then that raises more questions...</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/4284#pullrequestreview-1670527337">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLJSDTCNWNDVOTSUZT3X6ZQUTANCNFSM6AAAAAA53SDORY">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLMHFH6CDJJKKZHT6ODX6ZQUTA5CNFSM6AAAAAA53SDOR2WGG33NNVSW45C7OR4XAZNRKB2WY3CSMVYXKZLTORJGK5TJMV32UY3PNVWWK3TUL5UWJTTDSI4WS.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/4284/review/1670527337</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/4284#pullrequestreview-1670527337",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/4284#pullrequestreview-1670527337",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>