about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorDavid Yip <yipdw@member.fsf.org>2018-03-19 15:41:59 -0500
committerDavid Yip <yipdw@member.fsf.org>2018-03-19 15:41:59 -0500
commit0fa0836e63674104cea5095c5336bab8587d8634 (patch)
treebcafd10ffe52f32b95c470c59bdb83309a0f6ce9 /app
parentc074b226b68d81b0503f935dc81b74cd11b11d67 (diff)
parentdf70571bfe8aa18cfb44661fb02cc1e2e256c4e8 (diff)
Merge remote-tracking branch 'personal/merge/tootsuite/master' into gs-master
Diffstat (limited to 'app')
-rw-r--r--app/javascript/mastodon/locales/ar.json10
-rw-r--r--app/javascript/mastodon/locales/fi.json20
-rw-r--r--app/javascript/mastodon/locales/sk.json38
-rw-r--r--app/javascript/mastodon/locales/sv.json12
-rw-r--r--app/lib/ostatus/atom_serializer.rb2
-rw-r--r--app/models/user.rb32
-rw-r--r--app/serializers/activitypub/note_serializer.rb2
-rw-r--r--app/serializers/rest/status_serializer.rb6
-rw-r--r--app/views/notification_mailer/_status.html.haml5
-rw-r--r--app/views/notification_mailer/_status.text.erb5
-rw-r--r--app/views/user_mailer/email_changed.html.haml2
-rw-r--r--app/views/user_mailer/email_changed.text.erb2
12 files changed, 76 insertions, 60 deletions
diff --git a/app/javascript/mastodon/locales/ar.json b/app/javascript/mastodon/locales/ar.json
index 4928930fe..73680a1a1 100644
--- a/app/javascript/mastodon/locales/ar.json
+++ b/app/javascript/mastodon/locales/ar.json
@@ -60,10 +60,10 @@
   "compose_form.placeholder": "فيمَ تفكّر؟",
   "compose_form.publish": "بوّق",
   "compose_form.publish_loud": "{publish}!",
-  "compose_form.sensitive.marked": "Media is marked as sensitive",
+  "compose_form.sensitive.marked": "لقد تم تحديد هذه الصورة كحساسة",
   "compose_form.sensitive.unmarked": "Media is not marked as sensitive",
-  "compose_form.spoiler.marked": "Text is hidden behind warning",
-  "compose_form.spoiler.unmarked": "Text is not hidden",
+  "compose_form.spoiler.marked": "إنّ النص مخفي وراء تحذير",
+  "compose_form.spoiler.unmarked": "النص غير مخفي",
   "compose_form.spoiler_placeholder": "تنبيه عن المحتوى",
   "confirmation_modal.cancel": "إلغاء",
   "confirmations.block.confirm": "حجب",
@@ -254,9 +254,9 @@
   "status.sensitive_warning": "محتوى حساس",
   "status.share": "مشاركة",
   "status.show_less": "إعرض أقلّ",
-  "status.show_less_all": "Show less for all",
+  "status.show_less_all": "طي الكل",
   "status.show_more": "أظهر المزيد",
-  "status.show_more_all": "Show more for all",
+  "status.show_more_all": "توسيع الكل",
   "status.unmute_conversation": "فك الكتم عن المحادثة",
   "status.unpin": "فك التدبيس من الملف الشخصي",
   "tabs_bar.federated_timeline": "الموحَّد",
diff --git a/app/javascript/mastodon/locales/fi.json b/app/javascript/mastodon/locales/fi.json
index 1dea42ed4..1741445ed 100644
--- a/app/javascript/mastodon/locales/fi.json
+++ b/app/javascript/mastodon/locales/fi.json
@@ -3,7 +3,7 @@
   "account.block_domain": "Piilota kaikki sisältö verkkotunnuksesta {domain}",
   "account.blocked": "Estetty",
   "account.disclaimer_full": "Alla olevat käyttäjän profiilitiedot saattavat olla epätäydellisiä.",
