From 7dd5ba42a394e64ef55b066628294cc0c61d2d58 Mon Sep 17 00:00:00 2001 From: Korbinian Date: Mon, 3 Apr 2017 19:01:17 +0200 Subject: Updated and fixed german orthography --- config/locales/devise.de.yml | 50 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/config/locales/devise.de.yml b/config/locales/devise.de.yml index 181502f9c..58bfaa3d6 100644 --- a/config/locales/devise.de.yml +++ b/config/locales/devise.de.yml @@ -2,59 +2,59 @@ de: devise: confirmations: - confirmed: "Vielen Dank für Deine Registrierung. Bitte melde dich jetzt an." - send_instructions: "Du erhältst in wenigen Minuten eine E-Mail, mit der Du Deine Registrierung bestätigen kannst." - send_paranoid_instructions: "Falls Deine E-Mail-Adresse in unserer Datenbank existiert erhältst Du in wenigen Minuten eine E-Mail mit der Du Deine Registrierung bestätigen kannst." + confirmed: "Vielen Dank für deine Registrierung. Bitte melde dich jetzt an." + send_instructions: "Du erhältst in wenigen Minuten eine E-Mail, mit der du deine Registrierung bestätigen kannst." + send_paranoid_instructions: "Falls Deine E-Mail-Adresse in unserer Datenbank existiert, erhältst Du in wenigen Minuten eine E-Mail mit der du deine Registrierung bestätigen kannst." failure: already_authenticated: "Du bist bereits angemeldet." inactive: "Dein Account ist nicht aktiv." invalid: "Ungültige Anmeldedaten." - last_attempt: "Du hast noch einen Versuch bevor dein Account gesperrt wird" + last_attempt: "Du hast noch einen Versuch bevor dein Account gesperrt wird." locked: "Dein Account ist gesperrt." not_found_in_database: "E-Mail-Adresse oder Passwort ungültig." - timeout: "Deine Sitzung ist abgelaufen, bitte melde Dich erneut an." - unauthenticated: "Du musst Dich anmelden oder registrieren, bevor Du fortfahren kannst." - unconfirmed: "Du musst Deinen Account bestätigen, bevor Du fortfahren kannst." + timeout: "Deine Sitzung ist abgelaufen, bitte melde dich erneut an." + unauthenticated: "Du musst Dich anmelden oder registrieren, bevor du fortfahren kannst." + unconfirmed: "Du musst deinen Account bestätigen, bevor du fortfahren kannst." mailer: confirmation_instructions: - subject: "Mastodon: Anleitung zur Bestätigung Deines Accounts" + subject: "Mastodon: Anleitung zur Bestätigung deines Accounts" password_change: subject: 'Mastodon: Passwort wurde geändert' reset_password_instructions: - subject: "Mastodon: Anleitung um Dein Passwort zurückzusetzen" + subject: "Mastodon: Anleitung um dein Passwort zurückzusetzen" unlock_instructions: - subject: "Mastodon: Anleitung um Deinen Account freizuschalten" + subject: "Mastodon: Anleitung um deinen Account freizuschalten" omniauth_callbacks: - failure: "Du konntest nicht Deinem %{kind}-Account angemeldet werden, weil '%{reason}'." - success: "Du hast Dich erfolgreich mit Deinem %{kind}-Account angemeldet." + failure: "Du konntest nicht mit deinem %{kind}-Account angemeldet werden, weil '%{reason}'." + success: "Du hast dich erfolgreich mit Deinem %{kind}-Account angemeldet." passwords: - no_token: "Du kannst diese Seite nur von dem Link aus einer E-Mail zum Passwort-Zurücksetzen aufrufen. Wenn du einen solchen Link aufgerufen hast stelle bitte sicher, dass du die vollständige Adresse aufrufst." - send_instructions: "Du erhältst in wenigen Minuten eine E-Mail mit der Anleitung, wie Du Dein Passwort zurücksetzen kannst." - send_paranoid_instructions: "Falls Deine E-Mail-Adresse in unserer Datenbank existiert erhältst Du in wenigen Minuten eine E-Mail mit der Anleitung, wie Du Dein Passwort zurücksetzen können." + no_token: "Du kannst diese Seite nur über den Link aus der E-Mail zum Passwort-Zurücksetzen aufrufen. Wenn du einen solchen Link aufgerufen hast, stelle bitte sicher, dass du die vollständige Adresse aufrufst." + send_instructions: "Du erhältst in wenigen Minuten eine E-Mail mit der Anleitung, wie du dein Passwort zurücksetzen kannst." + send_paranoid_instructions: "Falls deine E-Mail-Adresse in unserer Datenbank existiert erhältst du in wenigen Minuten eine E-Mail mit der Anleitung, wie du dein Passwort zurücksetzen kannst." updated: "Dein Passwort wurde geändert. Du bist jetzt angemeldet." updated_not_active: "Dein Passwort wurde geändert." registrations: destroyed: "Dein Account wurde gelöscht." signed_up: "Du hast dich erfolgreich registriert." - signed_up_but_inactive: "Du hast dich erfolgreich registriert. Wir konnten Dich noch nicht anmelden, da Dein Account inaktiv ist." - signed_up_but_locked: "Du hast dich erfolgreich registriert. Wir konnten Dich noch nicht anmelden, da Dein Account gesperrt ist." - signed_up_but_unconfirmed: "Du hast Dich erfolgreich registriert. Wir konnten Dich noch nicht anmelden, da Dein Account noch nicht bestätigt ist. Du erhältst in Kürze eine E-Mail mit der Anleitung, wie Du Deinen Account freischalten kannst." - update_needs_confirmation: "Deine Daten wurden aktualisiert, aber Du musst Deine neue E-Mail-Adresse bestätigen. Du erhälst in wenigen Minuten eine E-Mail, mit der Du die Änderung Deiner E-Mail-Adresse abschließen kannst." + signed_up_but_inactive: "Du hast dich erfolgreich registriert. Wir konnten dich noch nicht anmelden, da dein Account inaktiv ist." + signed_up_but_locked: "Du hast dich erfolgreich registriert. Wir konnten dich noch nicht anmelden, da dein Account gesperrt ist." + signed_up_but_unconfirmed: "Du hast Dich erfolgreich registriert. Wir konnten dich noch nicht anmelden, da dein Account noch nicht bestätigt ist. Du erhältst in Kürze eine E-Mail mit der Anleitung, wie Du Deinen Account freischalten kannst." + update_needs_confirmation: "Deine Daten wurden aktualisiert, aber du musst deine neue E-Mail-Adresse bestätigen. Du erhälst in wenigen Minuten eine E-Mail, mit der du die Änderung deiner E-Mail-Adresse abschließen kannst." updated: "Deine Daten wurden aktualisiert." sessions: already_signed_out: "Erfolgreich abgemeldet." signed_in: "Erfolgreich angemeldet." signed_out: "Erfolgreich abgemeldet." unlocks: - send_instructions: "Du erhältst in wenigen Minuten eine E-Mail mit der Anleitung, wie Du Deinen Account entsperren können." - send_paranoid_instructions: "Falls Deine E-Mail-Adresse in unserer Datenbank existiert erhältst Du in wenigen Minuten eine E-Mail mit der Anleitung, wie Du Deinen Account entsperren kannst." + send_instructions: "Du erhältst in wenigen Minuten eine E-Mail mit der Anleitung, wie du deinen Account entsperren können." + send_paranoid_instructions: "Falls deine E-Mail-Adresse in unserer Datenbank existiert erhältst du in wenigen Minuten eine E-Mail mit der Anleitung, wie du deinen Account entsperren kannst." unlocked: "Dein Account wurde entsperrt. Du bist jetzt angemeldet." errors: messages: - already_confirmed: "wurde bereits bestätigt" - confirmation_period_expired: "muss innerhalb %{period} bestätigt werden, bitte fordere einen neuen Link an" - expired: "ist abgelaufen, bitte neu anfordern" - not_found: "nicht gefunden" + already_confirmed: "wurde bereits bestätigt." + confirmation_period_expired: "muss innerhalb %{period} bestätigt werden, bitte fordere einen neuen Link an." + expired: "ist abgelaufen, bitte neu anfordern." + not_found: "wurde nicht gefunden." not_locked: "ist nicht gesperrt" not_saved: one: "Konnte %{resource} nicht speichern: ein Fehler." -- cgit From ec8029a95531bd52bc6ed1e83c52362411210d5e Mon Sep 17 00:00:00 2001 From: Korbinian Date: Mon, 3 Apr 2017 19:10:48 +0200 Subject: Updated and fixed orthography --- config/locales/de.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index 320bd3144..d44845c6b 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1,14 +1,14 @@ --- de: about: - about_mastodon: Mastodon ist ein freier, quelloffener soziales Netzwerkserver. Eine dezentralisierte Alternative zu kommerziellen Plattformen, verhindert es die Risiken, die entstehen, wenn eine einzelne Firma deine Kommunikation monopolisiert. Jeder kann Mastodon verwenden und ganz einfach am sozialen Netzwerk teilnehmen. + about_mastodon: Mastodon ist ein freier, quelloffener soziales Netzwerkserver. Als dezentralisierte Alternative zu kommerziellen Plattformen verhindert es die Risiken, die entstehen, wenn eine einzelne Firma deine Kommunikation monopolisiert. Jeder kann Mastodon verwenden und ganz einfach am sozialen Netzwerk teilnehmen. get_started: Erste Schritte source_code: Quellcode terms: AGB accounts: follow: Folgen - followers: Folger - following: Folgt + followers: Follower + following: Gefolgt nothing_here: Hier gibt es nichts! people_followed_by: Nutzer, denen %{name} folgt people_who_follow: Nutzer, die %{name} folgen @@ -27,7 +27,7 @@ de: reset_password: Passwort zurücksetzen set_new_password: Neues Passwort setzen authorize_follow: - error: Das entfernte Profil konnte nicht geladen werden + error: Das Profil konnte nicht geladen werden follow: Folgen prompt_html: 'Du (%{self}) möchtest dieser Person folgen:' title: "%{acct} folgen" @@ -55,25 +55,25 @@ de: notification_mailer: favourite: body: 'Dein Beitrag wurde von %{name} favorisiert:' - subject: "%{name} hat deinen Beitrag favorisiert" + subject: "%{name} hat deinen Beitrag favorisiert." follow: body: "%{name} folgt dir jetzt!" - subject: "%{name} folgt dir nun" + subject: "%{name} folgt dir jetzt." follow_request: body: "%{name} möchte dir folgen:" - subject: "%{name} möchte dir folgen" + subject: "%{name} möchte dir folgen." mention: body: "%{name} hat dich erwähnt:" - subject: "%{name} hat dich erwähnt" + subject: "%{name} hat dich erwähnt." reblog: body: 'Dein Beitrag wurde von %{name} geteilt:' - subject: "%{name} teilte deinen Beitrag" + subject: "%{name} teilte deinen Beitrag." pagination: next: Vorwärts prev: Zurück remote_follow: - acct: Dein Nutzername@Domain, von dem du dieser Person folgen möchtest - missing_resource: Die erforderliche Weiterleitungs-URL konnte leider in deinem Profil nicht gefunden werden + acct: Dein Nutzername@Domain, von dem aus du dieser Person folgen möchtest. + missing_resource: Die erforderliche Weiterleitungs-URL konnte leider in deinem Profil nicht gefunden werden. proceed: Weiter prompt: 'Du wirst dieser Person folgen:' settings: -- cgit From 0700521ef36e5404f764523f387dafa331fa2b52 Mon Sep 17 00:00:00 2001 From: axolotl Date: Mon, 3 Apr 2017 20:22:50 +0200 Subject: added Esperanto (eo) --- app/helpers/settings_helper.rb | 1 + config/application.rb | 2 +- config/locales/devise.eo.yml | 61 ++++++++++++++ config/locales/doorkeeper.eo.yml | 113 ++++++++++++++++++++++++++ config/locales/eo.yml | 164 ++++++++++++++++++++++++++++++++++++++ config/locales/simple_form.eo.yml | 46 +++++++++++ 6 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 config/locales/devise.eo.yml create mode 100644 config/locales/doorkeeper.eo.yml create mode 100644 config/locales/eo.yml create mode 100644 config/locales/simple_form.eo.yml diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index 74215e8df..f92abb9bc 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -10,6 +10,7 @@ module SettingsHelper hu: 'Magyar', uk: 'Українська', 'zh-CN': '简体中文', + eo: 'Esperanto', }.freeze def human_locale(locale) diff --git a/config/application.rb b/config/application.rb index 9d32f30cb..77cd254af 100644 --- a/config/application.rb +++ b/config/application.rb @@ -24,7 +24,7 @@ module Mastodon # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - config.i18n.available_locales = [:en, :de, :es, :pt, :fr, :hu, :uk, 'zh-CN'] + config.i18n.available_locales = [:en, :de, :es, :pt, :fr, :hu, :uk, 'zh-CN', :eo] config.i18n.default_locale = :en # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb') diff --git a/config/locales/devise.eo.yml b/config/locales/devise.eo.yml new file mode 100644 index 000000000..b786647dd --- /dev/null +++ b/config/locales/devise.eo.yml @@ -0,0 +1,61 @@ +--- +eo: + devise: + confirmations: + confirmed: Via konto estas konfirmita. + send_instructions: Vi ricevos instrukciojn por konfirmi vian konton post kelkaj minutoj. + send_paranoid_instructions: Se via retpoŝt-adreso ekzistas en nia datumbazo, vi baldaŭ ricevos retpoŝt-mesaĝon, kiu enhavas la instrukciojn por konfirmi vian konton. + failure: + already_authenticated: Vi jam estas ensalutita. + inactive: Via konto ankoraŭ ne estas konfirmita. + invalid: Malĝusta retpoŝt-adreso aŭ pasvorto. + last_attempt: Vi ankoraŭ povas provi unufoje antaŭ ol via konto estos ŝlosita. + locked: Via konto estas ŝlosita. + not_found_in_database: Malĝusta retpoŝt-adreso aŭ pasvorto. + timeout: Via sesio eksiĝis. Bonvolu reensaluti por daŭrigi. + unauthenticated: Vi devas ensaluti aŭ membriĝi por daŭrigi. + unconfirmed: Vi devas konfirmi vian konton por daŭrigi. + mailer: + confirmation_instructions: + subject: Instrukcioj por konfirmi + password_change: + subject: Via pasvorto estis ŝanĝita senprobleme. + reset_password_instructions: + subject: Instrukcioj por ŝanĝi la pasvorton + unlock_instructions: + subject: Instrukcioj por malŝlosi la konton + omniauth_callbacks: + failure: 'Ni ne povis aŭtentigi vin per %{kind}: ''%{reason}''.' + success: Aŭtentigita senprobleme per %{kind}. + passwords: + no_token: Vi ne povas iri al tiu paĝo per alia vojo ol retpoŝt-mesaĝo por ŝanĝi pasvorton. Se vi venas de tia retpoŝt-mesaĝo, kontrolu ke vi uzis la tutan URL. + send_instructions: Vi ricevos retpoŝt-mesaĝon kun instrukcioj por ŝanĝi vian pasvorton post kelkaj minutoj. + send_paranoid_instructions: Se via retpoŝt-adreso ekzistas en nia datumbazo, vi ricevos ligilon por ŝanĝi vian pasvorton per retpoŝt-mesaĝo. + updated: Via pasvorto estis redaktita senprobleme, vi nun estas ensalutita. + updated_not_active: Via pasvorto estis redaktita senprobleme. + registrations: + destroyed: Ĝis! Via konto estis forigita senprobleme. Ni esperas revidi vin baldaŭ. + signed_up: Bonvenon! Vi membriĝis senprobleme. + signed_up_but_inactive: Vi bone membriĝis, sed vi ankoraŭ ne povas ensaluti ĉar via konto ne estis konfirmita. + signed_up_but_locked: Vi bone membriĝis, sed vi ne povas ensaluti ĉar via konto estas ŝlosita. + signed_up_but_unconfirmed: Retpoŝt-mesaĝo kun via ligilo por konfirmi vian konton estis sendita al via retpoŝt-adreso. Bonvolu uzi tiun ligilon por konfirmi vian konton. + update_needs_confirmation: Vi bone aktualigis vian konton, sed ni bezonas kontroli vian novan retpoŝt-adreson. Bonvolu kontroli viajn retpoŝt-mesaĝojn kaj uzi la ligilon por konfirmi vian novan retpoŝt-adreson. + updated: Via konto estis aktualigita senprobleme. + sessions: + already_signed_out: Elsalutita. + signed_in: Ensalutita. + signed_out: Elsalutita. + unlocks: + send_instructions: Vi ricevos retpoŝt-mesaĝon kun instrukcioj por malŝlosi vian konton post kelkaj minutoj. + send_paranoid_instructions: Se via retpoŝt-adreso ekzistas en nia datumbazo, vi ricevos ligilon por malŝlosi vian konton per retpoŝt-mesaĝo. + unlocked: Via konto estis malŝlosita senprobleme, vi nun estas ensalutita. + errors: + messages: + already_confirmed: jam estis konfirmita, bonvolu provi ensaluti + confirmation_period_expired: devas esti konfirmita en %{period}, bonvolu repeti + expired: eksiĝis, bonvolu repeti + not_found: ne estis trovita + not_locked: ne estis ŝlosita + not_saved: + one: '1 eraro malpermesis al tiu %{resource} esti konservita:' + other: '%{count} eraroj malpermesis al tiu %{resource} esti konservita:' diff --git a/config/locales/doorkeeper.eo.yml b/config/locales/doorkeeper.eo.yml new file mode 100644 index 000000000..33cc7cc19 --- /dev/null +++ b/config/locales/doorkeeper.eo.yml @@ -0,0 +1,113 @@ +--- +eo: + activerecord: + attributes: + doorkeeper/application: + name: Nomo + redirect_uri: URI de plusendo + errors: + models: + doorkeeper/application: + attributes: + redirect_uri: + fragment_present: ne povas enhavi eron. + invalid_uri: devas esti valida URI. + relative_uri: devas esti absoluta URI. + secured_uri: devas esti HTTPS/SSL-a URI. + doorkeeper: + applications: + buttons: + authorize: Rajtigi + cancel: Rezigni + destroy: Detrui + edit: Redakti + submit: Sendi + confirmations: + destroy: Ĉu vi certas? + edit: + title: Redakti aplikaĵon + form: + error: Ups! Kontrolu vian formularon ĉu estas eraroj + help: + native_redirect_uri: Uzu %{native_redirect_uri} por lokaj provoj + redirect_uri: Uzu unu linion por ĉiu URI + scopes: Apartigu ampleksojn per spacetoj. Lasu malplena por uzi la senŝanĝajn ampleksojn. + index: + callback_url: URL vokita per referenco + name: Nomo + new: Nova Aplikaĵo + title: Viaj aplikaĵoj + new: + title: Nova aplikaĵo + show: + actions: Agoj + application_id: Identigo de la aplikaĵo + callback_urls: URL-j vokitaj per referenco + scopes: Ampleksoj + secret: Sekreto + title: 'Aplikaĵo: %{name}' + authorizations: + buttons: + authorize: Rajtigi + deny: Rifuzi + error: + title: Eraro okazis + new: + able_to: Povos + prompt: La aplikaĵo %{client_name} petas aliron al via konto + title: Rajtigo bezonata + show: + title: Rajtiga kodo + authorized_applications: + buttons: + revoke: Malrajtigi + confirmations: + revoke: Ĉu vi certas? + index: + application: Aplikaĵo + created_at: Rajtigita + date_format: "%Y-%m-%d %H:%M:%S" + scopes: Ampleksoj + title: Viaj rajtigitaj aplikaĵoj + errors: + messages: + access_denied: La posedanto de la rimedo aŭ la rajtiga servilo rifuzis vian peton. + credential_flow_not_configured: La sendado de la identigiloj de la posedanto de la rimedo malsukcesis ĉar Doorkeeper.configure.resource_owner_from_credentials ne estis agordita. + invalid_client: La aŭtentigo de la kliento malsukcesis ĉar la kliento estas nekonata, aŭ mankis peto aŭtentigi, aŭ la aŭtentig-metodo ne estas subtenata. + invalid_grant: La rajtiga konsento ne estas valida, ne plu estas valida, estis forigita, ne kongruas kun la plusenda URI uzita en la aŭtentiga peto, aŭ estis sendita al alia kliento. + invalid_redirect_uri: La plusenda URI uzita en estas valida. + invalid_request: Mankis al la peto nepra parametro, enhavas nesubtenatan parametran valoron, aŭ la peto simple estas misformita. + invalid_resource_owner: La donitaj identigiloj pri la posedanto de la rimedo ne estas validaj, aŭ tiu ne povas esti trovita. + invalid_scope: La petita amplekso ne estas valida, estas nekonata, aŭ estas misformita. + invalid_token: + expired: La atingoĵetono eskiĝis. + revoked: La atingoĵetono estis rifuzita. + unknown: La atingoĵetono ne estas valida. + resource_owner_authenticator_not_configured: La posedanto de la rimedo ne povis esti trovita ĉar Doorkeeper.configure.resource_owner_authenticator ne estas agordita. + server_error: La rajtiga servilo rimarkis neatenditan kondiĉon, kiu malpermesis al ĝi plenumi la peton. + temporarily_unavailable: La rajtiga servilo ne povas nun plenumi la peton pro dumtempa superŝarĝo aŭ prizorgado de la servilo. + unauthorized_client: La kliento ne rajtas fari tian peton uzante tiun metodon. + unsupported_grant_type: La tipo de la rajtiga konsento ne estas subtenata de la rajtiga servilo. + unsupported_response_type: La rajtiga servilo ne subtenas tian respondon. + flash: + applications: + create: + notice: Aplikaĵo kreita. + destroy: + notice: Aplikaĵo forigita. + update: + notice: Aplikaĵo aktualigita. + authorized_applications: + destroy: + notice: Aplikaĵo malrajtigita. + layouts: + admin: + nav: + applications: Aplikaĵoj + oauth2_provider: OAuth2-provizanto + application: + title: OAuth-a rajtigo bezonata + scopes: + follow: sekvi, bloki, malbloki kaj malsekvi kontojn + read: legi la datumojn de via konto + write: mesaĝi kiel vi diff --git a/config/locales/eo.yml b/config/locales/eo.yml new file mode 100644 index 000000000..3644b37bb --- /dev/null +++ b/config/locales/eo.yml @@ -0,0 +1,164 @@ +--- +eo: + about: + about_mastodon: Mastodon estas senpaga, malfermitkoda socia reto. Ĝi estas sencentra alia eblo al komercaj servoj. Ĝi evitigas, ke unusola firmao regu vian tutan komunikadon. Elektu servilon, kiun vi fidas. Kiu ajn estas via elekto, vi povas interagi kun ĉiuj aliaj uzantoj. Iu ajn povas krei sian propran aperaĵon de Mastodon en sia servilo, kaj partopreni en la socia reto tute glate. + about_this: Pri tiu aperaĵo + apps: Aplikaĵoj + business_email: 'Profesia retpoŝt-adreso:' + contact: Kontakti + description_headline: Kio estas %{domain}? + domain_count_after: aliaj aperaĵoj + domain_count_before: Konektita al + features: + api: Malfermita API por aplikaĵoj kaj servoj + blocks: Kompletaj iloj por bloki kaj kaŝi + characters: Po 500 signoj por ĉiu mesaĝo + chronology: Tempolinioj laŭtempaj + ethics: 'Etike kreita: neniu reklamo, neniu ŝpurado' + gifv: Eblo diskonigi etajn videojn kaj GIFV + privacy: Videbleco agordita laŭ la mesaĝo + public: Publikaj tempolinioj + features_headline: Kiel Mastodon estas malsimila + get_started: Komenci + links: Ligiloj + other_instances: Aliaj aperaĵoj + source_code: Fontkodo + status_count_after: mesaĝoj + status_count_before: Kiu publikigis + terms: Terms + user_count_after: uzantoj + user_count_before: Hejmo de + accounts: + follow: Sekvi + followers: Sekvantoj + following: Sekvatoj + nothing_here: Estas nenio ĉi tie! + people_followed_by: Sekvatoj de %{name} + people_who_follow: Sekvantoj de %{name} + posts: Mesaĝoj + remote_follow: Fore sekvi + unfollow: Malsekvi + application_mailer: + settings: 'Ŝanĝi la retpoŝt-mesaĝajn preferojn: %{link}' + signature: Sciigoj de Mastodon el %{instance} + view: 'Vidi:' + applications: + invalid_url: La URL donita ne estas valida + auth: + change_password: Ŝanĝi pasvorton + didnt_get_confirmation: Ĉu vi ne ricevis la instrukciojn por konfirmi? + forgot_password: Pasvorto forgesita? + login: Ensaluti + logout: Elsaluti + register: Membriĝi + resend_confirmation: Resendi la instrukciojn por konfirmi + reset_password: Ŝanĝi la pasvorton + set_new_password: Elekti novan pasvorton + authorize_follow: + error: Bedaŭrinde, okazis eraro provante konsulti la foran konton + follow: Sekvi + prompt_html: 'Vi (%{self}) petis sekvi:' + title: Sekvi %{acct} + datetime: + distance_in_words: + about_x_hours: "%{count}h" + about_x_months: "%{count}mo" + about_x_years: "%{count}j" + almost_x_years: "%{count}j" + half_a_minute: Ĵus + less_than_x_minutes: "%{count}m" + less_than_x_seconds: Ĵus + over_x_years: "%{count}j" + x_days: "%{count}t" + x_minutes: "%{count}m" + x_months: "%{count}mo" + x_seconds: "%{count}s" + exports: + blocks: Vi blokas + csv: CSV + follows: Vi sekvas + storage: Mediaĵa konservado + generic: + changes_saved_msg: Ŝanĝoj senprobleme konservitaj! + powered_by: povigita de %{link} + save_changes: Konservi la ŝanĝojn + validation_errors: + one: Io ne okazis senprobleme! Bonvolu konsulti la suban erar-raporton. + other: Io ne okazis senprobleme! Bonvolu konsulti la subajn %{count} erar-raportojn. + imports: + preface: Vi povas alporti kelkajn datumojn, kiel listojn de ĉiuj homoj kiujn vi sekvas aŭ blokas, al via konto de ĉi tiu aperaĵo, per dosiero elportita de alia aperaĵo. + success: Viaj datumoj estis senprobleme alportitaj kaj estos traktitaj kiel planite. + types: + blocking: Listo de blokitoj + following: Listo de sekvatoj + upload: Alporti + landing_strip_html: %{name} estas uzanto en %{domain}. Vi povas sekvi tiun aŭ interagi kun tiu, se vi havas konton ie ajn en la Fediverse. Se vi ne havas, vi povas membriĝi ĉi tie.. + notification_mailer: + digest: + body: 'Jen eta resumo de tio, kio okazis en %{instance}, ekde kiam vi laste vizitis en %{since}:' + mention: "%{name} menciis vin en:" + new_followers_summary: + one: Vi ekhavis novan sekvanton! Jej! + other: Vi ekhavis %{count} novajn sekvantojn! Mirinde! + subject: + one: "1 nova sciigo ekde via lasta vizito \U0001F418" + other: "%{count} novaj sciigoj ekde via lasta vizito \U0001F418" + favourite: + body: '%{name} favoris vian mesaĝon:' + subject: "%{name} favoris vian mesaĝon" + follow: + body: "%{name} eksekvis vin:" + subject: "%{name} eksekvis vin" + follow_request: + body: "%{name} petis sekvi vin:" + subject: '%{name} petis sekvi vin' + mention: + body: '%{name} menciis vin en:' + subject: '%{name} menciis vin' + reblog: + body: '%{name} diskonigis vian mesaĝon:' + subject: "%{name} diskonigis vian mesaĝon" + pagination: + next: Sekva + prev: Malsekva + remote_follow: + acct: Enmetu vian uzantnomo@aperaĵo de kie vi volas sekvi tiun uzanton + missing_resource: La URL de plusendado ne povis esti trovita + proceed: Daŭrigi por plusendi + prompt: 'Vi eksekvos:' + settings: + authorized_apps: Rajtigitaj aplikaĵoj + back: Reveni al Mastodon + edit_profile: Redakti la profilon + export: Elporti datumojn + import: Alporti + preferences: Preferoj + settings: Agordoj + two_factor_auth: Dufaktora aŭtentigo + statuses: + open_in_web: Malfermi retumile + over_character_limit: limo de %{max} signoj trapasita + show_more: Montri pli + visibilities: + private: Montri nur al sekvantoj + public: Publika + unlisted: Publika, sed ne aperos en publikaj tempolinioj + stream_entries: + click_to_show: Alklaki por montri + reblogged: diskonigita + sensitive_content: Tikla enhavo + time: + formats: + default: "%b %d, %Y, %H:%M" + two_factor_auth: + description_html: Se vi ebligas dufaktoran aŭtentigon, vi bezonos vian poŝtelefonon por ensaluti, ĉar ĝi kreos nombrojn, kiujn vi devos entajpi. + disable: Malebligi + enable: Ebligi + instructions_html: "Skanu tiun QR-kodon per Google Authenticator aŭ per simila aplikaĵo de via poŝtelefono. De tiam, la aplikaĵo kreos nombrojn, kiujn vi devos entajpi." + plaintext_secret_html: 'Rekte legebla sekreta kodo: %{secret}' + warning: Se vi ne povas agordi aŭtentigan aplikaĵon nun, elektu "malebligi" aŭ vi ne plu povos ensaluti. + users: + invalid_email: La retpoŝt-adreso ne estas valida + invalid_otp_token: La dufaktora aŭtentigila kodo ne estas valida + will_paginate: + page_gap: "…" diff --git a/config/locales/simple_form.eo.yml b/config/locales/simple_form.eo.yml new file mode 100644 index 000000000..8c89a56e7 --- /dev/null +++ b/config/locales/simple_form.eo.yml @@ -0,0 +1,46 @@ +--- +eo: + simple_form: + hints: + defaults: + avatar: En la formato PNG, GIF aŭ JPG. Ĝis 2Mo. Estos malgrandigita al 120x120px + display_name: 30 signoj pleje + header: En la formato PNG, GIF aŭ JPG. Ĝis 2Mo. Estos malgrandigita al 700x335px + locked: Vi devos aprobi ĉiun peton de sekvado, kaj viaj mesaĝoj estos senŝanĝe nur por viaj sekvantoj. + note: 160 signoj pleje + imports: + data: Dosiero CSV el alia aperaĵo de Mastodon + labels: + defaults: + avatar: Profilbildo + confirm_new_password: Konfirmi novan pasvorton + confirm_password: Konfirmi la pasvorton + current_password: Nuna pasvorto + data: Datumoj + display_name: Publika nomo + email: Retpoŝt-adreso + header: Kapbildo + locale: Lingvo + locked: Privatigi la konton + new_password: Nova pasvorto + note: Sinprezento + otp_attempt: Dufaktora identigilo + password: Pasvorto + setting_default_privacy: Videbleco de la mesaĝoj + type: Tipo de alportado + username: Uzantnomo + interactions: + must_be_follower: Kaŝi la sciigojn de homoj, kiuj ne sekvas vin + must_be_following: Kaŝi la sciigojn de homoj, kiujn vi ne sekas + notification_emails: + digest: Sendi resumajn retpoŝt-mesaĝojn + favourite: Sendi retpoŝt-mesaĝon, kiam iu favoras mesaĝon de vi + follow: Sendi retpoŝt-mesaĝon, kiam iu eksekvas vin + follow_request: Sendi retpoŝt-mesaĝon, kiam iu petas sekvi vin + mention: Sendi retpoŝt-mesaĝon, kiam iu mencias vin + reblog: Sendi retpoŝt-mesaĝon, kiam iu diskonigas mesaĝon de vi + 'no': 'Ne' + required: + mark: "*" + text: bezonata + 'yes': 'Jes' -- cgit From ce1ca2859403fd21db1f6237ce6a563edd4f62ae Mon Sep 17 00:00:00 2001 From: Neville Park Date: Mon, 3 Apr 2017 17:45:36 -0400 Subject: Changed "reblogs" to "boosts" --- config/locales/simple_form.en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml index 4d1758f82..c781831a8 100644 --- a/config/locales/simple_form.en.yml +++ b/config/locales/simple_form.en.yml @@ -33,7 +33,7 @@ en: follow: Send e-mail when someone follows you follow_request: Send e-mail when someone requests to follow you mention: Send e-mail when someone mentions you - reblog: Send e-mail when someone reblogs your status + reblog: Send e-mail when someone boosts your status 'no': 'No' required: mark: "*" -- cgit From b8243c1b49a1d0a3c102901e5facd90dd88b9c13 Mon Sep 17 00:00:00 2001 From: JantsoP Date: Tue, 4 Apr 2017 08:26:59 +0200 Subject: changed line 25 for better translation --- app/assets/javascripts/components/locales/fi.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/components/locales/fi.jsx b/app/assets/javascripts/components/locales/fi.jsx index 5bef99923..39fa655e6 100644 --- a/app/assets/javascripts/components/locales/fi.jsx +++ b/app/assets/javascripts/components/locales/fi.jsx @@ -22,7 +22,7 @@ const fi = { "account.followers": "Seuraajia", "account.follows_you": "Seuraa sinua", "account.requested": "Odottaa hyväksyntää", - "getting_started.heading": "Päästä alkuun", + "getting_started.heading": "Aloitus", "getting_started.about_addressing": "Voit seurata ihmisiä jos tiedät heidän käyttäjänimensä ja domainin missä he ovat syöttämällä e-mail-esque osoitteen Etsi kenttään.", "getting_started.about_shortcuts": "Jos etsimäsi henkilö on samassa domainissa kuin sinä, pelkkä käyttäjänimi kelpaa. Sama pätee kun mainitset ihmisiä statuksessasi", "getting_started.open_source_notice": "Mastodon Mastodon on avoimen lähdekoodin ohjelma. Voit avustaa tai raportoida ongelmia githubissa {github}. {apps}.", -- cgit From dc89fc17cc35f8e1deaffb30ae581ac453a7a9fc Mon Sep 17 00:00:00 2001 From: JantsoP Date: Tue, 4 Apr 2017 08:29:53 +0200 Subject: updated translation --- config/locales/simple_form.fi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/simple_form.fi.yml b/config/locales/simple_form.fi.yml index 02c11752f..02943cea3 100644 --- a/config/locales/simple_form.fi.yml +++ b/config/locales/simple_form.fi.yml @@ -6,7 +6,7 @@ fi: avatar: PNG, GIF tai JPG. Korkeintaan 2MB. Skaalataan kokoon 120x120px display_name: Korkeintaan 30 merkkiä header: PNG, GIF tai JPG. Korkeintaan 2MB. Skaalataan kokoon 700x335px - locked: Vaatii sinun manuaalisesti hyväksymään seuraajat ja asettaa julkaisun yksityisyyden vain seuraajille + locked: Vaatii sinun manuaalisesti hyväksymään seuraajat ja asettaa julkaisujen yksityisyyden vain seuraajille note: Korkeintaan 160 merkkiä imports: data: CSV tiedosto tuotu toiselta Mastodon palvelimelta -- cgit From 10a8666e04c1a1b20481bd67fb47c760cf508d68 Mon Sep 17 00:00:00 2001 From: JantsoP Date: Tue, 4 Apr 2017 15:07:15 +0200 Subject: updated line 28 about GitHub --- app/assets/javascripts/components/locales/fi.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/components/locales/fi.jsx b/app/assets/javascripts/components/locales/fi.jsx index 39fa655e6..7b151d6f8 100644 --- a/app/assets/javascripts/components/locales/fi.jsx +++ b/app/assets/javascripts/components/locales/fi.jsx @@ -25,7 +25,7 @@ const fi = { "getting_started.heading": "Aloitus", "getting_started.about_addressing": "Voit seurata ihmisiä jos tiedät heidän käyttäjänimensä ja domainin missä he ovat syöttämällä e-mail-esque osoitteen Etsi kenttään.", "getting_started.about_shortcuts": "Jos etsimäsi henkilö on samassa domainissa kuin sinä, pelkkä käyttäjänimi kelpaa. Sama pätee kun mainitset ihmisiä statuksessasi", - "getting_started.open_source_notice": "Mastodon Mastodon on avoimen lähdekoodin ohjelma. Voit avustaa tai raportoida ongelmia githubissa {github}. {apps}.", + "getting_started.open_source_notice": "Mastodon Mastodon on avoimen lähdekoodin ohjelma. Voit avustaa tai raportoida ongelmia GitHub palvelussa {github}. {apps}.", "column.home": "Koti", "column.community": "Paikallinen aikajana", "column.public": "Yhdistetty aikajana", -- cgit From 665ec615e30274bc10307ba9e56d37e3f9836f03 Mon Sep 17 00:00:00 2001 From: Angristan Date: Tue, 4 Apr 2017 15:57:37 +0200 Subject: Missing quotes --- docs/Running-Mastodon/Production-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index 469fefa94..1fba2025b 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -132,7 +132,7 @@ Fill in the important data, like host/port of the redis database, host/port/user rake secret -To get a random string. If you are setting up on one single server (most likely), then REDIS_HOST is localhost and `DB_HOST` is `/var/run/postgresql`, `DB_USER` is `mastodon` and `DB_NAME` is `mastodon_production` while `DB_PASS` is empty because this setup will use the ident authentication method (system user "mastodon" maps to postgres user "mastodon"). +To get a random string. If you are setting up on one single server (most likely), then `REDIS_HOST` is localhost and `DB_HOST` is `/var/run/postgresql`, `DB_USER` is `mastodon` and `DB_NAME` is `mastodon_production` while `DB_PASS` is empty because this setup will use the ident authentication method (system user "mastodon" maps to postgres user "mastodon"). ## Setup -- cgit From 58bdb9b42ee90ca2723ac28c0f45af40df1c6383 Mon Sep 17 00:00:00 2001 From: Florian Maunier Date: Tue, 4 Apr 2017 16:03:05 +0200 Subject: Update List-of-Mastodon-instances.md Add my own instance --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 677ec7e56..5f8ef791c 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -37,5 +37,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [social.lkw.tf](https://social.lkw.tf)|N/A|No|No| | [manowar.social](https://manowar.social)|N/A|No|No| | [social.ballpointcarrot.net](https://social.ballpointcarrot.net)|Down at time of entry|No|No| +| [status.dissidence.ovh](https://status.dissidence.ovh)|N/A|Yes|Yes| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 192f079776322605accf81cb422ce1b0c7743247 Mon Sep 17 00:00:00 2001 From: Adam Thurlow Date: Tue, 4 Apr 2017 11:14:51 -0300 Subject: Add mastodon.club to running instances list --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 677ec7e56..380ff63c0 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -24,6 +24,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [social.imirhil.fr](https://social.imirhil.fr) |N/A|No|Yes| | [social.wxcafe.net](https://social.wxcafe.net) |Open registrations, federates everywhere, no moderation yet|Yes|Yes| | [octodon.social](https://octodon.social) |Open registrations, federates everywhere, cutest instance yet|Yes|Yes| +| [mastodon.club](https://mastodon.club)|Open Registration, Open Federation, Mostly Canadians|Yes|No| | [hostux.social](https://hostux.social) |N/A|Yes|Yes| | [social.alex73630.xyz](https://social.alex73630.xyz) |Francophones|Yes|Yes| | [maly.io](https://maly.io) |N/A|Yes|No| @@ -38,4 +39,5 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [manowar.social](https://manowar.social)|N/A|No|No| | [social.ballpointcarrot.net](https://social.ballpointcarrot.net)|Down at time of entry|No|No| + Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From d8855150a0dc46d4435d623c87e593b0e44a103c Mon Sep 17 00:00:00 2001 From: Jo Decker Date: Tue, 4 Apr 2017 15:29:07 +0100 Subject: Update social.diskseven.com's IPv6 status As far as I'm aware, my instance should be supporting IPv6 now. Was an error on my part that it wasn't working before. --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 677ec7e56..587e9d865 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -15,7 +15,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [gay.crime.team](https://gay.crime.team) |the place for doin' gay crime online (please don't actually do crime here)|Yes|No| | [icosahedron.website](https://icosahedron.website/) |Icosahedron-themed (well, visually), open registration.|Yes|No| | [memetastic.space](https://memetastic.space) |Memes|Yes|No| -| [social.diskseven.com](https://social.diskseven.com) |Single user|No|No (DNS entry but no response)| +| [social.diskseven.com](https://social.diskseven.com) |Single user|No|Yes| | [social.gestaltzerfall.net](https://social.gestaltzerfall.net) |Single user|No|No| | [mastodon.xyz](https://mastodon.xyz) |N/A|Yes|Yes| | [social.targaryen.house](https://social.targaryen.house) |Federates everywhere, quick updates.|Yes|Yes| -- cgit From e9a6da6bc739f4f68447f56b93810762da388ce8 Mon Sep 17 00:00:00 2001 From: Pete Keen Date: Tue, 4 Apr 2017 11:04:44 -0400 Subject: [#817] Add email whitelist This adds the ability to filter user signup with a whitelist instead of or in addition to a blacklist. Fixes #817 --- .env.production.sample | 2 ++ app/lib/email_validator.rb | 17 +++++++++++++++-- config/initializers/blacklists.rb | 1 + spec/models/user_spec.rb | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/.env.production.sample b/.env.production.sample index bd81b8fca..a7f9eb4bf 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -22,6 +22,8 @@ OTP_SECRET= # SINGLE_USER_MODE=true # Prevent registrations with following e-mail domains # EMAIL_DOMAIN_BLACKLIST=example1.com|example2.de|etc +# Only allow registrations with the following e-mail domains +# EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc # E-mail configuration SMTP_SERVER=smtp.mailgun.org diff --git a/app/lib/email_validator.rb b/app/lib/email_validator.rb index 856b8b1f7..06e9375f6 100644 --- a/app/lib/email_validator.rb +++ b/app/lib/email_validator.rb @@ -2,17 +2,30 @@ class EmailValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) - return if Rails.configuration.x.email_domains_blacklist.empty? - record.errors.add(attribute, I18n.t('users.invalid_email')) if blocked_email?(value) end private def blocked_email?(value) + on_blacklist?(value) || not_on_whitelist?(value) + end + + def on_blacklist?(value) + return false if Rails.configuration.x.email_domains_blacklist.blank? + domains = Rails.configuration.x.email_domains_blacklist.gsub('.', '\.') regexp = Regexp.new("@(.+\\.)?(#{domains})", true) value =~ regexp end + + def not_on_whitelist?(value) + return false if Rails.configuration.x.email_domains_whitelist.blank? + + domains = Rails.configuration.x.email_domains_whitelist.gsub('.', '\.') + regexp = Regexp.new("@(.+\\.)?(#{domains})", true) + + value !~ regexp + end end diff --git a/config/initializers/blacklists.rb b/config/initializers/blacklists.rb index 52646e64d..6db7be7dc 100644 --- a/config/initializers/blacklists.rb +++ b/config/initializers/blacklists.rb @@ -2,4 +2,5 @@ Rails.application.configure do config.x.email_domains_blacklist = ENV.fetch('EMAIL_DOMAIN_BLACKLIST') { 'mvrht.com' } + config.x.email_domains_whitelist = ENV.fetch('EMAIL_DOMAIN_WHITELIST') { '' } end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 64de06749..aa777fd39 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,5 +1,42 @@ require 'rails_helper' RSpec.describe User, type: :model do + let(:account) { Fabricate(:account, username: 'alice') } + let(:password) { 'abcd1234' } + describe 'blacklist' do + it 'should allow a non-blacklisted user to be created' do + user = User.new(email: 'foo@example.com', account: account, password: password) + + expect(user.valid?).to be_truthy + end + + it 'should not allow a blacklisted user to be created' do + user = User.new(email: 'foo@mvrht.com', account: account, password: password) + + expect(user.valid?).to be_falsey + end + end + + describe 'whitelist' do + around(:each) do |example| + old_whitelist = Rails.configuration.x.email_whitelist + + Rails.configuration.x.email_domains_whitelist = 'mastodon.space' + + example.run + + Rails.configuration.x.email_domains_whitelist = old_whitelist + end + + it 'should not allow a user to be created unless they are whitelisted' do + user = User.new(email: 'foo@example.com', account: account, password: password) + expect(user.valid?).to be_falsey + end + + it 'should allow a user to be created if they are whitelisted' do + user = User.new(email: 'foo@mastodon.space', account: account, password: password) + expect(user.valid?).to be_truthy + end + end end -- cgit From 2fcf8d79ad3e7051e0089741ed00ec0eff0de637 Mon Sep 17 00:00:00 2001 From: Angristan Date: Tue, 4 Apr 2017 17:23:56 +0200 Subject: Fix crontab edit Missing -u parameter to specify the mastodon user. --- docs/Running-Mastodon/Production-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index 469fefa94..2c8db20b7 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -221,7 +221,7 @@ I recommend creating a couple cronjobs for the following tasks: You may want to run `which bundle` first and copypaste that full path instead of simply `bundle` in the above commands because cronjobs usually don't have all the paths set. The time and intervals of when to run these jobs are up to you, but once every day should be enough for all. -You can edit the cronjob file for the `mastodon` user by running `sudo crontab -e mastodon` (outside of the mastodon user). +You can edit the cronjob file for the `mastodon` user by running `sudo crontab -e -u mastodon` (outside of the mastodon user). ## Things to look out for when upgrading Mastodon -- cgit From 731e650681004bcb8ad11d610e017975a706f57d Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 09:04:07 -0700 Subject: Use active record shorthand --- app/lib/feed_manager.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index a2efcce10..9398d6c70 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -118,7 +118,7 @@ class FeedManager def filter_from_mentions?(status, receiver) check_for_blocks = [status.account_id] - check_for_blocks.concat(status.mentions.select('account_id').map(&:account_id)) + check_for_blocks.concat(status.mentions.pluck(:account_id)) check_for_blocks.concat([status.in_reply_to_account]) if status.reply? && !status.in_reply_to_account_id.nil? should_filter = receiver.id == status.account_id # Filter if I'm mentioning myself -- cgit From 7015578655553b89e0184e6fe10b88075f4d8446 Mon Sep 17 00:00:00 2001 From: Sébastien Santoro Date: Tue, 4 Apr 2017 18:11:14 +0200 Subject: Add social.nasqueron.org instance --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 677ec7e56..d971147b6 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -37,5 +37,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [social.lkw.tf](https://social.lkw.tf)|N/A|No|No| | [manowar.social](https://manowar.social)|N/A|No|No| | [social.ballpointcarrot.net](https://social.ballpointcarrot.net)|Down at time of entry|No|No| +| [social.nasqueron.org](https://social.nasqueron.org) |Dreamers, open source developers, free culture|Yes|Yes| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 22000ef7a91f00058b69e26a0bac0298966d4cf7 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 4 Apr 2017 18:11:41 +0200 Subject: Add oc.todon.fr to the list of instances. [SKIP CI] --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 677ec7e56..39f51cff6 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -26,6 +26,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [octodon.social](https://octodon.social) |Open registrations, federates everywhere, cutest instance yet|Yes|Yes| | [hostux.social](https://hostux.social) |N/A|Yes|Yes| | [social.alex73630.xyz](https://social.alex73630.xyz) |Francophones|Yes|Yes| +| [oc.todon.fr](https://oc.todon.fr) |Modérée et principalement francophone, pas de tolérances pour misogynie/LGBTphobies/validisme/etc.|Yes|Yes| | [maly.io](https://maly.io) |N/A|Yes|No| | [social.lou.lt](https://social.lou.lt) |N/A|Yes|No| | [mastodon.ninetailed.uk](https://mastodon.ninetailed.uk) |N/A|Yes|No| -- cgit From 41ba74b511916330771c097cd74f3bc07801291f Mon Sep 17 00:00:00 2001 From: Pierre Ozoux Date: Tue, 4 Apr 2017 17:28:29 +0100 Subject: Update the list of instances --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 677ec7e56..b0c9c58fd 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -7,19 +7,17 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | -------------|-------------|---|---| | [mastodon.social](https://mastodon.social) |Flagship, quick updates|Yes|No| | [awoo.space](https://awoo.space) |Intentionally moderated, only federates with mastodon.social|Yes|No| -| [social.tchncs.de](https://social.tchncs.de)|N/A|Yes|No| | [animalliberation.social](https://animalliberation.social) |Animal Rights|Yes|No| | [socially.constructed.space](https://socially.constructed.space) |Single user|No|No| | [epiktistes.com](https://epiktistes.com) |N/A|Yes|No| | [fern.surgeplay.com](https://fern.surgeplay.com) |Federates everywhere, Minecraft-focused|Yes|No -| [gay.crime.team](https://gay.crime.team) |the place for doin' gay crime online (please don't actually do crime here)|Yes|No| +| [gay.crime.team](https://gay.crime.team) |the place for doin' gay crime online (please don't actually do crime here)|No|No| | [icosahedron.website](https://icosahedron.website/) |Icosahedron-themed (well, visually), open registration.|Yes|No| | [memetastic.space](https://memetastic.space) |Memes|Yes|No| | [social.diskseven.com](https://social.diskseven.com) |Single user|No|No (DNS entry but no response)| | [social.gestaltzerfall.net](https://social.gestaltzerfall.net) |Single user|No|No| | [mastodon.xyz](https://mastodon.xyz) |N/A|Yes|Yes| | [social.targaryen.house](https://social.targaryen.house) |Federates everywhere, quick updates.|Yes|Yes| -| [social.mashek.net](https://social.mashek.net) |Themed and customised for Mashekstein Labs community. Selectively federates.|Yes|No| | [masto.themimitoof.fr](https://masto.themimitoof.fr) |N/A|Yes|Yes| | [social.imirhil.fr](https://social.imirhil.fr) |N/A|No|Yes| | [social.wxcafe.net](https://social.wxcafe.net) |Open registrations, federates everywhere, no moderation yet|Yes|Yes| @@ -36,6 +34,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [share.elouworld.org](https://share.elouworld.org)|N/A|No|No| | [social.lkw.tf](https://social.lkw.tf)|N/A|No|No| | [manowar.social](https://manowar.social)|N/A|No|No| -| [social.ballpointcarrot.net](https://social.ballpointcarrot.net)|Down at time of entry|No|No| +| [social.ballpointcarrot.net](https://social.ballpointcarrot.net)|N/A|No|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 9a5d6e97150c0c1ab0f402e121d7dbafdd46998e Mon Sep 17 00:00:00 2001 From: "Thibaut (Eychics)" Date: Tue, 4 Apr 2017 18:58:19 +0200 Subject: Add closed_registrations message on French language --- config/locales/fr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 758501403..e9989e383 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -5,6 +5,7 @@ fr: about_this: À propos de cette instance apps: Applications business_email: E-mail professionnel + closed_registrations: Les inscriptions sont actuellement fermées sur cette instance. . description_headline: Qu'est-ce que %{domain} ? domain_count_after: autres instances domain_count_before: Connectés à -- cgit From 350958babfe9473ec362f6693abbcc4137b5ace4 Mon Sep 17 00:00:00 2001 From: Clément D Date: Tue, 4 Apr 2017 19:09:54 +0200 Subject: Fix typos on french translations --- config/locales/doorkeeper.fr.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/locales/doorkeeper.fr.yml b/config/locales/doorkeeper.fr.yml index c94e5c095..be109df9c 100644 --- a/config/locales/doorkeeper.fr.yml +++ b/config/locales/doorkeeper.fr.yml @@ -62,7 +62,7 @@ fr: buttons: revoke: Annuler confirmations: - revoke: Êtes-vous certain? + revoke: Êtes-vous certain ? index: application: Application created_at: Créé le @@ -72,19 +72,19 @@ fr: errors: messages: access_denied: Le propriétaire de la ressource ou le serveur d'autorisation a refusé la demande. - credential_flow_not_configured: Le flux des identifiants du mot de passe du propriétaire de la ressource a échoué en raison de Doorkeeper.configure.resource_owner_from_credentials n'est pas configuré. + credential_flow_not_configured: Le flux des identifiants du mot de passe du propriétaire de la ressource a échoué car Doorkeeper.configure.resource_owner_from_credentials n'est pas configuré. invalid_client: L'authentification du client a échoué à cause d'un client inconnu, d'aucune authentification de client incluse, ou d'une méthode d'authentification non prise en charge. invalid_grant: Le consentement d'autorisation accordé n'est pas valide, a expiré, est annulé, ne concorde pas avec l'URL de redirection utilisée dans la demande d'autorisation, ou a été émis à un autre client. invalid_redirect_uri: L'URL de redirection n'est pas valide. invalid_request: La demande manque un paramètre requis, inclut une valeur de paramètre non prise en charge, ou est autrement mal formée. - invalid_resource_owner: Les identifiants fournis du propriétaire de la ressource ne sont pas valides, ou le propriétaire de la ressource ne peut être trouvé + invalid_resource_owner: Les identifiants fournis par le propriétaire de la ressource ne sont pas valides, ou le propriétaire de la ressource ne peut être trouvé invalid_scope: La portée demandée n'est pas valide, est inconnue, ou est mal formée. invalid_token: expired: Le jeton d'accès a expiré revoked: Le jeton d'accès a été révoqué unknown: Le jeton d'accès n'est pas valide - resource_owner_authenticator_not_configured: La recherche du propriétaire de la ressource a échoué en raison de Doorkeeper.configure.resource_owner_authenticator n'est pas configuré. - server_error: Le serveur d'autorisation a rencontré une condition inattendue qui l'a empêché de remplir la demande. + resource_owner_authenticator_not_configured: La recherche du propriétaire de la ressource a échoué car Doorkeeper.configure.resource_owner_authenticator n'est pas configuré. + server_error: Le serveur d'autorisation a rencontré une condition inattendue l'empêchant de remplir la demande. temporarily_unavailable: Le serveur d'autorisation est actuellement incapable de traiter la demande à cause d'une surcharge ou d'un entretien temporaire du serveur. unauthorized_client: Le client n'est pas autorisé à effectuer cette demande à l'aide de cette méthode. unsupported_grant_type: Le type de consentement d'autorisation n'est pas pris en charge par le serveur d'autorisation. -- cgit From 6091b9b1a965ae5c1751627ee29c7db95643fcfe Mon Sep 17 00:00:00 2001 From: Angristan Date: Tue, 4 Apr 2017 19:23:53 +0200 Subject: Add file package If the file package is not installed, we get "Validation failed: File has contents that are not what they are reported to be" when upload media. --- docs/Running-Mastodon/Production-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index 469fefa94..a70f174d4 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -76,7 +76,7 @@ It is recommended to create a special user for mastodon on the server (you could ## General dependencies curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - - sudo apt-get install imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev nodejs + sudo apt-get install imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev nodejs file sudo npm install -g yarn ## Redis -- cgit From dcda852b5ff8cc894b384c30f69d66990ee61993 Mon Sep 17 00:00:00 2001 From: Nope Nope Date: Tue, 4 Apr 2017 20:45:32 +0200 Subject: typo in admin doc s/rails/rake/ --- docs/Running-Mastodon/Administration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Administration-guide.md b/docs/Running-Mastodon/Administration-guide.md index af78f6235..dd69eb303 100644 --- a/docs/Running-Mastodon/Administration-guide.md +++ b/docs/Running-Mastodon/Administration-guide.md @@ -7,7 +7,7 @@ So, you have a working Mastodon instance... now what? The following rake task: - rails mastodon:make_admin USERNAME=alice + rake mastodon:make_admin USERNAME=alice Would turn the local user "alice" into an admin. -- cgit From 8736ef50ad13d5506bd6a673d4fcb96c33b609a3 Mon Sep 17 00:00:00 2001 From: axolotl Date: Tue, 4 Apr 2017 20:54:42 +0200 Subject: Added Esperanto translation inside the javascripts folder --- .../javascripts/components/containers/mastodon.jsx | 3 +- app/assets/javascripts/components/locales/eo.jsx | 68 ++++++++++++++++++++++ .../javascripts/components/locales/index.jsx | 4 +- 3 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 app/assets/javascripts/components/locales/eo.jsx diff --git a/app/assets/javascripts/components/containers/mastodon.jsx b/app/assets/javascripts/components/containers/mastodon.jsx index 6dc08bb4c..2861c64e4 100644 --- a/app/assets/javascripts/components/containers/mastodon.jsx +++ b/app/assets/javascripts/components/containers/mastodon.jsx @@ -46,6 +46,7 @@ import fr from 'react-intl/locale-data/fr'; import pt from 'react-intl/locale-data/pt'; import hu from 'react-intl/locale-data/hu'; import uk from 'react-intl/locale-data/uk'; +import eo from 'react-intl/locale-data/eo'; import getMessagesForLocale from '../locales'; import { hydrateStore } from '../actions/store'; import createStream from '../stream'; @@ -58,7 +59,7 @@ const browserHistory = useRouterHistory(createBrowserHistory)({ basename: '/web' }); -addLocaleData([...en, ...de, ...es, ...fr, ...pt, ...hu, ...uk]); +addLocaleData([...en, ...de, ...es, ...fr, ...pt, ...hu, ...uk, ...eo]); const Mastodon = React.createClass({ diff --git a/app/assets/javascripts/components/locales/eo.jsx b/app/assets/javascripts/components/locales/eo.jsx new file mode 100644 index 000000000..8c118b31f --- /dev/null +++ b/app/assets/javascripts/components/locales/eo.jsx @@ -0,0 +1,68 @@ +const eo = { + "column_back_button.label": "Reveni", + "lightbox.close": "Fermi", + "loading_indicator.label": "Ŝarĝanta...", + "status.mention": "Mencii @{name}", + "status.delete": "Forigi", + "status.reply": "Respondi", + "status.reblog": "Diskonigi", + "status.favourite": "Favori", + "status.reblogged_by": "{name} diskonigita", + "status.sensitive_warning": "Tikla enhavo", + "status.sensitive_toggle": "Alklaki por vidi", + "video_player.toggle_sound": "Aktivigi sonojn", + "account.mention": "Mencii @{name}", + "account.edit_profile": "Redakti la profilon", + "account.unblock": "Malbloki @{name}", + "account.unfollow": "Malsekvi", + "account.block": "Bloki @{name}", + "account.follow": "Sekvi", + "account.posts": "Mesaĝoj", + "account.follows": "Sekvatoj", + "account.followers": "Sekvantoj", + "account.follows_you": "Sekvas vin", + "account.requested": "Atendas aprobon", + "getting_started.heading": "Por komenci", + "getting_started.about_addressing": "Vi povas sekvi homojn se vi konas la uzantnomon kaj domajnon tajpinte retpoŝtecan adreson en la serĉilon.", + "getting_started.about_shortcuts": "Se la celita uzanto troviĝas en la sama domajno de vi, uzi nur la uzantnomon sufiĉos. La sama regulo validas por mencii aliajn uzantojn en mesaĝo.", + "getting_started.open_source_notice": "Mastodon estas malfermitkoda programo. Vi povas kontribui aŭ raporti problemojn en github je {github}. {apps}.", + "column.home": "Hejmo", + "column.community": "Loka tempolinio", + "column.public": "Fratara tempolinio", + "column.notifications": "Sciigoj", + "tabs_bar.compose": "Ekskribi", + "tabs_bar.home": "Hejmo", + "tabs_bar.mentions": "Sciigoj", + "tabs_bar.public": "Fratara tempolinio", + "tabs_bar.notifications": "Sciigoj", + "compose_form.placeholder": "Pri kio vi pensas?", + "compose_form.publish": "Hup", + "compose_form.sensitive": "Marki ke la enhavo estas tikla", + "compose_form.spoiler": "Kaŝi la tekston malantaŭ averto", + "compose_form.private": "Marki ke la enhavo estas privata", + "compose_form.privacy_disclaimer": "Via privata mesaĝo estos sendita nur al menciitaj uzantoj en {domains}. Ĉu vi fidas {domainsCount, plural, one {tiun servilon} other {tiujn servilojn}}? Mesaĝa privateco funkcias nur en aperaĵoj de Mastodon. Se {domains} {domainsCount, plural, one {ne estas aperaĵo de Mastodon} other {ne estas aperaĵoj de Mastodon}}, estos neniu indiko ke via mesaĝo estas privata, kaj ĝi povus esti diskonigita aŭ videbligita al necelitaj ricevantoj.", + "compose_form.unlisted": "Ne afiŝi en publikaj tempolinioj", + "navigation_bar.edit_profile": "Redakti la profilon", + "navigation_bar.preferences": "Preferoj", + "navigation_bar.community_timeline": "Loka tempolinio", + "navigation_bar.public_timeline": "Fratara tempolinio", + "navigation_bar.logout": "Elsaluti", + "reply_indicator.cancel": "Rezigni", + "search.placeholder": "Serĉi", + "search.account": "Konto", + "search.hashtag": "Kradvorto", + "upload_button.label": "Aldoni enhavaĵon", + "upload_form.undo": "Malfari", + "notification.follow": "{name} sekvis vin", + "notification.favourite": "{name} favoris vian mesaĝon", + "notification.reblog": "{name} diskonigis vian mesaĝon", + "notification.mention": "{name} menciis vin", + "notifications.column_settings.alert": "Retumilaj atentigoj", + "notifications.column_settings.show": "Montri en kolono", + "notifications.column_settings.follow": "Novaj sekvantoj:", + "notifications.column_settings.favourite": "Favoroj:", + "notifications.column_settings.mention": "Mencioj:", + "notifications.column_settings.reblog": "Diskonigoj:", +}; + +export default eo; diff --git a/app/assets/javascripts/components/locales/index.jsx b/app/assets/javascripts/components/locales/index.jsx index 203929d66..255172f1e 100644 --- a/app/assets/javascripts/components/locales/index.jsx +++ b/app/assets/javascripts/components/locales/index.jsx @@ -5,6 +5,7 @@ import hu from './hu'; import fr from './fr'; import pt from './pt'; import uk from './uk'; +import eo from './eo'; const locales = { en, @@ -13,7 +14,8 @@ const locales = { hu, fr, pt, - uk + uk, + eo }; export default function getMessagesForLocale (locale) { -- cgit From 1e5a1b9abd9dca06e19651f80923249b09bcc847 Mon Sep 17 00:00:00 2001 From: Udo Kramer Date: Tue, 4 Apr 2017 23:45:29 +0200 Subject: Update Production-guide.md --- docs/Running-Mastodon/Production-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index 469fefa94..ffe42b411 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -112,7 +112,7 @@ Then once `rbenv` is ready, run `rbenv install 2.3.1` to install the Ruby versio You need the `git-core` package installed on your system. If it is so, from the `mastodon` user: cd ~ - git clone https://github.com/Gargron/mastodon.git live + git clone https://github.com/tootsuite/mastodon.git live cd live Then you can proceed to install project dependencies: -- cgit From 81c76fe375d9342e5a436db05c8e25305c650e8d Mon Sep 17 00:00:00 2001 From: Samy KACIMI Date: Wed, 5 Apr 2017 00:29:56 +0200 Subject: add more tests to models --- Gemfile | 1 + Gemfile.lock | 3 + app/models/block.rb | 5 +- app/models/follow.rb | 9 ++- app/models/follow_request.rb | 5 +- app/models/mention.rb | 5 +- config/database.yml | 4 ++ spec/fabricators/account_fabricator.rb | 2 +- spec/fabricators/block_fabricator.rb | 3 +- spec/fabricators/follow_fabricator.rb | 3 +- spec/fabricators/follow_request_fabricator.rb | 3 +- spec/fabricators/mention_fabricator.rb | 4 ++ spec/fabricators/user_fabricator.rb | 2 +- spec/models/account_spec.rb | 69 ++++++++++++++++++++++ spec/models/block_spec.rb | 17 ++++++ spec/models/domain_block_spec.rb | 18 ++++++ spec/models/follow_request_spec.rb | 19 ++++++ spec/models/follow_spec.rb | 19 ++++++ spec/models/mention_spec.rb | 17 ++++++ spec/models/user_spec.rb | 44 ++++++++++++++ spec/rails_helper.rb | 2 + .../matchers/model/model_have_error_on_field.rb | 15 +++++ 22 files changed, 252 insertions(+), 17 deletions(-) create mode 100644 spec/fabricators/mention_fabricator.rb create mode 100644 spec/support/matchers/model/model_have_error_on_field.rb diff --git a/Gemfile b/Gemfile index 4c6314763..87ea77735 100644 --- a/Gemfile +++ b/Gemfile @@ -70,6 +70,7 @@ group :test do gem 'simplecov', require: false gem 'webmock' gem 'rspec-sidekiq' + gem 'faker' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 26c7b9962..a774a89ba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -149,6 +149,8 @@ GEM erubis (2.7.0) execjs (2.7.0) fabrication (2.15.2) + faker (1.6.6) + i18n (~> 0.5) fast_blank (1.0.0) font-awesome-rails (4.6.3.1) railties (>= 3.2, < 5.1) @@ -470,6 +472,7 @@ DEPENDENCIES doorkeeper dotenv-rails fabrication + faker fast_blank font-awesome-rails fuubar diff --git a/app/models/block.rb b/app/models/block.rb index 9c55703c9..ae456a6b6 100644 --- a/app/models/block.rb +++ b/app/models/block.rb @@ -3,9 +3,8 @@ class Block < ApplicationRecord include Paginable - belongs_to :account - belongs_to :target_account, class_name: 'Account' + belongs_to :account, required: true + belongs_to :target_account, class_name: 'Account', required: true - validates :account, :target_account, presence: true validates :account_id, uniqueness: { scope: :target_account_id } end diff --git a/app/models/follow.rb b/app/models/follow.rb index 8bfe8b2f6..fd7325f05 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -3,11 +3,14 @@ class Follow < ApplicationRecord include Paginable - belongs_to :account, counter_cache: :following_count - belongs_to :target_account, class_name: 'Account', counter_cache: :followers_count + belongs_to :account, counter_cache: :following_count, required: true + + belongs_to :target_account, + class_name: 'Account', + counter_cache: :followers_count, + required: true has_one :notification, as: :activity, dependent: :destroy - validates :account, :target_account, presence: true validates :account_id, uniqueness: { scope: :target_account_id } end diff --git a/app/models/follow_request.rb b/app/models/follow_request.rb index 4224ab15d..20e1332dd 100644 --- a/app/models/follow_request.rb +++ b/app/models/follow_request.rb @@ -3,12 +3,11 @@ class FollowRequest < ApplicationRecord include Paginable - belongs_to :account - belongs_to :target_account, class_name: 'Account' + belongs_to :account, required: true + belongs_to :target_account, class_name: 'Account', required: true has_one :notification, as: :activity, dependent: :destroy - validates :account, :target_account, presence: true validates :account_id, uniqueness: { scope: :target_account_id } def authorize! diff --git a/app/models/mention.rb b/app/models/mention.rb index 10a9cb1cd..03e76fcc4 100644 --- a/app/models/mention.rb +++ b/app/models/mention.rb @@ -1,11 +1,10 @@ # frozen_string_literal: true class Mention < ApplicationRecord - belongs_to :account, inverse_of: :mentions - belongs_to :status + belongs_to :account, inverse_of: :mentions, required: true + belongs_to :status, required: true has_one :notification, as: :activity, dependent: :destroy - validates :account, :status, presence: true validates :account, uniqueness: { scope: :status } end diff --git a/config/database.yml b/config/database.yml index 5ec342f93..390113480 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,6 +3,10 @@ default: &default pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %> timeout: 5000 encoding: unicode + host: localhost + username: samy + password: tardis + port: 32769 development: <<: *default diff --git a/spec/fabricators/account_fabricator.rb b/spec/fabricators/account_fabricator.rb index 3a7c00bf5..567de05f4 100644 --- a/spec/fabricators/account_fabricator.rb +++ b/spec/fabricators/account_fabricator.rb @@ -1,3 +1,3 @@ Fabricator(:account) do - username "alice" + username { Faker::Internet.user_name(nil, %w(_)) } end diff --git a/spec/fabricators/block_fabricator.rb b/spec/fabricators/block_fabricator.rb index 9a5a6808f..379931ba6 100644 --- a/spec/fabricators/block_fabricator.rb +++ b/spec/fabricators/block_fabricator.rb @@ -1,3 +1,4 @@ Fabricator(:block) do - + account + target_account { Fabricate(:account) } end diff --git a/spec/fabricators/follow_fabricator.rb b/spec/fabricators/follow_fabricator.rb index 9d9d06f12..9b25dc547 100644 --- a/spec/fabricators/follow_fabricator.rb +++ b/spec/fabricators/follow_fabricator.rb @@ -1,3 +1,4 @@ Fabricator(:follow) do - + account + target_account { Fabricate(:account) } end diff --git a/spec/fabricators/follow_request_fabricator.rb b/spec/fabricators/follow_request_fabricator.rb index 9c3733cef..78a057919 100644 --- a/spec/fabricators/follow_request_fabricator.rb +++ b/spec/fabricators/follow_request_fabricator.rb @@ -1,3 +1,4 @@ Fabricator(:follow_request) do - + account + target_account { Fabricate(:account) } end diff --git a/spec/fabricators/mention_fabricator.rb b/spec/fabricators/mention_fabricator.rb new file mode 100644 index 000000000..cb5fe4299 --- /dev/null +++ b/spec/fabricators/mention_fabricator.rb @@ -0,0 +1,4 @@ +Fabricator(:mention) do + account + status +end diff --git a/spec/fabricators/user_fabricator.rb b/spec/fabricators/user_fabricator.rb index c08559137..16b3b1f6f 100644 --- a/spec/fabricators/user_fabricator.rb +++ b/spec/fabricators/user_fabricator.rb @@ -1,6 +1,6 @@ Fabricator(:user) do account - email "alice@example.com" + email { Faker::Internet.email } password "123456789" confirmed_at { Time.now } end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 91c8d75cf..fbc9a7d40 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -209,4 +209,73 @@ RSpec.describe Account, type: :model do expect(subject.match('Check this out https://medium.com/@alice/some-article#.abcdef123')).to be_nil end end + + describe 'validations' do + it 'has a valid fabricator' do + account = Fabricate.build(:account) + account.valid? + expect(account).to be_valid + end + + it 'is invalid without a username' do + account = Fabricate.build(:account, username: nil) + account.valid? + expect(account).to model_have_error_on_field(:username) + end + + it 'is invalid is the username already exists' do + account_1 = Fabricate(:account, username: 'the_doctor') + account_2 = Fabricate.build(:account, username: 'the_doctor') + account_2.valid? + expect(account_2).to model_have_error_on_field(:username) + end + + context 'when is local' do + it 'is invalid if the username doesn\'t only contains letters, numbers and underscores' do + account = Fabricate.build(:account, username: 'the-doctor') + account.valid? + expect(account).to model_have_error_on_field(:username) + end + + it 'is invalid if the username is longer then 30 characters' do + account = Fabricate.build(:account, username: Faker::Lorem.characters(31)) + account.valid? + expect(account).to model_have_error_on_field(:username) + end + end + end + + describe 'scopes' do + describe 'remote' do + it 'returns an array of accounts who have a domain' do + account_1 = Fabricate(:account, domain: nil) + account_2 = Fabricate(:account, domain: 'example.com') + expect(Account.remote).to match_array([account_2]) + end + end + + describe 'local' do + it 'returns an array of accounts who do not have a domain' do + account_1 = Fabricate(:account, domain: nil) + account_2 = Fabricate(:account, domain: 'example.com') + expect(Account.local).to match_array([account_1]) + end + end + + describe 'silenced' do + it 'returns an array of accounts who are silenced' do + account_1 = Fabricate(:account, silenced: true) + account_2 = Fabricate(:account, silenced: false) + expect(Account.silenced).to match_array([account_1]) + end + end + + describe 'suspended' do + it 'returns an array of accounts who are suspended' do + account_1 = Fabricate(:account, suspended: true) + account_2 = Fabricate(:account, suspended: false) + expect(Account.suspended).to match_array([account_1]) + end + end + end end diff --git a/spec/models/block_spec.rb b/spec/models/block_spec.rb index 6862de6fc..cabb41c3e 100644 --- a/spec/models/block_spec.rb +++ b/spec/models/block_spec.rb @@ -1,5 +1,22 @@ require 'rails_helper' RSpec.describe Block, type: :model do + describe 'validations' do + it 'has a valid fabricator' do + block = Fabricate.build(:block) + expect(block).to be_valid + end + it 'is invalid without an account' do + block = Fabricate.build(:block, account: nil) + block.valid? + expect(block).to model_have_error_on_field(:account) + end + + it 'is invalid without a target_account' do + block = Fabricate.build(:block, target_account: nil) + block.valid? + expect(block).to model_have_error_on_field(:target_account) + end + end end diff --git a/spec/models/domain_block_spec.rb b/spec/models/domain_block_spec.rb index ad5403110..b19c8083e 100644 --- a/spec/models/domain_block_spec.rb +++ b/spec/models/domain_block_spec.rb @@ -1,5 +1,23 @@ require 'rails_helper' RSpec.describe DomainBlock, type: :model do + describe 'validations' do + it 'has a valid fabricator' do + domain_block = Fabricate.build(:domain_block) + expect(domain_block).to be_valid + end + it 'is invalid without a domain' do + domain_block = Fabricate.build(:domain_block, domain: nil) + domain_block.valid? + expect(domain_block).to model_have_error_on_field(:domain) + end + + it 'is invalid if the domain already exists' do + domain_block_1 = Fabricate(:domain_block, domain: 'dalek.com') + domain_block_2 = Fabricate.build(:domain_block, domain: 'dalek.com') + domain_block_2.valid? + expect(domain_block_2).to model_have_error_on_field(:domain) + end + end end diff --git a/spec/models/follow_request_spec.rb b/spec/models/follow_request_spec.rb index f2ec642d8..cc6f8ee62 100644 --- a/spec/models/follow_request_spec.rb +++ b/spec/models/follow_request_spec.rb @@ -3,4 +3,23 @@ require 'rails_helper' RSpec.describe FollowRequest, type: :model do describe '#authorize!' describe '#reject!' + + describe 'validations' do + it 'has a valid fabricator' do + follow_request = Fabricate.build(:follow_request) + expect(follow_request).to be_valid + end + + it 'is invalid without an account' do + follow_request = Fabricate.build(:follow_request, account: nil) + follow_request.valid? + expect(follow_request).to model_have_error_on_field(:account) + end + + it 'is invalid without a target account' do + follow_request = Fabricate.build(:follow_request, target_account: nil) + follow_request.valid? + expect(follow_request).to model_have_error_on_field(:target_account) + end + end end diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index eb21f3e18..0fae25352 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -5,4 +5,23 @@ RSpec.describe Follow, type: :model do let(:bob) { Fabricate(:account, username: 'bob') } subject { Follow.new(account: alice, target_account: bob) } + + describe 'validations' do + it 'has a valid fabricator' do + follow = Fabricate.build(:follow) + expect(follow).to be_valid + end + + it 'is invalid without an account' do + follow = Fabricate.build(:follow, account: nil) + follow.valid? + expect(follow).to model_have_error_on_field(:account) + end + + it 'is invalid without a target_account' do + follow = Fabricate.build(:follow, target_account: nil) + follow.valid? + expect(follow).to model_have_error_on_field(:target_account) + end + end end diff --git a/spec/models/mention_spec.rb b/spec/models/mention_spec.rb index 5c91fda02..dbcf6a32c 100644 --- a/spec/models/mention_spec.rb +++ b/spec/models/mention_spec.rb @@ -1,5 +1,22 @@ require 'rails_helper' RSpec.describe Mention, type: :model do + describe 'validations' do + it 'has a valid fabricator' do + mention = Fabricate.build(:mention) + expect(mention).to be_valid + end + it 'is invalid without an account' do + mention = Fabricate.build(:mention, account: nil) + mention.valid? + expect(mention).to model_have_error_on_field(:account) + end + + it 'is invalid without a status' do + mention = Fabricate.build(:mention, status: nil) + mention.valid? + expect(mention).to model_have_error_on_field(:status) + end + end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 64de06749..1a3254185 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,5 +1,49 @@ require 'rails_helper' RSpec.describe User, type: :model do + describe 'validations' do + it 'is invalid without an account' do + user = Fabricate.build(:user, account: nil) + user.valid? + expect(user).to model_have_error_on_field(:account) + end + it 'is invalid without a valid locale' do + user = Fabricate.build(:user, locale: 'toto') + user.valid? + expect(user).to model_have_error_on_field(:locale) + end + + it 'is invalid without a valid email' do + user = Fabricate.build(:user, email: 'john@') + user.valid? + expect(user).to model_have_error_on_field(:email) + end + end + + describe 'scopes' do + describe 'recent' do + it 'returns an array of recent users ordered by id' do + user_1 = Fabricate(:user) + user_2 = Fabricate(:user) + expect(User.recent).to match_array([user_2, user_1]) + end + end + + describe 'admins' do + it 'returns an array of users who are admin' do + user_1 = Fabricate(:user, admin: false) + user_2 = Fabricate(:user, admin: true) + expect(User.admins).to match_array([user_2]) + end + end + + describe 'confirmed' do + it 'returns an array of users who are confirmed' do + user_1 = Fabricate(:user, confirmed_at: nil) + user_2 = Fabricate(:user, confirmed_at: Time.now) + expect(User.confirmed).to match_array([user_2]) + end + end + end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 977c7bdc0..faac96982 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -8,6 +8,8 @@ require 'rspec/rails' require 'webmock/rspec' require 'paperclip/matchers' +Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } + ActiveRecord::Migration.maintain_test_schema! WebMock.disable_net_connect!(allow: 'localhost:7575') Sidekiq::Testing.inline! diff --git a/spec/support/matchers/model/model_have_error_on_field.rb b/spec/support/matchers/model/model_have_error_on_field.rb new file mode 100644 index 000000000..5d5fe1c7b --- /dev/null +++ b/spec/support/matchers/model/model_have_error_on_field.rb @@ -0,0 +1,15 @@ +RSpec::Matchers.define :model_have_error_on_field do |expected| + match do |record| + if record.errors.empty? + record.valid? + end + + record.errors.has_key?(expected) + end + + failure_message do |record| + keys = record.errors.keys + + "expect record.errors(#{keys}) to include #{expected}" + end +end -- cgit From 7762467b476af5c793d214ebc051b983921492b7 Mon Sep 17 00:00:00 2001 From: Samy KACIMI Date: Wed, 5 Apr 2017 00:31:31 +0200 Subject: rollback database.yml update --- config/database.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/database.yml b/config/database.yml index 390113480..5ec342f93 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,10 +3,6 @@ default: &default pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %> timeout: 5000 encoding: unicode - host: localhost - username: samy - password: tardis - port: 32769 development: <<: *default -- cgit From 46c0e8b0e7980ecba0e68fe3b8c4d9121caa4b6f Mon Sep 17 00:00:00 2001 From: Samy KACIMI Date: Wed, 5 Apr 2017 00:37:23 +0200 Subject: update account_spec --- spec/models/account_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index fbc9a7d40..d7f59adb8 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -223,7 +223,7 @@ RSpec.describe Account, type: :model do expect(account).to model_have_error_on_field(:username) end - it 'is invalid is the username already exists' do + it 'is invalid if the username already exists' do account_1 = Fabricate(:account, username: 'the_doctor') account_2 = Fabricate.build(:account, username: 'the_doctor') account_2.valid? -- cgit From 04225ed72e4778c62c78af183f7110c667f1b667 Mon Sep 17 00:00:00 2001 From: Ash Furrow Date: Tue, 4 Apr 2017 18:45:24 -0400 Subject: Adds instructions for adding admin users. --- docs/Running-Mastodon/Heroku-guide.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Running-Mastodon/Heroku-guide.md b/docs/Running-Mastodon/Heroku-guide.md index b66e56200..cd92a8bfd 100644 --- a/docs/Running-Mastodon/Heroku-guide.md +++ b/docs/Running-Mastodon/Heroku-guide.md @@ -11,3 +11,5 @@ Mastodon can theoretically run indefinitely on a free [Heroku](https://heroku.co * You will want Amazon S3 for file storage. The only exception is for development purposes, where you may not care if files are not saved. Follow a guide online for creating a free Amazon S3 bucket and Access Key, then enter the details. * If you want your Mastodon to be able to send emails, configure SMTP settings here (or later). Consider using [Mailgun](https://mailgun.com) or similar, who offer free plans that should suit your interests. 3. Deploy! The app should be set up, with a working web interface and database. You can change settings and manage versions from the Heroku dashboard. + +You may need to use the `heroku` CLI application to modify the database directly to give yourself administration rights. -- cgit From 79ef756f645153b91643765573230814257d0cbf Mon Sep 17 00:00:00 2001 From: Samy KACIMI Date: Wed, 5 Apr 2017 00:47:17 +0200 Subject: fix rubocop issues --- Gemfile | 2 +- app/models/follow.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 87ea77735..0deed9ae0 100644 --- a/Gemfile +++ b/Gemfile @@ -69,8 +69,8 @@ end group :test do gem 'simplecov', require: false gem 'webmock' - gem 'rspec-sidekiq' gem 'faker' + gem 'rspec-sidekiq' end group :development do diff --git a/app/models/follow.rb b/app/models/follow.rb index fd7325f05..b6b9dca7c 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -4,7 +4,7 @@ class Follow < ApplicationRecord include Paginable belongs_to :account, counter_cache: :following_count, required: true - + belongs_to :target_account, class_name: 'Account', counter_cache: :followers_count, -- cgit From 5af0ecbcd9cfd757c4d5bd541d83ca11e44d14ef Mon Sep 17 00:00:00 2001 From: Samy KACIMI Date: Wed, 5 Apr 2017 00:52:55 +0200 Subject: alphebatically order test gem group as required by rubocop --- Gemfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 0deed9ae0..4e7ff6621 100644 --- a/Gemfile +++ b/Gemfile @@ -67,10 +67,10 @@ group :development, :test do end group :test do - gem 'simplecov', require: false - gem 'webmock' gem 'faker' gem 'rspec-sidekiq' + gem 'simplecov', require: false + gem 'webmock' end group :development do -- cgit From 50a88d6a6ed0bd9af8e29a4fbce66bc24b32cb04 Mon Sep 17 00:00:00 2001 From: Jason Snell Date: Tue, 4 Apr 2017 16:35:57 -0700 Subject: Adding https://mastodon.cc --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 677ec7e56..17a72d77d 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -37,5 +37,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [social.lkw.tf](https://social.lkw.tf)|N/A|No|No| | [manowar.social](https://manowar.social)|N/A|No|No| | [social.ballpointcarrot.net](https://social.ballpointcarrot.net)|Down at time of entry|No|No| +| [mastodon.cc](https://mastodon.cc)|Art|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From bda37489ac5c14d18b1bb4290f2a2931dc8728c9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 5 Apr 2017 02:32:18 +0200 Subject: Remove PuSH subscriptions when delivery is answered with a 4xx error --- app/workers/pubsubhubbub/delivery_worker.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/workers/pubsubhubbub/delivery_worker.rb b/app/workers/pubsubhubbub/delivery_worker.rb index 15005bc80..466def3a8 100644 --- a/app/workers/pubsubhubbub/delivery_worker.rb +++ b/app/workers/pubsubhubbub/delivery_worker.rb @@ -22,6 +22,7 @@ class Pubsubhubbub::DeliveryWorker .headers(headers) .post(subscription.callback_url, body: payload) + return subscription.destroy! if response.code > 299 && response.code < 500 && response.code != 429 # HTTP 4xx means error is not temporary, except for 429 (throttling) raise "Delivery failed for #{subscription.callback_url}: HTTP #{response.code}" unless response.code > 199 && response.code < 300 subscription.touch(:last_successful_delivery_at) -- cgit From f7e35d90db3a08dbb4e4104f513e5817e18659b9 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 4 Apr 2017 20:16:14 -0400 Subject: Remote follow improvements This stores the @username@instance you provide in your session and reuses it the next time you remote follow someone from this instance. --- app/controllers/remote_follow_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/remote_follow_controller.rb b/app/controllers/remote_follow_controller.rb index 7d4bfe6ce..1e3f786ec 100644 --- a/app/controllers/remote_follow_controller.rb +++ b/app/controllers/remote_follow_controller.rb @@ -8,6 +8,7 @@ class RemoteFollowController < ApplicationController def new @remote_follow = RemoteFollow.new + @remote_follow.acct = session[:remote_follow] if session.key?(:remote_follow) end def create @@ -22,6 +23,8 @@ class RemoteFollowController < ApplicationController render(:new) && return end + session[:remote_follow] = @remote_follow.acct + redirect_to Addressable::Template.new(redirect_url_link.template).expand(uri: "#{@account.username}@#{Rails.configuration.x.local_domain}").to_s else render :new -- cgit From dd441606aae48a08ec76ae26383c3e3738254a1a Mon Sep 17 00:00:00 2001 From: Ash Furrow Date: Tue, 4 Apr 2017 20:53:31 -0400 Subject: Updates instructions. --- docs/Running-Mastodon/Heroku-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Heroku-guide.md b/docs/Running-Mastodon/Heroku-guide.md index cd92a8bfd..0de26230c 100644 --- a/docs/Running-Mastodon/Heroku-guide.md +++ b/docs/Running-Mastodon/Heroku-guide.md @@ -12,4 +12,4 @@ Mastodon can theoretically run indefinitely on a free [Heroku](https://heroku.co * If you want your Mastodon to be able to send emails, configure SMTP settings here (or later). Consider using [Mailgun](https://mailgun.com) or similar, who offer free plans that should suit your interests. 3. Deploy! The app should be set up, with a working web interface and database. You can change settings and manage versions from the Heroku dashboard. -You may need to use the `heroku` CLI application to modify the database directly to give yourself administration rights. +You may need to use the `heroku` CLI application to run `USERNAME=yourUsername rails mastodon:make_admin` to make yourself an admin. -- cgit From c106b6d3e04fb3dd8fe568120c0068f1492e54f7 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 4 Apr 2017 09:26:21 -0400 Subject: Improve readability of text on profiles --- app/assets/stylesheets/accounts.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/stylesheets/accounts.scss b/app/assets/stylesheets/accounts.scss index 25e24a95a..b3ae33500 100644 --- a/app/assets/stylesheets/accounts.scss +++ b/app/assets/stylesheets/accounts.scss @@ -34,6 +34,7 @@ text-align: center; position: relative; z-index: 2; + text-shadow: 0 0 2px $color8; small { display: block; @@ -128,6 +129,7 @@ text-transform: uppercase; display: block; margin-bottom: 5px; + text-shadow: 0 0 2px $color8; } .counter-number { @@ -385,5 +387,6 @@ .account__header__content { font-size: 14px; color: $color1; + text-shadow: 0 0 2px $color8; } } -- cgit From 667ffafef8c8b7956cdd31b8f65d5e82778211d8 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 5 Apr 2017 03:31:26 +0200 Subject: Fix spec --- config/locales/en.yml | 2 +- spec/models/user_spec.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index 750af0b7a..742219df9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -5,8 +5,8 @@ en: about_this: About this instance apps: Apps business_email: 'Business e-mail:' - contact: Contact closed_registrations: Registrations are currently closed on this instance. + contact: Contact description_headline: What is %{domain}? domain_count_after: other instances domain_count_before: Connected to diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 5575ba107..eb2a4aaea 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -45,8 +45,9 @@ RSpec.describe User, type: :model do expect(User.confirmed).to match_array([user_2]) end end + end - let(:account) { Fabricate(:account, username: 'alice') } + let(:account) { Fabricate(:account, username: 'alice') } let(:password) { 'abcd1234' } describe 'blacklist' do @@ -55,7 +56,7 @@ RSpec.describe User, type: :model do expect(user.valid?).to be_truthy end - + it 'should not allow a blacklisted user to be created' do user = User.new(email: 'foo@mvrht.com', account: account, password: password) -- cgit From 128dcb28253a43cfc2552091f419048dd3b94a9f Mon Sep 17 00:00:00 2001 From: Ash Furrow Date: Tue, 4 Apr 2017 21:35:45 -0400 Subject: Adds mastodon.technology --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 0cd3f18d6..dbed11842 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -40,5 +40,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [social.nasqueron.org](https://social.nasqueron.org) |Dreamers, open source developers, free culture|Yes|Yes| | [status.dissidence.ovh](https://status.dissidence.ovh)|N/A|Yes|Yes| | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| +| [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From fa7b74cf51e2b5c7c60aaf3ec529ba2292450d7b Mon Sep 17 00:00:00 2001 From: Jason Snell Date: Tue, 4 Apr 2017 18:43:21 -0700 Subject: SSL best practices for nginx --- docs/Running-Mastodon/Production-guide.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index b1f7bd35b..d539ddf64 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -11,10 +11,22 @@ map $http_upgrade $connection_upgrade { '' close; } +server { + listen 80; + listen [::]:80; + server_name example.com; + return 301 https://$host$request_uri; +} + server { listen 443 ssl; server_name example.com; + ssl_protocols TLSv1.2; + ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:10m; + ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; -- cgit From 7d354cc8c5eceb1289259f23ecac4d85cb6c1f74 Mon Sep 17 00:00:00 2001 From: shel Date: Tue, 4 Apr 2017 21:47:13 -0400 Subject: Corrected misinformation regarding Direct Posts Unless something changed recently I have no clue why this said that direct posts do not federate because they do. --- docs/Using-Mastodon/User-guide.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Using-Mastodon/User-guide.md b/docs/Using-Mastodon/User-guide.md index f8018909a..acd02f24e 100644 --- a/docs/Using-Mastodon/User-guide.md +++ b/docs/Using-Mastodon/User-guide.md @@ -160,13 +160,13 @@ Toot privacy is handled independently of account privacy, and individually for e **Unlisted** toots are toggled with the "Do not display in public timeline" option in the Compose pane. They are visible to anyone following you and appear on your profile page to the public even without a Mastodon login, but do *not* appear to anyone viewing the Public Timeline while logged into Mastodon. -**Private** toots, finally, are toggled with the "Mark as private" switch. Private toots do not appear in the public timeline nor on your profile page to anyone viewing it unless they are on your Followers list. This means the option is of very limited use if your account is not also set to be private (as anyone can follow you without confirmation and thus see your private toots). However the separation of this means that if you *do* set your entire account to private, you can switch this option off on a toot to make unlisted or even public toots from your otherwise private account. +**Private** toots, finally, are toggled with the "Mark as private" switch. Private toots do not appear in the public timeline nor on your profile page to anyone viewing it unless they are on your Followers list. This means the option is of very limited use if your account is not also set to be private (as anyone can follow you without confirmation and thus see your private toots). However the separation of this means that if you *do* set your entire account to private, you can switch this option off on a toot to make unlisted or even public toots from your otherwise private account. Private posts are not encrypted. Make sure you trust your instance admin not to just read your private posts on the back-end. Private toots do not federate to other instances, unless you @mention a remote user. In this case, they will federate to their instance *and may appear there PUBLICLY*. A warning will be displayed if you're composing a private toot that will federate to another instance. Private toots cannot be boosted. If someone you follow makes a private toot, it will appear in your timeline with a padlock icon in place of the Boost icon. **NOTE** that remote instances may not respect this. -**Direct** messages are only visible to users you have @mentioned in them. This does *not* federate to protect your privacy (as other instances may ignore the "Direct" status and display the messages as public if they were to receive them), even if you have @mentioned a remote user. +**Direct** posts are only visible to users you have @mentioned in them and cannot be boosted. Like with private posts, you should be mindful that the remote instance may not respect this protocol. If you are discussing a sensitive matter you should move the conversation off of Mastodon. To summarise: @@ -175,7 +175,7 @@ Toot Privacy | Visible on Profile | Visible on Public Timeline | Federates to ot Public | Anyone incl. anonymous viewers | Yes | Yes Unlisted | Anyone incl. anonymous viewers | No | Yes Private | Followers only | No | Only remote @mentions -Direct | No | No | No +Direct | No | No | Only remote @mentions #### Blocking -- cgit From 1e96ce378e2aa35ed7287a4a88e5165c2ee20101 Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 20:16:53 -0700 Subject: By pushing this into a worker we can reduce the amount of time the feed manager using workers eat up a connection --- app/lib/feed_manager.rb | 2 +- app/workers/push_update_worker.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 app/workers/push_update_worker.rb diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 2cca1cefe..075f86c2d 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -34,7 +34,7 @@ class FeedManager trim(timeline_type, account.id) end - broadcast(account.id, event: 'update', payload: inline_render(account, 'api/v1/statuses/show', status)) + PushUpdateWorker.perform_async(timeline_type, account.id, status.id) end def broadcast(timeline_id, options = {}) diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb new file mode 100644 index 000000000..3d398b5ac --- /dev/null +++ b/app/workers/push_update_worker.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class PushUpdateWorker + include Sidekiq::Worker + + def perform(timeline, account_id, status_id) + account = Account.find(account_id) + status = Status.find(status_id) + message = inline_render(account, 'api/v1/statuses/show', status) + + broadcast(account_id, type: 'update', timeline: timeline, message: message) + end +end -- cgit From 96ef9338208e09cbc52a49a3d7171d877eab3c43 Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 20:36:03 -0700 Subject: Replacing the broadcast method with the one defined in the feed manager --- app/workers/push_update_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index 3d398b5ac..5b5e9f68a 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -8,6 +8,6 @@ class PushUpdateWorker status = Status.find(status_id) message = inline_render(account, 'api/v1/statuses/show', status) - broadcast(account_id, type: 'update', timeline: timeline, message: message) + ActionCable.server.broadcast("timeline:#{account_id}", type: 'update', timeline: timeline, message: message) end end -- cgit From dc5704b0b0c8f5a58ff95d3f3c4055929c6ecfba Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 20:38:07 -0700 Subject: This method isn't used anymore --- app/lib/feed_manager.rb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 075f86c2d..6698c78a5 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -37,11 +37,6 @@ class FeedManager PushUpdateWorker.perform_async(timeline_type, account.id, status.id) end - def broadcast(timeline_id, options = {}) - options[:queued_at] = (Time.now.to_f * 1000.0).to_i - ActionCable.server.broadcast("timeline:#{timeline_id}", options) - end - def trim(type, account_id) return unless redis.zcard(key(type, account_id)) > FeedManager::MAX_ITEMS last = redis.zrevrange(key(type, account_id), FeedManager::MAX_ITEMS - 1, FeedManager::MAX_ITEMS - 1) -- cgit From 0069c01285d7fc6b97220fd678f6e5b82f301b1a Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 20:39:14 -0700 Subject: Moving the queue_at into the worker --- app/workers/push_update_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index 5b5e9f68a..6512e13ad 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -7,7 +7,7 @@ class PushUpdateWorker account = Account.find(account_id) status = Status.find(status_id) message = inline_render(account, 'api/v1/statuses/show', status) - + queue_at = (Time.now.to_f * 1000.0).to_i ActionCable.server.broadcast("timeline:#{account_id}", type: 'update', timeline: timeline, message: message) end end -- cgit From 220051b8b2d09a741f5edadd34e21115c5938bf0 Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 20:48:22 -0700 Subject: I don't actually think we need that. --- app/workers/push_update_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index 6512e13ad..5b5e9f68a 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -7,7 +7,7 @@ class PushUpdateWorker account = Account.find(account_id) status = Status.find(status_id) message = inline_render(account, 'api/v1/statuses/show', status) - queue_at = (Time.now.to_f * 1000.0).to_i + ActionCable.server.broadcast("timeline:#{account_id}", type: 'update', timeline: timeline, message: message) end end -- cgit From 9638894233d31368733574217e4d173e4cd5d13c Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 20:51:18 -0700 Subject: Moving in the inline render --- app/workers/push_update_worker.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index 5b5e9f68a..fef75d909 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -6,8 +6,14 @@ class PushUpdateWorker def perform(timeline, account_id, status_id) account = Account.find(account_id) status = Status.find(status_id) - message = inline_render(account, 'api/v1/statuses/show', status) + message = Rabl::Renderer.new( + 'api/v1/statuses/show', + status, + view_path: 'app/views', + format: :json, + scope: InlineRablScope.new(account) + ) - ActionCable.server.broadcast("timeline:#{account_id}", type: 'update', timeline: timeline, message: message) + ActionCable.server.broadcast("timeline:#{account_id}", type: 'update', timeline: timeline, message: message.render) end end -- cgit From 7bed4e51db18c864c36c6b48eb22c65f11c16b1c Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 20:51:44 -0700 Subject: Moved to the worker --- app/lib/feed_manager.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 6698c78a5..87865bfdc 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -76,10 +76,6 @@ class FeedManager end end - def inline_render(target_account, template, object) - Rabl::Renderer.new(template, object, view_path: 'app/views', format: :json, scope: InlineRablScope.new(target_account)).render - end - private def redis -- cgit From 22dcadedb495d2e1279b834a624710d34daee6ad Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 21:14:37 -0700 Subject: We're going to want these nice helper methods, lets share them with a parent class that matches Rails 5 practices (application level abstraction) --- app/workers/application_worker.rb | 5 +++++ app/workers/distribution_worker.rb | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 app/workers/application_worker.rb diff --git a/app/workers/application_worker.rb b/app/workers/application_worker.rb new file mode 100644 index 000000000..f2d7c1062 --- /dev/null +++ b/app/workers/application_worker.rb @@ -0,0 +1,5 @@ +class ApplicationWorker + def info(message) + Rails.logger.info("#{self.class.name} - #{message}") + end +end diff --git a/app/workers/distribution_worker.rb b/app/workers/distribution_worker.rb index f4e738d80..9a2867ea6 100644 --- a/app/workers/distribution_worker.rb +++ b/app/workers/distribution_worker.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class DistributionWorker +class DistributionWorker < ApplicationWorker include Sidekiq::Worker def perform(status_id) @@ -9,6 +9,6 @@ class DistributionWorker FanOutOnWriteService.new.call(status) WarmCacheService.new.call(status) rescue ActiveRecord::RecordNotFound - true + info("Couldn't find the status") end end -- cgit From 29efeecb9ebd4eac0ec65040b2f688d7a5c77283 Mon Sep 17 00:00:00 2001 From: scriptjunkie Date: Tue, 4 Apr 2017 23:21:00 -0500 Subject: Add https://securitymastod.one/ --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 0cd3f18d6..6b6eda74c 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -6,6 +6,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | Name | Theme/Notes, if applicable | Open Registrations | IPv6 | | -------------|-------------|---|---| | [mastodon.social](https://mastodon.social) |Flagship, quick updates|Yes|No| +| [securitymastod.one](https://securitymastod.one/) |Information security enthusiasts and pros|Yes|Yes| | [awoo.space](https://awoo.space) |Intentionally moderated, only federates with mastodon.social|Yes|No| | [animalliberation.social](https://animalliberation.social) |Animal Rights|Yes|No| | [socially.constructed.space](https://socially.constructed.space) |Single user|No|No| -- cgit From 03adb5d7277bc1672ce3617d328280873e671b24 Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 4 Apr 2017 21:31:02 -0700 Subject: Mastodon isn't using jbuilder or sdoc, and it prevents an upgrade to 2.4.0 --- Gemfile | 2 -- Gemfile.lock | 11 ----------- 2 files changed, 13 deletions(-) diff --git a/Gemfile b/Gemfile index 4e7ff6621..b5705e9d1 100644 --- a/Gemfile +++ b/Gemfile @@ -8,8 +8,6 @@ gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' gem 'jquery-rails' -gem 'jbuilder', '~> 2.0' -gem 'sdoc', '~> 0.4.0', group: :doc gem 'puma' gem 'hamlit-rails' diff --git a/Gemfile.lock b/Gemfile.lock index a774a89ba..408d85ade 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -198,9 +198,6 @@ GEM parser (>= 2.2.3.0) term-ansicolor (>= 1.3.2) terminal-table (>= 1.5.1) - jbuilder (2.6.0) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) jmespath (1.3.1) jquery-rails (4.1.1) rails-dom-testing (>= 1, < 3) @@ -231,7 +228,6 @@ GEM mimemagic (0.3.2) mini_portile2 (2.1.0) minitest (5.10.1) - multi_json (1.12.1) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (4.0.1) @@ -310,8 +306,6 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (2.1.0) rake (12.0.0) - rdoc (4.2.2) - json (~> 1.4) react-rails (1.10.0) babel-transpiler (>= 0.7.0) coffee-script-source (~> 1.8) @@ -381,9 +375,6 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sdoc (0.4.1) - json (~> 1.7, >= 1.7.7) - rdoc (~> 4.0) sidekiq (4.2.7) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) @@ -483,7 +474,6 @@ DEPENDENCIES http httplog i18n-tasks (~> 0.9.6) - jbuilder (~> 2.0) jquery-rails letter_opener letter_opener_web @@ -514,7 +504,6 @@ DEPENDENCIES rubocop ruby-oembed sass-rails (~> 5.0) - sdoc (~> 0.4.0) sidekiq sidekiq-unique-jobs simple-navigation -- cgit From 8040d1d8cef092cd5f9b3497e1514301f4ebe54e Mon Sep 17 00:00:00 2001 From: Ian McDowell Date: Tue, 4 Apr 2017 23:43:57 -0500 Subject: Update List-of-Mastodon-instances.md Added mastodon.network. --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 0cd3f18d6..8b8aba124 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -6,6 +6,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | Name | Theme/Notes, if applicable | Open Registrations | IPv6 | | -------------|-------------|---|---| | [mastodon.social](https://mastodon.social) |Flagship, quick updates|Yes|No| +| [mastodon.network](https://mastodon.network) |N/A|Yes|Yes| | [awoo.space](https://awoo.space) |Intentionally moderated, only federates with mastodon.social|Yes|No| | [animalliberation.social](https://animalliberation.social) |Animal Rights|Yes|No| | [socially.constructed.space](https://socially.constructed.space) |Single user|No|No| -- cgit From 6a1da87cd32a077c8df2e82cbdc222c201ddda41 Mon Sep 17 00:00:00 2001 From: Brad Urani Date: Wed, 5 Apr 2017 06:02:58 +0000 Subject: Eliminate unnecessary queries and query clauses with none and all --- app/models/status.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/status.rb b/app/models/status.rb index daf128572..6948ad77c 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -161,9 +161,9 @@ class Status < ApplicationRecord return where.not(visibility: [:private, :direct]) if account.nil? if target_account.blocking?(account) # get rid of blocked peeps - where('1 = 0') + none elsif account.id == target_account.id # author can see own stuff - where('1 = 1') + all elsif account.following?(target_account) # followers can see followers-only stuff, but also things they are mentioned in joins('LEFT OUTER JOIN mentions ON statuses.id = mentions.status_id AND mentions.account_id = ' + account.id.to_s) .where('statuses.visibility != ? OR mentions.id IS NOT NULL', Status.visibilities[:direct]) -- cgit From b845ef395d2dc86f32beb7e2071cc828258816b5 Mon Sep 17 00:00:00 2001 From: JantsoP Date: Wed, 5 Apr 2017 09:51:35 +0200 Subject: updated reblog translation --- config/locales/simple_form.fi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/simple_form.fi.yml b/config/locales/simple_form.fi.yml index 02943cea3..684cbe39c 100644 --- a/config/locales/simple_form.fi.yml +++ b/config/locales/simple_form.fi.yml @@ -38,7 +38,7 @@ fi: follow: Lähetä s-posti kun joku seuraa sinua follow_request: Lähetä s-posti kun joku pyytää seurata sinua mention: Lähetä s-posti kun joku mainitsee sinut - reblog: Lähetä s-posti kun joku uudestaanblogaa julkaisusi + reblog: Lähetä s-posti kun joku reblogaa julkaisusi 'no': 'Ei' required: mark: "*" -- cgit From 473e4f781318b24c1df11da36e7846080de27ea9 Mon Sep 17 00:00:00 2001 From: JantsoP Date: Wed, 5 Apr 2017 09:52:31 +0200 Subject: udpdated display_name translation --- config/locales/simple_form.fi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/simple_form.fi.yml b/config/locales/simple_form.fi.yml index 684cbe39c..7e1205fdc 100644 --- a/config/locales/simple_form.fi.yml +++ b/config/locales/simple_form.fi.yml @@ -17,7 +17,7 @@ fi: confirm_password: Varmista salasana current_password: Nykyinen salasana data: Data - display_name: Näyttö nimi + display_name: Näykyvä nimi email: Sähköpostiosoite header: Header locale: Kieli -- cgit From b8a867adcc8bfeaba7fa09204b6babd17abe225b Mon Sep 17 00:00:00 2001 From: JantsoP Date: Wed, 5 Apr 2017 09:56:10 +0200 Subject: updated translation Updated some translations after seeing them in service. Should be better now --- app/assets/javascripts/components/locales/fi.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/components/locales/fi.jsx b/app/assets/javascripts/components/locales/fi.jsx index 7b151d6f8..b3ae4bc56 100644 --- a/app/assets/javascripts/components/locales/fi.jsx +++ b/app/assets/javascripts/components/locales/fi.jsx @@ -5,9 +5,9 @@ const fi = { "status.mention": "Mainitse @{name}", "status.delete": "Poista", "status.reply": "Vastaa", - "status.reblog": "Boostaa", + "status.reblog": "Buustaa", "status.favourite": "Tykkää", - "status.reblogged_by": "{name} boostattu", + "status.reblogged_by": "{name} buustasi", "status.sensitive_warning": "Arkaluontoista sisältöä", "status.sensitive_toggle": "Klikkaa nähdäksesi", "video_player.toggle_sound": "Äänet päälle/pois", @@ -28,7 +28,7 @@ const fi = { "getting_started.open_source_notice": "Mastodon Mastodon on avoimen lähdekoodin ohjelma. Voit avustaa tai raportoida ongelmia GitHub palvelussa {github}. {apps}.", "column.home": "Koti", "column.community": "Paikallinen aikajana", - "column.public": "Yhdistetty aikajana", + "column.public": "Yleinen aikajana", "column.notifications": "Ilmoitukset", "tabs_bar.compose": "Luo", "tabs_bar.home": "Koti", @@ -41,7 +41,7 @@ const fi = { "compose_form.spoiler": "Piiloita teksti varoituksen taakse", "compose_form.private": "Merkitse yksityiseksi", "compose_form.privacy_disclaimer": "Sinun yksityinen status toimitetaan mainitsemallesi käyttäjille domaineissa {domains}. Luotatko {domainsCount, plural, one {tähän palvelimeen} other {näihin palvelimiin}}? Postauksen yksityisyys toimii van Mastodon palvelimilla. Jos {domains} {domainsCount, plural, one {ei ole Mastodon palvelin} other {eivät ole Mastodon palvelin}}, viestiin ei tule Yksityinen-merkintää, ja sitä voidaan boostata tai muuten tehdä näkyväksi muille vastaanottajille.", - "compose_form.unlisted": "Älä näytä julkisilla aikajanoilla", + "compose_form.unlisted": "Älä näytä yleisillä aikajanoilla", "navigation_bar.edit_profile": "Muokkaa profiilia", "navigation_bar.preferences": "Ominaisuudet", "navigation_bar.community_timeline": "Paikallinen aikajana", @@ -55,14 +55,14 @@ const fi = { "upload_form.undo": "Peru", "notification.follow": "{name} seurasi sinua", "notification.favourite": "{name} tykkäsi statuksestasi", - "notification.reblog": "{name} boostasi statustasi", + "notification.reblog": "{name} buustasi statustasi", "notification.mention": "{name} mainitsi sinut", "notifications.column_settings.alert": "Työpöytä ilmoitukset", "notifications.column_settings.show": "Näytä sarakkeessa", "notifications.column_settings.follow": "Uusia seuraajia:", "notifications.column_settings.favourite": "Tykkäyksiä:", "notifications.column_settings.mention": "Mainintoja:", - "notifications.column_settings.reblog": "Boosteja:", + "notifications.column_settings.reblog": "Buusteja:", }; export default fi; -- cgit From 3ec221d3b7093e2a2606ec04036cca9e9f1f733d Mon Sep 17 00:00:00 2001 From: JantsoP Date: Wed, 5 Apr 2017 09:57:25 +0200 Subject: updated reblog to boost translation Since it is that :D --- config/locales/simple_form.fi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/simple_form.fi.yml b/config/locales/simple_form.fi.yml index 7e1205fdc..2bacd6d2c 100644 --- a/config/locales/simple_form.fi.yml +++ b/config/locales/simple_form.fi.yml @@ -38,7 +38,7 @@ fi: follow: Lähetä s-posti kun joku seuraa sinua follow_request: Lähetä s-posti kun joku pyytää seurata sinua mention: Lähetä s-posti kun joku mainitsee sinut - reblog: Lähetä s-posti kun joku reblogaa julkaisusi + reblog: Lähetä s-posti kun joku buustaa julkaisusi 'no': 'Ei' required: mark: "*" -- cgit From 3504da5cac467e367e39e2310aaa5dba6b643f45 Mon Sep 17 00:00:00 2001 From: Eugen Date: Wed, 5 Apr 2017 10:25:05 +0200 Subject: Fix API method URL typo --- docs/Using-the-API/API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Using-the-API/API.md b/docs/Using-the-API/API.md index bc5ca3de4..e09d8ac9c 100644 --- a/docs/Using-the-API/API.md +++ b/docs/Using-the-API/API.md @@ -310,7 +310,7 @@ Returns a [Status](#status). #### Getting status context: - GET /api/v1/statuses/:id/contexts + GET /api/v1/statuses/:id/context Returns a [Context](#context). -- cgit From 5dbcd92193f45d71629e261cc264725d59f2ea6c Mon Sep 17 00:00:00 2001 From: Angristan Date: Wed, 5 Apr 2017 10:44:08 +0200 Subject: ECDH only Disable DHE ciphers. We don't loose any compatibility as we already use TLS 1.2, and ECDH is faster and safer. Also, it's better so specify the curve. This is the conf I use here : https://tls.imirhil.fr/https/mstdn.io --- docs/Running-Mastodon/Production-guide.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index d539ddf64..3912fd2ba 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -23,7 +23,8 @@ server { server_name example.com; ssl_protocols TLSv1.2; - ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; + ssl_ciphers EECDH+AESGCM:EECDH+AES; + ssl_ecdh_curve secp384r1; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; -- cgit From 5963fce131b3bbfbe0a93b1b11a76d3efadce61f Mon Sep 17 00:00:00 2001 From: Jordan Guerder Date: Wed, 5 Apr 2017 10:52:56 +0200 Subject: Added mastodon.cx --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index d0bcf8c7d..e726e5dcd 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -7,6 +7,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | -------------|-------------|---|---| | [mastodon.social](https://mastodon.social) |Flagship, quick updates|No|No| | [securitymastod.one](https://securitymastod.one/) |Information security enthusiasts and pros|Yes|Yes| +| [mastodon.cx](https://mastodon.cx/) |Alternative Mastodon instance hosted in France|Yes|Yes| | [mastodon.network](https://mastodon.network) |N/A|Yes|Yes| | [awoo.space](https://awoo.space) |Intentionally moderated, only federates with mastodon.social|Yes|No| | [animalliberation.social](https://animalliberation.social) |Animal Rights|Yes|No| -- cgit From fa6f7c88984a052d5a10aae6807a3f9e2fcc761a Mon Sep 17 00:00:00 2001 From: Angristan Date: Wed, 5 Apr 2017 11:16:56 +0200 Subject: Add mstdn.io --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index d0bcf8c7d..a23cdafde 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -21,6 +21,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.xyz](https://mastodon.xyz) |N/A|Yes|Yes| | [social.targaryen.house](https://social.targaryen.house) |Federates everywhere, quick updates.|Yes|Yes| | [masto.themimitoof.fr](https://masto.themimitoof.fr) |N/A|Yes|Yes| +| [mstdn.io](https://mstdn.io) |N/A|Yes|Yes| | [social.imirhil.fr](https://social.imirhil.fr) |N/A|No|Yes| | [social.wxcafe.net](https://social.wxcafe.net) |Open registrations, federates everywhere, no moderation yet|Yes|Yes| | [octodon.social](https://octodon.social) |Open registrations, federates everywhere, cutest instance yet|Yes|Yes| -- cgit From bdf3ac95b8cc2efa277570082806b5777b24dfe4 Mon Sep 17 00:00:00 2001 From: Cédric Levieux Date: Wed, 5 Apr 2017 11:24:21 +0200 Subject: Add mastodon.partipirate.org --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index d0bcf8c7d..0b1720e11 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -19,6 +19,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [social.diskseven.com](https://social.diskseven.com) |Single user|No|Yes| | [social.gestaltzerfall.net](https://social.gestaltzerfall.net) |Single user|No|No| | [mastodon.xyz](https://mastodon.xyz) |N/A|Yes|Yes| +| [mastodon.partipirate.org](https://mastodon.partipirate.org) |French Pirate Part Instance - Politics and stuff|Yes|No| | [social.targaryen.house](https://social.targaryen.house) |Federates everywhere, quick updates.|Yes|Yes| | [masto.themimitoof.fr](https://masto.themimitoof.fr) |N/A|Yes|Yes| | [social.imirhil.fr](https://social.imirhil.fr) |N/A|No|Yes| -- cgit From 9572282a559a07196e62190a852aacbd94968c71 Mon Sep 17 00:00:00 2001 From: nicobz25 Date: Wed, 5 Apr 2017 13:13:09 +0200 Subject: Update List-of-Mastodon-instances.md Add our mastodon instance :) Thanks ! --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 0b98f8552..bf770dc43 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -46,5 +46,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [status.dissidence.ovh](https://status.dissidence.ovh)|N/A|Yes|Yes| | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| +| [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 85c768bf16986ce8df3c8df9ea0724f60f3aebe2 Mon Sep 17 00:00:00 2001 From: Cédric Levieux Date: Wed, 5 Apr 2017 13:19:34 +0200 Subject: Typography on partY --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 0b98f8552..435e51411 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -20,7 +20,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [social.diskseven.com](https://social.diskseven.com) |Single user|No|Yes| | [social.gestaltzerfall.net](https://social.gestaltzerfall.net) |Single user|No|No| | [mastodon.xyz](https://mastodon.xyz) |N/A|Yes|Yes| -| [mastodon.partipirate.org](https://mastodon.partipirate.org) |French Pirate Part Instance - Politics and stuff|Yes|No| +| [mastodon.partipirate.org](https://mastodon.partipirate.org) |French Pirate Party Instance - Politics and stuff|Yes|No| | [social.targaryen.house](https://social.targaryen.house) |Federates everywhere, quick updates.|Yes|Yes| | [masto.themimitoof.fr](https://masto.themimitoof.fr) |N/A|Yes|Yes| | [mstdn.io](https://mstdn.io) |N/A|Yes|Yes| -- cgit From 8530f9413b86e0734ed9e0be93f0168a070f9ac8 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 5 Apr 2017 13:28:46 +0200 Subject: Replace ActionCable broadcast call with simple redis publish --- app/lib/feed_manager.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 2cca1cefe..88f6f4a46 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -39,7 +39,7 @@ class FeedManager def broadcast(timeline_id, options = {}) options[:queued_at] = (Time.now.to_f * 1000.0).to_i - ActionCable.server.broadcast("timeline:#{timeline_id}", options) + redis.publish("timeline:#{timeline_id}", Oj.dump(options)) end def trim(type, account_id) -- cgit From cfe91ac984fcabcc1980e88367dd636f0a8cc799 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 5 Apr 2017 13:32:57 +0200 Subject: Add index on mentions status_id --- db/migrate/20170405112956_add_index_on_mentions_status_id.rb | 5 +++++ db/schema.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20170405112956_add_index_on_mentions_status_id.rb diff --git a/db/migrate/20170405112956_add_index_on_mentions_status_id.rb b/db/migrate/20170405112956_add_index_on_mentions_status_id.rb new file mode 100644 index 000000000..3ed1a20cf --- /dev/null +++ b/db/migrate/20170405112956_add_index_on_mentions_status_id.rb @@ -0,0 +1,5 @@ +class AddIndexOnMentionsStatusId < ActiveRecord::Migration[5.0] + def change + add_index :mentions, :status_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 3aaa3e3ad..b5d55fa16 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.define(version: 20170403172249) do +ActiveRecord::Schema.define(version: 20170405112956) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -127,6 +127,7 @@ ActiveRecord::Schema.define(version: 20170403172249) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true, using: :btree + t.index ["status_id"], name: "index_mentions_on_status_id", using: :btree end create_table "mutes", force: :cascade do |t| -- cgit From 0a984e90d3052272bf793cb4393b9d642432aebb Mon Sep 17 00:00:00 2001 From: Jonathan Hurter Date: Wed, 5 Apr 2017 13:45:03 +0200 Subject: Add scalingo support --- .buildpacks | 2 ++ scalingo.json | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 .buildpacks create mode 100644 scalingo.json diff --git a/.buildpacks b/.buildpacks new file mode 100644 index 000000000..29d7ee1e9 --- /dev/null +++ b/.buildpacks @@ -0,0 +1,2 @@ +https://github.com/Scalingo/ruby-buildpack +https://github.com/Scalingo/nodejs-buildpack diff --git a/scalingo.json b/scalingo.json new file mode 100644 index 000000000..84b690e24 --- /dev/null +++ b/scalingo.json @@ -0,0 +1,87 @@ +{ + "name": "Mastodon", + "description": "A GNU Social-compatible microblogging server", + "repository": "https://github.com/johnsudaar/mastodon", + "logo": "https://github.com/tootsuite/mastodon/raw/master/app/assets/images/logo.png", + "env": { + "LOCAL_DOMAIN": { + "description": "The domain that your Mastodon instance will run on (this can be appname.scalingo.io or a custom domain)", + "required": true + }, + "LOCAL_HTTPS": { + "description": "Will your domain support HTTPS? (Automatic for *.scalingo.io, requires manual configuration for custom domains)", + "value": "true", + "required": true + }, + "PAPERCLIP_SECRET": { + "description": "The secret key for storing media files", + "generator": "secret" + }, + "SECRET_KEY_BASE": { + "description": "The secret key base", + "generator": "secret" + }, + "SINGLE_USER_MODE": { + "description": "Should the instance run in single user mode? (Disable registrations, redirect to front page)", + "value": "false", + "required": true + }, + "S3_ENABLED": { + "description": "Should Mastodon use Amazon S3 for storage? This is highly recommended, as Scalingo does not have persistent file storage (files will be lost).", + "value": "true", + "required": false + }, + "S3_BUCKET": { + "description": "Amazon S3 Bucket", + "required": false + }, + "S3_REGION": { + "description": "Amazon S3 region that the bucket is located in", + "required": false + }, + "AWS_ACCESS_KEY_ID": { + "description": "Amazon S3 Access Key", + "required": false + }, + "AWS_SECRET_ACCESS_KEY": { + "description": "Amazon S3 Secret Key", + "required": false + }, + "SMTP_SERVER": { + "description": "Hostname for SMTP server, if you want to enable email", + "required": false + }, + "SMTP_PORT": { + "description": "Port for SMTP server", + "required": false + }, + "SMTP_LOGIN": { + "description": "Username for SMTP server", + "required": false + }, + "SMTP_PASSWORD": { + "description": "Password for SMTP server", + "required": false + }, + "SMTP_DOMAIN": { + "description": "Domain for SMTP server. Will default to instance domain if blank.", + "required": false + }, + "SMTP_FROM_ADDRESS": { + "description": "Address to send emails from", + "required": false + }, + "BUILDPACK_URL": { + "description": "Internal scalingo configuration", + "required": true, + "value": "https://github.com/Scalingo/multi-buildpack.git" + } + }, + "scripts": { + "postdeploy": "bundle exec rails db:migrate && bundle exec rails db:seed" + }, + "addons": [ + "scalingo-postgresql", + "scalingo-redis" + ] +} -- cgit From 79765d61f506e8e7dd08b683ebfdaabfba12b1fe Mon Sep 17 00:00:00 2001 From: Jonathan Hurter Date: Wed, 5 Apr 2017 13:53:30 +0200 Subject: Install nodejs before ruby --- .buildpacks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildpacks b/.buildpacks index 29d7ee1e9..d295b0f5d 100644 --- a/.buildpacks +++ b/.buildpacks @@ -1,2 +1,2 @@ -https://github.com/Scalingo/ruby-buildpack https://github.com/Scalingo/nodejs-buildpack +https://github.com/Scalingo/ruby-buildpack -- cgit From 5ed2de6be2f3003be4422a659bdd7ab96803adf0 Mon Sep 17 00:00:00 2001 From: Angristan Date: Wed, 5 Apr 2017 14:11:08 +0200 Subject: Add git and curl as dependencies In some VPS templates, they are not installed by default. --- docs/Running-Mastodon/Production-guide.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index 3912fd2ba..90e9c0dea 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -88,8 +88,9 @@ It is recommended to create a special user for mastodon on the server (you could ## General dependencies + sudo apt-get install imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev nodejs file git curl curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - - sudo apt-get install imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev nodejs file + apt-get intall nodejs sudo npm install -g yarn ## Redis -- cgit From 259e626165bd7bf3360b18f007d0f8c968405de2 Mon Sep 17 00:00:00 2001 From: wxcafé Date: Wed, 5 Apr 2017 14:21:45 +0200 Subject: Update List-of-Mastodon-instances.md --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 0b98f8552..07a6a4813 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -25,7 +25,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [masto.themimitoof.fr](https://masto.themimitoof.fr) |N/A|Yes|Yes| | [mstdn.io](https://mstdn.io) |N/A|Yes|Yes| | [social.imirhil.fr](https://social.imirhil.fr) |N/A|No|Yes| -| [social.wxcafe.net](https://social.wxcafe.net) |Open registrations, federates everywhere, no moderation yet|Yes|Yes| +| [social.wxcafe.net](https://social.wxcafe.net) |Open registrations, queer people, activists, safe as much as possible |Yes|Yes| | [octodon.social](https://octodon.social) |Open registrations, federates everywhere, cutest instance yet|Yes|Yes| | [mastodon.club](https://mastodon.club)|Open Registration, Open Federation, Mostly Canadians|Yes|No| | [hostux.social](https://hostux.social) |N/A|Yes|Yes| -- cgit From 220bc48e8e9c4b8cebd98537233998f34d768347 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 5 Apr 2017 14:26:17 +0200 Subject: Only render public payload once in FanOutOnWrite --- app/services/fan_out_on_write_service.rb | 17 +++++++++-------- app/workers/after_remote_follow_request_worker.rb | 2 ++ app/workers/after_remote_follow_worker.rb | 2 ++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 42222c25b..106d257ba 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -16,6 +16,7 @@ class FanOutOnWriteService < BaseService return if status.account.silenced? || !status.public_visibility? || status.reblog? + render_anonymous_payload(status) deliver_to_hashtags(status) return if status.reply? && status.in_reply_to_account_id != status.account_id @@ -48,23 +49,23 @@ class FanOutOnWriteService < BaseService end end + def render_anonymous_payload(status) + @payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status) + end + def deliver_to_hashtags(status) Rails.logger.debug "Delivering status #{status.id} to hashtags" - payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status) - status.tags.pluck(:name).each do |hashtag| - FeedManager.instance.broadcast("hashtag:#{hashtag}", event: 'update', payload: payload) - FeedManager.instance.broadcast("hashtag:#{hashtag}:local", event: 'update', payload: payload) if status.account.local? + FeedManager.instance.broadcast("hashtag:#{hashtag}", event: 'update', payload: @payload) + FeedManager.instance.broadcast("hashtag:#{hashtag}:local", event: 'update', payload: @payload) if status.account.local? end end def deliver_to_public(status) Rails.logger.debug "Delivering status #{status.id} to public timeline" - payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status) - - FeedManager.instance.broadcast(:public, event: 'update', payload: payload) - FeedManager.instance.broadcast('public:local', event: 'update', payload: payload) if status.account.local? + FeedManager.instance.broadcast(:public, event: 'update', payload: @payload) + FeedManager.instance.broadcast('public:local', event: 'update', payload: @payload) if status.account.local? end end diff --git a/app/workers/after_remote_follow_request_worker.rb b/app/workers/after_remote_follow_request_worker.rb index 1f2db3061..928069211 100644 --- a/app/workers/after_remote_follow_request_worker.rb +++ b/app/workers/after_remote_follow_request_worker.rb @@ -13,5 +13,7 @@ class AfterRemoteFollowRequestWorker follow_request.destroy FollowService.new.call(follow_request.account, updated_account.acct) + rescue ActiveRecord::RecordNotFound + true end end diff --git a/app/workers/after_remote_follow_worker.rb b/app/workers/after_remote_follow_worker.rb index bdd2c2a91..d12fa3454 100644 --- a/app/workers/after_remote_follow_worker.rb +++ b/app/workers/after_remote_follow_worker.rb @@ -13,5 +13,7 @@ class AfterRemoteFollowWorker follow.destroy FollowService.new.call(follow.account, updated_account.acct) + rescue ActiveRecord::RecordNotFound + true end end -- cgit From bf523fcd16cb7d4ffd81424d3d582e4dfab158b6 Mon Sep 17 00:00:00 2001 From: Jonathan Hurter Date: Wed, 5 Apr 2017 14:13:34 +0200 Subject: Add node_modules and .cache to slugignore --- .slugignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .slugignore diff --git a/.slugignore b/.slugignore new file mode 100644 index 000000000..cbf0615e7 --- /dev/null +++ b/.slugignore @@ -0,0 +1,2 @@ +node_modules/ +.cache/ -- cgit From d3bf0307dbcf4d0f99615f1b3cb90565721de81c Mon Sep 17 00:00:00 2001 From: Jantso Porali Date: Wed, 5 Apr 2017 14:47:42 +0200 Subject: updated translation for about page --- config/locales/fi.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 3bcfe5c20..c2f81413a 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -21,12 +21,12 @@ fi: features_headline: Mikä erottaa Mastodonin muista get_started: Aloita käyttö links: Linkit - other_instances: Muut palvelimet + other_instances: muuhun palvelimeen source_code: Lähdekoodi - status_count_after: statukset - status_count_before: Kuka loi + status_count_after: statusta + status_count_before: Ovat luoneet terms: Ehdot - user_count_after: käyttäjät + user_count_after: käyttäjää user_count_before: Koti käyttäjälle accounts: follow: Seuraa -- cgit From deb001bba87cc2e1b65de05ce6569e98ab3b0caa Mon Sep 17 00:00:00 2001 From: Jantso Porali Date: Wed, 5 Apr 2017 14:49:29 +0200 Subject: updated two-way auth and preferences translation --- config/locales/fi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/locales/fi.yml b/config/locales/fi.yml index c2f81413a..d5dfd8183 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -132,7 +132,7 @@ fi: edit_profile: Muokkaa profiilia export: Datan vienti import: Datan tuonti - preferences: Mieltymykset + preferences: Ominaisuudet settings: Asetukset two_factor_auth: Kaksivaiheinen tunnistus statuses: @@ -154,7 +154,7 @@ fi: description_html: Jos otat käyttöön kaksivaiheisen tunnistuksen, kirjautumiseen vaaditaan puhelin, joka voi generoida tokeneita kirjautumista varten. disable: Poista käytöstä enable: Ota käyttöön - instructions_html: "Skannaa tämä QR-koodi Google Authenticator tai samanlaiseen sovellukseen puhelimellasi. Tästä hetkestä lähtien, ohjelma generoi tokenit mikä sinun tarvitsee syöttää sisäänkirjautuessa." + instructions_html: "Skannaa tämä QR-koodi Google Authenticator tai samanlaiseen sovellukseen puhelimellasi. Tästä hetkestä lähtien ohjelma generoi koodin, mikä sinun tarvitsee syöttää sisäänkirjautuessa." plaintext_secret_html: 'Plain-text secret: %{secret}' warning: Jos et juuri nyt voi konfiguroida authenticator-applikaatiota juuri nyt, sinun pitäisi klikata "Poista käytöstä" tai et voi kirjautua sisään. users: -- cgit From 837030db98d2e3a054d2f74ba2aa331d58671c4b Mon Sep 17 00:00:00 2001 From: Jantso Porali Date: Wed, 5 Apr 2017 14:53:35 +0200 Subject: updated blocking translation --- config/locales/fi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/fi.yml b/config/locales/fi.yml index d5dfd8183..cdb2b9886 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -89,7 +89,7 @@ fi: preface: Voit tuoda tiettyä dataa kaikista ihmisistä joita seuraat tai estät tilillesi tälle palvelimelle tiedostoista, jotka on luotu toisella palvelimella success: Datasi on onnistuneesti ladattu ja käsitellään pian types: - blocking: Esto lista + blocking: Estetyt lista following: Seuratut lista upload: Lähetä landing_strip_html: %{name} on käyttäjä domainilla %{domain}. Voit seurata tai vuorovaikuttaa heidän kanssaan jos sinulla on tili yleisessä verkossa. Jos sinulla ei ole tiliä, voit rekisteröityä täällä. -- cgit From cbcfd92a14aca00139601e19b1c95f013f81036f Mon Sep 17 00:00:00 2001 From: Padraig Fahy Date: Wed, 5 Apr 2017 14:00:35 +0100 Subject: Adding mastodon.irish --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index a14836b80..0972e553f 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -28,6 +28,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [social.wxcafe.net](https://social.wxcafe.net) |Open registrations, queer people, activists, safe as much as possible |Yes|Yes| | [octodon.social](https://octodon.social) |Open registrations, federates everywhere, cutest instance yet|Yes|Yes| | [mastodon.club](https://mastodon.club)|Open Registration, Open Federation, Mostly Canadians|Yes|No| +| [mastodon.irish](https://mastodon.irish)|Open Registration|Yes|No| | [hostux.social](https://hostux.social) |N/A|Yes|Yes| | [social.alex73630.xyz](https://social.alex73630.xyz) |Francophones|Yes|Yes| | [oc.todon.fr](https://oc.todon.fr) |Modérée et principalement francophone, pas de tolérances pour misogynie/LGBTphobies/validisme/etc.|Yes|Yes| -- cgit From 152a1e578c46068dfac2888620798073d3d305b8 Mon Sep 17 00:00:00 2001 From: Jonathan Hurter Date: Wed, 5 Apr 2017 15:26:36 +0200 Subject: Add Scalingo one click on readme --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 20499e6e3..3827a74ab 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,10 @@ Which will re-create the updated containers, leaving databases and data as is. D Docker is great for quickly trying out software, but it has its drawbacks too. If you prefer to run Mastodon without using Docker, refer to the [production guide](docs/Running-Mastodon/Production-guide.md) for examples, configuration and instructions. +## Deployment on Scalingo + +[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/johnsudaar/mastodon#master) + ## Deployment on Heroku (experimental) [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) -- cgit From 5e7ec0fe573f11d9c853981ac0ae57a8b27cf9ce Mon Sep 17 00:00:00 2001 From: Jonathan Hurter Date: Wed, 5 Apr 2017 15:52:06 +0200 Subject: Use root repository url --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3827a74ab..fde4df6bb 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ Docker is great for quickly trying out software, but it has its drawbacks too. I ## Deployment on Scalingo -[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/johnsudaar/mastodon#master) +[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/tootsuite/mastodon#master) ## Deployment on Heroku (experimental) -- cgit From d6bab0c71cd94bff4f775b79a55493b6e02215a0 Mon Sep 17 00:00:00 2001 From: Jonathan Hurter Date: Wed, 5 Apr 2017 16:00:48 +0200 Subject: Add doc --- README.md | 2 ++ docs/Running-Mastodon/Scalingo-guide.md | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 docs/Running-Mastodon/Scalingo-guide.md diff --git a/README.md b/README.md index fde4df6bb..db60b66f7 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,8 @@ Docker is great for quickly trying out software, but it has its drawbacks too. I [![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/tootsuite/mastodon#master) +[You can view a guide for deployment on Scalingo here.](docs/Running-Mastodon/Scalingo-guide.md) + ## Deployment on Heroku (experimental) [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) diff --git a/docs/Running-Mastodon/Scalingo-guide.md b/docs/Running-Mastodon/Scalingo-guide.md new file mode 100644 index 000000000..6552056a8 --- /dev/null +++ b/docs/Running-Mastodon/Scalingo-guide.md @@ -0,0 +1,13 @@ +Scalingo guide +============== + +[![Deploy on Scalingo](https://cdn.scalingo.com/deploy/button.svg)](https://my.scalingo.com/deploy?source=https://github.com/tootsuite/mastodon#master) + +1. Click the above button. +2. Fill in the options requested. + * You can use a .scalingo.io domain, which will be simple to set up, or you can use a custom domain. + * You will want Amazon S3 for file storage. The only exception is for development purposes, where you may not care if files are not saved. Follow a guide online for creating a free Amazon S3 bucket and Access Key, then enter the details. + * If you want your Mastodon to be able to send emails, configure SMTP settings here (or later). Consider using [Mailgun](https://mailgun.com) or similar, who offer free plans that should suit your interests. +3. Deploy! The app should be set up, with a working web interface and database. You can change settings and manage versions from the Heroku dashboard. + +You may need to use the `scalingo` CLI application to run `USERNAME=yourUsername rails mastodon:make_admin` to make yourself an admin. -- cgit From 28fb01c71aea96e66bc639917206f5472ca2d34f Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Wed, 5 Apr 2017 16:02:47 +0200 Subject: Update List-of-Mastodon-instances.md --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..e0bb3d368 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [mastodon.top](https://mastodon.top) |N/A|Yes|Yes| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 9a534d1df639ccd462d0c1f0b2faee0734daab8d Mon Sep 17 00:00:00 2001 From: Technowix Date: Wed, 5 Apr 2017 16:18:52 +0200 Subject: Add niu.moe, cuz it's kawaii --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..2918db8e8 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [niu.moe](https://niu.moe/)|:dolls: The most cutest node ever, FR/EN, anime and computer :balloon:|Yes|Yes| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From ee758551d1e3e58fb91760b240de8e70c4981c85 Mon Sep 17 00:00:00 2001 From: shel Date: Wed, 5 Apr 2017 10:58:41 -0400 Subject: Correct innacurate info and other fixes This guide was pretty out of date and also contained outright errors which were never true. I have updated it. --- docs/Using-Mastodon/User-guide.md | 64 ++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/docs/Using-Mastodon/User-guide.md b/docs/Using-Mastodon/User-guide.md index acd02f24e..e456de29d 100644 --- a/docs/Using-Mastodon/User-guide.md +++ b/docs/Using-Mastodon/User-guide.md @@ -26,17 +26,17 @@ Mastodon User's Guide ## Intro -Mastodon is a social network application based on the GNU Social protocol. It behaves a lot like other social networks, especially Twitter, with one key difference - it is open-source and anyone can start their own server (also called an "*instance*"), and users of any instance can interact freely with those of other instances (called "*federation*"). Thus, it is possible for small communities to set up their own servers to use amongst themselves while also allowing interaction with other communities. +Mastodon is a social network application based on the OStatus protocol. It behaves a lot like other social networks, especially Twitter, with one key difference - it is open-source and anyone can start their own server (also called an "*instance*"), and users of any instance can interact freely with those of other instances (called "*federation*"). Thus, it is possible for small communities to set up their own servers to use amongst themselves while also allowing interaction with other communities. #### Decentralization and Federation Mastodon is a system decentralized through a concept called "*federation*" - rather than depending on a single person or organization to run its infrastructure, anyone can download and run the software and run their own server. Federation means different Mastodon servers can interact with each other seamlessly, similar to e.g. e-mail. -As such, anyone can download Mastodon and e.g. run it for a small community of people, but any user registered on that instance can follow and send and read posts from other Mastodon instances (as well as servers running other GNU Social-compatible services). This means that not only is users' data not inherently owned by a company with an interest in selling it to advertisers, but also that if any given server shuts down its users can set up a new one or migrate to another instance, rather than the entire service being lost. +As such, anyone can download Mastodon and e.g. run it for a small community of people, but any user registered on that instance can follow, send, and read posts from other Mastodon instances (as well as servers running other OStatus-compatible services, such as GNU Social and postActiv). This means that not only is users' data not inherently owned by a company with an interest in selling it to advertisers, but also that if any given server shuts down its users can set up a new one or migrate to another instance, rather than the entire service being lost. Within each Mastodon instance, usernames just appear as `@username`, similar to other services such as Twitter. Users from other instances appear, and can be searched for and followed, as `@user@servername.ext` - so e.g. `@gargron` on the `mastodon.social` instance can be followed from other instances as `@gargron@mastodon.social`). -Posts from users on external instances are "*federated*" into the local one, i.e. if `user1@mastodon1` follows `user2@gnusocial2`, any posts `user2@gnusocial2` makes appear in both `user1@mastodon`'s Home feed and the public timeline on the `mastodon1` server. Mastodon server administrators have some control over this and can exclude users' posts from appearing on the public timeline; post privacy settings from users on Mastodon instances also affect this, see below in the [Toot Privacy](User-guide.md#toot-privacy) section. +Posts from users on external instances are "*federated*" into the local one, i.e. if `user1@mastodon1` follows `user2@gnusocial2`, any posts `user2@gnusocial2` makes appear in both `user1@mastodon1`'s Home feed and the public timeline on the `mastodon1` server. Mastodon server administrators have some control over this and can exclude users' posts from appearing on the public timeline; post privacy settings from users on Mastodon instances also affect this, see below in the [Toot Privacy](User-guide.md#toot-privacy) section. ## Getting Started @@ -44,7 +44,7 @@ Posts from users on external instances are "*federated*" into the local one, i.e You can customise your Mastodon profile in a number of ways - you can set a custom "display" name, a profile "avatar" picture, a background image for your profile page header, and a short "bio" that summarises you or your account. -![Preferences icon](screenshots/preferences.png) To edit your profile, click the Preferences icon in the Compose column and select "Edit Profile" on the left-hand menu on the Preferences page. Your display name is limited to 30 characters, your bio to 160. Avatars and header pictures can be uploaded as png, gif or jpg images and cannot be larger than 2MB. They will be resized to standard sizes - 120x120 pixels for avatars, 700x335 pixels for header pictures. +![Preferences icon](screenshots/preferences.png) To edit your profile, click the Preferences icon in the Compose column and select "Edit Profile" on the left-hand menu on the Preferences page. Your display name is limited to 30 characters, your bio to 160. Avatars and header pictures can be uploaded as png, gif or jpg images and cannot be larger than 2MB. They will be resized to standard sizes - 120x120 pixels for avatars, 700x335 pixels for header pictures. #### E-Mail Notifications @@ -56,17 +56,17 @@ The most basic way to interact with Mastodon is to make a text post, also called If you want to reply to another user's toot, you can click the "Reply" icon on it. This will add their username to your input box along with a preview of the message you're replying to, and the user will receive a notification of your response. -Similarly, in order to start a conversation with another user, just mention their user name in your toot. When you type the @ symbol followed directly (without a space) by any character in a message, Mastodon will automatically start suggesting users that match the username you're typing. Like with replies, mentioning a user like this will send them a notification. +Similarly, in order to start a conversation with another user, just mention their user name in your toot. When you type the @ symbol followed directly (without a space) by any character in a message, Mastodon will automatically start suggesting users that match the username you're typing. Like with replies, mentioning a user like this will send them a notification. If the post starts with a mention, it will be treated as a reply and will only appear in the Home timelines of users who follow both you and the user you are mentioning. It will still be visible on your profile depending on privacy settings. ##### Content Warnings -When you want to post something that you don't want to be immediately visible - for example, spoilers for that film that's just out, or some personal thoughts that contain [triggers](http://www.bbc.co.uk/news/blogs-ouch-26295437), you can "hide" it behind a Content Warning. +When you want to post something that you don't want to be immediately visible - for example, spoilers for that film that's just come out, or some personal thoughts that mention potentially upsetting topics, you can "hide" it behind a Content Warning. To do this, click the ![CW icon](screenshots/compose-cw.png) "CW" switch under the Compose box. This will add another text box labeled "Content warning"; you should enter a short summary of what the "body" of your post contains here while your actual post goes into the "What is on your mind?" box as normal. ![animation showing how to enable content warnings](screenshots/content-warning.gif) -This will cause the body of your post to be hidden behind a "Show More" button in the timeline, with only the content warning visible by default: +This will cause the body of your post to be hidden behind a "Show More" button in the timeline, with only the content warning and any mentioned users visible by default: ![animation showing content warnings in the timeline](screenshots/cw-toot.gif) @@ -74,13 +74,13 @@ This will cause the body of your post to be hidden behind a "Show More" button i ##### Hashtags -If you're making a post belonging to a wider subject, it might be worth adding a "hashtag" to it. This can be done simply by adding any alphanumeric term with a # sign in front of it to the toot, e.g. #introductions (which is popular on mastodon.social for new users to introduce themselves to the community), or #politics for political discussions, etc. Clicking on a hashtag in a toot will show a timeline consisting only of toots that include this hashtag (i.e. it's a shortcut to searching for it). This allows users to group messages of similar subjects together, forming a separate "timeline" for people interested in that subject. +If you're making a post belonging to a wider subject, it might be worth adding a "hashtag" to it. This can be done simply by writing in the post a # sign followed by a phrase, e.g. #introductions (which is popular on mastodon.social for new users to introduce themselves to the community), or #politics for political discussions, etc. Clicking on a hashtag in a toot will show a timeline consisting only of public posts that include this hashtag (i.e. it's a shortcut to searching for it). This allows users to group messages of similar subjects together, forming a separate "timeline" for people interested in that subject. Hashtags can also be searched for from the search bar above the compose box. ##### Boosts and Favourites You can *favourite* another user's toot by clicking the star icon underneath. This will send the user a notification that you have marked their post as a favourite; the meaning of this varies widely by context from a general "I'm listening" to signalling agreement or offering support for the ideas expressed. -Additionally you can *boost* toots by clicking the "circular arrows" icon. Boosting a toot will show it on your profile timeline and make it appear to all your followers, even if they aren't following the user who made the original post. This is helpful if someone posts a message you think others should see, as it increases the message's reach while keeping the author information intact. +Additionally you can *boost* toots by clicking the "circular arrows" icon. Boosting a toot will show it on your profile timeline and make it appear to all your followers, even if they aren't following the user who made the original post. This is helpful if someone posts a message you think others should see, as it increases the message's reach while keeping the author information intact. #### Posting Images @@ -92,21 +92,21 @@ You can also attach video files or GIF animations to Toots. However, there is a #### Following Other Users -Following another user will make all of their toots as well as other users' toots which they [boost](User-guide.md#boosts-and-favourites) in your Home column. This gives you a separate timeline from the [federated timeline](User-guide.md#the-federated-timeline) in which you can read what particular people are up to without the noise of general conversation. +Following another user will make all of their toots as well as other users' toots which they [boost](User-guide.md#boosts-and-favourites) appear in your Home column. This gives you a separate timeline from the [public timelines](User-guide.md#the-public-timelines) in which you can read what particular people are up to without the noise of general conversation. ![Follow icon](screenshots/follow.png) In order to follow a user, click their name or avatar to open their profile, then click the Follow icon in the top left of their profile view. -If their account is locked (which is shown with a padlock icon ![Padlock icon](screenshots/locked-icon.png) next to their user name), they will receive a notification of your request to follow them and need to approve this before you are added to their follower list (and thus see their toots). To show you that you're waiting for someone to approve your follow request, the Follow icon ![Follow icon](screenshots/follow-icon.png) on their profile will be replaced with an hourglass icon ![Pending icon](screenshots/pending-icon.png). +If their account has a padlock icon ![Padlock icon](screenshots/locked-icon.png) next to their user name, they will receive a notification of your request to follow them and they will need to approve this before you are added to their follower list (and thus see their toots). To show you that you are waiting for someone to approve your follow request, the Follow icon ![Follow icon](screenshots/follow-icon.png) on their profile will be replaced with an hourglass icon ![Pending icon](screenshots/pending-icon.png). The requirement for new followers to be approved is something you can enable for your own profile under preferences. Once you follow a user, the Follow icon will be highlighted in blue on their profile ![Following icon](screenshots/following-icon.png); you can unfollow them again by clicking this. If you know someone's user name you can also open their profile for following by entering it in the [Search box](User-guide.md#searching) in the Compose column. This also works for remote users, though depending on whether they are known to your home instance you might have to enter their full name including the domain (e.g. `gargron@mastodon.social`) into the search box before their profile will appear in the suggestions. -Alternately, if you already have a user's profile open in a separate browser tab, most GNU Social-related networks should have a "Follow" or "Subscribe" button on their profile page. This will ask you to enter the full user name to follow **from** (ie. if your account is on mastodon.social you would want to enter this as `myaccount@mastodon.social`) +Alternately, if you already have a user's profile open in a separate browser tab, most OStatus-related networks should have a "Follow" or "Subscribe" button on their profile page. This will ask you to enter the full user name to follow **from** (ie. if your account is on mastodon.social you would want to enter this as `myaccount@mastodon.social`) #### Notifications -When someone follows your account or requests to follow you, mentions your user name (either as an initial message or in response to one of your toots) or boosts or favourites one of your toots, you will receive a notification for this. These will appear as desktop notifications on your computer (if your web browser supports this and you've enabled them) as well as in your "Notifications" column. +When someone follows your account or requests to follow you, mentions your user name, or boosts or favourites one of your toots, you will receive a notification for this. These will appear as desktop notifications on your computer (if your web browser supports this and you've enabled them) as well as in your "Notifications" column. ![Notification Settings icon](screenshots/notifications-settings.png) You can filter what kind of notifications you see in the Notifications column by clicking the Notification Settings icon at the top of the column and ticking or un-ticking what you do or don't want to see notifications for. @@ -116,21 +116,25 @@ When someone follows your account or requests to follow you, mentions your user #### Mobile Apps -There are no official mobile Mastodon apps for iOS or Android at this point. However, there are several third-party apps in development; you can find a list of these [here](Apps.md). +Mastodon has an open API, so anyone can develop a client or app to use Mastodon from anything. Many people have already developed mobile apps for iOS and Android. You can find a list of these [here](Apps.md). Many of these projects are also open source and welcome collaborators. -#### The Federated Timeline +#### The Public Timelines -Mastodon has a "Federated" timeline, which is a collection of all public toots made by all local users as well as posts from remote users that are federated (because someone on your instance follows the remote user making the post). This is a good way to meet new people to follow or interact with, but can be overwhelming especially if there's a lot of activity. +In addition to your Home timeline, there are two public timelines available. The Federated Timeline and the Local Timeline. These are both a good way to meet new people to follow or interact with. + +##### The Federated Timeline + +The Federated Timeline shows all public posts from all users "known" to your instance. This means the user is either on the same instance as you, or somebody on your instance follows that user. The Federated Timeline is a great way to engage in the broad chatter of the world. Following users on remote instances who you meet on the Federated Timeline can lead to meeting more users on more instances and further connecting your instance to more and more of the entire Mastodon and OStatus network. ![Federated Timeline icon](screenshots/federated-timeline.png) To view the federated timeline, click the "Federated Timeline" icon in your Compose column or the respective button on the Getting Started panel. To hide the federated timeline again, simply click the "Back" link at the top of the column while you're viewing it. #### The Local Timeline -In addition to the Federated Timeline, there's also a "Local" timeline, which only shows public toots made by users on your home instance. This is quieter than the Federated timeline, and useful if you want to stick close to your instance's community without having too much noise from outside. To view the Local Timeline, click the ![Menu icon](screenshots/compose-menu.png) Menu icon on the Compose pane and then select "Local Timeline" on the rightmost column. +The Local Timeline only shows public posts made by users on your home instance. This can be useful if your instance has particular community norms that users on other instances may not have, such as particular topics that get put under content warnings; or particular in-jokes and shared interests. To view the Local Timeline, click the ![Menu icon](screenshots/compose-menu.png) Menu icon on the Compose pane and then select "Local Timeline" on the rightmost column. #### Searching -Mastodon has a search function - however, this is limited to users and [hashtags](User-guide.md#hashtags) only and cannot be used to search through the full text of toots. In order to start a search, just type into the search box in the Compose column; Mastodon will automatically start showing suggestions of both user names and hashtags in a pop-up after a moment. Selecting any of these will open the user's profile or a view of all toots on the hashtag. +Mastodon has a search function - you can use it to search for users and [hashtags](User-guide.md#hashtags). The search does not look through the entire text of posts, only hashtags. In order to start a search, just type into the search box in the Compose column and hit *enter*; This will open the search pane. The search pane will show suggestions as you type. Selecting any of these will open the user's profile or a view of all toots on the hashtag. ## Privacy, Safety and Security @@ -140,7 +144,7 @@ Mastodon has a number of advanced security, privacy and safety features over mor Two-Factor Authentication (2FA) is a mechanism that improves the security of your Mastodon account by requiring a numeric code from another device (most commonly mobile phones) linked to your Mastodon account when you log in - this means that even if someone gets hold of both your e-mail address and your password, they cannot take over your Mastodon account as they would need a physical device you own to log in. -Mastodon's 2FA uses Google Authenticator (or compatible apps). You can install this for free to your [Android](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2) or [iOS](https://itunes.apple.com/gb/app/google-authenticator/id388497605) device; [this Wikipedia page](https://en.wikipedia.org/wiki/Google_Authenticator#Implementations) lists further versions of the app for other systems. +Mastodon's 2FA uses Google Authenticator (or compatible apps, such as Authy). You can install this for free to your [Android](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2) or [iOS](https://itunes.apple.com/gb/app/google-authenticator/id388497605) device; [this Wikipedia page](https://en.wikipedia.org/wiki/Google_Authenticator#Implementations) lists further versions of the app for other systems. ![Preferences icon](screenshots/preferences.png) In order to enable 2FA for your Mastodon account, click the Preferences icon in the Compose column, click "Two-factor Authentication" in the left menu on the settings page and follow the instructions. Once activated, every time you log in you will need a one-time code generated by the Authenticator app on the device you've linked to your account. @@ -154,18 +158,20 @@ To allow you more control over who can see your toots, Mastodon supports "privat #### Toot Privacy -Toot privacy is handled independently of account privacy, and individually for each toot. The three tiers of visibility for toots are Public (default), Unlisted or Private. In order to select your privacy level, click the ![Globe icon](screenshots/compose-privacy.png) globe icon. Changes to this setting are remembered between posts, i.e. if you make one private toot you will need to disable the switch again to make public toots. +Toot privacy is handled independently of account privacy, and individually for each toot. The four tiers of visibility for toots are Public (default), Unlisted, Private, and Direct. In order to select your privacy level, click the ![Globe icon](screenshots/compose-privacy.png) globe icon. Changes to this setting are remembered between posts, i.e. if you make one private toot, each toot you make will be private until you change it back to public. You can change your default post privacy under preferences. -**Public** is the default status of toots on accounts not set to private; a toot is public if neither of the two flags are set. Public toots are visible to any other user on the public timeline, federate to other GNU Social instances without restriction and appear on your user profile page to anyone including search engine bots and visitors who aren't logged into a Mastodon account. +**Public** is the default status of toots on most accounts. Public toots are visible to any other user on the public timelines, federate to other Mastodon and OStatus instances without restriction, and appear on your user profile page to anyone including search engine bots and visitors who aren't logged into a Mastodon account. -**Unlisted** toots are toggled with the "Do not display in public timeline" option in the Compose pane. They are visible to anyone following you and appear on your profile page to the public even without a Mastodon login, but do *not* appear to anyone viewing the Public Timeline while logged into Mastodon. +**Unlisted** toots are public, except that they do not appear in the public timelines or search results. They are visible to anyone following you and appear on your profile page to the public even without a Mastodon login. Other than not appearing in the public timelines or search results, they function identically to public posts. -**Private** toots, finally, are toggled with the "Mark as private" switch. Private toots do not appear in the public timeline nor on your profile page to anyone viewing it unless they are on your Followers list. This means the option is of very limited use if your account is not also set to be private (as anyone can follow you without confirmation and thus see your private toots). However the separation of this means that if you *do* set your entire account to private, you can switch this option off on a toot to make unlisted or even public toots from your otherwise private account. Private posts are not encrypted. Make sure you trust your instance admin not to just read your private posts on the back-end. - -Private toots do not federate to other instances, unless you @mention a remote user. In this case, they will federate to their instance *and may appear there PUBLICLY*. A warning will be displayed if you're composing a private toot that will federate to another instance. +**Private** toots do not appear in the public timeline nor on your profile page to anyone viewing it unless they are on your Followers list. The option is of limited use if your account is not also set to require approval of new followers (as anyone can follow you without confirmation and thus see your private toots). However the separation of this means that if you *do* set your entire account to private, you can switch this option off on a toot to make unlisted or even public toots from your otherwise private account. Private toots cannot be boosted. If someone you follow makes a private toot, it will appear in your timeline with a padlock icon in place of the Boost icon. **NOTE** that remote instances may not respect this. +Private toots do not federate to other instances, unless you @mention a remote user. In this case, they will federate to their instance, and users on that instance who follow both you and the @mentioned user will see it in their Home timelines. There is no reliable way to check if an instance will actually respect post privacy. Non-Mastodon servers, such as a GNU Social server, do not support Mastodon privacy settings. A user on GNU Social who you @mention in a private post would not even be aware that the post is intended to be private and would be able to boost it, which would undo the privacy setting. There is also no way to guarantee that someone could not just modify the code on their particular Mastodon instance to not respect private post restrictions. A warning will be displayed if you're composing a private toot that will federate to another instance. You should thus think through how much you trust the user you are @mentioning and the instance they are on. + +Private posts are not encrypted. Make sure you trust your instance admin not to just read your private posts on the back-end. Do not say anything you would not want potentially intercepted. + **Direct** posts are only visible to users you have @mentioned in them and cannot be boosted. Like with private posts, you should be mindful that the remote instance may not respect this protocol. If you are discussing a sensitive matter you should move the conversation off of Mastodon. To summarise: @@ -183,9 +189,13 @@ You can block a user to stop them contacting you. To do this, you can click or t **NOTE** that this will stop them from seeing your public toots while they are logged in, but they *will* be able to see your public toots by simply opening your profile in another browser that isn't logged into Mastodon (or logged into a different account that you have not blocked). -Mentions, favourites, boosts or any other interaction with you from a blocked user will be hidden from your view. You will not see replies to a blocked person, even if the reply mentions you, nor will you see their toots if someone boosts them. You will not see toots mentioning a blocked person except in the public timeline. +Mentions, favourites, boosts or any other interaction with you from a blocked user will be hidden from your view. You will not see replies to a blocked person, even if the reply mentions you, nor will you see their toots if someone boosts them. + +The blocked user will not be notified of your blocking them. They will be removed from your followers. + +#### Muting -The blocked user will not be notified of your blocking them. They will be removed from your followers, *but* will still be able to see any public toots you make. Blocks do not federate across instances. +If you do not wish to see posts from a particular user, but do not care about if they see your posts, you may choose to *mute* them. You can mute a user from the same menu on their profile page that you would block them from. You will not see posts from a muted user unless they @mention you. A muted user will have no way to know that you have them muted. #### Reporting Toots or Users -- cgit From 4de3182dc8dbd596785f2e77e3df939be1fc4962 Mon Sep 17 00:00:00 2001 From: Kody Date: Wed, 5 Apr 2017 17:00:03 +0200 Subject: Added im-in.space --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..8b5fa27ea 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [im-in.space](https://im-in.space/)|SPAAAAACE! Probably with a lot of French people. (Invite-only, might randomly open registrations)|No|Yes| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 4335dffe35acdf4a6a7aef2b31f8caa3b45967be Mon Sep 17 00:00:00 2001 From: Jonathan Hurter Date: Wed, 5 Apr 2017 17:28:11 +0200 Subject: Fix wrong url in scalingo.json --- scalingo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scalingo.json b/scalingo.json index 84b690e24..d60f1529c 100644 --- a/scalingo.json +++ b/scalingo.json @@ -1,7 +1,7 @@ { "name": "Mastodon", "description": "A GNU Social-compatible microblogging server", - "repository": "https://github.com/johnsudaar/mastodon", + "repository": "https://github.com/tootsuite/mastodon", "logo": "https://github.com/tootsuite/mastodon/raw/master/app/assets/images/logo.png", "env": { "LOCAL_DOMAIN": { -- cgit From b8218ca4826b8c93f9898386c1ee893fbed316e9 Mon Sep 17 00:00:00 2001 From: Jonathan Hurter Date: Wed, 5 Apr 2017 17:48:55 +0200 Subject: Make scalingo doc clearer --- docs/Running-Mastodon/Scalingo-guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/Running-Mastodon/Scalingo-guide.md b/docs/Running-Mastodon/Scalingo-guide.md index 6552056a8..9329f753e 100644 --- a/docs/Running-Mastodon/Scalingo-guide.md +++ b/docs/Running-Mastodon/Scalingo-guide.md @@ -8,6 +8,6 @@ Scalingo guide * You can use a .scalingo.io domain, which will be simple to set up, or you can use a custom domain. * You will want Amazon S3 for file storage. The only exception is for development purposes, where you may not care if files are not saved. Follow a guide online for creating a free Amazon S3 bucket and Access Key, then enter the details. * If you want your Mastodon to be able to send emails, configure SMTP settings here (or later). Consider using [Mailgun](https://mailgun.com) or similar, who offer free plans that should suit your interests. -3. Deploy! The app should be set up, with a working web interface and database. You can change settings and manage versions from the Heroku dashboard. +3. Deploy! The app should be set up, with a working web interface and database. You can change settings and manage versions from the Scalingo dashboard. -You may need to use the `scalingo` CLI application to run `USERNAME=yourUsername rails mastodon:make_admin` to make yourself an admin. +To make yourself an admin, you can use the `scalingo` CLI: `scalingo run -e USERNAME=yourusername rails mastodon:make_admin`. -- cgit From 9cf0b5b2557a6e26542a39c3fb31f46a15073662 Mon Sep 17 00:00:00 2001 From: Toby Deshane Date: Wed, 5 Apr 2017 11:49:36 -0400 Subject: Add social.bytestemplar.com to instances list --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..a99598eaf 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [social.bytestemplar.com](https://social.bytestemplar.com)|N/A|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 41a78be25e5b4d7b5f65cfbf4d6fba5184f41475 Mon Sep 17 00:00:00 2001 From: Ben Field Date: Wed, 5 Apr 2017 16:56:51 +0100 Subject: Update Production-guide.md Corrected spelling error for "install" --- docs/Running-Mastodon/Production-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index 90e9c0dea..1a65771ce 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -90,7 +90,7 @@ It is recommended to create a special user for mastodon on the server (you could sudo apt-get install imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev nodejs file git curl curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - - apt-get intall nodejs + apt-get install nodejs sudo npm install -g yarn ## Redis -- cgit From a31f5765afb2598937b418cce0b5bacdf71c5ba8 Mon Sep 17 00:00:00 2001 From: Amanda Visconti Date: Wed, 5 Apr 2017 12:04:21 -0400 Subject: Added digitalhumanities.club instance --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..a295d282b 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [digitalhumanities.club](http://www.digitalhumanities.club)|[Digital humanities](http://whatisdigitalhumanities.com) community; invitations will open once code of conduct drafted.|No|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 96812a6c792c8b048ed8d4a50351d9696dcf0f77 Mon Sep 17 00:00:00 2001 From: ZiiX Date: Wed, 5 Apr 2017 09:05:57 -0700 Subject: added instance --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..80fa61ab1 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [design.vu](https://design.vu)|— what's your design view‽|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 8989569dd42aabd9c768927f0975401af89bceb3 Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 5 Apr 2017 12:10:25 -0400 Subject: Update components.scss Use nicer scrollbars in MS edge --- app/assets/stylesheets/components.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss index d233b3471..696e89418 100644 --- a/app/assets/stylesheets/components.scss +++ b/app/assets/stylesheets/components.scss @@ -1,5 +1,9 @@ @import 'variables'; +.app-body{ + -ms-overflow-style: -ms-autohiding-scrollbar; +} + .button { background-color: darken($color4, 3%); font-family: inherit; -- cgit From b38bd58921317459ba5bc5cb00a6f18c1875d574 Mon Sep 17 00:00:00 2001 From: Thomas Alberola Date: Wed, 5 Apr 2017 18:15:39 +0200 Subject: Adding masto.raildecake.fr, french instance 🌻🐘 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..23a2867a2 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [masto.raildecake.fr](https://masto.raildecake.fr)|Hebergé chez un FAI associatif dans le sud de la france, grillons & pins en options|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 32d4b51939ac8827c2a82191969849b6283b432a Mon Sep 17 00:00:00 2001 From: foxiehkins Date: Wed, 5 Apr 2017 17:47:52 +0100 Subject: Add good-dragon.com --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..99d019838 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [good-dragon.com](https://good-dragon.com/)|Relaxed moderation, Open registrations, Furries, Others also accepted|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 1b8c244dff84ae981d89a1672a9db06f08cf405e Mon Sep 17 00:00:00 2001 From: Eugen Date: Wed, 5 Apr 2017 18:48:41 +0200 Subject: Add proper message to PushUpdateWorker, use redis directly --- app/workers/push_update_worker.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index fef75d909..9d16c20bf 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -5,7 +5,8 @@ class PushUpdateWorker def perform(timeline, account_id, status_id) account = Account.find(account_id) - status = Status.find(status_id) + status = Status.find(status_id) + message = Rabl::Renderer.new( 'api/v1/statuses/show', status, @@ -14,6 +15,8 @@ class PushUpdateWorker scope: InlineRablScope.new(account) ) - ActionCable.server.broadcast("timeline:#{account_id}", type: 'update', timeline: timeline, message: message.render) + Redis.current.publish("timeline:#{timeline_id}", Oj.dump({ event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i })) + rescue ActiveRecord::RecordNotFound + true end end -- cgit From ac1989d2c07b707699641987d62697103698393c Mon Sep 17 00:00:00 2001 From: foxiehkins Date: Wed, 5 Apr 2017 17:49:04 +0100 Subject: Update description on good-dragon.com --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 99d019838..5ffeecc10 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,6 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| -| [good-dragon.com](https://good-dragon.com/)|Relaxed moderation, Open registrations, Furries, Others also accepted|Yes|No| +| [good-dragon.com](https://good-dragon.com/)|Quick updates, Relaxed Moderation, Federates Everywhere, Furries|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From c9ebd5d19fccaabd1192f5e61537251c2c2d782e Mon Sep 17 00:00:00 2001 From: Eugen Date: Wed, 5 Apr 2017 18:58:32 +0200 Subject: Fix wrong variable used in publish channel --- app/workers/push_update_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index 9d16c20bf..166a9b449 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -15,7 +15,7 @@ class PushUpdateWorker scope: InlineRablScope.new(account) ) - Redis.current.publish("timeline:#{timeline_id}", Oj.dump({ event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i })) + Redis.current.publish("timeline:#{account.id}", Oj.dump({ event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i })) rescue ActiveRecord::RecordNotFound true end -- cgit From e5566ac6a6462c0a8a6c6c8f2a1171087bd662a4 Mon Sep 17 00:00:00 2001 From: Christopher Gilbert Date: Wed, 5 Apr 2017 13:05:27 -0400 Subject: Add Rich.GOP --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..83b7b8413 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [rich.gop](https://rich.gop/)|Federates everywhere, Open registration, Privacy respected|Yes|Yes| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 8fa8004a2b090a3911cce11473bb926ebd6782a6 Mon Sep 17 00:00:00 2001 From: Ben Field Date: Wed, 5 Apr 2017 18:20:08 +0100 Subject: Update List-of-Mastodon-instances.md --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..b4c2b8632 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,5 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| - +| [social.nowa.re](https://social.nowa.re)|Open Registration|Yes|Not Yet| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 29ffe1cad3f473c7b6c0b651d065f8ed9373d37e Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 5 Apr 2017 18:51:15 +0200 Subject: Make sure Rabl is using Oj --- config/initializers/rabl_init.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/config/initializers/rabl_init.rb b/config/initializers/rabl_init.rb index f7be0c607..132a42144 100644 --- a/config/initializers/rabl_init.rb +++ b/config/initializers/rabl_init.rb @@ -1,4 +1,5 @@ Rabl.configure do |config| + config.json_engine = Oj config.cache_all_output = false config.cache_sources = Rails.env.production? config.include_json_root = false -- cgit From 5b95be1c42ba69c9a3a79cfa990c80a5f2debfc6 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 5 Apr 2017 19:45:18 +0200 Subject: Replace calls to FeedManager#inline_render and #broadcast --- app/lib/feed_manager.rb | 2 +- app/lib/inline_renderer.rb | 13 +++++++++++++ app/services/fan_out_on_write_service.rb | 10 +++++----- app/services/notify_service.rb | 2 +- app/services/remove_status_service.rb | 6 +++--- app/workers/push_update_worker.rb | 13 +++---------- 6 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 app/lib/inline_renderer.rb diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 87865bfdc..58d9fb1fc 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -34,7 +34,7 @@ class FeedManager trim(timeline_type, account.id) end - PushUpdateWorker.perform_async(timeline_type, account.id, status.id) + PushUpdateWorker.perform_async(account.id, status.id) end def trim(type, account_id) diff --git a/app/lib/inline_renderer.rb b/app/lib/inline_renderer.rb new file mode 100644 index 000000000..8e04ad1d5 --- /dev/null +++ b/app/lib/inline_renderer.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class InlineRenderer + def self.render(status, current_account, template) + Rabl::Renderer.new( + template, + status, + view_path: 'app/views', + format: :json, + scope: InlineRablScope.new(current_account) + ).render + end +end diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 106d257ba..c63fcc1fe 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -50,22 +50,22 @@ class FanOutOnWriteService < BaseService end def render_anonymous_payload(status) - @payload = FeedManager.instance.inline_render(nil, 'api/v1/statuses/show', status) + @payload = InlineRenderer.render(status, nil, 'api/v1/statuses/show') end def deliver_to_hashtags(status) Rails.logger.debug "Delivering status #{status.id} to hashtags" status.tags.pluck(:name).each do |hashtag| - FeedManager.instance.broadcast("hashtag:#{hashtag}", event: 'update', payload: @payload) - FeedManager.instance.broadcast("hashtag:#{hashtag}:local", event: 'update', payload: @payload) if status.account.local? + Redis.current.publish("hashtag:#{hashtag}", Oj.dump(event: :update, payload: @payload)) + Redis.current.publish("hashtag:#{hashtag}:local", Oj.dump(event: :update, payload: @payload)) if status.account.local? end end def deliver_to_public(status) Rails.logger.debug "Delivering status #{status.id} to public timeline" - FeedManager.instance.broadcast(:public, event: 'update', payload: @payload) - FeedManager.instance.broadcast('public:local', event: 'update', payload: @payload) if status.account.local? + Redis.current.publish('public', Oj.dump(event: 'update', payload: @payload)) + Redis.current.publish('public:local', Oj.dump(event: 'update', payload: @payload)) if status.account.local? end end diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index 24486f220..62508a049 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -50,7 +50,7 @@ class NotifyService < BaseService def create_notification @notification.save! return unless @notification.browserable? - FeedManager.instance.broadcast(@recipient.id, event: 'notification', payload: FeedManager.instance.inline_render(@recipient, 'api/v1/notifications/show', @notification)) + Redis.current.publish(@recipient.id, Oj.dump(event: :notification, payload: InlineRenderer.render(@notification, @recipient, 'api/v1/notifications/show'))) end def send_email diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index cf1f432e4..e19fdd030 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -65,17 +65,17 @@ class RemoveStatusService < BaseService redis.zremrangebyscore(FeedManager.instance.key(type, receiver.id), status.id, status.id) end - FeedManager.instance.broadcast(receiver.id, event: 'delete', payload: status.id) + Redis.current.publish(receiver.id, Oj.dump(event: :delete, payload: status.id)) end def remove_from_hashtags(status) status.tags.each do |tag| - FeedManager.instance.broadcast("hashtag:#{tag.name}", event: 'delete', payload: status.id) + Redis.current.publish("hashtag:#{tag.name}", Oj.dump(event: :delete, payload: status.id)) end end def remove_from_public(status) - FeedManager.instance.broadcast(:public, event: 'delete', payload: status.id) + Redis.current.publish('public', Oj.dump(event: :delete, payload: status.id)) end def redis diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index 166a9b449..fbcdcf634 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -3,19 +3,12 @@ class PushUpdateWorker include Sidekiq::Worker - def perform(timeline, account_id, status_id) + def perform(account_id, status_id) account = Account.find(account_id) status = Status.find(status_id) - - message = Rabl::Renderer.new( - 'api/v1/statuses/show', - status, - view_path: 'app/views', - format: :json, - scope: InlineRablScope.new(account) - ) + message = InlineRenderer.render(status, account, 'api/v1/statuses/show') - Redis.current.publish("timeline:#{account.id}", Oj.dump({ event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i })) + Redis.current.publish("timeline:#{account.id}", Oj.dump(event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i)) rescue ActiveRecord::RecordNotFound true end -- cgit From 65b3a2a5a6e3151cf4da89132326b796a5c0687a Mon Sep 17 00:00:00 2001 From: Brad Janke Date: Wed, 5 Apr 2017 13:14:27 -0500 Subject: Adds mtndevelopment --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..28f756bfd 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [mastodon.mtndevelopment.com](https://mastodon.mtndevelopment.com/)|Open registration. General nerding out.|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 6b41fb2e6ffa11aa70d14600ad26575bf9aec112 Mon Sep 17 00:00:00 2001 From: ava Date: Wed, 5 Apr 2017 21:44:13 +0300 Subject: Update List-of-Mastodon-instances.md --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..3c72c2c14 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,5 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| - +| [mastodon.ml](http://mastodon.ml) |A chill place to hangout and chat about anime, programming and movies.|Yes|Yes| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From eb98c99924ab810eea8a97040a82308f68c805cc Mon Sep 17 00:00:00 2001 From: "Thibaut (Eychics)" Date: Wed, 5 Apr 2017 20:45:23 +0200 Subject: Add mastodon.nuzgo.net --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..26034c368 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -7,6 +7,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | -------------|-------------|---|---| | [mastodon.social](https://mastodon.social) |Flagship, quick updates|No|No| | [securitymastod.one](https://securitymastod.one/) |Information security enthusiasts and pros|Yes|Yes| +| [mastodon.nuzgo.net](https://mastodon.nuzgo.net/) |Mastodon instance hosted in Paris |Yes|No| | [mastodon.cx](https://mastodon.cx/) |Alternative Mastodon instance hosted in France|Yes|Yes| | [mastodon.network](https://mastodon.network) |N/A|Yes|Yes| | [awoo.space](https://awoo.space) |Intentionally moderated, only federates with mastodon.social|Yes|No| -- cgit From c19e0f1212b63a3db702adc2c6444e1a323b7d27 Mon Sep 17 00:00:00 2001 From: James Moore Date: Wed, 5 Apr 2017 11:53:39 -0700 Subject: Use NFS for the shared folder because it dramatically decreases latency for git operations. --- Vagrantfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 154d0e895..b93ec9fa2 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -97,6 +97,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.hostsupdater.remove_on_suspend = false end + config.vm.synced_folder ".", "/vagrant", type: "nfs", mount_options: ['rw', 'vers=3', 'tcp'] + # Otherwise, you can access the site at http://localhost:3000 config.vm.network :forwarded_port, guest: 80, host: 3000 -- cgit From 5442083b3c44c731679fc489568bf7f70a807a39 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 5 Apr 2017 21:41:50 +0200 Subject: Split SalmonWorker into smaller parts, move profile updating into another job --- app/services/follow_remote_account_service.rb | 16 ++++++---------- app/services/process_feed_service.rb | 6 +++--- app/services/process_interaction_service.rb | 10 +++------- app/workers/admin/suspension_worker.rb | 2 ++ app/workers/application_worker.rb | 2 ++ app/workers/distribution_worker.rb | 5 +---- app/workers/remote_profile_update_worker.rb | 20 ++++++++++++++++++++ app/workers/salmon_worker.rb | 2 +- spec/services/process_feed_service_spec.rb | 1 + 9 files changed, 39 insertions(+), 25 deletions(-) create mode 100644 app/workers/remote_profile_update_worker.rb diff --git a/app/services/follow_remote_account_service.rb b/app/services/follow_remote_account_service.rb index b39eafc70..936953429 100644 --- a/app/services/follow_remote_account_service.rb +++ b/app/services/follow_remote_account_service.rb @@ -45,13 +45,13 @@ class FollowRemoteAccountService < BaseService account.suspended = true if domain_block && domain_block.suspend? account.silenced = true if domain_block && domain_block.silence? - xml = get_feed(account.remote_url) - hubs = get_hubs(xml) + body, xml = get_feed(account.remote_url) + hubs = get_hubs(xml) account.uri = get_account_uri(xml) account.hub_url = hubs.first.attribute('href').value - get_profile(xml, account) + get_profile(body, account) account.save! account @@ -61,7 +61,7 @@ class FollowRemoteAccountService < BaseService def get_feed(url) response = http_client.get(Addressable::URI.parse(url)) - Nokogiri::XML(response) + [response.to_s, Nokogiri::XML(response)] end def get_hubs(xml) @@ -82,12 +82,8 @@ class FollowRemoteAccountService < BaseService author_uri.content end - def get_profile(xml, account) - update_remote_profile_service.call(xml.at_xpath('/xmlns:feed'), account) - end - - def update_remote_profile_service - @update_remote_profile_service ||= UpdateRemoteProfileService.new + def get_profile(body, account) + RemoteProfileUpdateWorker.perform_async(account.id, body.force_encoding('UTF-8'), false) end def http_client diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb index 69911abc5..cf2f7a826 100644 --- a/app/services/process_feed_service.rb +++ b/app/services/process_feed_service.rb @@ -5,15 +5,15 @@ class ProcessFeedService < BaseService xml = Nokogiri::XML(body) xml.encoding = 'utf-8' - update_author(xml, account) + update_author(body, xml, account) process_entries(xml, account) end private - def update_author(xml, account) + def update_author(body, xml, account) return if xml.at_xpath('/xmlns:feed', xmlns: TagManager::XMLNS).nil? - UpdateRemoteProfileService.new.call(xml.at_xpath('/xmlns:feed', xmlns: TagManager::XMLNS), account, true) + RemoteProfileUpdateWorker.perform_async(account.id, body.force_encoding('UTF-8'), true) end def process_entries(xml, account) diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb index d5f7b4b3c..805ca5a27 100644 --- a/app/services/process_interaction_service.rb +++ b/app/services/process_interaction_service.rb @@ -24,7 +24,7 @@ class ProcessInteractionService < BaseService return if account.suspended? if salmon.verify(envelope, account.keypair) - update_remote_profile_service.call(xml.at_xpath('/xmlns:entry', xmlns: TagManager::XMLNS), account, true) + RemoteProfileUpdateWorker.perform_async(account.id, body.force_encoding('UTF-8'), true) case verb(xml) when :follow @@ -114,7 +114,7 @@ class ProcessInteractionService < BaseService return if status.nil? - remove_status_service.call(status) if account.id == status.account_id + RemovalWorker.perform_async(status.id) if account.id == status.account_id end def favourite!(xml, from_account) @@ -130,7 +130,7 @@ class ProcessInteractionService < BaseService end def add_post!(body, account) - process_feed_service.call(body, account) + ProcessingWorker.perform_async(account.id, body.force_encoding('UTF-8')) end def status(xml) @@ -153,10 +153,6 @@ class ProcessInteractionService < BaseService @process_feed_service ||= ProcessFeedService.new end - def update_remote_profile_service - @update_remote_profile_service ||= UpdateRemoteProfileService.new - end - def remove_status_service @remove_status_service ||= RemoveStatusService.new end diff --git a/app/workers/admin/suspension_worker.rb b/app/workers/admin/suspension_worker.rb index 38761f3b9..7ef2b35ec 100644 --- a/app/workers/admin/suspension_worker.rb +++ b/app/workers/admin/suspension_worker.rb @@ -3,6 +3,8 @@ class Admin::SuspensionWorker include Sidekiq::Worker + sidekiq_options queue: 'pull' + def perform(account_id) SuspendAccountService.new.call(Account.find(account_id)) end diff --git a/app/workers/application_worker.rb b/app/workers/application_worker.rb index f2d7c1062..436f24763 100644 --- a/app/workers/application_worker.rb +++ b/app/workers/application_worker.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationWorker def info(message) Rails.logger.info("#{self.class.name} - #{message}") diff --git a/app/workers/distribution_worker.rb b/app/workers/distribution_worker.rb index 9a2867ea6..f7953689b 100644 --- a/app/workers/distribution_worker.rb +++ b/app/workers/distribution_worker.rb @@ -4,10 +4,7 @@ class DistributionWorker < ApplicationWorker include Sidekiq::Worker def perform(status_id) - status = Status.find(status_id) - - FanOutOnWriteService.new.call(status) - WarmCacheService.new.call(status) + FanOutOnWriteService.new.call(Status.find(status_id)) rescue ActiveRecord::RecordNotFound info("Couldn't find the status") end diff --git a/app/workers/remote_profile_update_worker.rb b/app/workers/remote_profile_update_worker.rb new file mode 100644 index 000000000..b91dc3466 --- /dev/null +++ b/app/workers/remote_profile_update_worker.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class RemoteProfileUpdateWorker + include Sidekiq::Worker + + sidekiq_options queue: 'pull' + + def perform(account_id, body, resubscribe) + account = Account.find(account_id) + + xml = Nokogiri::XML(body) + xml.encoding = 'utf-8' + + author_container = xml.at_xpath('/xmlns:feed', xmlns: TagManager::XMLNS) || xml.at_xpath('/xmlns:entry', xmlns: TagManager::XMLNS) + + UpdateRemoteProfileService.new.call(author_container, account, resubscribe) + rescue ActiveRecord::RecordNotFound + true + end +end diff --git a/app/workers/salmon_worker.rb b/app/workers/salmon_worker.rb index fc95ce47f..d37d40432 100644 --- a/app/workers/salmon_worker.rb +++ b/app/workers/salmon_worker.rb @@ -7,7 +7,7 @@ class SalmonWorker def perform(account_id, body) ProcessInteractionService.new.call(body, Account.find(account_id)) - rescue ActiveRecord::RecordNotFound + rescue Nokogiri::XML::XPath::SyntaxError, ActiveRecord::RecordNotFound true end end diff --git a/spec/services/process_feed_service_spec.rb b/spec/services/process_feed_service_spec.rb index 5e57d823b..b15284fee 100644 --- a/spec/services/process_feed_service_spec.rb +++ b/spec/services/process_feed_service_spec.rb @@ -16,6 +16,7 @@ RSpec.describe ProcessFeedService do end it 'updates remote user\'s account information' do + account.reload expect(account.display_name).to eq '::1' expect(account).to have_attached_file(:avatar) end -- cgit From 7aede8e72092fa2b8846f2212dff411247a841b1 Mon Sep 17 00:00:00 2001 From: Ninetailed Date: Wed, 5 Apr 2017 22:35:35 +0100 Subject: Description in instance list for mastodon.ninetailed.uk --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..b6a8c65a9 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -34,7 +34,7 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [oc.todon.fr](https://oc.todon.fr) |Modérée et principalement francophone, pas de tolérances pour misogynie/LGBTphobies/validisme/etc.|Yes|Yes| | [maly.io](https://maly.io) |N/A|Yes|No| | [social.lou.lt](https://social.lou.lt) |N/A|Yes|No| -| [mastodon.ninetailed.uk](https://mastodon.ninetailed.uk) |N/A|Yes|No| +| [mastodon.ninetailed.uk](https://mastodon.ninetailed.uk) |Open registrations, furry-friendly, UK-based|Yes|No| | [soc.louiz.org](https://soc.louiz.org) |"Coucou"|Yes|No| | [7nw.eu](https://7nw.eu) |N/A|Yes|No| | [mastodon.gougere.fr](https://mastodon.gougere.fr)|N/A|Yes|No| -- cgit From d025c5e59306bed05aad4ebc52c541c34cf43d94 Mon Sep 17 00:00:00 2001 From: Nick Gerakines Date: Wed, 5 Apr 2017 19:19:44 -0400 Subject: Added off-the-clock.us to the list of instances --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..5404d6b69 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [off-the-clock.us](https://off-the-clock.us/)|The work day is over.|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 540d6efe88717b0da4a23b5069a3caaff5b3241a Mon Sep 17 00:00:00 2001 From: blackle Date: Wed, 5 Apr 2017 20:04:13 -0400 Subject: Catch more errors in process_follows so it doesn't fail --- app/workers/import_worker.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/import_worker.rb b/app/workers/import_worker.rb index 7cf29fb53..d5a33cada 100644 --- a/app/workers/import_worker.rb +++ b/app/workers/import_worker.rb @@ -46,7 +46,7 @@ class ImportWorker begin FollowService.new.call(from_account, row[0]) - rescue Goldfinger::Error, HTTP::Error, OpenSSL::SSL::SSLError + rescue Mastodon::NotPermittedError, ActiveRecord::RecordNotFound, Goldfinger::Error, HTTP::Error, OpenSSL::SSL::SSLError next end end -- cgit From dbd529109ea95df43aefa514c312d7397e7fc713 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 6 Apr 2017 02:26:59 +0200 Subject: Fix notifications delivered to wrong pubsub channel, optimized RemoveStatusService, slightly optimized FanOutOnWriteService again --- app/services/fan_out_on_write_service.rb | 9 +++++---- app/services/notify_service.rb | 2 +- app/services/remove_status_service.rb | 28 +++++++++++++++------------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index c63fcc1fe..a25c20c93 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -51,21 +51,22 @@ class FanOutOnWriteService < BaseService def render_anonymous_payload(status) @payload = InlineRenderer.render(status, nil, 'api/v1/statuses/show') + @payload = Oj.dump(event: :update, payload: @payload) end def deliver_to_hashtags(status) Rails.logger.debug "Delivering status #{status.id} to hashtags" status.tags.pluck(:name).each do |hashtag| - Redis.current.publish("hashtag:#{hashtag}", Oj.dump(event: :update, payload: @payload)) - Redis.current.publish("hashtag:#{hashtag}:local", Oj.dump(event: :update, payload: @payload)) if status.account.local? + Redis.current.publish("hashtag:#{hashtag}", @payload) + Redis.current.publish("hashtag:#{hashtag}:local", @payload) if status.local? end end def deliver_to_public(status) Rails.logger.debug "Delivering status #{status.id} to public timeline" - Redis.current.publish('public', Oj.dump(event: 'update', payload: @payload)) - Redis.current.publish('public:local', Oj.dump(event: 'update', payload: @payload)) if status.account.local? + Redis.current.publish('public', @payload) + Redis.current.publish('public:local', @payload) if status.local? end end diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index 62508a049..ffeee5fcf 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -50,7 +50,7 @@ class NotifyService < BaseService def create_notification @notification.save! return unless @notification.browserable? - Redis.current.publish(@recipient.id, Oj.dump(event: :notification, payload: InlineRenderer.render(@notification, @recipient, 'api/v1/notifications/show'))) + Redis.current.publish("timeline:#{@recipient.id}", Oj.dump(event: :notification, payload: InlineRenderer.render(@notification, @recipient, 'api/v1/notifications/show'))) end def send_email diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index e19fdd030..60ce9987c 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -4,6 +4,8 @@ class RemoveStatusService < BaseService include StreamEntryRenderer def call(status) + @payload = Oj.dump(event: :delete, payload: status.id) + remove_from_self(status) if status.account.local? remove_from_followers(status) remove_from_mentioned(status) @@ -25,25 +27,23 @@ class RemoveStatusService < BaseService end def remove_from_followers(status) - status.account.followers.each do |follower| - next unless follower.local? + status.account.followers.where(domain: nil).each do |follower| unpush(:home, follower, status) end end def remove_from_mentioned(status) + return unless status.local? notified_domains = [] status.mentions.each do |mention| mentioned_account = mention.account - if mentioned_account.local? - unpush(:mentions, mentioned_account, status) - else - next if notified_domains.include?(mentioned_account.domain) - notified_domains << mentioned_account.domain - send_delete_salmon(mentioned_account, status) - end + next if mentioned_account.local? + next if notified_domains.include?(mentioned_account.domain) + + notified_domains << mentioned_account.domain + send_delete_salmon(mentioned_account, status) end end @@ -65,17 +65,19 @@ class RemoveStatusService < BaseService redis.zremrangebyscore(FeedManager.instance.key(type, receiver.id), status.id, status.id) end - Redis.current.publish(receiver.id, Oj.dump(event: :delete, payload: status.id)) + Redis.current.publish("timeline:#{receiver.id}", @payload) end def remove_from_hashtags(status) - status.tags.each do |tag| - Redis.current.publish("hashtag:#{tag.name}", Oj.dump(event: :delete, payload: status.id)) + status.tags.pluck(:name) do |hashtag| + Redis.current.publish("hashtag:#{hashtag}", @payload) + Redis.current.publish("hashtag:#{hashtag}:local", @payload) if status.local? end end def remove_from_public(status) - Redis.current.publish('public', Oj.dump(event: :delete, payload: status.id)) + Redis.current.publish('public', @payload) + Redis.current.publish('public:local', @payload) if status.local? end def redis -- cgit From 51d7caaf1994ee3cb531b64841e12d129dded298 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 6 Apr 2017 04:03:23 +0200 Subject: Fix wrong pubsub channel on public timelines --- app/services/fan_out_on_write_service.rb | 8 ++++---- app/services/remove_status_service.rb | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index a25c20c93..19eedc0a7 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -58,15 +58,15 @@ class FanOutOnWriteService < BaseService Rails.logger.debug "Delivering status #{status.id} to hashtags" status.tags.pluck(:name).each do |hashtag| - Redis.current.publish("hashtag:#{hashtag}", @payload) - Redis.current.publish("hashtag:#{hashtag}:local", @payload) if status.local? + Redis.current.publish("timeline:hashtag:#{hashtag}", @payload) + Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if status.local? end end def deliver_to_public(status) Rails.logger.debug "Delivering status #{status.id} to public timeline" - Redis.current.publish('public', @payload) - Redis.current.publish('public:local', @payload) if status.local? + Redis.current.publish('timeline:public', @payload) + Redis.current.publish('timeline:public:local', @payload) if status.local? end end diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 60ce9987c..50bb7fc97 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -70,14 +70,14 @@ class RemoveStatusService < BaseService def remove_from_hashtags(status) status.tags.pluck(:name) do |hashtag| - Redis.current.publish("hashtag:#{hashtag}", @payload) - Redis.current.publish("hashtag:#{hashtag}:local", @payload) if status.local? + Redis.current.publish("timeline:hashtag:#{hashtag}", @payload) + Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if status.local? end end def remove_from_public(status) - Redis.current.publish('public', @payload) - Redis.current.publish('public:local', @payload) if status.local? + Redis.current.publish('timeline:public', @payload) + Redis.current.publish('timeline:public:local', @payload) if status.local? end def redis -- cgit From 73b8e67f4b103fc3400064d153807d6d88f758d4 Mon Sep 17 00:00:00 2001 From: Derek Lewis Date: Thu, 6 Apr 2017 01:11:16 -0400 Subject: Add infinimatix.net to instance list --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..1b91e00ad 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [infinimatix.net](https://infinimatix.net)|Informatics|Yes|Yes| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From 83530f0eef8f6cf04321b61c917da08ab0f4e323 Mon Sep 17 00:00:00 2001 From: Guewen FAIVRE Date: Thu, 6 Apr 2017 08:46:16 +0200 Subject: Add mastodon.elao.com instance --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..39d0cd68b 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [mastodon.elao.com](https://mastodon.elao.com/)|OpenSource WebTech Agency. (France)|Yes|No| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From c62696bc467133869f6b1d39b923135b0e64900f Mon Sep 17 00:00:00 2001 From: Markus R Date: Thu, 6 Apr 2017 08:52:15 +0200 Subject: Update List-of-Mastodon-instances.md --- docs/Using-Mastodon/List-of-Mastodon-instances.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/List-of-Mastodon-instances.md b/docs/Using-Mastodon/List-of-Mastodon-instances.md index 1f5be3a61..69a58601b 100644 --- a/docs/Using-Mastodon/List-of-Mastodon-instances.md +++ b/docs/Using-Mastodon/List-of-Mastodon-instances.md @@ -48,5 +48,6 @@ There is also a list at [instances.mastodon.xyz](https://instances.mastodon.xyz) | [mastodon.cc](https://mastodon.cc)|Art|Yes|No| | [mastodon.technology](https://mastodon.technology)|Open registrations, federates everywhere, for tech folks|Yes|No| | [mastodon.systemlab.fr](https://mastodon.systemlab.fr/)|Le mastodon Français, informatique, jeux-vidéos, gaming et hébergement.|Yes|No| +| [social.0day.agency](https://social.0day.agency)|Infosec, Hacking, Fun (only protonmail)|Yes|Yes| Let me know if you start running one so I can add it to the list! (Alternatively, add it yourself as a pull request). -- cgit From a2637c17200f9dd2eea9e130368cea87076823c7 Mon Sep 17 00:00:00 2001 From: Ryan Wade Date: Thu, 6 Apr 2017 15:41:00 +0800 Subject: Optimize Dockerfile Optimize Dockerfile, reduce build time. --- .dockerignore | 1 + Dockerfile | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index 7892e503c..21d1f59a1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,3 +5,4 @@ public/assets node_modules storybook neo4j +vendor/bundle diff --git a/Dockerfile b/Dockerfile index bcc911343..f5eb08893 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV RAILS_ENV=production \ WORKDIR /mastodon -COPY . /mastodon +COPY Gemfile Gemfile.lock package.json yarn.lock /mastodon/ RUN BUILD_DEPS=" \ postgresql-dev \ @@ -28,4 +28,6 @@ RUN BUILD_DEPS=" \ && apk del $BUILD_DEPS \ && rm -rf /tmp/* /var/cache/apk/* +COPY . /mastodon + VOLUME /mastodon/public/system /mastodon/public/assets -- cgit From a2adf848580e0afcd344d0474dc96c389934d4a9 Mon Sep 17 00:00:00 2001 From: Ash Furrow Date: Thu, 6 Apr 2017 07:53:48 -0400 Subject: Updates slugignore. --- .slugignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.slugignore b/.slugignore index cbf0615e7..b0141b0e2 100644 --- a/.slugignore +++ b/.slugignore @@ -1,2 +1,5 @@ node_modules/ .cache/ +docs/ +spec/ +storybook/ -- cgit From a3d204e98217d3177d6733845c6937d63e3494c3 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 6 Apr 2017 12:16:39 -0400 Subject: Linux users must enable NFS for Vagrant --- docs/Running-Mastodon/Vagrant-guide.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Vagrant-guide.md b/docs/Running-Mastodon/Vagrant-guide.md index b24f14e83..83a892408 100644 --- a/docs/Running-Mastodon/Vagrant-guide.md +++ b/docs/Running-Mastodon/Vagrant-guide.md @@ -17,6 +17,8 @@ To create and provision a new virtual machine for Mastodon development: cd mastodon vagrant up +**Note:** On Linux hosts, you will need to [enable NFS support](https://www.vagrantup.com/docs/synced-folders/nfs.html). + Running `vagrant up` for the first time will run provisioning, which will: - Download the Ubuntu 14.04 base image, if there isn't already a copy on your machine @@ -61,4 +63,4 @@ To run the `rspec` tests and `rubocop` style checker, you may either: ## Support/help -If you are confused, or having any issues with the above, the Mastodon IRC channel ( irc.freenode.net #mastodon ) is a good place to find assistance. \ No newline at end of file +If you are confused, or having any issues with the above, the Mastodon IRC channel ( irc.freenode.net #mastodon ) is a good place to find assistance. -- cgit From a3318814e10d94fcbb1c3f717f5b0064c49c30c7 Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Thu, 6 Apr 2017 20:57:16 +0200 Subject: add metadata to Dockerfile --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile b/Dockerfile index f5eb08893..c28287cca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,13 @@ FROM ruby:2.3.1-alpine +LABEL maintainer="https://github.com/tootsuite/mastodon" \ + description="A GNU Social-compatible microblogging server" + ENV RAILS_ENV=production \ NODE_ENV=production +EXPOSE 3000 4000 + WORKDIR /mastodon COPY Gemfile Gemfile.lock package.json yarn.lock /mastodon/ -- cgit From ed2bfdee67735a32defda60036d5c01dfb71e417 Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Thu, 6 Apr 2017 20:59:20 +0200 Subject: add Docker microbadger to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index db60b66f7..9b43e8077 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,8 @@ Consult the example configuration file, `.env.production.sample` for the full li ## Running with Docker and Docker-Compose +[![](https://images.microbadger.com/badges/version/gargron/mastodon.svg)](https://microbadger.com/images/gargron/mastodon "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/image/gargron/mastodon.svg)](https://microbadger.com/images/gargron/mastodon "Get your own image badge on microbadger.com") + The project now includes a `Dockerfile` and a `docker-compose.yml`. You need to turn `.env.production.sample` into `.env.production` with all the variables set before you can: docker-compose build -- cgit From 97ae53daa8a2538e7f8b22c1bbf63d0713475438 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 6 Apr 2017 16:24:57 -0400 Subject: Reduce size of background-photo.jpeg Reduced by running through `guetzli` image optimizer. --- app/assets/images/background-photo.jpeg | Bin 894792 -> 214464 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/app/assets/images/background-photo.jpeg b/app/assets/images/background-photo.jpeg index b0a88ff35..d7937fd4b 100644 Binary files a/app/assets/images/background-photo.jpeg and b/app/assets/images/background-photo.jpeg differ -- cgit From 7596de1aeca20af1a7291d312ac720ab3d84dc45 Mon Sep 17 00:00:00 2001 From: Markus Amalthea Magnuson Date: Thu, 6 Apr 2017 22:34:59 +0200 Subject: Add a couple of network performance tweaks to Vagrantfile. --- Vagrantfile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index b93ec9fa2..cd7f74473 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -84,6 +84,16 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider :virtualbox do |vb| vb.name = "mastodon" vb.customize ["modifyvm", :id, "--memory", "1024"] + + # Disable VirtualBox DNS proxy to skip long-delay IPv6 resolutions. + # https://github.com/mitchellh/vagrant/issues/1172 + vb.customize ["modifyvm", :id, "--natdnsproxy1", "off"] + vb.customize ["modifyvm", :id, "--natdnshostresolver1", "off"] + + # Use "virtio" network interfaces for better performance. + vb.customize ["modifyvm", :id, "--nictype1", "virtio"] + vb.customize ["modifyvm", :id, "--nictype2", "virtio"] + end config.vm.hostname = "mastodon.dev" @@ -91,9 +101,9 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # This uses the vagrant-hostsupdater plugin, and lets you # access the development site at http://mastodon.dev. # To install: - # $ vagrant plugin install hostsupdater + # $ vagrant plugin install vagrant-hostsupdater if defined?(VagrantPlugins::HostsUpdater) - config.vm.network :private_network, ip: "192.168.42.42" + config.vm.network :private_network, ip: "192.168.42.42", nictype: "virtio" config.hostsupdater.remove_on_suspend = false end -- cgit From 31597fd37717db79edb69a64c97b1dca2f9a8a08 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 7 Apr 2017 00:04:09 +0200 Subject: Low-hanging fruit of query optimization, these indices were missing --- .../20170406215816_add_notifications_and_favourites_indices.rb | 7 +++++++ db/schema.rb | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20170406215816_add_notifications_and_favourites_indices.rb diff --git a/db/migrate/20170406215816_add_notifications_and_favourites_indices.rb b/db/migrate/20170406215816_add_notifications_and_favourites_indices.rb new file mode 100644 index 000000000..00e41bf3a --- /dev/null +++ b/db/migrate/20170406215816_add_notifications_and_favourites_indices.rb @@ -0,0 +1,7 @@ +class AddNotificationsAndFavouritesIndices < ActiveRecord::Migration[5.0] + def change + add_index :notifications, [:activity_id, :activity_type] + add_index :accounts, :url + add_index :favourites, :status_id + end +end diff --git a/db/schema.rb b/db/schema.rb index b5d55fa16..fe9b8dd4f 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.define(version: 20170405112956) do +ActiveRecord::Schema.define(version: 20170406215816) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -49,6 +49,7 @@ ActiveRecord::Schema.define(version: 20170405112956) do t.integer "following_count", default: 0, null: false t.index "(((setweight(to_tsvector('simple'::regconfig, (display_name)::text), 'A'::\"char\") || setweight(to_tsvector('simple'::regconfig, (username)::text), 'B'::\"char\")) || setweight(to_tsvector('simple'::regconfig, (COALESCE(domain, ''::character varying))::text), 'C'::\"char\")))", name: "search_index", using: :gin t.index "lower((username)::text), lower((domain)::text)", name: "index_accounts_on_username_and_domain_lower", using: :btree + t.index ["url"], name: "index_accounts_on_url", using: :btree t.index ["username", "domain"], name: "index_accounts_on_username_and_domain", unique: true, using: :btree end @@ -75,6 +76,7 @@ ActiveRecord::Schema.define(version: 20170405112956) do t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true, using: :btree + t.index ["status_id"], name: "index_favourites_on_status_id", using: :btree end create_table "follow_requests", force: :cascade do |t| @@ -128,6 +130,7 @@ ActiveRecord::Schema.define(version: 20170405112956) do t.datetime "updated_at", null: false t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true, using: :btree t.index ["status_id"], name: "index_mentions_on_status_id", using: :btree + t.index ["status_id"], name: "mentions_status_id_index", using: :btree end create_table "mutes", force: :cascade do |t| @@ -146,6 +149,7 @@ ActiveRecord::Schema.define(version: 20170405112956) do t.datetime "updated_at", null: false t.integer "from_account_id" t.index ["account_id", "activity_id", "activity_type"], name: "account_activity", unique: true, using: :btree + t.index ["activity_id", "activity_type"], name: "index_notifications_on_activity_id_and_activity_type", using: :btree end create_table "oauth_access_grants", force: :cascade do |t| -- cgit From 5d43a9cae2dd03f500c4bd9736a9e71e131b6d02 Mon Sep 17 00:00:00 2001 From: Jason Rhodes Date: Thu, 6 Apr 2017 22:48:17 -0400 Subject: Email service options :P Small addition in case people want email service options, sparkpost.com gives you 100k/mo free --- .env.production.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.production.sample b/.env.production.sample index a7f9eb4bf..9bb988ea6 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -26,7 +26,7 @@ OTP_SECRET= # EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc # E-mail configuration -SMTP_SERVER=smtp.mailgun.org +SMTP_SERVER=smtp.mailgun.org, smtp.sparkpostmail.com, etc. SMTP_PORT=587 SMTP_LOGIN= SMTP_PASSWORD= -- cgit From 6d6a429af8fe4bd92ed497f401676353fdc603e0 Mon Sep 17 00:00:00 2001 From: Eugen Date: Fri, 7 Apr 2017 05:56:56 +0200 Subject: Rewrite Atom generation from stream entries to use Ox instead of Nokogiri (#1124) * Rewrite Atom generation from stream entries to use Ox instead of Nokogiri::Builder StreamEntry is now limited to only statuses, which allows some optimization. Removed extra queries on AccountsController#show. AtomSerializer instead of AtomBuilderHelper used in AccountsController#show, StreamEntriesController#show, StreamEntryRenderer and PubSubHubbub::DistributionWorker PubSubHubbub::DistributionWorker moves n+1 DomainBlock query to PubSubHubbub::DeliveryWorker instead. All Salmon slaps that aren't based on StreamEntry still use AtomBuilderHelper and Nokogiri * All Salmon slaps now use Ox instead of Nokogiri. No touch from status on account --- Gemfile | 1 + Gemfile.lock | 2 + app/controllers/accounts_controller.rb | 3 +- app/controllers/stream_entries_controller.rb | 4 +- app/lib/atom_serializer.rb | 348 ++++++++++++++++++++++++ app/lib/tag_manager.rb | 2 + app/models/stream_entry.rb | 28 +- app/services/after_block_service.rb | 18 +- app/services/authorize_follow_service.rb | 27 +- app/services/block_service.rb | 18 +- app/services/concerns/stream_entry_renderer.rb | 3 +- app/services/favourite_service.rb | 22 +- app/services/follow_service.rb | 44 +-- app/services/reject_follow_service.rb | 27 +- app/services/unblock_service.rb | 18 +- app/services/unfavourite_service.rb | 22 +- app/services/unfollow_service.rb | 21 +- app/views/accounts/show.atom.ruby | 27 -- app/views/stream_entries/show.atom.ruby | 9 - app/workers/pubsubhubbub/delivery_worker.rb | 3 + app/workers/pubsubhubbub/distribution_worker.rb | 8 +- 21 files changed, 393 insertions(+), 262 deletions(-) create mode 100644 app/lib/atom_serializer.rb delete mode 100644 app/views/accounts/show.atom.ruby delete mode 100644 app/views/stream_entries/show.atom.ruby diff --git a/Gemfile b/Gemfile index b5705e9d1..65bd5eb49 100644 --- a/Gemfile +++ b/Gemfile @@ -34,6 +34,7 @@ gem 'doorkeeper' gem 'rabl' gem 'rqrcode' gem 'twitter-text' +gem 'ox' gem 'oj' gem 'hiredis' gem 'redis', '~>3.2', require: ['redis', 'redis/connection/hiredis'] diff --git a/Gemfile.lock b/Gemfile.lock index 408d85ade..f2a199931 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -240,6 +240,7 @@ GEM addressable (~> 2.4) http (~> 2.0) nokogiri (~> 1.6) + ox (2.4.11) paperclip (5.1.0) activemodel (>= 4.2.0) activesupport (>= 4.2.0) @@ -482,6 +483,7 @@ DEPENDENCIES nokogiri oj ostatus2 + ox paperclip (~> 5.1) paperclip-av-transcoder pg diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index dc1aeb5ea..619c04be2 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -16,7 +16,8 @@ class AccountsController < ApplicationController end format.atom do - @entries = @account.stream_entries.order('id desc').where(activity_type: 'Status').where(hidden: false).with_includes.paginate_by_max_id(20, params[:max_id], params[:since_id]) + @entries = @account.stream_entries.order('id desc').where(hidden: false).with_includes.paginate_by_max_id(20, params[:max_id], params[:since_id]) + render xml: AtomSerializer.render(AtomSerializer.new.feed(@account, @entries.to_a)) end format.activitystreams2 diff --git a/app/controllers/stream_entries_controller.rb b/app/controllers/stream_entries_controller.rb index de38b3602..469a8c33e 100644 --- a/app/controllers/stream_entries_controller.rb +++ b/app/controllers/stream_entries_controller.rb @@ -19,7 +19,9 @@ class StreamEntriesController < ApplicationController end end - format.atom + format.atom do + render xml: AtomSerializer.render(AtomSerializer.new.entry(@stream_entry, true)) + end end end diff --git a/app/lib/atom_serializer.rb b/app/lib/atom_serializer.rb new file mode 100644 index 000000000..21f485c2d --- /dev/null +++ b/app/lib/atom_serializer.rb @@ -0,0 +1,348 @@ +# frozen_string_literal: true + +class AtomSerializer + include RoutingHelper + + class << self + def render(element) + document = Ox::Document.new(version: '1.0') + document << element + "#{Ox.dump(element)}" + end + end + + def author(account) + author = Ox::Element.new('author') + + uri = TagManager.instance.uri_for(account) + + append_element(author, 'id', uri) + append_element(author, 'activity:object-type', TagManager::TYPES[:person]) + append_element(author, 'uri', uri) + append_element(author, 'name', account.username) + append_element(author, 'email', account.local? ? "#{account.acct}@#{Rails.configuration.x.local_domain}" : account.acct) + append_element(author, 'summary', account.note) + append_element(author, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(account)) + append_element(author, 'link', nil, rel: :avatar, type: account.avatar_content_type, 'media:width': 120, 'media:height': 120, href: full_asset_url(account.avatar.url(:original))) + append_element(author, 'link', nil, rel: :header, type: account.header_content_type, 'media:width': 700, 'media:height': 335, href: full_asset_url(account.header.url(:original))) + append_element(author, 'poco:preferredUsername', account.username) + append_element(author, 'poco:displayName', account.display_name) unless account.display_name.blank? + append_element(author, 'poco:note', Formatter.instance.simplified_format(account).to_str) unless account.note.blank? + append_element(author, 'mastodon:scope', account.locked? ? :private : :public) + + author + end + + def feed(account, stream_entries) + feed = Ox::Element.new('feed') + + add_namespaces(feed) + + append_element(feed, 'id', account_url(account, format: 'atom')) + append_element(feed, 'title', account.display_name) + append_element(feed, 'subtitle', account.note) + append_element(feed, 'updated', account.updated_at.iso8601) + append_element(feed, 'logo', full_asset_url(account.avatar.url(:original))) + + feed << author(account) + + append_element(feed, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(account)) + append_element(feed, 'link', nil, rel: :self, type: 'application/atom+xml', href: account_url(account, format: 'atom')) + append_element(feed, 'link', nil, rel: :next, type: 'application/atom+xml', href: account_url(account, format: 'atom', max_id: stream_entries.last.id)) if stream_entries.size == 20 + append_element(feed, 'link', nil, rel: :hub, href: api_push_url) + append_element(feed, 'link', nil, rel: :salmon, href: api_salmon_url(account.id)) + + stream_entries.each do |stream_entry| + feed << entry(stream_entry) + end + + feed + end + + def entry(stream_entry, root = false) + entry = Ox::Element.new('entry') + + add_namespaces(entry) if root + + append_element(entry, 'id', TagManager.instance.unique_tag(stream_entry.created_at, stream_entry.activity_id, stream_entry.activity_type)) + append_element(entry, 'published', stream_entry.created_at.iso8601) + append_element(entry, 'updated', stream_entry.updated_at.iso8601) + append_element(entry, 'title', stream_entry&.status&.title) + append_element(entry, 'activity:object-type', TagManager::TYPES[stream_entry.object_type]) + append_element(entry, 'activity:verb', TagManager::VERBS[stream_entry.verb]) + + entry << object(stream_entry.target) if stream_entry.targeted? + + serialize_status_attributes(entry, stream_entry.status) unless stream_entry.status.nil? + + append_element(entry, 'link', nil, rel: :alternate, type: 'text/html', href: account_stream_entry_url(stream_entry.account, stream_entry)) + append_element(entry, 'link', nil, rel: :self, type: 'application/atom+xml', href: account_stream_entry_url(stream_entry.account, stream_entry, format: 'atom')) + append_element(entry, 'thr:in-reply-to', nil, ref: TagManager.instance.uri_for(stream_entry.thread), href: TagManager.instance.url_for(stream_entry.thread)) if stream_entry.threaded? + + entry + end + + def object(status) + object = Ox::Element.new('activity:object') + + append_element(object, 'id', TagManager.instance.uri_for(status)) + append_element(object, 'published', status.created_at.iso8601) + append_element(object, 'updated', status.updated_at.iso8601) + append_element(object, 'title', status.title) + + object << author(status.account) + + append_element(object, 'activity:object-type', TagManager::TYPES[status.object_type]) + append_element(object, 'activity:verb', TagManager::VERBS[status.verb]) + + serialize_status_attributes(object, status) + + append_element(object, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(status)) + append_element(object, 'thr:in-reply-to', nil, ref: TagManager.instance.uri_for(status.thread), href: TagManager.instance.url_for(status.thread)) if status.reply? + + object + end + + def follow_salmon(follow) + entry = Ox::Element.new('entry') + add_namespaces(entry) + + description = "#{follow.account.acct} started following #{follow.target_account.acct}" + + append_element(entry, 'id', TagManager.instance.unique_tag(follow.created_at, follow.id, 'Follow')) + append_element(entry, 'title', description) + append_element(entry, 'content', description, type: :html) + + entry << author(follow.account) + + append_element(entry, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(entry, 'activity:verb', TagManager::VERBS[:follow]) + + object = author(follow.target_account) + object.value = 'activity:object' + + entry << object + entry + end + + def follow_request_salmon(follow_request) + entry = Ox::Element.new('entry') + add_namespaces(entry) + + append_element(entry, 'id', TagManager.instance.unique_tag(follow_request.created_at, follow_request.id, 'FollowRequest')) + append_element(entry, 'title', "#{follow_request.account.acct} requested to follow #{follow_request.target_account.acct}") + + entry << author(follow_request.account) + + append_element(entry, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(entry, 'activity:verb', TagManager::VERBS[:request_friend]) + + object = author(follow_request.target_account) + object.value = 'activity:object' + + entry << object + entry + end + + def authorize_follow_request_salmon(follow_request) + entry = Ox::Element.new('entry') + add_namespaces(entry) + + append_element(entry, 'id', TagManager.instance.unique_tag(Time.now.utc, follow_request.id, 'FollowRequest')) + append_element(entry, 'title', "#{follow_request.target_account.acct} authorizes follow request by #{follow_request.account.acct}") + + entry << author(follow_request.target_account) + + append_element(entry, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(entry, 'activity:verb', TagManager::VERBS[:authorize]) + + object = Ox::Element.new('activity:object') + object << author(follow_request.account) + + append_element(object, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(object, 'activity:verb', TagManager::VERBS[:request_friend]) + + inner_object = author(follow_request.target_account) + inner_object.value = 'activity:object' + + object << inner_object + entry << object + entry + end + + def reject_follow_request_salmon(follow_request) + entry = Ox::Element.new('entry') + add_namespaces(entry) + + append_element(entry, 'id', TagManager.instance.unique_tag(Time.now.utc, follow_request.id, 'FollowRequest')) + append_element(entry, 'title', "#{follow_request.target_account.acct} rejects follow request by #{follow_request.account.acct}") + + entry << author(follow_request.target_account) + + append_element(entry, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(entry, 'activity:verb', TagManager::VERBS[:reject]) + + object = Ox::Element.new('activity:object') + object << author(follow_request.account) + + append_element(object, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(object, 'activity:verb', TagManager::VERBS[:request_friend]) + + inner_object = author(follow_request.target_account) + inner_object.value = 'activity:object' + + object << inner_object + entry << object + entry + end + + def unfollow_salmon(follow) + entry = Ox::Element.new('entry') + add_namespaces(entry) + + description = "#{follow.account.acct} is no longer following #{follow.target_account.acct}" + + append_element(entry, 'id', TagManager.instance.unique_tag(Time.now.utc, follow.id, 'Follow')) + append_element(entry, 'title', description) + append_element(entry, 'content', description, type: :html) + + entry << author(follow.account) + + append_element(entry, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(entry, 'activity:verb', TagManager::VERBS[:unfollow]) + + object = author(follow.target_account) + object.value = 'activity:object' + + entry << object + entry + end + + def block_salmon(block) + entry = Ox::Element.new('entry') + add_namespaces(entry) + + description = "#{block.account.acct} no longer wishes to interact with #{block.target_account.acct}" + + append_element(entry, 'id', TagManager.instance.unique_tag(Time.now.utc, block.id, 'Block')) + append_element(entry, 'title', description) + + entry << author(block.account) + + append_element(entry, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(entry, 'activity:verb', TagManager::VERBS[:block]) + + object = author(block.target_account) + object.value = 'activity:object' + + entry << object + entry + end + + def unblock_salmon(block) + entry = Ox::Element.new('entry') + add_namespaces(entry) + + description = "#{block.account.acct} no longer blocks #{block.target_account.acct}" + + append_element(entry, 'id', TagManager.instance.unique_tag(Time.now.utc, block.id, 'Block')) + append_element(entry, 'title', description) + + entry << author(block.account) + + append_element(entry, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(entry, 'activity:verb', TagManager::VERBS[:unblock]) + + object = author(block.target_account) + object.value = 'activity:object' + + entry << object + entry + end + + def favourite_salmon(favourite) + entry = Ox::Element.new('entry') + add_namespaces(entry) + + description = "#{favourite.account.acct} favourited a status by #{favourite.status.account.acct}" + + append_element(entry, 'id', TagManager.instance.unique_tag(favourite.created_at, favourite.id, 'Favourite')) + append_element(entry, 'title', description) + append_element(entry, 'content', description, type: :html) + + entry << author(favourite.account) + + append_element(entry, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(entry, 'activity:verb', TagManager::VERBS[:favorite]) + + entry << object(favourite.status) + + append_element(entry, 'thr:in-reply-to', nil, ref: TagManager.instance.uri_for(favourite.status), href: TagManager.instance.url_for(favourite.status)) + + entry + end + + def unfavourite_salmon(favourite) + entry = Ox::Element.new('entry') + add_namespaces(entry) + + description = "#{favourite.account.acct} no longer favourites a status by #{favourite.status.account.acct}" + + append_element(entry, 'id', TagManager.instance.unique_tag(Time.now.utc, favourite.id, 'Favourite')) + append_element(entry, 'title', description) + append_element(entry, 'content', description, type: :html) + + entry << author(favourite.account) + + append_element(entry, 'activity:object-type', TagManager::TYPES[:activity]) + append_element(entry, 'activity:verb', TagManager::VERBS[:unfavorite]) + + entry << object(favourite.status) + + append_element(entry, 'thr:in-reply-to', nil, ref: TagManager.instance.uri_for(favourite.status), href: TagManager.instance.url_for(favourite.status)) + + entry + end + + private + + def append_element(parent, name, content = nil, attributes = {}) + element = Ox::Element.new(name) + attributes.each { |k, v| element[k] = v.to_s } + element << content.to_s unless content.nil? + parent << element + end + + def add_namespaces(parent) + parent['xmlns'] = TagManager::XMLNS + parent['xmlns:thr'] = TagManager::THR_XMLNS + parent['xmlns:activity'] = TagManager::AS_XMLNS + parent['xmlns:poco'] = TagManager::POCO_XMLNS + parent['xmlns:media'] = TagManager::MEDIA_XMLNS + parent['xmlns:ostatus'] = TagManager::OS_XMLNS + parent['xmlns:mastodon'] = TagManager::MTDN_XMLNS + end + + def serialize_status_attributes(entry, status) + append_element(entry, 'summary', status.spoiler_text) unless status.spoiler_text.blank? + append_element(entry, 'content', Formatter.instance.format(status.reblog? ? status.reblog : status).to_str, type: 'html') + + status.mentions.each do |mentioned| + append_element(entry, 'link', nil, rel: :mentioned, 'ostatus:object-type': TagManager::TYPES[:person], href: TagManager.instance.uri_for(mentioned.account)) + end + + append_element(entry, 'link', nil, rel: :mentioned, 'ostatus:object-type': TagManager::TYPES[:collection], href: TagManager::COLLECTIONS[:public]) if status.public_visibility? + + status.tags.each do |tag| + append_element(entry, 'category', nil, term: tag.name) + end + + append_element(entry, 'category', nil, term: 'nsfw') if status.sensitive? + + status.media_attachments.each do |media| + append_element(entry, 'link', nil, rel: :enclosure, type: media.file_content_type, length: media.file_file_size, href: full_asset_url(media.file.url(:original, false))) + end + + append_element(entry, 'mastodon:scope', status.visibility) + end +end diff --git a/app/lib/tag_manager.rb b/app/lib/tag_manager.rb index 2a5e7a409..07b2fb91e 100644 --- a/app/lib/tag_manager.rb +++ b/app/lib/tag_manager.rb @@ -78,6 +78,8 @@ class TagManager case target.object_type when :person account_url(target) + when :note, :comment, :activity + unique_tag(target.created_at, target.id, 'Status') else unique_tag(target.stream_entry.created_at, target.stream_entry.activity_id, target.stream_entry.activity_type) end diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb index ae7ae446e..8aff5ae06 100644 --- a/app/models/stream_entry.rb +++ b/app/models/stream_entry.rb @@ -5,25 +5,21 @@ class StreamEntry < ApplicationRecord belongs_to :account, inverse_of: :stream_entries belongs_to :activity, polymorphic: true - belongs_to :status, foreign_type: 'Status', foreign_key: 'activity_id', inverse_of: :stream_entry validates :account, :activity, presence: true - STATUS_INCLUDES = [:account, :stream_entry, :media_attachments, :tags, mentions: :account, reblog: [:stream_entry, :account, mentions: :account], thread: [:stream_entry, :account]].freeze + STATUS_INCLUDES = [:account, :stream_entry, :media_attachments, :tags, mentions: :account, reblog: [:stream_entry, :account, :media_attachments, :tags, mentions: :account], thread: [:stream_entry, :account]].freeze + default_scope { where(activity_type: 'Status') } scope :with_includes, -> { includes(:account, status: STATUS_INCLUDES) } def object_type - if orphaned? - :activity - else - targeted? ? :activity : activity.object_type - end + orphaned? || targeted? ? :activity : status.object_type end def verb - orphaned? ? :delete : activity.verb + orphaned? ? :delete : status.verb end def targeted? @@ -31,15 +27,15 @@ class StreamEntry < ApplicationRecord end def target - orphaned? ? nil : activity.target + orphaned? ? nil : status.target end def title - orphaned? ? nil : activity.title + orphaned? ? nil : status.title end def content - orphaned? ? nil : activity.content + orphaned? ? nil : status.content end def threaded? @@ -47,20 +43,16 @@ class StreamEntry < ApplicationRecord end def thread - orphaned? ? nil : activity.thread + orphaned? ? nil : status.thread end def mentions - activity.respond_to?(:mentions) ? activity.mentions.map(&:account) : [] - end - - def activity - !new_record? ? send(activity_type.underscore) || super : super + orphaned? ? [] : status.mentions.map(&:account) end private def orphaned? - activity.nil? + status.nil? end end diff --git a/app/services/after_block_service.rb b/app/services/after_block_service.rb index 8c6197f2c..0f478bcb7 100644 --- a/app/services/after_block_service.rb +++ b/app/services/after_block_service.rb @@ -9,20 +9,20 @@ class AfterBlockService < BaseService private def clear_timelines(account, target_account) - mentions_key = FeedManager.instance.key(:mentions, account.id) - home_key = FeedManager.instance.key(:home, account.id) + home_key = FeedManager.instance.key(:home, account.id) - target_account.statuses.select('id').find_each do |status| - redis.zrem(mentions_key, status.id) - redis.zrem(home_key, status.id) + redis.pipelined do + target_account.statuses.select('id').find_each do |status| + redis.zrem(home_key, status.id) + end end end def clear_notifications(account, target_account) - Notification.where(account: account).joins(:follow).where(activity_type: 'Follow', follows: { account_id: target_account.id }).destroy_all - Notification.where(account: account).joins(mention: :status).where(activity_type: 'Mention', statuses: { account_id: target_account.id }).destroy_all - Notification.where(account: account).joins(:favourite).where(activity_type: 'Favourite', favourites: { account_id: target_account.id }).destroy_all - Notification.where(account: account).joins(:status).where(activity_type: 'Status', statuses: { account_id: target_account.id }).destroy_all + Notification.where(account: account).joins(:follow).where(activity_type: 'Follow', follows: { account_id: target_account.id }).delete_all + Notification.where(account: account).joins(mention: :status).where(activity_type: 'Mention', statuses: { account_id: target_account.id }).delete_all + Notification.where(account: account).joins(:favourite).where(activity_type: 'Favourite', favourites: { account_id: target_account.id }).delete_all + Notification.where(account: account).joins(:status).where(activity_type: 'Status', statuses: { account_id: target_account.id }).delete_all end def redis diff --git a/app/services/authorize_follow_service.rb b/app/services/authorize_follow_service.rb index ac465bdb2..97c76bee1 100644 --- a/app/services/authorize_follow_service.rb +++ b/app/services/authorize_follow_service.rb @@ -10,31 +10,6 @@ class AuthorizeFollowService < BaseService private def build_xml(follow_request) - Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - unique_id xml, Time.now.utc, follow_request.id, 'FollowRequest' - title xml, "#{follow_request.target_account.acct} authorizes follow request by #{follow_request.account.acct}" - - author(xml) do - include_author xml, follow_request.target_account - end - - object_type xml, :activity - verb xml, :authorize - - target(xml) do - author(xml) do - include_author xml, follow_request.account - end - - object_type xml, :activity - verb xml, :request_friend - - target(xml) do - include_author xml, follow_request.target_account - end - end - end - end.to_xml + AtomSerializer.render(AtomSerializer.new.authorize_follow_request_salmon(follow_request)) end end diff --git a/app/services/block_service.rb b/app/services/block_service.rb index bd914d8be..d59b47afb 100644 --- a/app/services/block_service.rb +++ b/app/services/block_service.rb @@ -18,22 +18,6 @@ class BlockService < BaseService private def build_xml(block) - Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - unique_id xml, block.created_at, block.id, 'Block' - title xml, "#{block.account.acct} no longer wishes to interact with #{block.target_account.acct}" - - author(xml) do - include_author xml, block.account - end - - object_type xml, :activity - verb xml, :block - - target(xml) do - include_author xml, block.target_account - end - end - end.to_xml + AtomSerializer.render(AtomSerializer.new.block_salmon(block)) end end diff --git a/app/services/concerns/stream_entry_renderer.rb b/app/services/concerns/stream_entry_renderer.rb index a4255daea..ef176d8a6 100644 --- a/app/services/concerns/stream_entry_renderer.rb +++ b/app/services/concerns/stream_entry_renderer.rb @@ -2,7 +2,6 @@ module StreamEntryRenderer def stream_entry_to_xml(stream_entry) - renderer = StreamEntriesController.renderer.new(method: 'get', http_host: Rails.configuration.x.local_domain, https: Rails.configuration.x.use_https) - renderer.render(:show, assigns: { stream_entry: stream_entry }, formats: [:atom]) + AtomSerializer.render(AtomSerializer.new.entry(stream_entry, true)) end end diff --git a/app/services/favourite_service.rb b/app/services/favourite_service.rb index 5cc96403c..e92aada64 100644 --- a/app/services/favourite_service.rb +++ b/app/services/favourite_service.rb @@ -22,26 +22,6 @@ class FavouriteService < BaseService private def build_xml(favourite) - description = "#{favourite.account.acct} favourited a status by #{favourite.status.account.acct}" - - Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - unique_id xml, favourite.created_at, favourite.id, 'Favourite' - title xml, description - content xml, description - - author(xml) do - include_author xml, favourite.account - end - - object_type xml, :activity - verb xml, :favorite - in_reply_to xml, TagManager.instance.uri_for(favourite.status), TagManager.instance.url_for(favourite.status) - - target(xml) do - include_target xml, favourite.status - end - end - end.to_xml + AtomSerializer.render(AtomSerializer.new.favourite_salmon(favourite)) end end diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index 17b3b2542..844f5282d 100644 --- a/app/services/follow_service.rb +++ b/app/services/follow_service.rb @@ -10,7 +10,7 @@ class FollowService < BaseService target_account = FollowRemoteAccountService.new.call(uri) raise ActiveRecord::RecordNotFound if target_account.nil? || target_account.id == source_account.id || target_account.suspended? - raise Mastodon::NotPermittedError if target_account.blocking?(source_account) || source_account.blocking?(target_account) + raise Mastodon::NotPermittedError if target_account.blocking?(source_account) || source_account.blocking?(target_account) if target_account.locked? request_follow(source_account, target_account) @@ -55,48 +55,10 @@ class FollowService < BaseService end def build_follow_request_xml(follow_request) - description = "#{follow_request.account.acct} requested to follow #{follow_request.target_account.acct}" - - Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - unique_id xml, follow_request.created_at, follow_request.id, 'FollowRequest' - title xml, description - content xml, description - - author(xml) do - include_author xml, follow_request.account - end - - object_type xml, :activity - verb xml, :request_friend - - target(xml) do - include_author xml, follow_request.target_account - end - end - end.to_xml + AtomSerializer.render(AtomSerializer.new.follow_request_salmon(follow_request)) end def build_follow_xml(follow) - description = "#{follow.account.acct} started following #{follow.target_account.acct}" - - Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - unique_id xml, follow.created_at, follow.id, 'Follow' - title xml, description - content xml, description - - author(xml) do - include_author xml, follow.account - end - - object_type xml, :activity - verb xml, :follow - - target(xml) do - include_author xml, follow.target_account - end - end - end.to_xml + AtomSerializer.render(AtomSerializer.new.follow_salmon(follow)) end end diff --git a/app/services/reject_follow_service.rb b/app/services/reject_follow_service.rb index 1b03d62e6..675007938 100644 --- a/app/services/reject_follow_service.rb +++ b/app/services/reject_follow_service.rb @@ -10,31 +10,6 @@ class RejectFollowService < BaseService private def build_xml(follow_request) - Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - unique_id xml, Time.now.utc, follow_request.id, 'FollowRequest' - title xml, "#{follow_request.target_account.acct} rejects follow request by #{follow_request.account.acct}" - - author(xml) do - include_author xml, follow_request.target_account - end - - object_type xml, :activity - verb xml, :reject - - target(xml) do - author(xml) do - include_author xml, follow_request.account - end - - object_type xml, :activity - verb xml, :request_friend - - target(xml) do - include_author xml, follow_request.target_account - end - end - end - end.to_xml + AtomSerializer.render(AtomSerializer.new.reject_follow_request_salmon(follow_request)) end end diff --git a/app/services/unblock_service.rb b/app/services/unblock_service.rb index c4f789f74..3a3fd2d8c 100644 --- a/app/services/unblock_service.rb +++ b/app/services/unblock_service.rb @@ -11,22 +11,6 @@ class UnblockService < BaseService private def build_xml(block) - Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - unique_id xml, Time.now.utc, block.id, 'Block' - title xml, "#{block.account.acct} no longer blocks #{block.target_account.acct}" - - author(xml) do - include_author xml, block.account - end - - object_type xml, :activity - verb xml, :unblock - - target(xml) do - include_author xml, block.target_account - end - end - end.to_xml + AtomSerializer.render(AtomSerializer.new.unblock_salmon(block)) end end diff --git a/app/services/unfavourite_service.rb b/app/services/unfavourite_service.rb index 5f0ba4254..a32e87bff 100644 --- a/app/services/unfavourite_service.rb +++ b/app/services/unfavourite_service.rb @@ -13,26 +13,6 @@ class UnfavouriteService < BaseService private def build_xml(favourite) - description = "#{favourite.account.acct} no longer favourites a status by #{favourite.status.account.acct}" - - Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - unique_id xml, Time.now.utc, favourite.id, 'Favourite' - title xml, description - content xml, description - - author(xml) do - include_author xml, favourite.account - end - - object_type xml, :activity - verb xml, :unfavorite - in_reply_to xml, TagManager.instance.uri_for(favourite.status), TagManager.instance.url_for(favourite.status) - - target(xml) do - include_target xml, favourite.status - end - end - end.to_xml + AtomSerializer.render(AtomSerializer.new.unfavourite_salmon(favourite)) end end diff --git a/app/services/unfollow_service.rb b/app/services/unfollow_service.rb index 3440da364..244c9b529 100644 --- a/app/services/unfollow_service.rb +++ b/app/services/unfollow_service.rb @@ -13,25 +13,6 @@ class UnfollowService < BaseService private def build_xml(follow) - description = "#{follow.account.acct} is no longer following #{follow.target_account.acct}" - - Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - unique_id xml, Time.now.utc, follow.id, 'Follow' - title xml, description - content xml, description - - author(xml) do - include_author xml, follow.account - end - - object_type xml, :activity - verb xml, :unfollow - - target(xml) do - include_author xml, follow.target_account - end - end - end.to_xml + AtomSerializer.render(AtomSerializer.new.unfollow_salmon(follow)) end end diff --git a/app/views/accounts/show.atom.ruby b/app/views/accounts/show.atom.ruby deleted file mode 100644 index e15021178..000000000 --- a/app/views/accounts/show.atom.ruby +++ /dev/null @@ -1,27 +0,0 @@ -# frozen_string_literal: true - -Nokogiri::XML::Builder.new do |xml| - feed(xml) do - simple_id xml, account_url(@account, format: 'atom') - title xml, @account.display_name - subtitle xml, @account.note - updated_at xml, stream_updated_at - logo xml, full_asset_url(@account.avatar.url(:original)) - - author(xml) do - include_author xml, @account - end - - link_alternate xml, TagManager.instance.url_for(@account) - link_self xml, account_url(@account, format: 'atom') - link_next xml, account_url(@account, format: 'atom', max_id: @entries.last.id) if @entries.size == 20 - link_hub xml, api_push_url - link_salmon xml, api_salmon_url(@account.id) - - @entries.each do |stream_entry| - entry(xml, false) do - include_entry xml, stream_entry - end - end - end -end.to_xml diff --git a/app/views/stream_entries/show.atom.ruby b/app/views/stream_entries/show.atom.ruby deleted file mode 100644 index a298f3269..000000000 --- a/app/views/stream_entries/show.atom.ruby +++ /dev/null @@ -1,9 +0,0 @@ -Nokogiri::XML::Builder.new do |xml| - entry(xml, true) do - author(xml) do - include_author xml, @stream_entry.account - end - - include_entry xml, @stream_entry - end -end.to_xml diff --git a/app/workers/pubsubhubbub/delivery_worker.rb b/app/workers/pubsubhubbub/delivery_worker.rb index 466def3a8..8412be4b7 100644 --- a/app/workers/pubsubhubbub/delivery_worker.rb +++ b/app/workers/pubsubhubbub/delivery_worker.rb @@ -13,6 +13,9 @@ class Pubsubhubbub::DeliveryWorker def perform(subscription_id, payload) subscription = Subscription.find(subscription_id) headers = {} + host = Addressable::URI.parse(subscription.callback_url).host + + return if DomainBlock.blocked?(host) headers['User-Agent'] = 'Mastodon/PubSubHubbub' headers['Link'] = LinkHeader.new([[api_push_url, [%w(rel hub)]], [account_url(subscription.account, format: :atom), [%w(rel self)]]]).to_s diff --git a/app/workers/pubsubhubbub/distribution_worker.rb b/app/workers/pubsubhubbub/distribution_worker.rb index 82ff257af..68ca0f870 100644 --- a/app/workers/pubsubhubbub/distribution_worker.rb +++ b/app/workers/pubsubhubbub/distribution_worker.rb @@ -10,14 +10,10 @@ class Pubsubhubbub::DistributionWorker return if stream_entry.hidden? - account = stream_entry.account - renderer = AccountsController.renderer.new(method: 'get', http_host: Rails.configuration.x.local_domain, https: Rails.configuration.x.use_https) - payload = renderer.render(:show, assigns: { account: account, entries: [stream_entry] }, formats: [:atom]) - # domains = account.followers_domains + account = stream_entry.account + payload = AtomSerializer.render(AtomSerializer.new.feed(account, [stream_entry])) Subscription.where(account: account).active.select('id, callback_url').find_each do |subscription| - host = Addressable::URI.parse(subscription.callback_url).host - next if DomainBlock.blocked?(host) # || !domains.include?(host) Pubsubhubbub::DeliveryWorker.perform_async(subscription.id, payload) end rescue ActiveRecord::RecordNotFound -- cgit From 1c351709bc45611c2ed48fb8539c2b27ab51b6fe Mon Sep 17 00:00:00 2001 From: Eugen Date: Fri, 7 Apr 2017 11:09:14 +0200 Subject: Force UTF8 encoding on generated XML (#1140) --- Procfile | 2 +- app/lib/atom_serializer.rb | 2 +- app/views/layouts/application.html.haml | 6 ++++-- config/puma.rb | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Procfile b/Procfile index 6cdd89518..646e26059 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1,2 @@ web: bundle exec puma -C config/puma.rb -worker: bundle exec sidekiq -q default -q mailers -q push +worker: bundle exec sidekiq -q default -q push -q pull -q mailers diff --git a/app/lib/atom_serializer.rb b/app/lib/atom_serializer.rb index 21f485c2d..4e01c3d43 100644 --- a/app/lib/atom_serializer.rb +++ b/app/lib/atom_serializer.rb @@ -7,7 +7,7 @@ class AtomSerializer def render(element) document = Ox::Document.new(version: '1.0') document << element - "#{Ox.dump(element)}" + ('' + Ox.dump(element)).force_encoding('UTF-8') end end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 7eae6982b..abab14a28 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -11,8 +11,10 @@ %meta{:name => "theme-color", :content => "#282c37"}/ %meta{:name => "apple-mobile-web-app-capable", :content => "yes"}/ - %title - = "#{yield(:page_title)} - " if content_for?(:page_title) + %title< + - if content_for?(:page_title) + = yield(:page_title) + = ' - ' = Setting.site_title = stylesheet_link_tag 'application', media: 'all' diff --git a/config/puma.rb b/config/puma.rb index 550129bdc..191f00cca 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -9,7 +9,7 @@ preload_app! on_worker_boot do if ENV['HEROKU'] # Spawn the workers from Puma, to only use one dyno - @sidekiq_pid ||= spawn('bundle exec sidekiq -q default -q mailers -q push') + @sidekiq_pid ||= spawn('bundle exec sidekiq -q default -q push -q pull -q mailers ') end ActiveRecord::Base.establish_connection if defined?(ActiveRecord) -- cgit From 624a9a7136159d460228a0c2f5df18a9ead3b7f2 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 7 Apr 2017 12:21:00 +0200 Subject: Re-add forgotten element on standalone --- app/lib/atom_serializer.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/lib/atom_serializer.rb b/app/lib/atom_serializer.rb index 4e01c3d43..4ce0f4513 100644 --- a/app/lib/atom_serializer.rb +++ b/app/lib/atom_serializer.rb @@ -68,6 +68,9 @@ class AtomSerializer append_element(entry, 'published', stream_entry.created_at.iso8601) append_element(entry, 'updated', stream_entry.updated_at.iso8601) append_element(entry, 'title', stream_entry&.status&.title) + + entry << author(stream_entry.account) if root + append_element(entry, 'activity:object-type', TagManager::TYPES[stream_entry.object_type]) append_element(entry, 'activity:verb', TagManager::VERBS[stream_entry.verb]) -- cgit From e3a3422a65901c71ec3ff4a2729309c441660d63 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 7 Apr 2017 12:40:26 +0200 Subject: Allow setting of default language through config Setting of locale in controller extracted to Localized concern, the doorkeeper authorized applications controller moved under custom namespace with inclusion of Localized, which resolves the "it sometimes appears in a different random language" bug --- .env.production.sample | 3 +++ app/controllers/application_controller.rb | 9 ++------- app/controllers/concerns/localized.rb | 19 ++++++++++++++++++ app/controllers/oauth/authorizations_controller.rb | 9 ++------- .../oauth/authorized_applications_controller.rb | 16 +++++++++++++++ .../authorized_applications/index.html.haml | 23 ---------------------- .../oauth/authorized_applications/index.html.haml | 23 ++++++++++++++++++++++ config/routes.rb | 2 +- 8 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 app/controllers/concerns/localized.rb create mode 100644 app/controllers/oauth/authorized_applications_controller.rb delete mode 100644 app/views/doorkeeper/authorized_applications/index.html.haml create mode 100644 app/views/oauth/authorized_applications/index.html.haml diff --git a/.env.production.sample b/.env.production.sample index a7f9eb4bf..a0e963ca6 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -25,6 +25,9 @@ OTP_SECRET= # Only allow registrations with the following e-mail domains # EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc +# Optionally change default language +# DEFAULT_LOCALE=de + # E-mail configuration SMTP_SERVER=smtp.mailgun.org SMTP_PORT=587 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c06142fd4..f00f9c1e3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class ApplicationController < ActionController::Base + include Localized + # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception @@ -14,7 +16,6 @@ class ApplicationController < ActionController::Base rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_entity before_action :store_current_location, except: :raise_not_found, unless: :devise_controller? - before_action :set_locale before_action :set_user_activity before_action :check_suspension, if: :user_signed_in? @@ -28,12 +29,6 @@ class ApplicationController < ActionController::Base store_location_for(:user, request.url) end - def set_locale - I18n.locale = current_user.try(:locale) || I18n.default_locale - rescue I18n::InvalidLocale - I18n.locale = I18n.default_locale - end - def require_admin! redirect_to root_path unless current_user&.admin? end diff --git a/app/controllers/concerns/localized.rb b/app/controllers/concerns/localized.rb new file mode 100644 index 000000000..b6f868090 --- /dev/null +++ b/app/controllers/concerns/localized.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Localized + extend ActiveSupport::Concern + + included do + before_action :set_locale + end + + def set_locale + I18n.locale = current_user.try(:locale) || default_locale + rescue I18n::InvalidLocale + I18n.locale = default_locale + end + + def default_locale + ENV.fetch('DEFAULT_LOCALE') { I18n.default_locale } + end +end diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb index 7c25266d8..cdbfde0fb 100644 --- a/app/controllers/oauth/authorizations_controller.rb +++ b/app/controllers/oauth/authorizations_controller.rb @@ -1,9 +1,10 @@ # frozen_string_literal: true class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController + include Localized + skip_before_action :authenticate_resource_owner! - before_action :set_locale before_action :store_current_location before_action :authenticate_resource_owner! @@ -12,10 +13,4 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController def store_current_location store_location_for(:user, request.url) end - - def set_locale - I18n.locale = current_user.try(:locale) || I18n.default_locale - rescue I18n::InvalidLocale - I18n.locale = I18n.default_locale - end end diff --git a/app/controllers/oauth/authorized_applications_controller.rb b/app/controllers/oauth/authorized_applications_controller.rb new file mode 100644 index 000000000..09dd5d3c4 --- /dev/null +++ b/app/controllers/oauth/authorized_applications_controller.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicationsController + include Localized + + skip_before_action :authenticate_resource_owner! + + before_action :store_current_location + before_action :authenticate_resource_owner! + + private + + def store_current_location + store_location_for(:user, request.url) + end +end diff --git a/app/views/doorkeeper/authorized_applications/index.html.haml b/app/views/doorkeeper/authorized_applications/index.html.haml deleted file mode 100644 index d4719881c..000000000 --- a/app/views/doorkeeper/authorized_applications/index.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -- content_for :page_title do - = t('doorkeeper.authorized_applications.index.title') - -%table.table - %thead - %tr - %th= t('doorkeeper.authorized_applications.index.application') - %th= t('doorkeeper.authorized_applications.index.scopes') - %th= t('doorkeeper.authorized_applications.index.created_at') - %th - %tbody - - @applications.each do |application| - %tr - %td - - if application.website.blank? - = application.name - - else - = link_to application.name, application.website - %th= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('
').html_safe - %td= l application.created_at - %td - - unless application.superapp? - = table_link_to 'times', t('doorkeeper.authorized_applications.buttons.revoke'), oauth_authorized_application_path(application), method: :delete, data: { confirm: t('doorkeeper.authorized_applications.confirmations.revoke') } diff --git a/app/views/oauth/authorized_applications/index.html.haml b/app/views/oauth/authorized_applications/index.html.haml new file mode 100644 index 000000000..d4719881c --- /dev/null +++ b/app/views/oauth/authorized_applications/index.html.haml @@ -0,0 +1,23 @@ +- content_for :page_title do + = t('doorkeeper.authorized_applications.index.title') + +%table.table + %thead + %tr + %th= t('doorkeeper.authorized_applications.index.application') + %th= t('doorkeeper.authorized_applications.index.scopes') + %th= t('doorkeeper.authorized_applications.index.created_at') + %th + %tbody + - @applications.each do |application| + %tr + %td + - if application.website.blank? + = application.name + - else + = link_to application.name, application.website + %th= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('
').html_safe + %td= l application.created_at + %td + - unless application.superapp? + = table_link_to 'times', t('doorkeeper.authorized_applications.buttons.revoke'), oauth_authorized_application_path(application), method: :delete, data: { confirm: t('doorkeeper.authorized_applications.confirmations.revoke') } diff --git a/config/routes.rb b/config/routes.rb index ca77191f7..315ad5da5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,7 +11,7 @@ Rails.application.routes.draw do end use_doorkeeper do - controllers authorizations: 'oauth/authorizations' + controllers authorizations: 'oauth/authorizations', authorized_applications: 'oauth/authorized_applications' end get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta -- cgit From 786e6f94b986dbf98eae9d79bc75e147fcefc8ec Mon Sep 17 00:00:00 2001 From: Jantso Porali Date: Fri, 7 Apr 2017 12:58:12 +0200 Subject: Update Finnish translations, add sample Minio config (#954) --- .env.production.sample | 10 ++++++++++ app/views/user_mailer/confirmation_instructions.fi.html.erb | 5 +++++ app/views/user_mailer/confirmation_instructions.fi.text.erb | 5 +++++ app/views/user_mailer/password_change.fi.html.erb | 3 +++ app/views/user_mailer/password_change.fi.text.erb | 3 +++ .../user_mailer/reset_password_instructions.fi.html.erb | 8 ++++++++ .../user_mailer/reset_password_instructions.fi.text.erb | 8 ++++++++ config/locales/fi.yml | 12 ++++++------ docs/Using-Mastodon/FAQ.md | 3 ++- 9 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 app/views/user_mailer/confirmation_instructions.fi.html.erb create mode 100644 app/views/user_mailer/confirmation_instructions.fi.text.erb create mode 100644 app/views/user_mailer/password_change.fi.html.erb create mode 100644 app/views/user_mailer/password_change.fi.text.erb create mode 100644 app/views/user_mailer/reset_password_instructions.fi.html.erb create mode 100644 app/views/user_mailer/reset_password_instructions.fi.text.erb diff --git a/.env.production.sample b/.env.production.sample index a7f9eb4bf..a4eabc384 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -44,6 +44,16 @@ SMTP_FROM_ADDRESS=notifications@example.com # S3_PROTOCOL=http # S3_HOSTNAME=192.168.1.123:9000 +# S3 (Minio Config (optional) Please check Minio instance for details) +# S3_ENABLED=true +# S3_BUCKET= +# AWS_ACCESS_KEY_ID= +# AWS_SECRET_ACCESS_KEY= +# S3_REGION= +# S3_PROTOCOL=https +# S3_HOSTNAME= +# S3_ENDPOINT= + # Optional alias for S3 if you want to use Cloudfront or Cloudflare in front # S3_CLOUDFRONT_HOST= diff --git a/app/views/user_mailer/confirmation_instructions.fi.html.erb b/app/views/user_mailer/confirmation_instructions.fi.html.erb new file mode 100644 index 000000000..8b72722da --- /dev/null +++ b/app/views/user_mailer/confirmation_instructions.fi.html.erb @@ -0,0 +1,5 @@ +

