From 360116c80dc8716566fee63f83c04580cdc9545d Mon Sep 17 00:00:00 2001
From: Arnaud Levy <contact@arnaudlevy.com>
Date: Thu, 14 Sep 2023 12:19:42 +0200
Subject: [PATCH] tiktok

---
 app/controllers/admin/communication/websites_controller.rb   | 2 +-
 app/models/communication/website.rb                          | 1 +
 app/models/communication/website/configs/base.rb             | 1 +
 .../communication/website/configs/default_languages.rb       | 1 +
 .../communication/website/configs/default_permalinks.rb      | 1 +
 .../communication/website/configs/development_config.rb      | 1 +
 .../communication/website/configs/production_config.rb       | 1 +
 app/views/admin/communication/websites/_form.html.erb        | 1 +
 app/views/admin/communication/websites/static.html.erb       | 2 +-
 config/locales/communication/en.yml                          | 1 +
 config/locales/communication/fr.yml                          | 1 +
 .../20230914101635_add_tiktok_to_communication_websites.rb   | 5 +++++
 db/schema.rb                                                 | 3 ++-
 test/fixtures/communication/websites.yml                     | 1 +
 14 files changed, 19 insertions(+), 3 deletions(-)
 create mode 100644 db/migrate/20230914101635_add_tiktok_to_communication_websites.rb

diff --git a/app/controllers/admin/communication/websites_controller.rb b/app/controllers/admin/communication/websites_controller.rb
index d19a50c95..796e19783 100644
--- a/app/controllers/admin/communication/websites_controller.rb
+++ b/app/controllers/admin/communication/websites_controller.rb
@@ -89,7 +89,7 @@ class Admin::Communication::WebsitesController < Admin::Communication::Websites:
       :name, :url, :repository, :about_type, :about_id, :in_production,
       :git_provider, :git_endpoint, :git_branch, :plausible_url, 
       :feature_posts, :feature_agenda,
-      :social_mastodon, :social_x, :social_linkedin, :social_youtube, :social_vimeo, :social_peertube, :social_instagram, :social_facebook,
+      :social_mastodon, :social_x, :social_linkedin, :social_youtube, :social_vimeo, :social_peertube, :social_instagram, :social_facebook, :social_tiktok,
       :deployment_status_badge, :autoupdate_theme, language_ids: []
     ]
     attribute_names << :access_token unless params[:communication_website][:access_token].blank?
diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb
index cc5ab95cf..8ba01a97b 100644
--- a/app/models/communication/website.rb
+++ b/app/models/communication/website.rb
@@ -21,6 +21,7 @@
 #  social_linkedin         :string
 #  social_mastodon         :string
 #  social_peertube         :string
+#  social_tiktok           :string
 #  social_vimeo            :string
 #  social_x                :string
 #  social_youtube          :string
diff --git a/app/models/communication/website/configs/base.rb b/app/models/communication/website/configs/base.rb
index d0e38d1b8..9b7fa604c 100644
--- a/app/models/communication/website/configs/base.rb
+++ b/app/models/communication/website/configs/base.rb
@@ -21,6 +21,7 @@
 #  social_linkedin         :string
 #  social_mastodon         :string
 #  social_peertube         :string
+#  social_tiktok           :string
 #  social_vimeo            :string
 #  social_x                :string
 #  social_youtube          :string
diff --git a/app/models/communication/website/configs/default_languages.rb b/app/models/communication/website/configs/default_languages.rb
index fb7e5ecfe..47d7ec2ed 100644
--- a/app/models/communication/website/configs/default_languages.rb
+++ b/app/models/communication/website/configs/default_languages.rb
@@ -21,6 +21,7 @@
 #  social_linkedin         :string
 #  social_mastodon         :string
 #  social_peertube         :string
+#  social_tiktok           :string
 #  social_vimeo            :string
 #  social_x                :string
 #  social_youtube          :string
diff --git a/app/models/communication/website/configs/default_permalinks.rb b/app/models/communication/website/configs/default_permalinks.rb
index e02be68d9..20b02d549 100644
--- a/app/models/communication/website/configs/default_permalinks.rb
+++ b/app/models/communication/website/configs/default_permalinks.rb
@@ -21,6 +21,7 @@
 #  social_linkedin         :string
 #  social_mastodon         :string
 #  social_peertube         :string
+#  social_tiktok           :string
 #  social_vimeo            :string
 #  social_x                :string
 #  social_youtube          :string
diff --git a/app/models/communication/website/configs/development_config.rb b/app/models/communication/website/configs/development_config.rb
index 23456e16c..25cdeed1b 100644
--- a/app/models/communication/website/configs/development_config.rb
+++ b/app/models/communication/website/configs/development_config.rb
@@ -21,6 +21,7 @@
 #  social_linkedin         :string
 #  social_mastodon         :string
 #  social_peertube         :string