-  "account.domain_blocked": "Domain hidden",
+  "account.domain_blocked": "Verkko-osoite piilotettu",
   "account.edit_profile": "Muokkaa",
   "account.follow": "Seuraa",
   "account.followers": "Seuraajia",
@@ -60,10 +60,10 @@
   "compose_form.placeholder": "Mitä sinulla on mielessä?",
   "compose_form.publish": "Toot",
   "compose_form.publish_loud": "{publish}!",
-  "compose_form.sensitive.marked": "Media is marked as sensitive",
-  "compose_form.sensitive.unmarked": "Media is not marked as sensitive",
-  "compose_form.spoiler.marked": "Text is hidden behind warning",
-  "compose_form.spoiler.unmarked": "Text is not hidden",
+  "compose_form.sensitive.marked": "Media on merkitty arkaluontoiseksi",
+  "compose_form.sensitive.unmarked": "Mediaa ei ole merkitty arkaluontoiseksi",
+  "compose_form.spoiler.marked": "Teksti on piilotettu varoituksen taakse",
+  "compose_form.spoiler.unmarked": "Teksti ei ole piilotettu",
   "compose_form.spoiler_placeholder": "Content warning",
   "confirmation_modal.cancel": "Peruuta",
   "confirmations.block.confirm": "Estä",
@@ -182,13 +182,13 @@
   "onboarding.page_four.notifications": "Ilmoitukset-sarake näyttää sinulle, kun joku on viestii kanssasi.",
   "onboarding.page_one.federation": "Mastodon on yhteisöpalvelu, joka toimii monen itsenäisen palvelimen muodostamassa verkossa. Me kutsumme näitä palvelimia instansseiksi.",
   "onboarding.page_one.full_handle": "Koko käyttäjänimesi",
-  "onboarding.page_one.handle_hint": "This is what you would tell your friends to search for.",
+  "onboarding.page_one.handle_hint": "Tämä on se, mitä voisit ehdottaa ystäviäsi etsimään.",
   "onboarding.page_one.welcome": "Tervetuloa Mastodoniin!",
   "onboarding.page_six.admin": "Instanssisi ylläpitäjä on {admin}.",
   "onboarding.page_six.almost_done": "Melkein valmista...",
   "onboarding.page_six.appetoot": "Bon Appetööt!",
   "onboarding.page_six.apps_available": "{apps} on saatavilla iOS:lle, Androidille ja muille alustoille.",
-  "onboarding.page_six.github": "Mastodon is free open-source software. You can report bugs, request features, or contribute to the code on {github}.",
+  "onboarding.page_six.github": "Mastodon on ilmainen, vapaan lähdekoodin ohjelma. Voit raportoida bugeja, pyytää ominaisuuksia tai osallistua kehittämiseen GitHub-palvelussa: {github}.",
   "onboarding.page_six.guidelines": "yhteisön säännöt",
   "onboarding.page_six.read_guidelines": "Ole hyvä ja lue {domain}:n {guidelines}!",
   "onboarding.page_six.various_app": "mobiilisovellukset",
@@ -254,12 +254,12 @@
   "status.sensitive_warning": "Arkaluontoista sisältöä",
   "status.share": "Jaa",
   "status.show_less": "Näytä vähemmän",
-  "status.show_less_all": "Show less for all",
+  "status.show_less_all": "Näytä vähemmän kaikista",
   "status.show_more": "Näytä lisää",
-  "status.show_more_all": "Show more for all",
+  "status.show_more_all": "Näytä enemmän kaikista",
   "status.unmute_conversation": "Poista mykistys keskustelulta",
   "status.unpin": "Irrota profiilista",
-  "tabs_bar.federated_timeline": "Federated",
+  "tabs_bar.federated_timeline": "Yleinen",
   "tabs_bar.home": "Koti",
   "tabs_bar.local_timeline": "Paikallinen",
   "tabs_bar.notifications": "Ilmoitukset",
