Repository navigation
Unfeature post tool for moderators #2167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Oaphi
wants to merge
17
commits into
develop
Choose a base branch
from
0valt/2165/post-unfeaturing
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a97a36c
Switch feature post action to verify_moderator callback
Oaphi 0d5ab0f
Add featured? predicate to Post model
Oaphi 481facd
Add audit log helpers (static) to PinnedLink
Oaphi b58c9da
featured? predicate should only check active links
Oaphi d127c6b
Fix typo in audit_create helper method for PinnedLink
Oaphi bd6b66a
Add a proper partial for rending individual post tools
Oaphi 4e5a050
Allow posts to be unfeatured from post tools
Oaphi e0b77f5
Add a proper partial for pinned links sidebar widget
Oaphi ae7e8fa
pull_pinned_links_and_hot_questions should make use of the 'current' …
Oaphi febabb7
Add tests for the unfeature action
Oaphi 4b8d772
Add minitest-stub_any_instance test dependency
Oaphi 650b7bd
:unfeature should at least set a generic error status on failure
Oaphi aa24208
Add test covering :unfeature update failures
Oaphi 7248bb4
Minor rubocop fix
Oaphi f8fe23a
Make assert_audit_log more robust in concurrent tests
Oaphi d9352f5
Ensure posts can be featured only once wihtout unfeaturing first
Oaphi f7e613b
Restrict unfeaturing to current pinned links only
Oaphi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <%# | ||
| Renders a widget listing currently pinned links | ||
|
|
||
| Variables: | ||
| links : ActiveRecord::Relation<PinnedLink> collection of pinned links to display | ||
| %> | ||
|
|
||
| <% has_timed = links.any?(&:timed?) %> | ||
|
|
||
| <% cache_unless has_timed, links do %> | ||
| <div class="widget has-margin-4 is-teal"> | ||
| <div class="widget--header">Featured</div> | ||
| <% links.each do |pl| %> | ||
| <div class="widget--body"> | ||
| <% pl_link = pl.post.nil? ? pl.link : generic_share_link(pl.post) %> | ||
| <% pl_label = pl.post.nil? ? pl.label : (pl.post.parent.nil? ? pl.post.title : pl.post.parent.title) %> | ||
| <%= link_to pl_link, class: 'h-fw-bold' do %> | ||
| <%= pl_label %> | ||
| <% end %> | ||
| <% unless pl.shown_before.nil? %> | ||
| <div> | ||
| — | ||
| <% if !pl.shown_after.nil? %> | ||
| <% if pl.shown_after < DateTime.now %> | ||
| ends in <%= time_ago_in_words(pl.shown_before) %> | ||
| <% else %> | ||
| starts in <%= time_ago_in_words(pl.shown_after) %> | ||
| <% end %> | ||
| <% else %> | ||
| in <%= time_ago_in_words(pl.shown_before) %> | ||
| <% end %> | ||
| </div> | ||
| <% end %> | ||
| </div> | ||
| <% end %> | ||
| </div> | ||
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <%# | ||
| Renders a single post tool | ||
|
|
||
| Variables: | ||
| post : the Post instance to render the tool for | ||
| name : unique name of the tool | ||
| method : HTTP method to use for the tool's action | ||
| %> | ||
|
|
||
| <details> | ||
| <summary><%= t("posts.tools.#{name}") %></summary> | ||
| <p><%= t("posts.tools.#{name}_blurb") %></p> | ||
| <%= form_tag send("post_#{name}_url", post), | ||
| method: method, | ||
| remote: true, | ||
| class: "js-#{name}-post" do %> | ||
| <%= submit_tag t("posts.tools.#{name}_action"), | ||
| class: 'button is-filled' %> | ||
| <% end %> | ||
| </details> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| en: | ||
| pinned_links: | ||
| success: | ||
| create: > | ||
| Your pinned link has been created. | ||
| It may take some time for the changes to take effect due to caching. | ||
| update: > | ||
| The pinned link has been updated. | ||
| It may take some time for the changes to take effect due to caching. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not know Spanish and refuse to use genai-in-a-trenchcoat services for "translation", so if anyone can help creating
es.pinned_links.ymland adjustinges.posts.yml, it'd be appreciated.