Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' into french-translation
- Loading branch information
Showing
96 changed files
with
2,819 additions
and
473 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
class Alert < ApplicationRecord | ||
belongs_to :device | ||
PROBLEM_TAGS = [ | ||
SEED_DATA = "api.seed_data.missing", | ||
TOUR = "api.tour.not_taken", | ||
USER = "api.user.not_welcomed", | ||
DOCUMENTATION = "api.documentation.unread", | ||
BULLETIN = "api.bulletin.unread" | ||
DEFAULTS = [ | ||
SEED_DATA = { problem_tag: "api.seed_data.missing", priority: 400 }, | ||
DOCUMENTATION = { problem_tag: "api.documentation.unread", priority: 300 }, | ||
TOUR = { problem_tag: "api.tour.not_taken", priority: 200 }, | ||
USER = { problem_tag: "api.user.not_welcomed", priority: 100 }, | ||
] | ||
|
||
PROBLEM_TAGS = DEFAULTS.map { |x| x.fetch(:problem_tag) } | ||
|
||
validates_inclusion_of :problem_tag, in: PROBLEM_TAGS | ||
end |
This file contains 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 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 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 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 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 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 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 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 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,35 @@ | ||
module Devices | ||
class Reset < Mutations::Command | ||
include Users::PasswordHelpers | ||
|
||
required do | ||
model :device | ||
string :password | ||
end | ||
|
||
def validate | ||
confirm_password(user, password) | ||
end | ||
|
||
def execute | ||
self.delay.run_it | ||
{ ok: "OK" } | ||
end | ||
|
||
private | ||
|
||
def run_it | ||
Device::SINGULAR_RESOURCES.keys.map do |resource| | ||
device.send(resource).destroy! | ||
end | ||
|
||
Device::PLURAL_RESOURCES.map do |resources| | ||
device.send(resources).destroy_all | ||
end | ||
end | ||
|
||
def user | ||
@user ||= User.find_by!(device: device) | ||
end | ||
end | ||
end |
Oops, something went wrong.