diff --git a/app/javascript/mastodon/locales/sk.json b/app/javascript/mastodon/locales/sk.json
index 2cb249d2a..683f2aadb 100644
--- a/app/javascript/mastodon/locales/sk.json
+++ b/app/javascript/mastodon/locales/sk.json
@@ -18,7 +18,7 @@
   "account.muted": "Utíšený/á",
   "account.posts": "Hlášky",
   "account.posts_with_replies": "Príspevky s odpoveďami",
-  "account.report": "Nahlásiť @{name}",
+  "account.report": "Nahlás @{name}",
   "account.requested": "Čaká na schválenie. Kliknite pre zrušenie žiadosti",
   "account.share": "Zdieľať @{name} profil",
   "account.show_reblogs": "Zobraziť povýšenia od @{name}",
@@ -35,13 +35,13 @@
   "bundle_modal_error.close": "Zatvoriť",
   "bundle_modal_error.message": "Nastala chyba pri načítaní tohto komponentu.",
   "bundle_modal_error.retry": "Skúsiť znova",
-  "column.blocks": "Blokovaní používatelia",
+  "column.blocks": "Blokovaní užívatelia",
   "column.community": "Lokálna časová os",
   "column.favourites": "Obľúbené",
   "column.follow_requests": "Žiadosti o sledovaní",
   "column.home": "Domov",
   "column.lists": "Zoznamy",
-  "column.mutes": "Ignorovaní používatelia",
+  "column.mutes": "Ignorovaní užívatelia",
   "column.notifications": "Notifikácie",
   "column.pins": "Pripnuté toots",
   "column.public": "Federovaná časová os",
@@ -50,20 +50,20 @@
   "column_header.moveLeft_settings": "Presunúť stĺpec doľava",
   "column_header.moveRight_settings": "Presunúť stĺpec doprava",
   "column_header.pin": "Pripnúť",
-  "column_header.show_settings": "Ukázať nastavenia",
+  "column_header.show_settings": "Ukáž nastavenia",
   "column_header.unpin": "Odopnúť",
   "column_subheading.navigation": "Navigácia",
   "column_subheading.settings": "Nastavenia",
-  "compose_form.hashtag_warning": "Tento toot nebude zobrazený pod žiadným haštagom lebo nieje listovaný. Iba verejné toots môžu byť nájdené podľa haštagu.",
+  "compose_form.hashtag_warning": "Tento toot nebude zobrazený pod žiadným haštagom lebo nieje listovaný. Iba verejné tooty môžu byť nájdené podľa haštagu.",
   "compose_form.lock_disclaimer": "Váš účet nie je zamknutý. Ktokoľvek ťa môže nasledovať a vidieť tvoje správy pre sledujúcich.",
   "compose_form.lock_disclaimer.lock": "zamknutý",
   "compose_form.placeholder": "Na čo myslíš?",
   "compose_form.publish": "Toot",
   "compose_form.publish_loud": "{publish}!",
-  "compose_form.sensitive.marked": "Media is marked as sensitive",
-  "compose_form.sensitive.unmarked": "Media is not marked as sensitive",
-  "compose_form.spoiler.marked": "Text is hidden behind warning",
-  "compose_form.spoiler.unmarked": "Text is not hidden",
+  "compose_form.sensitive.marked": "Médiálny obsah je označený ako chúlostivý",
+  "compose_form.sensitive.unmarked": "Médiálny obsah nieje označený ako chúlostivý",
+  "compose_form.spoiler.marked": "Text je ukrytý za varovaním",
+  "compose_form.spoiler.unmarked": "Text nieje ukrytý",
   "compose_form.spoiler_placeholder": "Sem napíšte vaše varovanie",
   "confirmation_modal.cancel": "Zrušiť",
   "confirmations.block.confirm": "Blokovať",
@@ -101,14 +101,14 @@
   "empty_column.list": "Tento zoznam je ešte prázdny. Keď ale členovia tohoto zoznamu napíšu nové správy, tak tie sa objavia priamo tu.",
   "empty_column.notifications": "Nemáte ešte žiadne notifikácie. Napíšte niekomu, následujte niekoho a komunikujte s ostatnými aby diskusia mohla začať.",
   "empty_column.public": "Ešte tu nič nie je. Napíšte niečo verejne alebo začnite sledovať používateľov z iných Mastodon serverov aby tu niečo pribudlo",
