From 5a33e6f00c66fd6e0ada797c4accae9b24ded1f3 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 24 Jul 2014 14:27:34 -0400 Subject: [PATCH] Move FAQ, Terms of Service, and Privacy Policy into topics in the Staff category. First post of those topics will be rendered on their respective pages. Site settings and content are not used for these documents anymore. Translations of the default text is moved into the standard YML files. --- .../javascripts/discourse/lib/markdown.js | 1 + app/controllers/static_controller.rb | 33 +- app/models/site_content.rb | 2 - app/views/static/show.html.erb | 16 + config/locales/server.en.yml | 341 +++++++++++++++++- config/site_settings.yml | 21 +- db/fixtures/999_topics.rb | 36 +- lib/tasks/db.rake | 2 + spec/components/system_message_spec.rb | 1 - spec/controllers/static_controller_spec.rb | 13 +- 10 files changed, 423 insertions(+), 43 deletions(-) create mode 100644 app/views/static/show.html.erb diff --git a/app/assets/javascripts/discourse/lib/markdown.js b/app/assets/javascripts/discourse/lib/markdown.js index 390389274..89f9b471f 100644 --- a/app/assets/javascripts/discourse/lib/markdown.js +++ b/app/assets/javascripts/discourse/lib/markdown.js @@ -228,6 +228,7 @@ Discourse.Markdown.whiteListTag('a', 'class', 'onebox'); Discourse.Markdown.whiteListTag('a', 'class', 'mention'); Discourse.Markdown.whiteListTag('a', 'data-bbcode'); +Discourse.Markdown.whiteListTag('a', 'name'); Discourse.Markdown.whiteListTag('img', 'src', /^data:image.*/i); diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index 824282c26..3a510b2f6 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -8,38 +8,31 @@ class StaticController < ApplicationController return redirect_to('/') if current_user && params[:id] == 'login' map = { - "faq" => "faq_url", - "tos" => "tos_url", - "privacy" => "privacy_policy_url" + "faq" => {redirect: "faq_url", topic_id: "guidelines_topic_id"}, + "tos" => {redirect: "tos_url", topic_id: "tos_topic_id"}, + "privacy" => {redirect: "privacy_policy_url", topic_id: "privacy_topic_id"} } - page = params[:id] + @page = params[:id] - if site_setting_key = map[page] + if map.has_key?(@page) + site_setting_key = map[@page][:redirect] url = SiteSetting.send(site_setting_key) return redirect_to(url) unless url.blank? end # The /guidelines route ALWAYS shows our FAQ, ignoring the faq_url site setting. - page = 'faq' if page == 'guidelines' + @page = 'faq' if @page == 'guidelines' # Don't allow paths like ".." or "/" or anything hacky like that - page.gsub!(/[^a-z0-9\_\-]/, '') + @page.gsub!(/[^a-z0-9\_\-]/, '') - file = "static/#{page}.#{I18n.locale}" - - # if we don't have a localized version, try the English one - if not lookup_context.find_all("#{file}.html").any? - file = "static/#{page}.en" - end - - if not lookup_context.find_all("#{file}.html").any? - file = "static/#{page}" - end - - if lookup_context.find_all("#{file}.html").any? + if map.has_key?(@page) + @topic = Topic.find_by_id(SiteSetting.send(map[@page][:topic_id])) + raise Discourse::NotFound unless @topic + @body = @topic.posts.first.cooked @faq_overriden = !SiteSetting.faq_url.blank? - render file, layout: !request.xhr?, formats: [:html] + render :show, layout: !request.xhr?, formats: [:html] return end diff --git a/app/models/site_content.rb b/app/models/site_content.rb index 969eaae3b..d35bb22f3 100644 --- a/app/models/site_content.rb +++ b/app/models/site_content.rb @@ -19,8 +19,6 @@ class SiteContent < ActiveRecord::Base add_content_type :tos_miscellaneous, default_18n_key: 'terms_of_service.miscellaneous' add_content_type :login_required_welcome_message, default_18n_key: 'login_required.welcome_message' add_content_type :tos_signup_form_message, default_18n_key: 'terms_of_service.signup_form_message', format: :html - add_content_type :privacy_policy, allow_blank: true - add_content_type :faq, allow_blank: true add_content_type :top, allow_blank: true, format: :html add_content_type :bottom, allow_blank: true, format: :html add_content_type :head, allow_blank: true, format: :html diff --git a/app/views/static/show.html.erb b/app/views/static/show.html.erb new file mode 100644 index 000000000..c3944fca5 --- /dev/null +++ b/app/views/static/show.html.erb @@ -0,0 +1,16 @@ + + +<% if staff? %> +