Tervetuloa <%= @resource.email %>!

+ +

Voit vahvistaa Mastodon tilisi klikkaamalla alla olevaa linkkiä:

+ +

<%= link_to 'Varmista tilini', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/app/views/user_mailer/confirmation_instructions.fi.text.erb b/app/views/user_mailer/confirmation_instructions.fi.text.erb new file mode 100644 index 000000000..796913abb --- /dev/null +++ b/app/views/user_mailer/confirmation_instructions.fi.text.erb @@ -0,0 +1,5 @@ +Tervetuloa <%= @resource.email %>! + +Voit vahvistaa Mastodon tilisi klikkaamalla alla olevaa linkkiä: + +<%= confirmation_url(@resource, confirmation_token: @token) %> diff --git a/app/views/user_mailer/password_change.fi.html.erb b/app/views/user_mailer/password_change.fi.html.erb new file mode 100644 index 000000000..c56b96593 --- /dev/null +++ b/app/views/user_mailer/password_change.fi.html.erb @@ -0,0 +1,3 @@ +

Hei <%= @resource.email %>!

+ +

Lähetämme tämän viestin ilmoittaaksemme että salasanasi on vaihdettu.

diff --git a/app/views/user_mailer/password_change.fi.text.erb b/app/views/user_mailer/password_change.fi.text.erb new file mode 100644 index 000000000..d90c3fdeb --- /dev/null +++ b/app/views/user_mailer/password_change.fi.text.erb @@ -0,0 +1,3 @@ +Hei <%= @resource.email %>! + +Lähetämme tämän viestin ilmoittaaksemme että salasanasi on vaihdettu. diff --git a/app/views/user_mailer/reset_password_instructions.fi.html.erb b/app/views/user_mailer/reset_password_instructions.fi.html.erb new file mode 100644 index 000000000..53be0b62b --- /dev/null +++ b/app/views/user_mailer/reset_password_instructions.fi.html.erb @@ -0,0 +1,8 @@ +