-  "follow_request.authorize": "Povoliť prístup",
-  "follow_request.reject": "Odmietnúť",
+  "follow_request.authorize": "Povoľ prístup",
+  "follow_request.reject": "Odmietni",
   "getting_started.appsshort": "Aplikácie",
-  "getting_started.faq": "FAQ",
-  "getting_started.heading": "Začíname",
+  "getting_started.faq": "Časté otázky",
+  "getting_started.heading": "Začni tu",
   "getting_started.open_source_notice": "Mastodon má otvorený kód. Nahlásiť chyby, alebo prispievať vlastným kódom môžete na GitHube v {github}.",
   "getting_started.userguide": "Používateľská príručka",
-  "home.column_settings.advanced": "Rozšírené",
+  "home.column_settings.advanced": "Pokročilé",
   "home.column_settings.basic": "Základné",
   "home.column_settings.filter_regex": "Filtrovať použitím regulárnych výrazov",
   "home.column_settings.show_reblogs": "Zobraziť povýšené",
@@ -147,7 +147,7 @@
   "missing_indicator.label": "Nenájdené",
   "missing_indicator.sublabel": "Tento zdroj sa nepodarilo nájsť",
   "mute_modal.hide_notifications": "Skryť notifikácie od tohoto užívateľa?",
-  "navigation_bar.blocks": "Blokovaní používatelia",
+  "navigation_bar.blocks": "Blokovaní užívatelia",
   "navigation_bar.community_timeline": "Lokálna časová os",
   "navigation_bar.edit_profile": "Upraviť profil",
   "navigation_bar.favourites": "Obľúbené",
@@ -156,9 +156,9 @@
   "navigation_bar.keyboard_shortcuts": "Klávesové skratky",
   "navigation_bar.lists": "Zoznamy",
   "navigation_bar.logout": "Odhlásiť",
-  "navigation_bar.mutes": "Ignorovaní používatelia",
+  "navigation_bar.mutes": "Ignorovaní užívatelia",
   "navigation_bar.pins": "Pripnuté toots",
-  "navigation_bar.preferences": "Možnosti",
+  "navigation_bar.preferences": "Voľby",
   "navigation_bar.public_timeline": "Federovaná časová os",
   "notification.favourite": "{name} sa páči tvoj status",
   "notification.follow": "{name} ťa začal/a následovať",
@@ -254,9 +254,9 @@
   "status.sensitive_warning": "Chúlostivý obsah",
   "status.share": "Zdieľať",
   "status.show_less": "Zobraz menej",
-  "status.show_less_all": "Show less for all",
+  "status.show_less_all": "Všetkým ukáž menej",
   "status.show_more": "Zobraz viac",
-  "status.show_more_all": "Show more for all",
+  "status.show_more_all": "Všetkým ukáž viac",
   "status.unmute_conversation": "Prestať ignorovať konverzáciu",
   "status.unpin": "Odopnúť z profilu",
   "tabs_bar.federated_timeline": "Federovaná",
diff --git a/app/javascript/mastodon/locales/sv.json b/app/javascript/mastodon/locales/sv.json
index 3451212d0..4fa129173 100644
--- a/app/javascript/mastodon/locales/sv.json
+++ b/app/javascript/mastodon/locales/sv.json
@@ -60,10 +60,10 @@
   "compose_form.placeholder": "Vad funderar du på?",
   "compose_form.publish": "Toot",
   "compose_form.publish_loud": "{publish}!",
-  "compose_form.sensitive.marked": "Media is marked as sensitive",
-  "compose_form.sensitive.unmarked": "Media is not marked as sensitive",
-  "compose_form.spoiler.marked": "Text is hidden behind warning",
-  "compose_form.spoiler.unmarked": "Text is not hidden",
+  "compose_form.sensitive.marked": "Media har markerats som känsligt",
+  "compose_form.sensitive.unmarked": "Media har inte markerats som känsligt",
+  "compose_form.spoiler.marked": "Texten har dolts bakom en varning",
+  "compose_form.spoiler.unmarked": "Texten är inte dold",
   "compose_form.spoiler_placeholder": "Skriv din varning här",
   "confirmation_modal.cancel": "Ångra",
   "confirmations.block.confirm": "Blockera",
