fixes #3824: render tag requests dynamically in the forum post
refactoring
This commit is contained in:
@@ -15,9 +15,7 @@ class BulkUpdateRequestsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
respond_with(@bulk_update_request) do |fmt|
|
@bulk_update_request = BulkUpdateRequest.find(params[:id])
|
||||||
fmt.html { redirect_to bulk_update_requests_path(search: { id: @bulk_update_request.id }) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
|||||||
@@ -6,4 +6,49 @@ module ForumTopicsHelper
|
|||||||
def available_min_user_levels
|
def available_min_user_levels
|
||||||
ForumTopic::MIN_LEVELS.select { |name, level| level <= CurrentUser.level }.to_a
|
ForumTopic::MIN_LEVELS.select { |name, level| level <= CurrentUser.level }.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tag_request_message(obj)
|
||||||
|
if obj.is_a?(TagRelationship)
|
||||||
|
if obj.is_active?
|
||||||
|
return "The #{obj.relationship} ##{obj.id} [[#{obj.antecedent_name}]] -> [[#{obj.consequent_name}]] is active."
|
||||||
|
elsif obj.is_retired?
|
||||||
|
return "The #{obj.relationship} ##{obj.id} [[#{obj.antecedent_name}]] -> [[#{obj.consequent_name}]] has been retired"
|
||||||
|
elsif obj.is_pending?
|
||||||
|
return "The #{obj.relationship} ##{obj.id} [[#{obj.antecedent_name}]] -> [[#{obj.consequent_name}]] is pending approval."
|
||||||
|
elsif obj.is_errored?
|
||||||
|
return "The #{obj.relationship} ##{obj.id} [[#{obj.antecedent_name}]] -> [[#{obj.consequent_name}]] (#{relationship} failed during processing."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if obj.is_a?(BulkUpdateRequest)
|
||||||
|
if obj.is_approved?
|
||||||
|
return "The bulk update request ##{obj.id} is active.\n\n[expand]#{obj.script_with_links}[/expand]"
|
||||||
|
elsif obj.is_pending?
|
||||||
|
return "The \"bulk update request ##{obj.id}\":/bulk_update_requests/#{obj.id} is pending approval.\n\n[expand]#{obj.script_with_links}[/expand]"
|
||||||
|
elsif obj.is_rejected?
|
||||||
|
return "The bulk update request ##{obj.id} has been rejected.\n\n[expand]#{obj.script_with_links}[/expand]"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse_embedded_tag_request_text(text)
|
||||||
|
# for dev mode, prime these
|
||||||
|
if Rails.env.development?
|
||||||
|
[TagAlias, TagImplication]
|
||||||
|
end
|
||||||
|
|
||||||
|
[*TagRelationship.subclasses, BulkUpdateRequest].each do |tag_request|
|
||||||
|
text.gsub!(tag_request.embedded_pattern) do |match|
|
||||||
|
begin
|
||||||
|
obj = tag_request.find($~[:id])
|
||||||
|
tag_request_message(obj) || match
|
||||||
|
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
match
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
text
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class ForumUpdater
|
|||||||
@forum_topic = forum_topic
|
@forum_topic = forum_topic
|
||||||
@forum_post = options[:forum_post]
|
@forum_post = options[:forum_post]
|
||||||
@expected_title = options[:expected_title]
|
@expected_title = options[:expected_title]
|
||||||
|
@skip_update = options[:skip_update]
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(message, title_tag = nil)
|
def update(message, title_tag = nil)
|
||||||
@@ -31,6 +32,7 @@ class ForumUpdater
|
|||||||
end
|
end
|
||||||
|
|
||||||
def update_post(body)
|
def update_post(body)
|
||||||
|
return if @skip_update
|
||||||
forum_post.update(body: "#{forum_post.body}\n\nEDIT: #{body}", skip_mention_notifications: true)
|
forum_post.update(body: "#{forum_post.body}\n\nEDIT: #{body}", skip_mention_notifications: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ class TagAliasRequest
|
|||||||
"Tag alias: #{antecedent_name} -> #{consequent_name}"
|
"Tag alias: #{antecedent_name} -> #{consequent_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.command_string(antecedent_name, consequent_name)
|
def self.command_string(antecedent_name, consequent_name, id=nil)
|
||||||
|
if id
|
||||||
|
return "[ta:#{id}]"
|
||||||
|
end
|
||||||
|
|
||||||
"create alias [[#{antecedent_name}]] -> [[#{consequent_name}]]"
|
"create alias [[#{antecedent_name}]] -> [[#{consequent_name}]]"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -51,7 +55,7 @@ class TagAliasRequest
|
|||||||
ForumTopic.new(
|
ForumTopic.new(
|
||||||
:title => TagAliasRequest.topic_title(antecedent_name, consequent_name),
|
:title => TagAliasRequest.topic_title(antecedent_name, consequent_name),
|
||||||
:original_post_attributes => {
|
:original_post_attributes => {
|
||||||
:body => TagAliasRequest.command_string(antecedent_name, consequent_name) + "\n\n\"Link to alias\":/tag_aliases?search[id]=#{tag_alias_id}\n\n#{reason}"
|
:body => TagAliasRequest.command_string(antecedent_name, consequent_name, tag_alias_id) + "\n\nReason: #{reason}"
|
||||||
},
|
},
|
||||||
:category_id => 1
|
:category_id => 1
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ class TagImplicationRequest
|
|||||||
"Tag implication: #{antecedent_name} -> #{consequent_name}"
|
"Tag implication: #{antecedent_name} -> #{consequent_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.command_string(antecedent_name, consequent_name)
|
def self.command_string(antecedent_name, consequent_name, id=nil)
|
||||||
|
if id
|
||||||
|
return "[ti:#{id}]"
|
||||||
|
end
|
||||||
|
|
||||||
"create implication [[#{antecedent_name}]] -> [[#{consequent_name}]]"
|
"create implication [[#{antecedent_name}]] -> [[#{consequent_name}]]"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -51,7 +55,7 @@ class TagImplicationRequest
|
|||||||
ForumTopic.new(
|
ForumTopic.new(
|
||||||
:title => TagImplicationRequest.topic_title(antecedent_name, consequent_name),
|
:title => TagImplicationRequest.topic_title(antecedent_name, consequent_name),
|
||||||
:original_post_attributes => {
|
:original_post_attributes => {
|
||||||
:body => TagImplicationRequest.command_string(antecedent_name, consequent_name) + "\n\n\"Link to implication\":/tag_implications?search[id]=#{tag_implication_id}\n\n#{reason}"
|
:body => TagImplicationRequest.command_string(antecedent_name, consequent_name, tag_implication_id) + "\n\nReason: #{reason}"
|
||||||
},
|
},
|
||||||
:category_id => 1
|
:category_id => 1
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -90,7 +90,8 @@ class BulkUpdateRequest < ApplicationRecord
|
|||||||
ForumUpdater.new(
|
ForumUpdater.new(
|
||||||
forum_topic,
|
forum_topic,
|
||||||
forum_post: post,
|
forum_post: post,
|
||||||
expected_title: title
|
expected_title: title,
|
||||||
|
skip_update: !TagRelationship::SUPPORT_HARD_CODED
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -168,12 +169,20 @@ class BulkUpdateRequest < ApplicationRecord
|
|||||||
include ApprovalMethods
|
include ApprovalMethods
|
||||||
include ValidationMethods
|
include ValidationMethods
|
||||||
|
|
||||||
|
concerning :EmbeddedText do
|
||||||
|
class_methods do
|
||||||
|
def embedded_pattern
|
||||||
|
/\[bur:(?<id>\d+)\]/m
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def editable?(user)
|
def editable?(user)
|
||||||
user_id == user.id || user.is_builder?
|
user_id == user.id || user.is_builder?
|
||||||
end
|
end
|
||||||
|
|
||||||
def reason_with_link
|
def reason_with_link
|
||||||
"#{script_with_links}\n\n\"Link to request\":/bulk_update_requests?search[id]=#{id}\n\n#{reason}"
|
"[bur:#{id}]\n\nReason: #{reason}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def script_with_links
|
def script_with_links
|
||||||
|
|||||||
@@ -36,14 +36,15 @@ class TagAlias < TagRelationship
|
|||||||
def forum_updater
|
def forum_updater
|
||||||
@forum_updater ||= begin
|
@forum_updater ||= begin
|
||||||
post = if forum_topic
|
post = if forum_topic
|
||||||
forum_post || forum_topic.posts.where("body like ?", TagAliasRequest.command_string(antecedent_name, consequent_name) + "%").last
|
forum_post || forum_topic.posts.where("body like ?", TagAliasRequest.command_string(antecedent_name, consequent_name, id) + "%").last
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
ForumUpdater.new(
|
ForumUpdater.new(
|
||||||
forum_topic,
|
forum_topic,
|
||||||
forum_post: post,
|
forum_post: post,
|
||||||
expected_title: TagAliasRequest.topic_title(antecedent_name, consequent_name)
|
expected_title: TagAliasRequest.topic_title(antecedent_name, consequent_name),
|
||||||
|
skip_update: !TagRelationship::SUPPORT_HARD_CODED
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -53,6 +54,14 @@ class TagAlias < TagRelationship
|
|||||||
include ApprovalMethods
|
include ApprovalMethods
|
||||||
include ForumMethods
|
include ForumMethods
|
||||||
|
|
||||||
|
concerning :EmbeddedText do
|
||||||
|
class_methods do
|
||||||
|
def embedded_pattern
|
||||||
|
/\[ta:(?<id>\d+)\]/m
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.to_aliased(names)
|
def self.to_aliased(names)
|
||||||
Cache.get_multi(Array(names), "ta") do |tag|
|
Cache.get_multi(Array(names), "ta") do |tag|
|
||||||
ActiveRecord::Base.select_value_sql("select consequent_name from tag_aliases where status in ('active', 'processing') and antecedent_name = ?", tag) || tag.to_s
|
ActiveRecord::Base.select_value_sql("select consequent_name from tag_aliases where status in ('active', 'processing') and antecedent_name = ?", tag) || tag.to_s
|
||||||
|
|||||||
@@ -196,14 +196,15 @@ class TagImplication < TagRelationship
|
|||||||
|
|
||||||
def forum_updater
|
def forum_updater
|
||||||
post = if forum_topic
|
post = if forum_topic
|
||||||
forum_post || forum_topic.posts.where("body like ?", TagImplicationRequest.command_string(antecedent_name, consequent_name) + "%").last
|
forum_post || forum_topic.posts.where("body like ?", TagImplicationRequest.command_string(antecedent_name, consequent_name, id) + "%").last
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
ForumUpdater.new(
|
ForumUpdater.new(
|
||||||
forum_topic,
|
forum_topic,
|
||||||
forum_post: post,
|
forum_post: post,
|
||||||
expected_title: TagImplicationRequest.topic_title(antecedent_name, consequent_name)
|
expected_title: TagImplicationRequest.topic_title(antecedent_name, consequent_name),
|
||||||
|
skip_update: !TagRelationship::SUPPORT_HARD_CODED
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
memoize :forum_updater
|
memoize :forum_updater
|
||||||
@@ -214,6 +215,14 @@ class TagImplication < TagRelationship
|
|||||||
include ValidationMethods
|
include ValidationMethods
|
||||||
include ApprovalMethods
|
include ApprovalMethods
|
||||||
|
|
||||||
|
concerning :EmbeddedText do
|
||||||
|
class_methods do
|
||||||
|
def embedded_pattern
|
||||||
|
/\[ti:(?<id>\d+)\]/m
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def reload(options = {})
|
def reload(options = {})
|
||||||
flush_cache
|
flush_cache
|
||||||
super
|
super
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class TagRelationship < ApplicationRecord
|
class TagRelationship < ApplicationRecord
|
||||||
self.abstract_class = true
|
self.abstract_class = true
|
||||||
|
|
||||||
|
SUPPORT_HARD_CODED = true
|
||||||
EXPIRY = 60
|
EXPIRY = 60
|
||||||
EXPIRY_WARNING = 55
|
EXPIRY_WARNING = 55
|
||||||
|
|
||||||
@@ -54,6 +55,10 @@ class TagRelationship < ApplicationRecord
|
|||||||
status == "active"
|
status == "active"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def is_errored?
|
||||||
|
status =~ /\Aerror:/
|
||||||
|
end
|
||||||
|
|
||||||
def deletable_by?(user)
|
def deletable_by?(user)
|
||||||
return true if user.is_admin?
|
return true if user.is_admin?
|
||||||
return true if is_pending? && user.is_builder?
|
return true if is_pending? && user.is_builder?
|
||||||
@@ -173,6 +178,14 @@ class TagRelationship < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
concerning :EmbeddedText do
|
||||||
|
class_methods do
|
||||||
|
def embedded_pattern
|
||||||
|
raise NotImplementedError
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def antecedent_and_consequent_are_different
|
def antecedent_and_consequent_are_different
|
||||||
if antecedent_name == consequent_name
|
if antecedent_name == consequent_name
|
||||||
errors[:base] << "Cannot alias or implicate a tag to itself"
|
errors[:base] << "Cannot alias or implicate a tag to itself"
|
||||||
|
|||||||
@@ -7,16 +7,16 @@
|
|||||||
|
|
||||||
<div class="input">
|
<div class="input">
|
||||||
<label class="text optional" for="bulk_update_request_script">Script</label>
|
<label class="text optional" for="bulk_update_request_script">Script</label>
|
||||||
<pre class="hint">
|
|
||||||
Use the following format:
|
|
||||||
unalias aaa -> bbb
|
|
||||||
unimply aaa -> bbb
|
|
||||||
alias aaa -> bbb
|
|
||||||
imply aaa -> bbb
|
|
||||||
update aaa -> bbb
|
|
||||||
category tag_name -> category_name
|
|
||||||
</pre>
|
|
||||||
<%= text_area :bulk_update_request, :script, :size => "50x10" %>
|
<%= text_area :bulk_update_request, :script, :size => "50x10" %>
|
||||||
|
<p><a href="#" id="script-help-link">Help</a></p>
|
||||||
|
<ul class="hint" id="script-help" title="Bulk Update Request Help">
|
||||||
|
<li>unalias aaa -> bbb</li>
|
||||||
|
<li>unimply aaa -> bbb</li>
|
||||||
|
<li>alias aaa -> bbb</li>
|
||||||
|
<li>imply aaa -> bbb</li>
|
||||||
|
<li>update aaa -> bbb</li>
|
||||||
|
<li>category tag_name -> category_name</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @bulk_update_request.new_record? %>
|
<% if @bulk_update_request.new_record? %>
|
||||||
@@ -45,3 +45,15 @@ category tag_name -> category_name
|
|||||||
<%= f.button :submit, :value => "Submit" %>
|
<%= f.button :submit, :value => "Submit" %>
|
||||||
<%= dtext_preview_button "bulk_update_request", "reason" %>
|
<%= dtext_preview_button "bulk_update_request", "reason" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= content_for(:html_header) do %>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$("#script-help").hide();
|
||||||
|
$("#script-help-link").click(function() {
|
||||||
|
$("#script-help").dialog({width: "30em"});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<% end %>
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
<td><%= script_with_line_breaks(request.script) %></td>
|
<td><%= script_with_line_breaks(request.script) %></td>
|
||||||
<td id="request-status-for-<%= request.id %>"><%= request.status %></td>
|
<td id="request-status-for-<%= request.id %>"><%= request.status %></td>
|
||||||
<td>
|
<td>
|
||||||
|
<%= link_to "Show", bulk_update_request_path(request) %> |
|
||||||
<% if CurrentUser.is_admin? && request.status == "pending" %>
|
<% if CurrentUser.is_admin? && request.status == "pending" %>
|
||||||
<%= link_to "Approve", approve_bulk_update_request_path(request), :remote => true, :method => :post %> |
|
<%= link_to "Approve", approve_bulk_update_request_path(request), :remote => true, :method => :post %> |
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
29
app/views/bulk_update_requests/show.html.erb
Normal file
29
app/views/bulk_update_requests/show.html.erb
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<div id="c-bulk-update-requests">
|
||||||
|
<div id="a-show">
|
||||||
|
<h1>Bulk Update Request: <%= @bulk_update_request.title %></h1>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% if @bulk_update_request.forum_topic_id %>
|
||||||
|
<li><strong>Reference</strong> <%= link_to "topic ##{@bulk_update_request.forum_topic_id}", forum_topic_path(@bulk_update_request.forum_topic_id) %></li>
|
||||||
|
<% end %>
|
||||||
|
<li><strong>Creator</strong> <%= link_to_user @bulk_update_request.user %></li>
|
||||||
|
<li><strong>Date</strong> <%= @bulk_update_request.created_at %></li>
|
||||||
|
<li><strong>Status</strong>: <%= @bulk_update_request.status %></li>
|
||||||
|
|
||||||
|
<% if CurrentUser.is_admin? && @bulk_update_request.is_pending? %>
|
||||||
|
<li><strong>Commands</strong> <%= link_to "Approve", approve_bulk_update_request_path(@bulk_update_request), :method => :post %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div style="margin: 1em 0;">
|
||||||
|
<h2>Script</h2>
|
||||||
|
<pre><%= format_text @bulk_update_request.script_with_links %></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= render "secondary_links" %>
|
||||||
|
|
||||||
|
<% content_for(:page_title) do %>
|
||||||
|
Bulk Update Request - <%= Danbooru.config.app_name %>
|
||||||
|
<% end %>
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="prose">
|
<div class="prose">
|
||||||
<%= format_text(forum_post.body) %>
|
<%= format_text(parse_embedded_tag_request_text(forum_post.body)) %>
|
||||||
</div>
|
</div>
|
||||||
<%= render "update_notice", record: forum_post %>
|
<%= render "update_notice", record: forum_post %>
|
||||||
<menu>
|
<menu>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<%= subnav_link_to "New", new_forum_topic_path %>
|
<%= subnav_link_to "New", new_forum_topic_path %>
|
||||||
<%= subnav_link_to "Request alias", new_tag_alias_request_path %>
|
<%= subnav_link_to "Request alias", new_tag_alias_request_path %>
|
||||||
<%= subnav_link_to "Request implication", new_tag_implication_request_path %>
|
<%= subnav_link_to "Request implication", new_tag_implication_request_path %>
|
||||||
|
<%= subnav_link_to "Request BUR", new_bulk_update_request_path %>
|
||||||
<%= subnav_link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post, :"data-shortcut" => "shift+r" %>
|
<%= subnav_link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post, :"data-shortcut" => "shift+r" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,11 @@
|
|||||||
<% if @tag_alias.respond_to?(:reason) && @tag_alias.reason.present? %>
|
<% if @tag_alias.respond_to?(:reason) && @tag_alias.reason.present? %>
|
||||||
<li><strong>Reason</strong> <%= format_text @tag_alias.reason %></li>
|
<li><strong>Reason</strong> <%= format_text @tag_alias.reason %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<li><strong>Status</strong>: <%= @tag_alias.status %></li>
|
||||||
|
|
||||||
|
<% if CurrentUser.is_admin? && @tag_alias.is_pending? %>
|
||||||
|
<li><strong>Commands</strong> <%= link_to "Approve", approve_tag_alias_path(@tag_alias), :method => :post %></li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,6 +13,11 @@
|
|||||||
<% if @tag_implication.respond_to?(:reason) && @tag_implication.reason.present? %>
|
<% if @tag_implication.respond_to?(:reason) && @tag_implication.reason.present? %>
|
||||||
<li><strong>Reason</strong> <%= format_text @tag_implication.reason %></li>
|
<li><strong>Reason</strong> <%= format_text @tag_implication.reason %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<li><strong>Status</strong>: <%= @tag_implication.status %></li>
|
||||||
|
|
||||||
|
<% if CurrentUser.is_admin? && @tag_implication.is_pending? %>
|
||||||
|
<li><strong>Commands</strong> <%= link_to "Approve", approve_tag_implication_path(@tag_implication), :method => :post %></li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ class TagAliasTest < ActiveSupport::TestCase
|
|||||||
CurrentUser.scoped(@admin) do
|
CurrentUser.scoped(@admin) do
|
||||||
@topic = FactoryBot.create(:forum_topic, :title => TagAliasRequest.topic_title("aaa", "bbb"))
|
@topic = FactoryBot.create(:forum_topic, :title => TagAliasRequest.topic_title("aaa", "bbb"))
|
||||||
@post = FactoryBot.create(:forum_post, :topic_id => @topic.id, :body => TagAliasRequest.command_string("aaa", "bbb"))
|
@post = FactoryBot.create(:forum_post, :topic_id => @topic.id, :body => TagAliasRequest.command_string("aaa", "bbb"))
|
||||||
@alias = FactoryBot.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb", :forum_topic => @topic, :status => "pending")
|
@alias = FactoryBot.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb", :forum_topic => @topic, :forum_post => @post, :status => "pending")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ class TagImplicationTest < ActiveSupport::TestCase
|
|||||||
@admin = FactoryBot.create(:admin_user)
|
@admin = FactoryBot.create(:admin_user)
|
||||||
@topic = FactoryBot.create(:forum_topic, :title => TagImplicationRequest.topic_title("aaa", "bbb"))
|
@topic = FactoryBot.create(:forum_topic, :title => TagImplicationRequest.topic_title("aaa", "bbb"))
|
||||||
@post = FactoryBot.create(:forum_post, topic_id: @topic.id, :body => TagImplicationRequest.command_string("aaa", "bbb"))
|
@post = FactoryBot.create(:forum_post, topic_id: @topic.id, :body => TagImplicationRequest.command_string("aaa", "bbb"))
|
||||||
@implication = FactoryBot.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "bbb", :forum_topic => @topic, :status => "pending")
|
@implication = FactoryBot.create(:tag_implication, :antecedent_name => "aaa", :consequent_name => "bbb", :forum_topic => @topic, :forum_post => @post, :status => "pending")
|
||||||
end
|
end
|
||||||
|
|
||||||
should "update the topic when processed" do
|
should "update the topic when processed" do
|
||||||
|
|||||||
Reference in New Issue
Block a user