<%=t "edit_this_page" -%>

+<% end %> + +<%= @body.html_safe %> diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index a649993eb..d8bebc188 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -601,21 +601,15 @@ en: welcome_invite: title: "Welcome: Invited User" description: "A private message automatically sent to all new invited users when they accept the invitation from another user to participate." - privacy_policy: - title: "Privacy Policy" - description: "Your site's privacy policy. Leave blank for default policy." - faq: - title: "FAQ" - description: "Your site's FAQ. Leave blank for the default FAQ." login_required_welcome_message: title: "Login Required: Welcome Message" description: "Welcome message that is displayed to logged out users when the 'login required' setting is enabled." tos_user_content_license: title: "Terms of Service: Content License" - description: "The text for the Content License section of the Terms of Service." + description: "DEPRECATED. Not used anymore and will be removed. Edit the Terms of Service topic in the Staff category instead." tos_miscellaneous: title: "Terms of Service: Miscellaneous" - description: "The text for the Miscellaneous section of the Terms of Service." + description: "DEPRECATED. Not used anymore and will be removed. Edit the Terms of Service topic in the Staff category instead." login_required: title: "Login Required: Homepage" description: "The text displayed for unauthorized users when login is required on the site." @@ -653,9 +647,9 @@ en: title: "Brief title of this site, used in the title tag." site_description: "Describe this site in one sentence, used in the meta description tag." contact_email: "Email address of key contact for site. Important notices from discourse.org regarding critical updates may be sent to this address." - company_full_name: "The full name of the company that runs this site, used in legal documents like /tos and /privacy" - company_short_name: "The short name of the company that runs this site, used in legal documents like /tos and /privacy" - company_domain: "The domain name owned by the company that runs this site, used in legal documents like /tos and /privacy" + company_full_name: "DEPRECATED. Not used anymore and will be removed. The full name of the company that runs this site, used in legal documents like /tos and /privacy" + company_short_name: "DEPRECATED. Not used anymore and will be removed. The short name of the company that runs this site, used in legal documents like /tos and /privacy" + company_domain: "DEPRECATED. Not used anymore and will be removed. The domain name owned by the company that runs this site, used in legal documents like /tos and /privacy" queue_jobs: "DEVELOPER ONLY! WARNING! By default, queue jobs in sidekiq. If disabled, your site will be broken." crawl_images: "Retrieve images from remote URLs to insert the correct width and height dimensions." download_remote_images_to_local: "Convert remote images to local images by downloading them; this prevents broken images." @@ -1652,6 +1646,7 @@ en: This discussion forum requires an account to view %{title}. Please create an account or login to continue. terms_of_service: + title: "Terms of Service" user_content_license: | User contributions are licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US). Without limiting any of those representations or warranties, %{company_short_name} has the right (though not the obligation) to, in %{company_short_name}’s sole discretion (i) refuse or remove any content that, in %{company_short_name}’s reasonable opinion, violates any %{company_short_name} policy or is in any way harmful or objectionable, or (ii) terminate or deny access to and use of the Website to any individual or entity for any reason, in %{company_short_name}’s sole discretion. %{company_short_name} will have no obligation to provide a refund of any amounts previously paid. miscellaneous: "This Agreement constitutes the entire agreement between %{company_short_name} and you concerning the subject matter hereof, and they may only be modified by a written amendment signed by an authorized executive of %{company_short_name}, or by the posting by %{company_short_name} of a revised version. Except to the extent applicable law, if any, provides otherwise, this Agreement, any access to or use of the Website will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions, and the proper venue for any disputes arising out of or relating to any of the same will be the state and federal courts located in San Francisco County, California. Except for claims for injunctive or equitable relief or claims regarding intellectual property rights (which may be brought in any competent court without the posting of a bond), any dispute arising under this Agreement shall be finally settled in accordance with the Comprehensive Arbitration Rules of the Judicial Arbitration and Mediation Service, Inc. (“JAMS”) by three arbitrators appointed in accordance with such Rules. The arbitration shall take place in San Francisco, California, in the English language and the arbitral decision may be enforced in any court. The prevailing party in any action or proceeding to enforce this Agreement shall be entitled to costs and attorneys’ fees. If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties’ original intent, and the remaining portions will remain in full force and effect. A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms and conditions; %{company_short_name} may assign its rights under this Agreement without condition. This Agreement will be binding upon and will inure to the benefit of the parties, their successors and permitted assigns." @@ -1695,3 +1690,327 @@ en: base_theme_name: "Base" guidelines: "Guidelines" + privacy: "Privacy" + + edit_this_page: "Edit this page" + + static_topic_first_reply: | + Edit the first post in this topic to change the contents of the %{page_name} page. + + guidelines_topic: + title: "FAQ/Guidelines" + body: | + + + ## [This is a Civilized Place for Public Discussion](#civilized) + + Please treat this discussion forum with the same respect you would a public park. We, too, are a shared community resource — a place to share skills, knowledge and interests through ongoing conversation. + + These are not hard and fast rules, merely aids to the human judgment of our community. Use these guidelines to keep this a clean, well-lighted place for civilized public discourse. + + + + ## [Improve the Discussion](#improve) + + Help us make this a great place for discussion by always working to improve the discussion in some way, however small. If you are not sure your post adds to the conversation, think over what you want to say and try again later. + + The topics discussed here matter to us, and we want you to act as if they matter to you, too. Be respectful of the topics and the people discussing them, even if you disagree with some of what is being said. + + One way to improve the discussion is by discovering ones that are already happening. Please spend some time browsing the topics here before replying or starting your own, and you’ll have a better chance of meeting others who share your interests. + + + + ## [Be Agreeable, Even When You Disagree](#agreeable) + + You may wish to respond to something by disagreeing with it. That’s fine. But, remember to _criticize ideas, not people_. Please avoid: + + * Name-calling. + * Ad hominem attacks. + * Responding to a post’s tone instead of its actual content. + * Knee-jerk contradiction. + + Instead, provide reasoned counter-arguments that improve the conversation. + + + + ## [Your Participation Counts](#participate) + + The conversations we have here set the tone for everyone. Help us influence the future of this community by choosing to engage in discussions that make this forum an interesting place to be — and avoiding those that do not. + + Discourse provides tools that enable the community to collectively identify the best (and worst) contributions: favorites, bookmarks, likes, flags, replies, edits, and so forth. Use these tools to improve your own experience, and everyone else’s, too. + + Let’s try to leave our park better than we found it. + + + + ## [If You See a Problem, Flag It](#flag-problems) + + Moderators have special authority; they are responsible for this forum. But so are you. With your help, moderators can be community facilitators, not just janitors or police. + + When you see bad behavior, don’t reply. It encourages the bad behavior by acknowledging it, consumes your energy, and wastes everyone’s time. _Just flag it_. If enough flags accrue, action will be taken, either automatically or by moderator intervention. + + In order to maintain our community, moderators reserve the right to remove any content and any user account for any reason at any time. Moderators do not preview new posts in any way; the moderators and site operators take no responsibility for any content posted by the community. + + + + ## [Always Be Civil](#be-civil) + + Nothing sabotages a healthy conversation like rudeness: + + * Be civil. Don’t post anything that a reasonable person would consider offensive, abusive, or hate speech. + * Keep it clean. Don’t post anything obscene or sexually explicit. + * Respect each other. Don’t harass or grief anyone, impersonate people, or expose their private information. + * Respect our forum. Don’t post spam or otherwise vandalize the forum. + + These are not concrete terms with precise definitions — avoid even the _appearance_ of any of these things. If you’re unsure, ask yourself how you would feel if your post was featured on the front page of the New York Times. + + This is a public forum, and search engines index these discussions. Keep the language, links, and images safe for family and friends. + + + + ## [Keep It Tidy](#keep-tidy) + + Make the effort to put things in the right place, so that we can spend more time discussing and less cleaning up. So: + + * Don’t start a topic in the wrong category. + * Don’t cross-post the same thing in multiple topics. + * Don’t post no-content replies. + * Don’t divert a topic by changing it midstream. + * Don’t sign your posts — every post has your profile information attached to it. + + Rather than posting “+1” or “Agreed”, use the Like button. Rather than taking an existing topic in a radically different direction, use Reply as a New Topic. + + + + ## [Post Only Your Own Stuff](#stealing) + + You may not post anything digital that belongs to someone else without permission. You may not post descriptions of, links to, or methods for stealing someone’s intellectual property (software, video, audio, images), or for breaking any other law. + + + + ## [Terms of Service](#tos) + + Yes, legalese is boring, but we must protect ourselves – and by extension, you and your data – against unfriendly folks. We have a [Terms of Service](/tos) describing your (and our) behavior and rights related to content, privacy, and laws. To use this service, you must agree to abide by our [TOS](/tos). + + tos_topic: + title: "Terms of Service" + body: | + The following terms and conditions govern all use of the %{company_domain} website and all content, services and products available at or through the website, including, but not limited to, %{company_domain} Forum Software, %{company_domain} Support Forums and the %{company_domain} Hosting service ("Hosting"), (taken together, the Website). The Website is owned and operated by %{company_full_name} ("%{company_name}"). The Website is offered subject to your acceptance without modification of all of the terms and conditions contained herein and all other operating rules, policies (including, without limitation, %{company_domain}’s [Privacy Policy](/privacy) and [Community Guidelines](/faq)) and procedures that may be published from time to time on this Site by %{company_name} (collectively, the "Agreement"). + + Please read this Agreement carefully before accessing or using the Website. By accessing or using any part of the web site, you agree to become bound by the terms and conditions of this agreement. If you do not agree to all the terms and conditions of this agreement, then you may not access the Website or use any services. If these terms and conditions are considered an offer by %{company_name}, acceptance is expressly limited to these terms. The Website is available only to individuals who are at least 13 years old. + + + + ## [1. Your %{company_domain} Account](#1) + + If you create an account on the Website, you are responsible for maintaining the security of your account and you are fully responsible for all activities that occur under the account. You must immediately notify %{company_name} of any unauthorized uses of your account or any other breaches of security. %{company_name} will not be liable for any acts or omissions by you, including any damages of any kind incurred as a result of such acts or omissions. + + + + ## [2. Responsibility of Contributors](#2) + + If you post material to the Website, post links on the Website, or otherwise make (or allow any third party to make) material available by means of the Website (any such material, "Content"), You are entirely responsible for the content of, and any harm resulting from, that Content. That is the case regardless of whether the Content in question constitutes text, graphics, an audio file, or computer software. By making Content available, you represent and warrant that: + + * the downloading, copying and use of the Content will not infringe the proprietary rights, including but not limited to the copyright, patent, trademark or trade secret rights, of any third party; + * if your employer has rights to intellectual property you create, you have either (i) received permission from your employer to post or make available the Content, including but not limited to any software, or (ii) secured from your employer a waiver as to all rights in or to the Content; + * you have fully complied with any third-party licenses relating to the Content, and have done all things necessary to successfully pass through to end users any required terms; + * the Content does not contain or install any viruses, worms, malware, Trojan horses or other harmful or destructive content; + * the Content is not spam, is not machine- or randomly-generated, and does not contain unethical or unwanted commercial content designed to drive traffic to third party sites or boost the search engine rankings of third party sites, or to further unlawful acts (such as phishing) or mislead recipients as to the source of the material (such as spoofing); + * the Content is not pornographic, does not contain threats or incite violence, and does not violate the privacy or publicity rights of any third party; + * your content is not getting advertised via unwanted electronic messages such as spam links on newsgroups, email lists, blogs and web sites, and similar unsolicited promotional methods; + * your content is not named in a manner that misleads your readers into thinking that you are another person or company; and + * you have, in the case of Content that includes computer code, accurately categorized and/or described the type, nature, uses and effects of the materials, whether requested to do so by %{company_name} or otherwise. + + + + ## [3. User Content License](#3) + + User contributions are licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US). Without limiting any of those representations or warranties, %{company_name} has the right (though not the obligation) to, in %{company_name}’s sole discretion (i) refuse or remove any content that, in %{company_name}’s reasonable opinion, violates any %{company_name} policy or is in any way harmful or objectionable, or (ii) terminate or deny access to and use of the Website to any individual or entity for any reason, in %{company_name}’s sole discretion. %{company_name} will have no obligation to provide a refund of any amounts previously paid. + + + + + ## [4. Payment and Renewal](#4) + + ### General Terms + + Optional paid services or upgrades may be available on the Website. When utilizing an optional paid service or upgrade, you agree to pay %{company_name} the monthly or annual subscription fees indicated. Payments will be charged on a pre-pay basis on the day you begin utilizing the service or upgrade and will cover the use of that service or upgrade for a monthly or annual subscription period as indicated. These fees are not refundable. + + ### Automatic Renewal + + Unless you notify %{company_name} before the end of the applicable subscription period that you want to cancel a service or upgrade, your subscription will automatically renew and you authorize us to collect the then-applicable annual or monthly subscription fee (as well as any taxes) using any credit card or other payment mechanism we have on record for you. Subscriptions can be canceled at any time. + + + + ## [5. Services](#5) + + ### Hosting, Support Services + + Optional Hosting and Support services may be provided by %{company_name} under the terms and conditions for each such service. By signing up for a Hosting/Support or Support services account, you agree to abide by such terms and conditions. + + + + ## [6. Responsibility of Website Visitors](#6) + + %{company_name} has not reviewed, and cannot review, all of the material, including computer software, posted to the Website, and cannot therefore be responsible for that material’s content, use or effects. By operating the Website, %{company_name} does not represent or imply that it endorses the material there posted, or that it believes such material to be accurate, useful or non-harmful. You are responsible for taking precautions as necessary to protect yourself and your computer systems from viruses, worms, Trojan horses, and other harmful or destructive content. The Website may contain content that is offensive, indecent, or otherwise objectionable, as well as content containing technical inaccuracies, typographical mistakes, and other errors. The Website may also contain material that violates the privacy or publicity rights, or infringes the intellectual property and other proprietary rights, of third parties, or the downloading, copying or use of which is subject to additional terms and conditions, stated or unstated. %{company_name} disclaims any responsibility for any harm resulting from the use by visitors of the Website, or from any downloading by those visitors of content there posted. + + + + ## [7. Content Posted on Other Websites](#7) + + We have not reviewed, and cannot review, all of the material, including computer software, made available through the websites and webpages to which %{company_domain} links, and that link to %{company_domain}. %{company_name} does not have any control over those non-%{company_domain} websites and webpages, and is not responsible for their contents or their use. By linking to a non-%{company_domain} website or webpage, %{company_name} does not represent or imply that it endorses such website or webpage. You are responsible for taking precautions as necessary to protect yourself and your computer systems from viruses, worms, Trojan horses, and other harmful or destructive content. %{company_name} disclaims any responsibility for any harm resulting from your use of non-%{company_domain} websites and webpages. + + + + ## [8. Copyright Infringement and DMCA Policy](#8) + + As %{company_name} asks others to respect its intellectual property rights, it respects the intellectual property rights of others. If you believe that material located on or linked to by %{company_domain} violates your copyright, and if this website resides in the USA, you are encouraged to notify %{company_name} in accordance with %{company_name}’s [Digital Millennium Copyright Act](http://en.wikipedia.org/wiki/Digital_Millennium_Copyright_Act) ("DMCA") Policy. %{company_name} will respond to all such notices, including as required or appropriate by removing the infringing material or disabling all links to the infringing material. %{company_name} will terminate a visitor’s access to and use of the Website if, under appropriate circumstances, the visitor is determined to be a repeat infringer of the copyrights or other intellectual property rights of %{company_name} or others. In the case of such termination, %{company_name} will have no obligation to provide a refund of any amounts previously paid to %{company_name}. + + + + ## [9. Intellectual Property](#9) + + This Agreement does not transfer from %{company_name} to you any %{company_name} or third party intellectual property, and all right, title and interest in and to such property will remain (as between the parties) solely with %{company_name}. %{company_name}, %{company_domain}, the %{company_domain} logo, and all other trademarks, service marks, graphics and logos used in connection with %{company_domain}, or the Website are trademarks or registered trademarks of %{company_name} or %{company_name}’s licensors. Other trademarks, service marks, graphics and logos used in connection with the Website may be the trademarks of other third parties. Your use of the Website grants you no right or license to reproduce or otherwise use any %{company_name} or third-party trademarks. + + + + ## [10. Advertisements](#10) + + %{company_name} reserves the right to display advertisements on your content unless you have purchased an Ad-free Upgrade or a Services account. + + + + ## [11. Attribution](#11) + + %{company_name} reserves the right to display attribution links such as ‘Powered by %{company_domain},’ theme author, and font attribution in your content footer or toolbar. Footer credits and the %{company_domain} toolbar may not be removed regardless of upgrades purchased. + + + + ## [12. Changes](#12) + + %{company_name} reserves the right, at its sole discretion, to modify or replace any part of this Agreement. It is your responsibility to check this Agreement periodically for changes. Your continued use of or access to the Website following the posting of any changes to this Agreement constitutes acceptance of those changes. %{company_name} may also, in the future, offer new services and/or features through the Website (including, the release of new tools and resources). Such new features and/or services shall be subject to the terms and conditions of this Agreement. + + + + ## [13. Termination](#13) + + %{company_name} may terminate your access to all or any part of the Website at any time, with or without cause, with or without notice, effective immediately. If you wish to terminate this Agreement or your %{company_domain} account (if you have one), you may simply discontinue using the Website. All provisions of this Agreement which by their nature should survive termination shall survive termination, including, without limitation, ownership provisions, warranty disclaimers, indemnity and limitations of liability. + + + + ## [14. Disclaimer of Warranties](#14) + + The Website is provided "as is". %{company_name} and its suppliers and licensors hereby disclaim all warranties of any kind, express or implied, including, without limitation, the warranties of merchantability, fitness for a particular purpose and non-infringement. Neither %{company_name} nor its suppliers and licensors, makes any warranty that the Website will be error free or that cess thereto will be continuous or uninterrupted. If you’re actually reading this, here’s [a treat](http://www.newyorker.com/online/blogs/shouts/2012/12/the-hundred-best-lists-of-all-time.html). You understand that you download from, or otherwise obtain content or services through, the Website at your own discretion and risk. + + + + ## [15. Limitation of Liability](#15) + + In no event will %{company_name}, or its suppliers or licensors, be liable with respect to any subject matter of this agreement under any contract, negligence, strict liability or other legal or equitable theory for: (i) any special, incidental or consequential damages; (ii) the cost of procurement for substitute products or services; (iii) for interruption of use or loss or corruption of data; or (iv) for any amounts that exceed the fees paid by you to %{company_name} under this agreement during the twelve (12) month period prior to the cause of action. %{company_name} shall have no liability for any failure or delay due to matters beyond their reasonable control. The foregoing shall not apply to the extent prohibited by applicable law. + + + + ## [16. General Representation and Warranty](#16) + + You represent and warrant that (i) your use of the Website will be in strict accordance with the %{company_name} [Privacy Policy](/privacy), [Community Guidelines](/guidelines), with this Agreement and with all applicable laws and regulations (including without limitation any local laws or regulations in your country, state, city, or other governmental area, regarding online conduct and acceptable content, and including all applicable laws regarding the transmission of technical data exported from the country in which this website resides or the country in which you reside) and (ii) your use of the Website will not infringe or misappropriate the intellectual property rights of any third party. + + + + ## [17. Indemnification](#17) + + You agree to indemnify and hold harmless %{company_name}, its contractors, and its licensors, and their respective directors, officers, employees and agents from and against any and all claims and expenses, including attorneys’ fees, arising out of your use of the Website, including but not limited to your violation of this Agreement. + + + + ## [18. Miscellaneous](#18) + + This Agreement constitutes the entire agreement between %{company_name} and you concerning the subject matter hereof, and they may only be modified by a written amendment signed by an authorized executive of %{company_name}, or by the posting by %{company_name} of a revised version. Except to the extent applicable law, if any, provides otherwise, this Agreement, any access to or use of the Website will be governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions, and the proper venue for any disputes arising out of or relating to any of the same will be the state and federal courts located in San Francisco County, California. Except for claims for injunctive or equitable relief or claims regarding intellectual property rights (which may be brought in any competent court without the posting of a bond), any dispute arising under this Agreement shall be finally settled in accordance with the Comprehensive Arbitration Rules of the Judicial Arbitration and Mediation Service, Inc. (“JAMS”) by three arbitrators appointed in accordance with such Rules. The arbitration shall take place in San Francisco, California, in the English language and the arbitral decision may be enforced in any court. The prevailing party in any action or proceeding to enforce this Agreement shall be entitled to costs and attorneys’ fees. If any part of this Agreement is held invalid or unenforceable, that part will be construed to reflect the parties’ original intent, and the remaining portions will remain in full force and effect. A waiver by either party of any term or condition of this Agreement or any breach thereof, in any one instance, will not waive such term or condition or any subsequent breach thereof. You may assign your rights under this Agreement to any party that consents to, and agrees to be bound by, its terms and conditions; %{company_name} may assign its rights under this Agreement without condition. This Agreement will be binding upon and will inure to the benefit of the parties, their successors and permitted assigns. + + This document is CC-BY-SA. It was last updated May 31, 2013. + + Originally adapted from the [WordPress Terms of Service](http://en.wordpress.com/tos/). + + privacy_topic: + title: "Privacy Policy" + body: | + + + ## [What information do we collect?](#collect) + + We collect information from you when you register on our site and gather data when you participate in the forum by reading, writing, and evaluating the content shared here. + + When registering on our site, you may be asked to enter your name and e-mail address. You may, however, visit our site without registering. Your e-mail address will be verified by an email containing a unique link. If that link is visited, we know that you control the e-mail address. + + When registered and posting, we record the IP address that the post originated from. We also may retain server logs which include the IP address of every request to our server. + + + + ## [What do we use your information for?](#use) + + Any of the information we collect from you may be used in one of the following ways: + + * To personalize your experience — your information helps us to better respond to your individual needs. + * To improve our site — we continually strive to improve our site offerings based on the information and feedback we receive from you. + * To improve customer service — your information helps us to more effectively respond to your customer service requests and support needs. + * To send periodic emails — The email address you provide may be used to send you information, notifications that you request about changes to topics or in response to your user name, respond to inquiries, and/or other requests or questions. + + + + ## [How do we protect your information?](#use) + + We implement a variety of security measures to maintain the safety of your personal information when you enter, submit, or access your personal information. + + + + ## [What is your data retention policy?](#data-retention) + + We will make a good faith effort to: + + * Retain server logs containing the IP address of all requests to this server no more than 90 days. + * Retain the IP addresses associated with registered users and their posts no more than 5 years. + + + + ## [Do we use cookies?](#cookies) + + Yes. Cookies are small files that a site or its service provider transfers to your computer's hard drive through your Web browser (if you allow). These cookies enable the site to recognize your browser and, if you have a registered account, associate it with your registered account. + + We use cookies to understand and save your preferences for future visits and compile aggregate data about site traffic and site interaction so that we can offer better site experiences and tools in the future. We may contract with third-party service providers to assist us in better understanding our site visitors. These service providers are not permitted to use the information collected on our behalf except to help us conduct and improve our business. + + + + ## [Do we disclose any information to outside parties?](#disclose) + + We do not sell, trade, or otherwise transfer to outside parties your personally identifiable information. This does not include trusted third parties who assist us in operating our site, conducting our business, or servicing you, so long as those parties agree to keep this information confidential. We may also release your information when we believe release is appropriate to comply with the law, enforce our site policies, or protect ours or others rights, property, or safety. However, non-personally identifiable visitor information may be provided to other parties for marketing, advertising, or other uses. + + + + ## [Third party links](#third-party) + + Occasionally, at our discretion, we may include or offer third party products or services on our site. These third party sites have separate and independent privacy policies. We therefore have no responsibility or liability for the content and activities of these linked sites. Nonetheless, we seek to protect the integrity of our site and welcome any feedback about these sites. + + + + ## [Children's Online Privacy Protection Act Compliance](#coppa) + + Our site, products and services are all directed to people who are at least 13 years old or older. If this server is in the USA, and you are under the age of 13, per the requirements of COPPA ([Children's Online Privacy Protection Act](http://en.wikipedia.org/wiki/Children)), do not use this site. + + + + ## [Online Privacy Policy Only](#online) + + This online privacy policy applies only to information collected through our site and not to information collected offline. + + + + ## [Your Consent](#consent) + + By using our site, you consent to our web site privacy policy. + + + + ## [Changes to our Privacy Policy](#changes) + + If we decide to change our privacy policy, we will post those changes on this page. + + This document is CC-BY-SA. It was last updated May 31, 2013. diff --git a/config/site_settings.yml b/config/site_settings.yml index a68035def..9016549b6 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -42,9 +42,6 @@ required: client: true default: '/images/default-favicon.ico' apple_touch_icon_url: '/images/default-apple-touch-icon.png' - company_full_name: 'My Unconfigured Forum Ltd.' - company_short_name: 'Unconfigured Forum' - company_domain: 'www.example.com' basic: default_locale: @@ -287,9 +284,7 @@ posting: default: 10 max_post_length: client: true - default: - test: 4000 - default: 32000 + default: 32000 body_min_entropy: 7 min_topic_title_length: client: true @@ -705,3 +700,17 @@ uncategorized: default: true disable_edit_notifications: false + + company_full_name: 'My Unconfigured Forum Ltd.' + company_short_name: 'Unconfigured Forum' + company_domain: 'www.example.com' + + tos_topic_id: + default: -1 + hidden: true + guidelines_topic_id: + default: -1 + hidden: true + privacy_topic_id: + default: -1 + hidden: true diff --git a/db/fixtures/999_topics.rb b/db/fixtures/999_topics.rb index c1bc9f75f..3a5454482 100644 --- a/db/fixtures/999_topics.rb +++ b/db/fixtures/999_topics.rb @@ -2,10 +2,11 @@ User.reset_column_information Topic.reset_column_information Post.reset_column_information +staff = Category.find_by(id: SiteSetting.staff_category_id) + if Topic.where('id NOT IN (SELECT topic_id from categories where topic_id is not null)').count == 0 && !Rails.env.test? puts "Seeding welcome topics" - staff = Category.find_by(id: SiteSetting.staff_category_id) welcome = File.read(Rails.root + 'docs/ADMIN-QUICK-START-GUIDE.md') PostCreator.create(Discourse.system_user, raw: welcome, title: "READ ME FIRST: Admin Quick Start Guide", skip_validations: true, category: staff ? staff.name : nil) PostCreator.create(Discourse.system_user, raw: I18n.t('assets_topic_body'), title: "Assets for the forum design", skip_validations: true, category: staff ? staff.name : nil) @@ -20,3 +21,36 @@ if Topic.where('id NOT IN (SELECT topic_id from categories where topic_id is not post.topic.update_pinned(true) end end + +unless Rails.env.test? + def create_static_page_topic(site_setting_key, title_key, body_key, body_override, category, description, params={}) + unless SiteSetting.send(site_setting_key) > 0 + post = PostCreator.create( Discourse.system_user, + title: I18n.t(title_key, default: I18n.t(title_key, locale: :en)), + raw: body_override.present? ? body_override : I18n.t(body_key, params.merge(default: I18n.t(body_key, params.merge(locale: :en)))), + skip_validations: true, + category: category ? category.name : nil) + + raise "Failed to create the #{description} topic! #{post.errors.full_messages.join('. ')}" unless post.valid? + + SiteSetting.send("#{site_setting_key}=", post.topic_id) + + reply = PostCreator.create( Discourse.system_user, + raw: I18n.t('static_topic_first_reply', page_name: I18n.t(title_key, default: I18n.t(title_key, locale: :en))), + skip_validations: true, + topic_id: post.topic_id ) + end + end + + create_static_page_topic('tos_topic_id', 'tos_topic.title', "tos_topic.body", nil, staff, "terms of service", { + company_domain: SiteSetting.company_domain, + company_full_name: SiteSetting.company_full_name, + company_name: SiteSetting.company_short_name + }) + + create_static_page_topic('guidelines_topic_id', 'guidelines_topic.title', "guidelines_topic.body", + (SiteContent.content_for(:faq) rescue nil), staff, "guidelines") + + create_static_page_topic('privacy_topic_id', 'privacy_topic.title', "privacy_topic.body", + (SiteContent.content_for(:privacy_policy) rescue nil), staff, "privacy policy") +end diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 727c94606..b830e10d6 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -1,9 +1,11 @@ # we need to run seed_fu every time we run rake db:migrate task 'db:migrate' => 'environment' do + I18n.locale = SiteSetting.default_locale SeedFu.seed end task 'test:prepare' => 'environment' do + I18n.locale = SiteSetting.default_locale SeedFu.seed end diff --git a/spec/components/system_message_spec.rb b/spec/components/system_message_spec.rb index 012fc1a29..622fdfad2 100644 --- a/spec/components/system_message_spec.rb +++ b/spec/components/system_message_spec.rb @@ -14,7 +14,6 @@ describe SystemMessage do let(:topic) { post.topic } it 'should create a post correctly' do - SiteSetting.stubs(:max_post_length).returns(100_000) post.should be_present post.should be_valid topic.should be_private_message diff --git a/spec/controllers/static_controller_spec.rb b/spec/controllers/static_controller_spec.rb index e77e4467d..6279c2239 100644 --- a/spec/controllers/static_controller_spec.rb +++ b/spec/controllers/static_controller_spec.rb @@ -3,6 +3,13 @@ require 'spec_helper' describe StaticController do context 'show' do + before do + post = create_post + SiteSetting.stubs(:tos_topic_id).returns(post.topic.id) + SiteSetting.stubs(:guidelines_topic_id).returns(post.topic.id) + SiteSetting.stubs(:privacy_topic_id).returns(post.topic.id) + end + context "with a static file that's present" do before do @@ -14,7 +21,8 @@ describe StaticController do end it "renders the file" do - response.should render_template('static/faq.en') + response.should render_template('static/show') + assigns(:page).should == 'faq' end end @@ -24,7 +32,8 @@ describe StaticController do context "when #{setting_name} site setting is NOT set" do it "renders the #{id} page" do - expect(subject).to render_template("static/#{id}.en") + expect(subject).to render_template("static/show") + assigns(:page).should == id end end