@@ -254,9 +254,9 @@
   "status.sensitive_warning": "Känsligt innehåll",
   "status.share": "Dela",
   "status.show_less": "Visa mindre",
-  "status.show_less_all": "Show less for all",
+  "status.show_less_all": "Visa mindre för alla",
   "status.show_more": "Visa mer",
-  "status.show_more_all": "Show more for all",
+  "status.show_more_all": "Visa mer för alla",
   "status.unmute_conversation": "Öppna konversation",
   "status.unpin": "Ångra fäst i profil",
   "tabs_bar.federated_timeline": "Förenad",
diff --git a/app/lib/ostatus/atom_serializer.rb b/app/lib/ostatus/atom_serializer.rb
index 656e45822..46d0a8b37 100644
--- a/app/lib/ostatus/atom_serializer.rb
+++ b/app/lib/ostatus/atom_serializer.rb
@@ -351,7 +351,7 @@ class OStatus::AtomSerializer
     append_element(entry, 'summary', status.spoiler_text, 'xml:lang': status.language) if status.spoiler_text?
     append_element(entry, 'content', Formatter.instance.format(status).to_str, type: 'html', 'xml:lang': status.language)
 
-    status.mentions.each do |mentioned|
+    status.mentions.order(:id).each do |mentioned|
       append_element(entry, 'link', nil, rel: :mentioned, 'ostatus:object-type': OStatus::TagManager::TYPES[:person], href: OStatus::TagManager.instance.uri_for(mentioned.account))
     end
 
diff --git a/app/models/user.rb b/app/models/user.rb
index 0346cf8ae..803eb8a33 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -52,6 +52,8 @@ class User < ApplicationRecord
   devise :registerable, :recoverable, :rememberable, :trackable, :validatable,
          :confirmable
 
+  devise :pam_authenticatable if ENV['PAM_ENABLED'] == 'true'
+
   devise :omniauthable
 
   belongs_to :account, inverse_of: :user
@@ -96,7 +98,7 @@ class User < ApplicationRecord
 
   def pam_conflict?
     return false unless Devise.pam_authentication
-    encrypted_password.present? && is_pam_account?
+    encrypted_password.present? && pam_managed_user?
   end
 
   def pam_get_name
@@ -267,22 +269,22 @@ class User < ApplicationRecord
   end
 
   def self.pam_get_user(attributes = {})
-    if attributes[:email]
-      resource =
-        if Devise.check_at_sign && !attributes[:email].index('@')
-          joins(:account).find_by(accounts: { username: attributes[:email] })
-        else
-          find_by(email: attributes[:email])
-        end
-
-      if resource.blank?
-        resource = new(email: attributes[:email])
-        if Devise.check_at_sign && !resource[:email].index('@')
-          resource[:email] = "#{attributes[:email]}@#{resource.find_pam_suffix}"
-        end
+    return nil unless attributes[:email]
+    resource =
+      if Devise.check_at_sign && !attributes[:email].index('@')
+        joins(:account).find_by(accounts: { username: attributes[:email] })
+      else
+        find_by(email: attributes[:email])
+      end
+
+    if resource.blank?
+      resource = new(email: attributes[:email])
+      if Devise.check_at_sign && !resource[:email].index('@')
+        resource[:email] = Rpam2.getenv(resource.find_pam_service, attributes[:email], attributes[:password], 'email', false)
+        resource[:email] = "#{attributes[:email]}@#{resource.find_pam_suffix}" unless resource[:email]
       end
-      resource
     end
+    resource
   end
 
   def self.ldap_get_user(attributes = {})
diff --git a/app/serializers/activitypub/note_serializer.rb b/app/serializers/activitypub/note_serializer.rb
index d0e6290c1..abaf29047 100644
--- a/app/serializers/activitypub/note_serializer.rb
+++ b/app/serializers/activitypub/note_serializer.rb
@@ -57,7 +57,7 @@ class ActivityPub::NoteSerializer < ActiveModel::Serializer
   end
 
   def virtual_tags
