Преглед на файлове

fix minor app form bugs

Kylie Jo Swistak преди 5 години
родител
ревизия
b8f3072314

+ 1 - 1
app/app_forms/char_reject.rb

@@ -7,7 +7,7 @@ class CharacerRejection < ApplicationForm
       app = event.message.embeds.first
       reactions = event.message.reactions
 
-      if reactions[Emoji::CHECK].count.to_i > 1
+      if reactions[Emoji::CHECK]&.count.to_i > 1
         # Find user and create embed
         user = event.server.member(UID.match(app.description)[1])
         embed = rejected_app(event, :character)

+ 3 - 3
app/app_forms/image_app.rb

@@ -7,9 +7,9 @@ class ImageApplication < ApplicationForm
       maj = majority(event)
 
       reactions = event.message.reactions
-      if reactions[Emoji::Y].count.to_i > maj && star(event)
+      if reactions[Emoji::Y]&.count.to_i > maj && star(event)
         approve(event)
-      elsif reactions[Emoji::N].count.to_i > maj
+      elsif reactions[Emoji::N]&.count.to_i > maj
         deny(event)
       elsif reactions[Emoji::CROSS]&.count.to_i > 1
         remove(event)
@@ -50,7 +50,7 @@ class ImageApplication < ApplicationForm
     # Create App Rejection
     reply = BotResponse.new(
       embed: reject_app(event.message.embeds.first, :image),
-      reactions: ImgApp::REJECT_MESSAGES.map{ |k,v| k }
+      reactions: ImgApp::REJECT_MESSAGES.map{ |k,v| k }.push(Emoji::CHECK)
     )
 
     # Delete app, and reply

+ 1 - 1
app/app_forms/item_app.rb

@@ -41,7 +41,7 @@ class ItemApplication < ApplicationForm
   def self.deny(event)
     reply = BotResponse.new(
       embed: reject_app(event.message.embeds.first, :item),
-      reactions: ItemApp::REJECT_MESSAGES.map{ |k,v| k }
+      reactions: ItemApp::REJECT_MESSAGES.map{ |k,v| k }.push(Emoji::CHECK)
     )
 
     # Delete message and reply

+ 1 - 1
app/app_forms/item_reject.rb

@@ -7,7 +7,7 @@ class ItemRejection < ApplicationForm
       app = event.message.embeds.first
       reactions = event.message.reactions
 
-      if reactions[Emoji::CHECK].count.to_i > 1
+      if reactions[Emoji::CHECK]&.count.to_i > 1
         # Find user and create embed
         user = event.server.member(UID.match(app.description)[1])
         embed = rejected_app(event, :item)

+ 1 - 1
app/app_forms/landmark_app.rb

@@ -41,7 +41,7 @@ class LandmarkApplication < ApplicationForm
   def self.deny(event)
     reply = BotResponse.new(
       embed: reject_app(event.message.embeds.first, :landmark),
-      reactions: LmApp::REJECT_MESSAGES.map{ |k,v| k }
+      reactions: LmApp::REJECT_MESSAGES.map{ |k,v| k }.push(Emoji::CHECK)
     )
 
     # Delete message and reply

+ 1 - 1
app/app_forms/landmark_reject.rb

@@ -7,7 +7,7 @@ class LandmarkRejection < ApplicationForm
       app = event.message.embeds.first
       reactions = event.message.reactions
 
-      if reactions[Emoji::CHECK].count.to_i > 1
+      if reactions[Emoji::CHECK]&.count.to_i > 1
         # Find user and create embed
         user = event.server.member(UID.match(app.description)[1])
         embed = rejected_app(event, :landmark)

+ 3 - 3
app/app_forms/reactivate_app.rb

@@ -10,9 +10,9 @@ class ReactivationApplication < ApplicationForm
       reactions = event.message.reactions
       if reactions[Emoji::Y]&.count.to_i > maj && star(event)
         approve(event)
-      elsif reactions[Emoji::N]&count.to_i > maj
+      elsif reactions[Emoji::N]&.count.to_i > maj
         deny(event)
-      elsif reactions[Emoji::CRAYON]&count.to_i > maj
+      elsif reactions[Emoji::CRAYON]&.count.to_i > maj
         edit(event)
       elsif reactions[Emoji::CROSS]&.count.to_i > 1
         remove(event)
@@ -55,7 +55,7 @@ class ReactivationApplication < ApplicationForm
     # Create App Rejection
     reply = BotResponse.new(
       embed: reject_app(event.message.embeds.first, :reactivation),
-      reactions: CharApp::REJECT_MESSAGES.map{ |k,v| k }
+      reactions: CharApp::REJECT_MESSAGES.map{ |k,v| k }.push(Emoji::CHECK)
     )
 
     # Delete app, and reply

+ 1 - 1
app/embeds/reject.rb

@@ -3,7 +3,7 @@ FTR = "If you have any questions, feel free to ask a Guildmaster"
 
 def reject_app(app, opts)
   embed = Embed.new(
-    title: app.title,
+    title: app.fields[1].value || 'Unknown Character',
     description: app.description,
     color: ERROR,
     author: {