+#  social_tiktok           :string
 #  social_vimeo            :string
 #  social_x                :string
 #  social_youtube          :string
diff --git a/app/models/communication/website/configs/production_config.rb b/app/models/communication/website/configs/production_config.rb
index ba78f3b54..8f3a51424 100644
--- a/app/models/communication/website/configs/production_config.rb
+++ b/app/models/communication/website/configs/production_config.rb
@@ -21,6 +21,7 @@
 #  social_linkedin         :string
 #  social_mastodon         :string
 #  social_peertube         :string
+#  social_tiktok           :string
 #  social_vimeo            :string
 #  social_x                :string
 #  social_youtube          :string
diff --git a/app/views/admin/communication/websites/_form.html.erb b/app/views/admin/communication/websites/_form.html.erb
index 8504f11ed..b984f5fa7 100644
--- a/app/views/admin/communication/websites/_form.html.erb
+++ b/app/views/admin/communication/websites/_form.html.erb
@@ -58,6 +58,7 @@
         <%= f.input :social_vimeo %>
         <%= f.input :social_instagram %>
         <%= f.input :social_facebook %>
+        <%= f.input :social_tiktok %>
       <% end %>
     </div>
   </div>
diff --git a/app/views/admin/communication/websites/static.html.erb b/app/views/admin/communication/websites/static.html.erb
index b1a221700..dfa54600c 100644
--- a/app/views/admin/communication/websites/static.html.erb
+++ b/app/views/admin/communication/websites/static.html.erb
@@ -6,7 +6,7 @@ external_domains:
 <% end %>
 social:
 <% 
-[:mastodon, :peertube, :x, :linkedin, :youtube, :vimeo, :instagram, :facebook].each do |network| 
+[:mastodon, :peertube, :x, :linkedin, :youtube, :vimeo, :instagram, :facebook, :tiktok].each do |network| 
   value = @website.send "social_#{network}"
   next if value.blank?
 %>
diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml
index ff65e7fb0..c56658451 100644
--- a/config/locales/communication/en.yml
+++ b/config/locales/communication/en.yml
@@ -155,6 +155,7 @@ en:
         social_linkedin: "LinkedIn (private, belongs to Microsoft)"
         social_mastodon: Mastodon (free)
         social_peertube: Peertube (free)
+        social_tiktok: "TikTok (private)"
         social_vimeo: "Vimeo (private)"
         social_x: "X, ex-Twitter (private)"
         social_youtube: "Youtube (private, belongs to Google)"
diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml
index 6bebc525b..58b5c9cdf 100644
--- a/config/locales/communication/fr.yml
+++ b/config/locales/communication/fr.yml
@@ -155,6 +155,7 @@ fr:
         social_linkedin: "LinkedIn (privatif, appartient à Microsoft)"
         social_mastodon: Mastodon (libre)
         social_peertube: Peertube (libre)
+        social_tiktok: "TikTok (privatif)"
         social_vimeo: "Vimeo (privatif)"
         social_x: "X, ex-Twitter (privatif)"
         social_youtube: "Youtube (privatif, appartient à Google)"
diff --git a/db/migrate/20230914101635_add_tiktok_to_communication_websites.rb b/db/migrate/20230914101635_add_tiktok_to_communication_websites.rb
new file mode 100644
index 000000000..a3cbdaab5
--- /dev/null
+++ b/db/migrate/20230914101635_add_tiktok_to_communication_websites.rb
@@ -0,0 +1,5 @@
+class AddTiktokToCommunicationWebsites < ActiveRecord::Migration[7.0]
+  def change
+    add_column :communication_websites, :social_tiktok, :string
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index efca9222d..3e8dc7af3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema[7.0].define(version: 2023_09_13_130910) do
+ActiveRecord::Schema[7.0].define(version: 2023_09_14_101635) do
   # These are extensions that must be enabled in order to support this database
   enable_extension "pgcrypto"
   enable_extension "plpgsql"
@@ -558,6 +558,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_13_130910) do
     t.string "social_peertube"
     t.string "social_instagram"
     t.string "social_facebook"
+    t.string "social_tiktok"
     t.index ["about_type", "about_id"], name: "index_communication_websites_on_about"
     t.index ["default_language_id"], name: "index_communication_websites_on_default_language_id"
     t.index ["university_id"], name: "index_communication_websites_on_university_id"
diff --git a/test/fixtures/communication/websites.yml b/test/fixtures/communication/websites.yml
index 423109ff0..e4a7fe2de 100644
--- a/test/fixtures/communication/websites.yml
+++ b/test/fixtures/communication/websites.yml
@@ -21,6 +21,7 @@
 #  social_linkedin         :string
 #  social_mastodon         :string
 #  social_peertube         :string
+#  social_tiktok           :string
 #  social_vimeo            :string
 #  social_x                :string
 #  social_youtube          :string
-- 
GitLab