Commit Graph

397 Commits

Author SHA1 Message Date
Gabriel Grubba
b39c30045b
FEATURE: Add skip notification option to group invite to topic (#29741)
* FEATURE: Add skip notification option to group invite to topic

* DEV: rename `skip_notification` to `should_notify`

* DEV: update `should_notify` param to be default `true` in controllers

* DEV: update spec to use `greater than` instead of `equal to` to prevent flakiness

* Update app/controllers/topics_controller.rb

Co-authored-by: David Taylor <david@taylorhq.com>

* DEV: merged two `#invite_group` specs into one

* DEV: Added test case for `invite-group` in requests spec

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2024-11-14 13:00:15 -03:00
Ted Johansson
f8360f9665
FIX: Don't error out on nested topic show id param (#29274)
We're expecting the ID param to be something that neatly coerces into an ID. If we receive something like a nested parameter, this will blow up. (We already handle the case of arrays.)

This commit raises an InvalidParameters exception in the case of a nested ID.
2024-10-18 14:37:52 +08:00
Alan Guo Xiang Tan
35284c77f1
Build(deps-dev): Bump rubocop from 1.66.1 to 1.67.0 (#29226)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.66.1 to 1.67.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/rubocop/rubocop/releases">rubocop's releases</a>.</em></p>
<blockquote>
<h2>RuboCop 1.67</h2>
<h3>New features</h3>
<ul>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13259">#13259</a>: Add new <code>Lint/DuplicateSetElement</code> cop. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13223">#13223</a>: Add <code>AllowRBSInlineAnnotation</code> config option to <code>Layout/LeadingCommentSpace</code> to support RBS::Inline style annotation comments. ([<a href="https://github.com/tk0miya"><code>@​tk0miya</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13310">#13310</a>: Display analysis Ruby version in <code>rubocop -V</code>. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13314">#13314</a>: Fix a false negative for <code>Style/Semicolon</code> when using a semicolon between a closing parenthesis after a line break and a consequent expression. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13217">#13217</a>: Fix a false positive in <code>Lint/ParenthesesAsGroupedExpression</code> with compound ranges. ([<a href="https://github.com/gsamokovarov"><code>@​gsamokovarov</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13268">#13268</a>: Fix a false positive for <code>Style/BlockDelimiters</code> when a single line do-end block with an inline <code>rescue</code> with a semicolon before <code>rescue</code>. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13298">#13298</a>: Fix an error for <code>Layout/AccessModifierIndentation</code> when the access modifier is on the same line as the class definition. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13198">#13198</a>: Fix an error for <code>Style/OneLineConditional</code> when using nested if/then/else/end. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13316">#13316</a>: Fix an incorrect autocorrect for <code>Lint/ImplicitStringConcatenation</code> with <code>Lint/TripleQuotes</code> when string literals with triple quotes are used. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13220">#13220</a>: Fix an incorrect autocorrect for <code>Style/ArgumentsForwarding</code> when using only forwarded arguments in brackets. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13202">#13202</a>: Fix an incorrect autocorrect for <code>Style/CombinableLoops</code> when looping over the same data with different block variable names. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13291">#13291</a>: Fix an incorrect autocorrect for <code>Style/RescueModifier</code> when using modifier rescue for method call with heredoc argument. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13226">#13226</a>: Fix <code>--auto-gen-config</code> when passing an absolute config path. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13225">#13225</a>: Avoid syntax error when correcting <code>Style/OperatorMethodCall</code> with <code>/</code> operations followed by a parenthesized argument. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13235">#13235</a>: Fix an error for <code>Style/IfUnlessModifier</code> when multiline <code>if</code> that fits on one line and using implicit method call with hash value omission syntax. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13219">#13219</a>: Fix a false positive for <code>Style/ArgumentsForwarding</code> with Ruby 3.0 and optional position arguments. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13271">#13271</a>: Fix a false positive for <code>Lint/AmbiguousRange</code> when using rational literals. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13260">#13260</a>: Fix a false positive for <code>Lint/RedundantSafeNavigation</code> with namespaced constants. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13224">#13224</a>: Fix false positives for <code>Style/OperatorMethodCall</code> with named forwarding. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13213">#13213</a>: Fix false positives for <code>Style/AccessModifierDeclarations</code> when <code>AllowModifiersOnAttrs: true</code> and using splat with a percent symbol array, or with a constant. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13145">#13145</a>: Fix false positives for <code>Style/RedundantLineContinuation</code> when line continuations with comparison operator and the LHS is wrapped in parentheses. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/12875">#12875</a>: Fix false positive for <code>Style/ArgumentsForwarding</code> when argument is used inside a block. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13239">#13239</a>: Fix false positive for <code>Style/CollectionCompact</code> when using <code>delete_if</code>. ([<a href="https://github.com/masato-bkn"><code>@​masato-bkn</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13210">#13210</a>: Fix omit_parentheses style for pattern match with value omission in single-line branch. ([<a href="https://github.com/gsamokovarov"><code>@​gsamokovarov</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13149">#13149</a>: Handle crashes in custom Ruby extractors more gracefully. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13319">#13319</a>: Handle literal forward slashes inside a <code>regexp</code> in <code>Lint/LiteralInInterpolation</code>. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13208">#13208</a>: Fix an incorrect autocorrect for <code>Style/IfWithSemicolon</code> when single-line <code>if/;/end</code> when the then body contains a method call with <code>[]</code> or <code>[]=</code>. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13318">#13318</a>: Prevent modifying blocks with <code>Style/HashEachMethods</code> if the hash is modified within the block. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13293">#13293</a>: Fix <code>TargetRubyVersion</code> from a gemspec when the gemspec is not named like the folder it is located in. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13211">#13211</a>: Fix wrong autocorrect for <code>Style/GuardClause</code> when using heredoc without <code>else</code> branch. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13215">#13215</a>: Fix wrong autocorrect for <code>Lint/BigDecimalNew</code> when using <code>::BigDecimal.new</code>. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13215">#13215</a>: Fix wrong autocorrect for <code>Style/MethodCallWithArgsParentheses</code> with <code>EnforcedStyle: omit_parentheses</code> and whitespace. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13302">#13302</a>: Fix incompatible autocorrect between <code>Style/RedundantBegin</code> and <code>Style/BlockDelimiters</code> with <code>EnforcedStyle: braces_for_chaining</code>. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
</ul>
<h3>Changes</h3>
<ul>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13221">#13221</a>: Do not group accessors having RBS::Inline annotation comments in <code>Style/AccessorGrouping</code>. ([<a href="https://github.com/tk0miya"><code>@​tk0miya</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13286">#13286</a>: Add <code>AllowedMethods</code> configuration to <code>Layout/FirstMethodArgumentLineBreak</code>. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13110">#13110</a>: Add support in <code>Style/ArgumentsForwarding</code> for detecting forwarding of all anonymous arguments. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13222">#13222</a>: Allow to write RBS::Inline annotation comments after method definition in <code>Style/CommentedKeyword</code>. ([<a href="https://github.com/tk0miya"><code>@​tk0miya</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13253">#13253</a>: Emit a deprecation when custom cops inherit from <code>RuboCop::Cop::Cop</code>. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13300">#13300</a>: Set <code>EnforcedShorthandSyntax: either</code> by default for <code>Style/HashSyntax</code>. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13254">#13254</a>: Enhance the autocorrect for <code>Naming/InclusiveLanguage</code> when a sole suggestion is set. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13232">#13232</a>: Make server mode aware of auto-restart for local config update. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md">rubocop's changelog</a>.</em></p>
<blockquote>
<h2>1.67.0 (2024-10-15)</h2>
<h3>New features</h3>
<ul>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13259">#13259</a>: Add new <code>Lint/DuplicateSetElement</code> cop. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13223">#13223</a>: Add <code>AllowRBSInlineAnnotation</code> config option to <code>Layout/LeadingCommentSpace</code> to support RBS::Inline style annotation comments. ([<a href="https://github.com/tk0miya"><code>@​tk0miya</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13310">#13310</a>: Display analysis Ruby version in <code>rubocop -V</code>. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13314">#13314</a>: Fix a false negative for <code>Style/Semicolon</code> when using a semicolon between a closing parenthesis after a line break and a consequent expression. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13217">#13217</a>: Fix a false positive in <code>Lint/ParenthesesAsGroupedExpression</code> with compound ranges. ([<a href="https://github.com/gsamokovarov"><code>@​gsamokovarov</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13268">#13268</a>: Fix a false positive for <code>Style/BlockDelimiters</code> when a single line do-end block with an inline <code>rescue</code> with a semicolon before <code>rescue</code>. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13298">#13298</a>: Fix an error for <code>Layout/AccessModifierIndentation</code> when the access modifier is on the same line as the class definition. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13198">#13198</a>: Fix an error for <code>Style/OneLineConditional</code> when using nested if/then/else/end. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13316">#13316</a>: Fix an incorrect autocorrect for <code>Lint/ImplicitStringConcatenation</code> with <code>Lint/TripleQuotes</code> when string literals with triple quotes are used. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13220">#13220</a>: Fix an incorrect autocorrect for <code>Style/ArgumentsForwarding</code> when using only forwarded arguments in brackets. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13202">#13202</a>: Fix an incorrect autocorrect for <code>Style/CombinableLoops</code> when looping over the same data with different block variable names. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13291">#13291</a>: Fix an incorrect autocorrect for <code>Style/RescueModifier</code> when using modifier rescue for method call with heredoc argument. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13226">#13226</a>: Fix <code>--auto-gen-config</code> when passing an absolute config path. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13225">#13225</a>: Avoid syntax error when correcting <code>Style/OperatorMethodCall</code> with <code>/</code> operations followed by a parenthesized argument. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13235">#13235</a>: Fix an error for <code>Style/IfUnlessModifier</code> when multiline <code>if</code> that fits on one line and using implicit method call with hash value omission syntax. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13219">#13219</a>: Fix a false positive for <code>Style/ArgumentsForwarding</code> with Ruby 3.0 and optional position arguments. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13271">#13271</a>: Fix a false positive for <code>Lint/AmbiguousRange</code> when using rational literals. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13260">#13260</a>: Fix a false positive for <code>Lint/RedundantSafeNavigation</code> with namespaced constants. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13224">#13224</a>: Fix false positives for <code>Style/OperatorMethodCall</code> with named forwarding. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13213">#13213</a>: Fix false positives for <code>Style/AccessModifierDeclarations</code> when <code>AllowModifiersOnAttrs: true</code> and using splat with a percent symbol array, or with a constant. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13145">#13145</a>: Fix false positives for <code>Style/RedundantLineContinuation</code> when line continuations with comparison operator and the LHS is wrapped in parentheses. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/12875">#12875</a>: Fix false positive for <code>Style/ArgumentsForwarding</code> when argument is used inside a block. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13239">#13239</a>: Fix false positive for <code>Style/CollectionCompact</code> when using <code>delete_if</code>. ([<a href="https://github.com/masato-bkn"><code>@​masato-bkn</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13210">#13210</a>: Fix omit_parentheses style for pattern match with value omission in single-line branch. ([<a href="https://github.com/gsamokovarov"><code>@​gsamokovarov</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13149">#13149</a>: Handle crashes in custom Ruby extractors more gracefully. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13319">#13319</a>: Handle literal forward slashes inside a <code>regexp</code> in <code>Lint/LiteralInInterpolation</code>. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13208">#13208</a>: Fix an incorrect autocorrect for <code>Style/IfWithSemicolon</code> when single-line <code>if/;/end</code> when the then body contains a method call with <code>[]</code> or <code>[]=</code>. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13318">#13318</a>: Prevent modifying blocks with <code>Style/HashEachMethods</code> if the hash is modified within the block. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13293">#13293</a>: Fix <code>TargetRubyVersion</code> from a gemspec when the gemspec is not named like the folder it is located in. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13211">#13211</a>: Fix wrong autocorrect for <code>Style/GuardClause</code> when using heredoc without <code>else</code> branch. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13215">#13215</a>: Fix wrong autocorrect for <code>Lint/BigDecimalNew</code> when using <code>::BigDecimal.new</code>. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13215">#13215</a>: Fix wrong autocorrect for <code>Style/MethodCallWithArgsParentheses</code> with <code>EnforcedStyle: omit_parentheses</code> and whitespace. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13302">#13302</a>: Fix incompatible autocorrect between <code>Style/RedundantBegin</code> and <code>Style/BlockDelimiters</code> with <code>EnforcedStyle: braces_for_chaining</code>. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
</ul>
<h3>Changes</h3>
<ul>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13221">#13221</a>: Do not group accessors having RBS::Inline annotation comments in <code>Style/AccessorGrouping</code>. ([<a href="https://github.com/tk0miya"><code>@​tk0miya</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13286">#13286</a>: Add <code>AllowedMethods</code> configuration to <code>Layout/FirstMethodArgumentLineBreak</code>. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/issues/13110">#13110</a>: Add support in <code>Style/ArgumentsForwarding</code> for detecting forwarding of all anonymous arguments. ([<a href="https://github.com/dvandersluis"><code>@​dvandersluis</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13222">#13222</a>: Allow to write RBS::Inline annotation comments after method definition in <code>Style/CommentedKeyword</code>. ([<a href="https://github.com/tk0miya"><code>@​tk0miya</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13253">#13253</a>: Emit a deprecation when custom cops inherit from <code>RuboCop::Cop::Cop</code>. ([<a href="https://github.com/earlopain"><code>@​earlopain</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13300">#13300</a>: Set <code>EnforcedShorthandSyntax: either</code> by default for <code>Style/HashSyntax</code>. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
<li><a href="https://redirect.github.com/rubocop/rubocop/pull/13254">#13254</a>: Enhance the autocorrect for <code>Naming/InclusiveLanguage</code> when a sole suggestion is set. ([<a href="https://github.com/koic"><code>@​koic</code></a>][])</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="c108ac0822"><code>c108ac0</code></a> Cut 1.67</li>
<li><a href="74ddd9bb96"><code>74ddd9b</code></a> Update Changelog</li>
<li><a href="b5c12aea89"><code>b5c12ae</code></a> Update Changelog</li>
<li><a href="c936160665"><code>c936160</code></a> [Fix <a href="https://redirect.github.com/rubocop/rubocop/issues/13331">#13331</a>] Fix an error when using release task</li>
<li><a href="60ecb00dd7"><code>60ecb00</code></a> [Fix <a href="https://redirect.github.com/rubocop/rubocop/issues/13328">#13328</a>] Declare <code>Enabled</code> as a common config key</li>
<li><a href="99022d9880"><code>99022d9</code></a> Merge pull request <a href="https://redirect.github.com/rubocop/rubocop/issues/13327">#13327</a> from koic/make_server_mode_aware_of_auto_restart_fo...</li>
<li><a href="60432f5e44"><code>60432f5</code></a> Apply <code>RESTRICT_ON_SEND</code> to <code>Bundler/GemVersion</code></li>
<li><a href="6b31c39f1e"><code>6b31c39</code></a> Make server mode aware of auto-restart for .rubocop_todo.yml update</li>
<li><a href="adb7ceed43"><code>adb7cee</code></a> [Fix <a href="https://redirect.github.com/rubocop/rubocop/issues/9816">#9816</a>] Refine <code>Lint/SafeNavigationConsistency</code></li>
<li><a href="7d6797cf9d"><code>7d6797c</code></a> [Fix <a href="https://redirect.github.com/rubocop/rubocop/issues/13286">#13286</a>] Add <code>AllowedMethods</code> and <code>AllowedPatterns</code> configuration to `Lay...</li>
<li>Additional commits viewable in <a href="https://github.com/rubocop/rubocop/compare/v1.66.1...v1.67.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rubocop&package-manager=bundler&previous-version=1.66.1&new-version=1.67.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>
2024-10-16 10:56:58 +08:00
Linca
741e9d70ad
FIX: Don't show move topic for private messages for TL4 (#28871)
In TopicController, in addition to ensure_can_move_posts!, we also
checked if the topic is private message in this line:

```ruby
raise Discourse::InvalidAccess if params[:archetype] == "private_message" && !guardian.is_staff?
```

However, this was not present in `guardian.can_move_posts?`. As a result,
the frontend topic view got an incorrect serialized result, thinking
that TL4 could move the private message post. In fact, once they tried
to move it, they got the `InvalidAccess` error message.

This commit fixes that TL4 will no longer sees the "move to" option in
the "select post" panel for a private message.
2024-09-16 11:30:05 +08:00
Ted Johansson
bfad9a7170
DEV: Gracefully handle an array of IDs passed to Topics#show (#28631)
We're seeing a lot of log noise coming from unhandled exceptions stemming from requests to TopicsController#show where id is passed in as an array.

In the implementation of the method, we assume that if id is present it will be a string. This is because one of the routes to this action uses :id as a URL fragment, and so must be a string. However, there are other routes that go to this endpoint as well. Some of them don't have this URL fragment, so you can pass an arbitrary id query parameter.

Instead of a downstream unhandled exception, we raise a Discourse::InvalidParameters upfront.
2024-08-29 14:22:42 +08:00
Alan Guo Xiang Tan
21bb28df91
PERF: Ensure suggested topics is only loaded on last page of topic view (#28507)
This commit improves `TopicsController#show` to not load suggested and
related topics unless it is the last page of the topic's view.
Previously, we avoided loading suggested and related topics by the use
of conditionals in the `TopicViewSerializer` to avoid calling
`TopicView#suggested_topics` and `TopicView#related_topics`. However,
this pattern is not reliable as the methods can still be called from
other spots in the code base. Instead, we ensure that
`TopicView#include_suggested` and `TopicView#include_related` is set
correctly on the instance of `TopicView` which ensures that for the
given instance, `TopicView#suggested_topics` and
`TopicView#related_topics` will be a noop.
2024-08-23 16:10:50 +08:00
Ted Johansson
a32390f5dc
FIX: Don't count draft views towards topic view stats (#28162)
When creating a shared draft, we're recording topic view stats on the draft and then pass those on when the draft is published, conflating the actual view count.

This fixes that by not registering topic views if the topic is a shared draft.
2024-07-31 11:10:50 +08:00
Osama Sayegh
731fcad3d5
FIX: Perform topics merge in a background thread (#28114)
Similar to https://github.com/discourse/discourse/pull/28061, merging topics with many posts can exceed the 30 seconds timeout that Unicorn workers are limited to, so we should move the operation into a background thread to get around this limit.

Internal topic: t/133710.
2024-07-30 13:54:17 +03:00
Osama Sayegh
596a93d2cd
FIX: Perform topics bulk action in a background thread (#28061)
Performing a bulk action on many topics can exceed the 30 seconds timeout that Unicorn workers have which results in the request failing and the operation getting aborted. To get around this 30 seconds timeout, we can push the operation into a background thread using the rack `hijack` API.

Internal topic: t/133779.
2024-07-25 11:43:00 +03:00
Joffrey JAFFEUX
e954eb234e
FIX: return is invalid inside a block (#28036)
Fixed using next instead. It was causing this kind of errors:

```
Job exception: unexpected return

/var/www/discourse/app/controllers/topics_controller.rb:1304:in `block in defer_topic_view'
/var/www/discourse/lib/scheduler/defer.rb:115:in `block in do_work'
rails_multisite-6.0.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
rails_multisite-6.0.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
/var/www/discourse/lib/scheduler/defer.rb:109:in `do_work'
/var/www/discourse/lib/scheduler/defer.rb:97:in `block (2 levels) in start_thread'
```
2024-07-23 09:56:38 +02:00
锦心
600f2854c7
FEATURE: Log topic slow mode changes (#27934)
Previously, we did not log any topic slow mode changes. This allowed
some malicious (or just careless) TL4 users to delete slow modes created
by moderators at will. Administrators could not see who changed the slow
mode unless they had SQL knowledge and used Data Explorer.

This commit enables logging who turns slow mode on, off, or changes it.

Related meta topic: https://meta.discourse.org/t/why-is-there-no-record-of-who-added-or-removed-slow-mode/316354
2024-07-16 17:08:09 +08:00
Martin Brennan
eca4ed8f80
DEV: Remove old defer_track_visit_v2 method (#27812)
Followup b46e1fe2aa
2024-07-10 11:40:45 +10:00
Martin Brennan
b46e1fe2aa
DEV: Renaming TopicsController defer track visit (#27761)
Followup to 527f02e99f,
I had to introduce defer_track_visit_v2 because discourse-docs
relied on defer_track_visit. Now that discourse-docs
is using the new method as of
discourse/discourse-docs@0d9365571b,
we can rename it in core. Then we will need one more PR
in both core and docs to remove usage of the "v2" method.
2024-07-08 16:00:20 +10:00
Martin Brennan
527f02e99f
FEATURE: Only count topic views for explicit/deferred tracked views (#27533)
Followup 2f2da72747

This commit moves topic view tracking from happening
every time a Topic is requested, which is susceptible
to inflating numbers of views from web crawlers, to
our request tracker middleware.

In this new location, topic views are only tracked when
the following headers are sent:

* HTTP_DISCOURSE_TRACK_VIEW - This is sent on every page navigation when
  clicking around the ember app. We count these as browser page views
  because we know it comes from the AJAX call in our app. The topic ID
  is extracted from HTTP_DISCOURSE_TRACK_VIEW_TOPIC_ID
* HTTP_DISCOURSE_DEFERRED_TRACK_VIEW - Sent when MessageBus initializes
  after first loading the page to count the initial page load view. The
  topic ID is extracted from HTTP_DISCOURSE_DEFERRED_TRACK_VIEW.

This will bring topic views more in line with the change we
made to page views in the referenced commit and result in
more realistic topic view counts.
2024-07-03 10:38:49 +10:00
Keegan George
ea58140032
DEV: Remove summarization code (#27373) 2024-07-02 08:51:47 -07:00
Jan Cernik
6599b85a75
DEV: Block accidental serialization of entire AR models (#27668) 2024-07-01 17:08:48 -03:00
Loïc Guitaut
2a28cda15c DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
Régis Hanol
e04ac5e2d8
FIX: display validation errors when converting topics (#27064)
When converting a PM to a public topic (and vice versa), if there was a validation error (like a topic already used, or a tag required or not allowed) the error message wasn't bubbled up nor shown to the user.

This fix ensures we properly stop the conversion whenever a validation error happens and bubble up the errors back to the user so they can be informed.

Internal ref - t/128795
2024-05-17 16:36:25 +02:00
Martin Brennan
edec941a87
FIX: Better tracking of topic visibility changes (#26709)
This commit introduces a few changes as a result of
customer issues with finding why a topic was relisted.
In one case, if a user edited the OP of a topic that was
unlisted and hidden because of too many flags, the topic
would get relisted by directly changing topic.visible,
instead of going via TopicStatusUpdater.

To improve tracking we:

* Introduce a visibility_reason_id to topic which functions
  in a similar way to hidden_reason_id on post, this column is
  set from the various places we change topic visibility
* Fix Post#unhide! which was directly modifying topic.visible,
  instead we use TopicStatusUpdater which sets visibility_reason_id
  and also makes a small action post
* Show the reason topic visibility changed when hovering the
  unlisted icon in topic status on topic titles
2024-04-29 10:34:46 +10:00
Blake Erickson
8da49b5664
FEATURE: Add message to bulk close topics (#26535)
This will allow you to type a single message when bulk closing topics
that will be applied to every topic, that way they all have the same
message.
2024-04-05 14:56:52 -06:00
Mark VanLandingham
797ab30d95
DEV: Modifier to add params to TopicsController redirect url (#26470) 2024-04-02 15:35:44 -05:00
Penar Musaraj
c1577019c8
DEV: Add post_id parameter to reset_bump_date route (#25372)
This would allow a theme component (or an API call) to reset the bump
date of a topic to a given post's created_at date.

I picked `post_id` as the parameter here because it provides a bit of
extra protection against accidentally resetting the bump date to a date
that doesn't make sense.
2024-02-15 16:42:42 +11:00
Jarek Radosz
694b5f108b
DEV: Fix various rubocop lints (#24749)
These (21 + 3 from previous PRs) are soon to be enabled in rubocop-discourse:

Capybara/VisibilityMatcher
Lint/DeprecatedOpenSSLConstant
Lint/DisjunctiveAssignmentInConstructor
Lint/EmptyConditionalBody
Lint/EmptyEnsure
Lint/LiteralInInterpolation
Lint/NonLocalExitFromIterator
Lint/ParenthesesAsGroupedExpression
Lint/RedundantCopDisableDirective
Lint/RedundantRequireStatement
Lint/RedundantSafeNavigation
Lint/RedundantStringCoercion
Lint/RedundantWithIndex
Lint/RedundantWithObject
Lint/SafeNavigationChain
Lint/SafeNavigationConsistency
Lint/SelfAssignment
Lint/UnreachableCode
Lint/UselessMethodDefinition
Lint/Void

Previous PRs:
Lint/ShadowedArgument
Lint/DuplicateMethods
Lint/BooleanSymbol
RSpec/SpecFilePathSuffix
2023-12-06 23:25:00 +01:00
Alan Guo Xiang Tan
b4eb078b0e
FIX: Preserve preview_theme_id param on topic redirects (#23965)
Why this change?

When the URL `/t/1234?preview_theme_id=21` is loaded, we redirect to
`/t/<topic slug>/1234` stripping the `preview_theme_id` query params.

What does this change do?

This change builds on 61248652cd and
simply adds the `preview_theme_id` query param when redirecting.
2023-10-19 09:32:56 +08:00
Bianca Nenciu
3700514819
DEV: Prefer nested queries (#23464)
Some sites have a large number of categories and fetching the category
IDs or category topic IDs just to build another query can take a long
time or resources (i.e. memory).
2023-09-25 19:38:54 +03:00
Ted Johansson
752a2cc654
DEV: Handle bad parameters in TopicsController#wordpress (#23404)
We're seeing a large number of log noise from this endpoint due to malicious scanners that are trying to send clever params and seeing if they can break something.

This change simply rescues any NoMethodError during parameter parsing and re-raises a Discourse::InvalidParameters exception, which will be caught and render a 400.
2023-09-05 16:35:46 +08:00
Roman Rizzi
e20de81de3
FIX: Display summaries for anonymous users. (#23294)
Streaming doesn't work for anonymous users because we scope updates to the current user. Since they can only see cached summaries, we can skip the streaming parameter and update it directly with the ajax response.
2023-08-28 17:29:48 -03:00
Roman Rizzi
7ca5ee6cd2
FEATURE: Stream topic summaries. (#23065)
When we receive the stream parameter, we'll queue a job that periodically publishes partial updates, and after the summarization finishes, a final one with the completed version, plus metadata.

`summary-box` listens to these updates via MessageBus, and updates state accordingly.
2023-08-11 15:08:49 -03:00
Alan Guo Xiang Tan
fff578f5fb
FIX: Can't dismiss unread posts in topics of a sub-subcategory (#22870)
This is a similar fix to 32d4810e2b

Why this change?

Prior to this change, there is a bug in `TopicsController#bulk`
where it does not dismiss new unred posts in sub-subcategories when the
`category_id` and `include_subcategories=true` params are present. This
is because the controller did not account for sub-subcategories when
fetching the category ids of the new topics that should be dismissed.

This commit fixes the problem by relying on the `Category.subcategory_ids` class
method which accounts for sub-subcategories.
2023-07-31 11:22:16 +08:00
Alan Guo Xiang Tan
32d4810e2b
FIX: Can't dismiss new topics that belong to a sub-sub category (#22849)
What is the context for this change?

Prior to this change, there is a bug in `TopicsController#reset_new`
where it does not dismiss new topics in sub-subcategories when the
`category_id` and `include_subcategories=true` params are present. This
is because the controller did not account for sub-subcategories when
fetching the category ids of the new topics that should be dismissed.

This commit fixes the problem by relying on the `Category.subcategory_ids` class
method which accounts for sub-subcategories.
2023-07-28 12:06:42 +08:00
Roman Rizzi
238d71bcad
FEATURE: Regenerate outdated summaries. (#22718)
Users unable to generate new summaries won't be able to regenerate them. They'll only see the warning saying it's outdated.
2023-07-20 15:25:46 -03:00
Roman Rizzi
77e5153350
UX: Point that topic summaries are generated by an AI (#22646) 2023-07-17 17:24:41 -03:00
Alan Guo Xiang Tan
48c8ed49d6
FIX: Dismissing unread posts did not publish changes to other clients (#22584)
Why this change?

Prior to this change, dismissing unreads posts did not publish the
changes across clients for the same user. As a result, users can end up
seeing an unread count being present but saw no topics being loaded when
visiting the `/unread` route.
2023-07-13 18:05:56 +08:00
Roman Rizzi
61aeb2da90
FEATURE: Inline topic summary. Cached version accessible to everyone. (#22551)
* FEATURE:  Inline topic summary. Cached version accessible to everyone.

Anons and non-members of the `custom_summarization_allowed_groups_map` groups can see cached summaries for any accessible topic. After the first 12 hours and if the posts to summarize have changed, allowed users clicking on the button will automatically re-generate it.

* Ensure chat summaries work and prevent model hallucinations when there are no messages.
2023-07-12 11:21:51 -03:00
Roman Rizzi
f4e7a80600
DEV: Cache summarization strategy results. (#22230)
Updates the interface for implementing summarization strategies and adds a cache layer to summarize topics once.

The cache stores the final summary and each chunk used to build it, which will be useful when we have to extend or rebuild it.
2023-06-27 11:44:34 -03:00
Roman Rizzi
8938ecabc2
FEATURE: Custom content summarization strategies. (#21813)
* FEATURE: Content custom summarization strategies.

This PR establishes a pattern for plugins to register alternative ways of summarizing content by extending a class that defines an interface.

Core controls which strategy we'll use and who has access to it through the `summarization_strategy` and `custom_summarization_allowed_groups`. It also defines the UI for summarizing topics.

Other plugins can access this summarization mechanism and implement their features, removing cross-plugin customizations, as it currently happens between chat and the discourse-ai plugin.

* Group membership validation and rate limiting

* Work with objects instead of classes

* Port summarization feature from discourse-ai to chat

* Rename available summaries to 'Top Replies' and 'Summary'
2023-06-13 14:21:46 -03:00
Blake Erickson
dcceb91000
SECURITY: Prevent dismissal of topics that user can't see (#22086)
Co-authored-by: OsamaSayegh <asooomaasoooma90@gmail.com>
2023-06-13 11:08:55 -06:00
Krzysztof Kotlarek
af74cf5c77
FEATURE: new dismiss button for combined new and unread view (#21817)
Display modal for combined new and unread view with options:
- [x] Dismiss new topics
- [x] Dismiss new posts
- [ ] Stop tracking these topics so they stop appearing in my new list
2023-06-07 10:06:57 +10:00
Renato Atilio
c539f749f1
FEATURE: support for chronologically merging posts into existing topic (#21374)
When a user chooses to move a topic/message to an existing topic/message, they can now opt to merge the posts chronologically (using a checkbox in the UI).
2023-05-25 14:38:34 -04:00
Faizaan Gagan
a58c37bdc5
FIX: allow admin to change topic notification level via API (#21581)
* FIX: allow admin to change topic notification level via API

* default to `current_user` if admin changes own level

* check param existence

* simplify condition

* remove rescue

* Update spec/requests/topics_controller_spec.rb

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>

* added specs for other cases

---------

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2023-05-23 00:47:58 +05:30
Natalie Tay
068a36d354
UX: Improve error message when a topic cannot be moved due to category restrictions (#20900) 2023-03-31 02:18:57 +08:00
Loïc Guitaut
a9f2c6db64 SECURITY: Show only visible tags in metadata
Currently, the topic metadata show both public and private
tags whereas only visible ones should be exposed.
2023-02-23 17:22:20 +01:00
Loïc Guitaut
f7c57fbc19 DEV: Enable unless cops
We discussed the use of `unless` internally and decided to enforce
available rules from rubocop to restrict its most problematic uses.
2023-02-21 10:30:48 +01:00
Ted Johansson
25a226279a
DEV: Replace #pluck_first freedom patch with AR #pick in core (#19893)
The #pluck_first freedom patch, first introduced by @danielwaterworth has served us well, and is used widely throughout both core and plugins. It seems to have been a common enough use case that Rails 6 introduced it's own method #pick with the exact same implementation. This allows us to retire the freedom patch and switch over to the built-in ActiveRecord method.

There is no replacement for #pluck_first!, but a quick search shows we are using this in a very limited capacity, and in some cases incorrectly (by assuming a nil return rather than an exception), which can quite easily be replaced with #pick plus some extra handling.
2023-02-13 12:39:45 +08:00
Bianca Nenciu
8fc11215e1
FIX: Ensure soft-deleted topics can be deleted (#19802)
* FIX: Ensure soft-deleted topics can be deleted

The topic was not found during the deletion process because it was
deleted and `@post.topic` was nil.

* DEV: Use @topic instead of finding the topic every time
2023-01-27 16:15:33 +02:00
Daniel Waterworth
666536cbd1
DEV: Prefer \A and \z over ^ and $ in regexes (#19936) 2023-01-20 12:52:49 -06:00
Selase Krakani
73ec80893d
FEATURE: Extend topic update API scope to allow status updates (#19654)
Allow an API key created with topic:update API scope to make updates to
topic status. This change also introduces an optional category_id scope
param.
2023-01-13 01:21:04 +00:00
David Taylor
5a003715d3
DEV: Apply syntax_tree formatting to app/* 2023-01-09 14:14:59 +00:00
Rafael dos Santos Silva
9f3760cfd8
FEATURE: Allow category moderators to set auto deletion topic timers (#19383)
Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2022-12-08 17:14:43 -03:00
Bianca Nenciu
08ab09c928
FIX: Remove public topic invite functionality (#18488)
This can no longer be used from the user interface and could be used to
generate useless topic invites notifications. This commit adds site 
setting max_topic_invitations_per_minute to prevent invite spam.
2022-10-10 19:21:51 +03:00