summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/api/files.rb2
-rw-r--r--lib/award_emoji.rb53
-rw-r--r--lib/gitlab/visibility_level.rb9
3 files changed, 27 insertions, 37 deletions
diff --git a/lib/api/files.rb b/lib/api/files.rb
index a7a768f8895..8ad2c1883c7 100644
--- a/lib/api/files.rb
+++ b/lib/api/files.rb
@@ -7,7 +7,7 @@ module API
def commit_params(attrs)
{
file_path: attrs[:file_path],
- current_branch: attrs[:branch_name],
+ source_branch: attrs[:branch_name],
target_branch: attrs[:branch_name],
commit_message: attrs[:commit_message],
file_content: attrs[:content],
diff --git a/lib/award_emoji.rb b/lib/award_emoji.rb
index 3825f4650be..783fcfb61ad 100644
--- a/lib/award_emoji.rb
+++ b/lib/award_emoji.rb
@@ -1,35 +1,4 @@
class AwardEmoji
- ALIASES = {
- pout: "rage",
- satisfied: "laughing",
- hankey: "shit",
- poop: "shit",
- collision: "boom",
- thumbsup: "+1",
- thumbsdown: "-1",
- punch: "facepunch",
- raised_hand: "hand",
- running: "runner",
- ng_woman: "no_good",
- shoe: "mans_shoe",
- tshirt: "shirt",
- honeybee: "bee",
- flipper: "dolphin",
- paw_prints: "feet",
- waxing_gibbous_moon: "moon",
- telephone: "phone",
- knife: "hocho",
- envelope: "email",
- pencil: "memo",
- open_book: "book",
- sailboat: "boat",
- red_car: "car",
- lantern: "izakaya_lantern",
- uk: "gb",
- heavy_exclamation_mark: "exclamation",
- squirrel: "shipit"
- }.with_indifferent_access
-
CATEGORIES = {
other: "Other",
objects: "Objects",
@@ -46,17 +15,15 @@ class AwardEmoji
}.with_indifferent_access
def self.normilize_emoji_name(name)
- ALIASES[name] || name
+ aliases[name] || name
end
def self.emoji_by_category
unless @emoji_by_category
@emoji_by_category = {}
- emojis_added = []
- Emoji.emojis.each do |emoji_name, data|
- next if emojis_added.include?(data["name"])
- emojis_added << data["name"]
+ emojis.each do |emoji_name, data|
+ data["name"] = emoji_name
@emoji_by_category[data["category"]] ||= []
@emoji_by_category[data["category"]] << data
@@ -67,4 +34,18 @@ class AwardEmoji
@emoji_by_category
end
+
+ def self.emojis
+ @emojis ||= begin
+ json_path = File.join(Rails.root, 'fixtures', 'emojis', 'index.json' )
+ JSON.parse(File.read(json_path))
+ end
+ end
+
+ def self.aliases
+ @aliases ||= begin
+ json_path = File.join(Rails.root, 'fixtures', 'emojis', 'aliases.json' )
+ JSON.parse(File.read(json_path))
+ end
+ end
end
diff --git a/lib/gitlab/visibility_level.rb b/lib/gitlab/visibility_level.rb
index 335dc44be19..3160a3c7582 100644
--- a/lib/gitlab/visibility_level.rb
+++ b/lib/gitlab/visibility_level.rb
@@ -51,6 +51,15 @@ module Gitlab
def allowed_fork_levels(origin_level)
[PRIVATE, INTERNAL, PUBLIC].select{ |level| level <= origin_level }
end
+
+ def level_name(level)
+ level_name = 'Unknown'
+ options.each do |name, lvl|
+ level_name = name if lvl == level.to_i
+ end
+
+ level_name
+ end
end
def private?