Hei <%= @resource.email %>!

+ +

Joku on pyytänyt salasanvaihto Mastodonissa. Voit tehdä sen allaolevassa linkissä.

+ +

<%= link_to 'Vaihda salasanani', edit_password_url(@resource, reset_password_token: @token) %>

+ +

Jos et pyytänyt vaihtoa, poista tämä viesti.

+

Salasanaasi ei vaihdeta ennen kuin menet ylläolevaan linkkiin ja luot uuden.

diff --git a/app/views/user_mailer/reset_password_instructions.fi.text.erb b/app/views/user_mailer/reset_password_instructions.fi.text.erb new file mode 100644 index 000000000..c826d5fc8 --- /dev/null +++ b/app/views/user_mailer/reset_password_instructions.fi.text.erb @@ -0,0 +1,8 @@ +Hei <%= @resource.email %>! + +Joku on pyytänyt salasanvaihto Mastodonissa. Voit tehdä sen allaolevassa linkissä. + +<%= edit_password_url(@resource, reset_password_token: @token) %> + +Jos et pyytänyt vaihtoa, poista tämä viesti. +Salasanaasi ei vaihdeta ennen kuin menet ylläolevaan linkkiin ja luot uuden. diff --git a/config/locales/fi.yml b/config/locales/fi.yml index cdb2b9886..947d3f646 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -16,18 +16,18 @@ fi: chronology: Aikajana on kronologisessa järjestyksessä ethics: 'Eettinen suunnittelu: ei mainoksia, no seurantaa' gifv: GIFV settejä ja lyhyitä videoita - privacy: Julkaisu kohtainen yksityisyys aseuts + privacy: Julkaisu kohtainen yksityisyys asetus public: Julkiset aikajanat features_headline: Mikä erottaa Mastodonin muista get_started: Aloita käyttö links: Linkit - other_instances: muuhun palvelimeen + other_instances: Muut palvelimet source_code: Lähdekoodi status_count_after: statusta status_count_before: Ovat luoneet terms: Ehdot - user_count_after: käyttäjää - user_count_before: Koti käyttäjälle + user_count_after: käyttäjälle + user_count_before: Koti accounts: follow: Seuraa followers: Seuraajat @@ -130,8 +130,8 @@ fi: authorized_apps: Valtuutetut ohjelmat back: Takaisin Mastodoniin edit_profile: Muokkaa profiilia - export: Datan vienti - import: Datan tuonti + export: Vie dataa + import: Tuo dataa preferences: Ominaisuudet settings: Asetukset two_factor_auth: Kaksivaiheinen tunnistus diff --git a/docs/Using-Mastodon/FAQ.md b/docs/Using-Mastodon/FAQ.md index daedcbdd8..3b03a8ee4 100644 --- a/docs/Using-Mastodon/FAQ.md +++ b/docs/Using-Mastodon/FAQ.md @@ -36,8 +36,9 @@ While Mastodon is compatible with GNU social in terms of server to server commun Because Mastodon has been created from a blank slate, it is much simpler to have the API mirror internal structures as closely as possible, rather than build an emulation layer. Secondly, the GNU social client API is actually a half-way implementation of the legacy Twitter API - that's the reason why it works with some older Twitter client apps. However, many of those apps are not maintained anymore, the GNU social API does not actually keep up with the real Twitter API and never fully implemented all its features; at the same time, the Twitter API was never meant for a federated service and so obscures some of the functionality. + #### How is Mastodon funded? Development of Mastodon and hosting of mastodon.social is funded through my [Patreon (also BTC/PayPal donations)](https://www.patreon.com/user?u=619786). Beyond that, I am not interested in VC funding, monetizing, advertising, or anything of that sort. I could offer setup/maintenance services on demand. -The software is free and open source and communities should host their own servers if they can, that way the costs are more or less distributed. Obviously it'd be hard for me to pay the bills if literally everyone decided to use the mastodon.social instance only. \ No newline at end of file +The software is free and open source and communities should host their own servers if they can, that way the costs are more or less distributed. Obviously it'd be hard for me to pay the bills if literally everyone decided to use the mastodon.social instance only. -- cgit From 8a6d8de60ac573f5b97bfe52f91f5a9e8e09fadf Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 7 Apr 2017 13:05:34 +0200 Subject: Fix nil#object_type error --- app/lib/atom_serializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/atom_serializer.rb b/app/lib/atom_serializer.rb index 4ce0f4513..be1cced8b 100644 --- a/app/lib/atom_serializer.rb +++ b/app/lib/atom_serializer.rb @@ -101,7 +101,7 @@ class AtomSerializer serialize_status_attributes(object, status) append_element(object, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(status)) - append_element(object, 'thr:in-reply-to', nil, ref: TagManager.instance.uri_for(status.thread), href: TagManager.instance.url_for(status.thread)) if status.reply? + append_element(object, 'thr:in-reply-to', nil, ref: TagManager.instance.uri_for(status.thread), href: TagManager.instance.url_for(status.thread)) if status.reply? && !status.thread.nil? object end -- cgit From 2ac8a590cd164891be0f11ca3d705a3ec948cecb Mon Sep 17 00:00:00 2001 From: Jason Rhodes Date: Fri, 7 Apr 2017 07:43:44 -0400 Subject: Moved into a comment per feedback --- .env.production.sample | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.env.production.sample b/.env.production.sample index 9bb988ea6..6d28a4a11 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -26,7 +26,8 @@ OTP_SECRET= # EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc # E-mail configuration -SMTP_SERVER=smtp.mailgun.org, smtp.sparkpostmail.com, etc. +# Note: Mailgun and SparkPost (https://sparkpo.st/smtp) each have good free tiers +SMTP_SERVER=smtp.mailgun.org SMTP_PORT=587 SMTP_LOGIN= SMTP_PASSWORD= -- cgit From 0f4fa59812c11cbc77f13d7d07ceb3db7452c828 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 7 Apr 2017 11:34:10 -0400 Subject: Update heroku instructions --- docs/Running-Mastodon/Heroku-guide.md | 55 ++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 8 deletions(-) diff --git a/docs/Running-Mastodon/Heroku-guide.md b/docs/Running-Mastodon/Heroku-guide.md index 0de26230c..754f923ed 100644 --- a/docs/Running-Mastodon/Heroku-guide.md +++ b/docs/Running-Mastodon/Heroku-guide.md @@ -3,13 +3,52 @@ Heroku guide [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://dashboard.heroku.com/new?button-url=https://github.com/tootsuite/mastodon&template=https://github.com/tootsuite/mastodon) -Mastodon can theoretically run indefinitely on a free [Heroku](https://heroku.com) app. It should be noted this has limited testing and could have unpredictable results. +Mastodon can be run on a free [Heroku](https://heroku.com) app. It should be +noted this has limited testing and could have unpredictable results. -1. Click the above button. -2. Fill in the options requested. - * You can use a .herokuapp.com domain, which will be simple to set up, or you can use a custom domain. If you want a custom domain and HTTPS, you will need to upgrade to a paid plan (to use Heroku's SSL features), or set up [CloudFlare](https://cloudflare.com) who offer free "Flexible SSL" (note: CloudFlare have some undefined limits on WebSockets. So far, no one has reported hitting concurrent connection limits). - * You will want Amazon S3 for file storage. The only exception is for development purposes, where you may not care if files are not saved. Follow a guide online for creating a free Amazon S3 bucket and Access Key, then enter the details. - * If you want your Mastodon to be able to send emails, configure SMTP settings here (or later). Consider using [Mailgun](https://mailgun.com) or similar, who offer free plans that should suit your interests. -3. Deploy! The app should be set up, with a working web interface and database. You can change settings and manage versions from the Heroku dashboard. +## Basic setup -You may need to use the `heroku` CLI application to run `USERNAME=yourUsername rails mastodon:make_admin` to make yourself an admin. +Click the button above to start creating a Heroku app with the Mastodon repo as +the source. This tells Heroku to use the `app.json` file which does things like +prompt for config variables, set up the right buildpacks, run a postdeploy task, +and add the appropriate addons. + +If you don't use the deploy button and app.json approach, you will need to do +some of that manually. + +## Domain names and SSL + +You can add your domain name to the Heroku app's setting, and then also use +Heroku's (free) auto renewal program for Lets Encrypt certificates, by +requesting a cert from the settings screen. You'll have to point your hostname +DNS at Heroku using the values heroku gives you on this screen, using whatever +method is appropriate for your DNS setup. + +You should set the Heroku config vars of `LOCAL_DOMAIN` to your hostname, and +`LOCAL_HTTPS` to "true" as well. + +## Email + +Consider using [Mailgun](https://mailgun.com) or similar, who offer free plans +that should suit your interests. Look in `production.rb` to see which config +variables need to be set on Heroku for outgoing email to work. + +## File storage + +You will want Amazon S3 for file storage. The only exception is for development +purposes, where you may not care if files are not saved. Follow a guide online +for creating a free Amazon S3 bucket and Access Key, then enter the details. + +## Deployment + +You can deploy from the Heroku web interface or from the command line. Run: + + `heroku run rails db:migrate` + +after you first deploy to set up the first database. + +You may need to use the `heroku` CLI application to run: + + `USERNAME=yourUsername rails mastodon:make_admin` + +to make yourself an admin. -- cgit From 38bec798117446603b304c0d14ca39bae5ee8be8 Mon Sep 17 00:00:00 2001 From: Chad Pytel Date: Fri, 7 Apr 2017 12:50:43 -0400 Subject: Add specs for media attachment validations There are currently not specs for the two media validations that are performed by `PostStatusService`. This adds specs for the validations that ensure that you cannot attach more than four files, and that a status cannot have both image and video attachments. --- spec/fabricators/media_attachment_fabricator.rb | 2 +- spec/services/post_status_service_spec.rb | 41 +++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/spec/fabricators/media_attachment_fabricator.rb b/spec/fabricators/media_attachment_fabricator.rb index 59db2440d..dc91d708f 100644 --- a/spec/fabricators/media_attachment_fabricator.rb +++ b/spec/fabricators/media_attachment_fabricator.rb @@ -1,3 +1,3 @@ Fabricator(:media_attachment) do - + account end diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index 9ee4daf6f..acb922d64 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -7,4 +7,45 @@ RSpec.describe PostStatusService do it 'creates a new response status' it 'processes mentions' it 'pings PuSH hubs' + + it 'does not allow attaching more than 4 files' do + account = Fabricate(:account) + + expect do + PostStatusService.new.call( + account, + "test status update", + nil, + media_ids: [ + Fabricate(:media_attachment, account: account), + Fabricate(:media_attachment, account: account), + Fabricate(:media_attachment, account: account), + Fabricate(:media_attachment, account: account), + Fabricate(:media_attachment, account: account), + ].map(&:id), + ) + end.to raise_error( + Mastodon::ValidationError, + 'Cannot attach more than 4 files', + ) + end + + it 'does not allow attaching both videos and images' do + account = Fabricate(:account) + + expect do + PostStatusService.new.call( + account, + "test status update", + nil, + media_ids: [ + Fabricate(:media_attachment, type: :video, account: account), + Fabricate(:media_attachment, type: :image, account: account), + ].map(&:id), + ) + end.to raise_error( + Mastodon::ValidationError, + 'Cannot attach a video to a toot that already contains images', + ) + end end -- cgit From d4c94fa004117fdb7226b1b846a12d12dc0542d9 Mon Sep 17 00:00:00 2001 From: Joël Quenneville Date: Fri, 7 Apr 2017 14:18:30 -0400 Subject: DRY up reblog vs original status check Checking reblog vs original status was happening in multiple places across the app. For views, this logic was encapsulated in a helper method named `proper_status` but in the other layers of the app, the logic was duplicated. Because the logic is used at all layers of the app, we extracted it into a `Status#proper` method on the model and changed all uses of the logic to use this method. There is now a single source of truth for this condition. We added test coverage to untested methods that got refactored. --- app/helpers/stream_entries_helper.rb | 4 -- app/lib/atom_serializer.rb | 2 +- app/models/account.rb | 4 +- app/models/status.rb | 6 ++- app/views/stream_entries/_status.html.haml | 2 +- spec/models/account_spec.rb | 68 +++++++++++++++++++++++++++++- spec/models/status_spec.rb | 11 +++++ 7 files changed, 86 insertions(+), 11 deletions(-) diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index a26e912a3..38e63ed8d 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -34,10 +34,6 @@ module StreamEntriesHelper user_signed_in? && @favourited.key?(status.id) ? 'favourited' : '' end - def proper_status(status) - status.reblog? ? status.reblog : status - end - def rtl?(text) return false if text.empty? diff --git a/app/lib/atom_serializer.rb b/app/lib/atom_serializer.rb index be1cced8b..b9dcee6b3 100644 --- a/app/lib/atom_serializer.rb +++ b/app/lib/atom_serializer.rb @@ -328,7 +328,7 @@ class AtomSerializer def serialize_status_attributes(entry, status) append_element(entry, 'summary', status.spoiler_text) unless status.spoiler_text.blank? - append_element(entry, 'content', Formatter.instance.format(status.reblog? ? status.reblog : status).to_str, type: 'html') + append_element(entry, 'content', Formatter.instance.format(status.proper).to_str, type: 'html') status.mentions.each do |mentioned| append_element(entry, 'link', nil, rel: :mentioned, 'ostatus:object-type': TagManager::TYPES[:person], href: TagManager.instance.uri_for(mentioned.account)) diff --git a/app/models/account.rb b/app/models/account.rb index 6968607a2..cbba8b5b6 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -125,11 +125,11 @@ class Account < ApplicationRecord end def favourited?(status) - (status.reblog? ? status.reblog : status).favourites.where(account: self).count.positive? + status.proper.favourites.where(account: self).count.positive? end def reblogged?(status) - (status.reblog? ? status.reblog : status).reblogs.where(account: self).count.positive? + status.proper.reblogs.where(account: self).count.positive? end def keypair diff --git a/app/models/status.rb b/app/models/status.rb index 6948ad77c..7e3dd3e28 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -62,8 +62,12 @@ class Status < ApplicationRecord reply? ? :comment : :note end + def proper + reblog? ? reblog : self + end + def content - reblog? ? reblog.text : text + proper.text end def target diff --git a/app/views/stream_entries/_status.html.haml b/app/views/stream_entries/_status.html.haml index cdd0dde3b..434c5c8da 100644 --- a/app/views/stream_entries/_status.html.haml +++ b/app/views/stream_entries/_status.html.haml @@ -16,7 +16,7 @@ %strong= display_name(status.account) = t('stream_entries.reblogged') - = render partial: centered ? 'stream_entries/detailed_status' : 'stream_entries/simple_status', locals: { status: proper_status(status) } + = render partial: centered ? 'stream_entries/detailed_status' : 'stream_entries/simple_status', locals: { status: status.proper } - if include_threads = render partial: 'stream_entries/status', collection: @descendants, as: :status, locals: { is_successor: true } diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index d7f59adb8..93a45459d 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -99,11 +99,75 @@ RSpec.describe Account, type: :model do end describe '#favourited?' do - pending + let(:original_status) do + author = Fabricate(:account, username: 'original') + Fabricate(:status, account: author) + end + + context 'when the status is a reblog of another status' do + let(:original_reblog) do + author = Fabricate(:account, username: 'original_reblogger') + Fabricate(:status, reblog: original_status, account: author) + end + + it 'is is true when this account has favourited it' do + Fabricate(:favourite, status: original_reblog, account: subject) + + expect(subject.favourited?(original_status)).to eq true + end + + it 'is false when this account has not favourited it' do + expect(subject.favourited?(original_status)).to eq false + end + end + + context 'when the status is an original status' do + it 'is is true when this account has favourited it' do + Fabricate(:favourite, status: original_status, account: subject) + + expect(subject.favourited?(original_status)).to eq true + end + + it 'is false when this account has not favourited it' do + expect(subject.favourited?(original_status)).to eq false + end + end end describe '#reblogged?' do - pending + let(:original_status) do + author = Fabricate(:account, username: 'original') + Fabricate(:status, account: author) + end + + context 'when the status is a reblog of another status'do + let(:original_reblog) do + author = Fabricate(:account, username: 'original_reblogger') + Fabricate(:status, reblog: original_status, account: author) + end + + it 'is true when this account has reblogged it' do + Fabricate(:status, reblog: original_reblog, account: subject) + + expect(subject.reblogged?(original_reblog)).to eq true + end + + it 'is false when this account has not reblogged it' do + expect(subject.reblogged?(original_reblog)).to eq false + end + end + + context 'when the status is an original status' do + it 'is true when this account has reblogged it' do + Fabricate(:status, reblog: original_status, account: subject) + + expect(subject.reblogged?(original_status)).to eq true + end + + it 'is false when this account has not reblogged it' do + expect(subject.reblogged?(original_status)).to eq false + end + end end describe '.find_local' do diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index b9d079521..db244ebe7 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -97,4 +97,15 @@ RSpec.describe Status, type: :model do describe '#favourites_count' do pending end + + describe '#proper' do + it 'is itself for original statuses' do + expect(subject.proper).to eq subject + end + + it 'is the source status for reblogs' do + subject.reblog = other + expect(subject.proper).to eq other + end + end end -- cgit From 13c0077003288416b8cacd5d339f8796bc347f39 Mon Sep 17 00:00:00 2001 From: Chad Pytel Date: Fri, 7 Apr 2017 13:48:38 -0400 Subject: Add specs for PostStatusService This implements all pending specs, and adds additional coverage for the following functionality: * Normal status creation * Creating a reply status * Creating a sensitive status * Creating a status with spoiler text * A status with no spoiler text gets an empty string for spoiler text * Creating a status with custom visibility * Creating a status for an application * Processing mentions * Processing Hashtags * Pinging PuSH hubs * Crawling links * Attaching media --- spec/fabricators/status_fabricator.rb | 1 + spec/services/post_status_service_spec.rb | 165 +++++++++++++++++++++++++----- 2 files changed, 143 insertions(+), 23 deletions(-) diff --git a/spec/fabricators/status_fabricator.rb b/spec/fabricators/status_fabricator.rb index df222fc9d..8ec5f4ba7 100644 --- a/spec/fabricators/status_fabricator.rb +++ b/spec/fabricators/status_fabricator.rb @@ -1,3 +1,4 @@ Fabricator(:status) do + account text "Lorem ipsum dolor sit amet" end diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index acb922d64..3fe878f63 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -3,27 +3,142 @@ require 'rails_helper' RSpec.describe PostStatusService do subject { PostStatusService.new } - it 'creates a new status' - it 'creates a new response status' - it 'processes mentions' - it 'pings PuSH hubs' + it 'creates a new status' do + account = Fabricate(:account) + text = "test status update" - it 'does not allow attaching more than 4 files' do + status = subject.call(account, text) + + expect(status).to be_persisted + expect(status.text).to eq text + end + + it 'creates a new response status' do + in_reply_to_status = Fabricate(:status) account = Fabricate(:account) + text = "test status update" - expect do - PostStatusService.new.call( + status = subject.call(account, text, in_reply_to_status) + + expect(status).to be_persisted + expect(status.text).to eq text + expect(status.thread).to eq in_reply_to_status + end + + it 'creates a sensitive status' do + status = create_status_with_options(sensitive: true) + + expect(status).to be_persisted + expect(status).to be_sensitive + end + + it 'creates a status with spoiler text' do + spoiler_text = "spoiler text" + + status = create_status_with_options(spoiler_text: spoiler_text) + + expect(status).to be_persisted + expect(status.spoiler_text).to eq spoiler_text + end + + it 'creates a status with empty default spoiler text' do + status = create_status_with_options(spoiler_text: nil) + + expect(status).to be_persisted + expect(status.spoiler_text).to eq '' + end + + it 'creates a status with the given visibility' do + status = create_status_with_options(visibility: :private) + + expect(status).to be_persisted + expect(status.visibility).to eq "private" + end + + it 'creates a status for the given application' do + application = Fabricate(:application) + + status = create_status_with_options(application: application) + + expect(status).to be_persisted + expect(status.application).to eq application + end + + it 'processes mentions' do + mention_service = double(:process_mentions_service) + allow(mention_service).to receive(:call) + allow(ProcessMentionsService).to receive(:new).and_return(mention_service) + account = Fabricate(:account) + + status = subject.call(account, "test status update") + + expect(ProcessMentionsService).to have_received(:new) + expect(mention_service).to have_received(:call).with(status) + end + + it 'processes hashtags' do + hashtags_service = double(:process_hashtags_service) + allow(hashtags_service).to receive(:call) + allow(ProcessHashtagsService).to receive(:new).and_return(hashtags_service) + account = Fabricate(:account) + + status = subject.call(account, "test status update") + + expect(ProcessHashtagsService).to have_received(:new) + expect(hashtags_service).to have_received(:call).with(status) + end + + it 'pings PuSH hubs' do + allow(DistributionWorker).to receive(:perform_async) + allow(Pubsubhubbub::DistributionWorker).to receive(:perform_async) + account = Fabricate(:account) + + status = subject.call(account, "test status update") + + expect(DistributionWorker).to have_received(:perform_async).with(status.id) + expect(Pubsubhubbub::DistributionWorker). + to have_received(:perform_async).with(status.stream_entry.id) + end + + it 'crawls links' do + allow(LinkCrawlWorker).to receive(:perform_async) + account = Fabricate(:account) + + status = subject.call(account, "test status update") + + expect(LinkCrawlWorker).to have_received(:perform_async).with(status.id) + end + + it 'attaches the given media to the created status' do + account = Fabricate(:account) + media = Fabricate(:media_attachment) + + status = subject.call( account, "test status update", nil, - media_ids: [ - Fabricate(:media_attachment, account: account), - Fabricate(:media_attachment, account: account), - Fabricate(:media_attachment, account: account), - Fabricate(:media_attachment, account: account), - Fabricate(:media_attachment, account: account), - ].map(&:id), + media_ids: [media.id], ) + + expect(media.reload.status).to eq status + end + + it 'does not allow attaching more than 4 files' do + account = Fabricate(:account) + + expect do + subject.call( + account, + "test status update", + nil, + media_ids: [ + Fabricate(:media_attachment, account: account), + Fabricate(:media_attachment, account: account), + Fabricate(:media_attachment, account: account), + Fabricate(:media_attachment, account: account), + Fabricate(:media_attachment, account: account), + ].map(&:id), + ) end.to raise_error( Mastodon::ValidationError, 'Cannot attach more than 4 files', @@ -34,18 +149,22 @@ RSpec.describe PostStatusService do account = Fabricate(:account) expect do - PostStatusService.new.call( - account, - "test status update", - nil, - media_ids: [ - Fabricate(:media_attachment, type: :video, account: account), - Fabricate(:media_attachment, type: :image, account: account), - ].map(&:id), - ) + subject.call( + account, + "test status update", + nil, + media_ids: [ + Fabricate(:media_attachment, type: :video, account: account), + Fabricate(:media_attachment, type: :image, account: account), + ].map(&:id), + ) end.to raise_error( Mastodon::ValidationError, 'Cannot attach a video to a toot that already contains images', ) end + + def create_status_with_options(options = {}) + subject.call(Fabricate(:account), "test", nil, options) + end end -- cgit From ad5ddd5e95062d0d5cd4bc56baff53698c598723 Mon Sep 17 00:00:00 2001 From: Chad Pytel Date: Fri, 7 Apr 2017 14:19:16 -0400 Subject: Use I18n for media attachment validation errors These are currently user facing errors, but are not localized. This adds the ability for these messages to be localized. --- app/services/post_status_service.rb | 4 ++-- config/locales/en.yml | 4 ++++ spec/services/post_status_service_spec.rb | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index b8179f7dc..221aa42a3 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -37,11 +37,11 @@ class PostStatusService < BaseService def validate_media!(media_ids) return if media_ids.nil? || !media_ids.is_a?(Enumerable) - raise Mastodon::ValidationError, 'Cannot attach more than 4 files' if media_ids.size > 4 + raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if media_ids.size > 4 media = MediaAttachment.where(status_id: nil).where(id: media_ids.take(4).map(&:to_i)) - raise Mastodon::ValidationError, 'Cannot attach a video to a toot that already contains images' if media.size > 1 && media.find(&:video?) + raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if media.size > 1 && media.find(&:video?) media end diff --git a/config/locales/en.yml b/config/locales/en.yml index 742219df9..aa3a732f9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -163,3 +163,7 @@ en: invalid_otp_token: Invalid two-factor code will_paginate: page_gap: "…" + media_attachments: + validations: + too_many: Cannot attach more than 4 files + images_and_video: Cannot attach a video to a status that already contains images diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index 3fe878f63..0e39cd969 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -141,7 +141,7 @@ RSpec.describe PostStatusService do ) end.to raise_error( Mastodon::ValidationError, - 'Cannot attach more than 4 files', + I18n.t('media_attachments.validations.too_many'), ) end @@ -160,7 +160,7 @@ RSpec.describe PostStatusService do ) end.to raise_error( Mastodon::ValidationError, - 'Cannot attach a video to a toot that already contains images', + I18n.t('media_attachments.validations.images_and_video'), ) end -- cgit From 27012aaeb6af9c41adc19443cbd17153e3b2d565 Mon Sep 17 00:00:00 2001 From: Ed Knutson Date: Fri, 7 Apr 2017 14:10:39 -0500 Subject: change suggested cipher for nginx --- docs/Running-Mastodon/Production-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index 90e9c0dea..1dba56131 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -24,7 +24,7 @@ server { ssl_protocols TLSv1.2; ssl_ciphers EECDH+AESGCM:EECDH+AES; - ssl_ecdh_curve secp384r1; + ssl_ecdh_curve prime256v1; ssl_prefer_server_ciphers on; ssl_session_cache shared:SSL:10m; -- cgit From 131f505fd0dc11297ba0ad4d9744e5ea2b3d73e1 Mon Sep 17 00:00:00 2001 From: seekr Date: Fri, 7 Apr 2017 16:33:13 -0300 Subject: typo --- docs/Running-Mastodon/Production-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Production-guide.md b/docs/Running-Mastodon/Production-guide.md index 90e9c0dea..1a65771ce 100644 --- a/docs/Running-Mastodon/Production-guide.md +++ b/docs/Running-Mastodon/Production-guide.md @@ -90,7 +90,7 @@ It is recommended to create a special user for mastodon on the server (you could sudo apt-get install imagemagick ffmpeg libpq-dev libxml2-dev libxslt1-dev nodejs file git curl curl -sL https://deb.nodesource.com/setup_4.x | sudo bash - - apt-get intall nodejs + apt-get install nodejs sudo npm install -g yarn ## Redis -- cgit From 4fdeac21f4520c5fffb06b1143bf4b1ac88d8533 Mon Sep 17 00:00:00 2001 From: Joël Quenneville Date: Fri, 7 Apr 2017 15:30:36 -0400 Subject: Implement pending specs on Status Implement the two pending specs on `Status`: `reblogs_count` and `favourites_count`. --- spec/models/status_spec.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index b9d079521..675e18418 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -91,10 +91,20 @@ RSpec.describe Status, type: :model do end describe '#reblogs_count' do - pending + it 'is the number of reblogs' do + Fabricate(:status, account: bob, reblog: subject) + Fabricate(:status, account: alice, reblog: subject) + + expect(subject.reblogs_count).to eq 2 + end end describe '#favourites_count' do - pending + it 'is the number of favorites' do + Fabricate(:favourite, account: bob, status: subject) + Fabricate(:favourite, account: alice, status: subject) + + expect(subject.favourites_count).to eq 2 + end end end -- cgit From 12f1cdeed1dcc328efc09eb0e9fe358f6bff1b8e Mon Sep 17 00:00:00 2001 From: Florian Maunier Date: Fri, 7 Apr 2017 13:31:18 +0200 Subject: Fix npm/yarn cache cleaning --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c28287cca..57a8f34e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,8 @@ RUN BUILD_DEPS=" \ && npm install -g npm@3 && npm install -g yarn \ && bundle install --deployment --without test development \ && yarn \ - && npm cache clean \ + && yarn cache clean \ + && npm -g cache clean \ && apk del $BUILD_DEPS \ && rm -rf /tmp/* /var/cache/apk/* -- cgit From a7ab2204d48162605cb351ee60183ef3f3d844a6 Mon Sep 17 00:00:00 2001 From: David Huerta Date: Fri, 7 Apr 2017 17:44:32 -0400 Subject: Update Heroku-guide.md Cleaning up the heroku admin command bit to match the form used in Administration-guide.md and clarify the wording a bit. --- docs/Running-Mastodon/Heroku-guide.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/Running-Mastodon/Heroku-guide.md b/docs/Running-Mastodon/Heroku-guide.md index 754f923ed..269bc6331 100644 --- a/docs/Running-Mastodon/Heroku-guide.md +++ b/docs/Running-Mastodon/Heroku-guide.md @@ -47,8 +47,6 @@ You can deploy from the Heroku web interface or from the command line. Run: after you first deploy to set up the first database. -You may need to use the `heroku` CLI application to run: +To make yourself an admin, you may need to use the `heroku` CLI application after creating an account online: - `USERNAME=yourUsername rails mastodon:make_admin` - -to make yourself an admin. + `heroku rake mastodon:make_admin USERNAME=yourUsername` -- cgit From f578cf8331dbc9254ba6733db6cea590a8014642 Mon Sep 17 00:00:00 2001 From: benklop Date: Fri, 7 Apr 2017 16:31:50 -0600 Subject: Update Administration-guide.md the syntax for running the rake task wasn't correct. --- docs/Running-Mastodon/Administration-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Running-Mastodon/Administration-guide.md b/docs/Running-Mastodon/Administration-guide.md index dd69eb303..09b0f1df1 100644 --- a/docs/Running-Mastodon/Administration-guide.md +++ b/docs/Running-Mastodon/Administration-guide.md @@ -7,7 +7,7 @@ So, you have a working Mastodon instance... now what? The following rake task: - rake mastodon:make_admin USERNAME=alice + RAILS_ENV=production bundle exec rails mastodon:make_admin USERNAME=alice Would turn the local user "alice" into an admin. -- cgit From f113af5350a02152e3984edd027e3136bc888244 Mon Sep 17 00:00:00 2001 From: Ray Alez Date: Fri, 7 Apr 2017 15:56:02 -0700 Subject: Add HackerNewsBot I have created a bot that will post Hacker News stories with 100+ points. Adding it to the list. --- docs/Using-Mastodon/Apps.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Using-Mastodon/Apps.md b/docs/Using-Mastodon/Apps.md index 67b14dc26..b5e1fa36b 100644 --- a/docs/Using-Mastodon/Apps.md +++ b/docs/Using-Mastodon/Apps.md @@ -13,5 +13,6 @@ Some people have started working on apps for the Mastodon API. Here is a list of |Albatross|iOS||[@goldie_ice@mastodon.social](https://mastodon.social/users/goldie_ice)| |Tooter|Chrome||[@effy@mastodon.social](https://mastodon.social/users/effy)| |tootstream|CLI||[@Raccoon@mastodon.social](https://mastodon.social/users/Raccoon)| +|HackerNewsBot|CLI||[@rayalez@hackertribe.io](https://hackertribe.io/users/rayalez)| If you have a project like this, let me know so I can add it to the list! -- cgit