-    object.mentions + object.tags + object.emojis
+    object.mentions.order(:id) + object.tags + object.emojis
   end
 
   def atom_uri
diff --git a/app/serializers/rest/status_serializer.rb b/app/serializers/rest/status_serializer.rb
index e6270f902..67da92cd5 100644
--- a/app/serializers/rest/status_serializer.rb
+++ b/app/serializers/rest/status_serializer.rb
@@ -15,7 +15,7 @@ class REST::StatusSerializer < ActiveModel::Serializer
   belongs_to :account, serializer: REST::AccountSerializer
 
   has_many :media_attachments, serializer: REST::MediaAttachmentSerializer
-  has_many :mentions
+  has_many :ordered_mentions, key: :mentions
   has_many :tags
   has_many :emojis, serializer: REST::CustomEmojiSerializer
 
@@ -86,6 +86,10 @@ class REST::StatusSerializer < ActiveModel::Serializer
       %w(public unlisted).include?(object.visibility)
   end
 
+  def ordered_mentions
+    object.mentions.order(:id)
+  end
+
   class ApplicationSerializer < ActiveModel::Serializer
     attributes :name, :website
   end
diff --git a/app/views/notification_mailer/_status.html.haml b/app/views/notification_mailer/_status.html.haml
index f82ada146..57b5688bd 100644
--- a/app/views/notification_mailer/_status.html.haml
+++ b/app/views/notification_mailer/_status.html.haml
@@ -24,6 +24,11 @@
                                       %bdi= display_name(status.account)
                                       = "@#{status.account.acct}"
 
+                              - if status.spoiler_text?
+                                %div{ dir: rtl_status?(status) ? 'rtl' : 'ltr' }
+                                  %p
+                                    = Formatter.instance.format_spoiler(status)
+
                               %div{ dir: rtl_status?(status) ? 'rtl' : 'ltr' }
                                 = Formatter.instance.format(status)
 
diff --git a/app/views/notification_mailer/_status.text.erb b/app/views/notification_mailer/_status.text.erb
index 85a0136b7..8999a1f8e 100644
--- a/app/views/notification_mailer/_status.text.erb
+++ b/app/views/notification_mailer/_status.text.erb
@@ -1,3 +1,8 @@
+<% if status.spoiler_text? %>
+<%= raw status.spoiler_text %>
+----
+
+<% end %>
 <%= raw Formatter.instance.plaintext(status) %>
 
 <%= raw t('application_mailer.view')%> <%= web_url("statuses/#{status.id}") %>
diff --git a/app/views/user_mailer/email_changed.html.haml b/app/views/user_mailer/email_changed.html.haml
index 7e82f23e4..0802aaf96 100644
--- a/app/views/user_mailer/email_changed.html.haml
+++ b/app/views/user_mailer/email_changed.html.haml
@@ -38,7 +38,7 @@
                           %table.input{ align: 'center', cellspacing: 0, cellpadding: 0 }
                             %tbody
                               %tr
-                                %td= @resource.unconfirmed_email
+                                %td= @resource.try(:unconfirmed_email) ? @resource.unconfirmed_email : @resource.email
 
 %table.email-table{ cellspacing: 0, cellpadding: 0 }
   %tbody
diff --git a/app/views/user_mailer/email_changed.text.erb b/app/views/user_mailer/email_changed.text.erb
index 2b58415f5..345b16a2c 100644
--- a/app/views/user_mailer/email_changed.text.erb
+++ b/app/views/user_mailer/email_changed.text.erb
@@ -4,6 +4,6 @@
 
 <%= t 'devise.mailer.email_changed.explanation' %>
 
-<%= @resource.unconfirmed_email %>
+<%= @resource.try(:unconfirmed_email) ? @resource.unconfirmed_email : @resource.email %>
 
 <%= t 'devise.mailer.email_changed.extra' %>