diff --git a/.gitignore b/.gitignore index db2900f71..19d075c15 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,6 @@ chef/tmp/* # .procfile .procfile + +# exclude our git version file for now +config/version.rb diff --git a/Gemfile b/Gemfile index f884e0966..b1c61b588 100644 --- a/Gemfile +++ b/Gemfile @@ -47,7 +47,7 @@ gem 'slim' # required for sidekiq-web gem 'therubyracer', require: 'v8' gem 'thin' -# Gem that enables support for plugins. It is required +# Gem that enables support for plugins. It is required. gem 'discourse_plugin', path: 'vendor/gems/discourse_plugin' # Discourse Plugins (optional) diff --git a/app/assets/javascripts/admin/templates/flags.js.handlebars b/app/assets/javascripts/admin/templates/flags.js.handlebars index 17670abee..ac4046257 100644 --- a/app/assets/javascripts/admin/templates/flags.js.handlebars +++ b/app/assets/javascripts/admin/templates/flags.js.handlebars @@ -13,7 +13,7 @@
{{{unbound excerpt}}} diff --git a/app/assets/javascripts/discourse/views/list/list_topics_view.js.coffee b/app/assets/javascripts/discourse/views/list/list_topics_view.js.coffee index e5d97650a..cd50ddebf 100644 --- a/app/assets/javascripts/discourse/views/list/list_topics_view.js.coffee +++ b/app/assets/javascripts/discourse/views/list/list_topics_view.js.coffee @@ -18,6 +18,10 @@ window.Discourse.ListTopicsView = Ember.View.extend Discourse.Scrolling, Discour willDestroyElement: -> @unbindScrolling() + allLoaded: (-> + !@get('loading') && !@get('controller.content.more_topics_url') + ).property('loading', 'controller.content.more_topics_url') + didInsertElement: -> @bindScrolling() eyeline = new Discourse.Eyeline('.topic-list-item') diff --git a/app/assets/javascripts/discourse/views/search/search_view.js.coffee b/app/assets/javascripts/discourse/views/search/search_view.js.coffee index d4fdba0a2..eacc6c539 100644 --- a/app/assets/javascripts/discourse/views/search/search_view.js.coffee +++ b/app/assets/javascripts/discourse/views/search/search_view.js.coffee @@ -92,8 +92,8 @@ window.Discourse.SearchView = Ember.View.extend Discourse.Presence, count ).property('content') - moreOfType: (e) -> - @set('typeFilter', e.context) + moreOfType: (type) -> + @set('typeFilter', type) false cancelType: -> diff --git a/app/assets/stylesheets/application/faqs.css.scss b/app/assets/stylesheets/application/faqs.css.scss index bd005833d..07d6d16d7 100755 --- a/app/assets/stylesheets/application/faqs.css.scss +++ b/app/assets/stylesheets/application/faqs.css.scss @@ -36,7 +36,6 @@ margin-bottom: 8px; } - // Lists ul, ol { margin-left: 40px; @@ -44,9 +43,6 @@ } -// Content wrapper -// -------------------------------------------------- - .body-page { .container { @@ -54,44 +50,12 @@ width: 960px; margin: 0 auto; padding: 20px 10px; + margin-top: -60px; } } -// Navigation -// -------------------------------------------------- - -.body-page { - - nav { - width: 280px; - overflow: hidden; - position: fixed; - float: left; - border: 1px solid #b9b9b9; - background-color: #fafafa; - @include border-radius-all(4px); - @include box-shadow(0 1px 0 #fff); - > a { - display: block; - border-top: 1px solid #e6e6e6; - padding: 13px; - font-weight: bold; - font-size: 16px; - line-height: 20px; - text-shadow: 0 1px 0 rgba($white, 0.5); - &:first-child { - border-top: 0; - } - &:hover { - background-color: #eee; - } - &.active { - color: #f15b22; - background-color: #f9e7e0; - cursor: default; - } - } - } - +.nav-pills { + margin-left:0px !important; + font: 13px/18px "Helvetica Neue",Helvetica,Arial,sans-serif; } \ No newline at end of file diff --git a/app/assets/stylesheets/application/topic-post.css.scss b/app/assets/stylesheets/application/topic-post.css.scss index f9cb327ee..c972a2b82 100644 --- a/app/assets/stylesheets/application/topic-post.css.scss +++ b/app/assets/stylesheets/application/topic-post.css.scss @@ -431,6 +431,7 @@ a.arrow { float: right; margin: 3px 0 3px 0; + color: grey; } } diff --git a/app/assets/stylesheets/application/user.css.scss b/app/assets/stylesheets/application/user.css.scss index adf60b259..49a5b86d6 100644 --- a/app/assets/stylesheets/application/user.css.scss +++ b/app/assets/stylesheets/application/user.css.scss @@ -258,6 +258,9 @@ .type { color: lighten($black, 40%); } + span.name { + color: lighten($black, 40%); + } .time { display: block; float: right; diff --git a/app/controllers/exceptions_controller.rb b/app/controllers/exceptions_controller.rb index 413807413..6014ebc9c 100644 --- a/app/controllers/exceptions_controller.rb +++ b/app/controllers/exceptions_controller.rb @@ -1,6 +1,5 @@ class ExceptionsController < ApplicationController skip_before_filter :check_xhr - skip_before_filter :check_restricted_access layout 'no_js' def not_found diff --git a/app/models/category.rb b/app/models/category.rb index d180a34eb..b0e67c869 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -17,7 +17,6 @@ class Category < ActiveRecord::Base after_save :invalidate_site_cache after_destroy :invalidate_site_cache - def uncategorized_validator return errors.add(:name, I18n.t(:is_reserved)) if name == SiteSetting.uncategorized_name return errors.add(:slug, I18n.t(:is_reserved)) if slug == SiteSetting.uncategorized_name @@ -26,24 +25,22 @@ class Category < ActiveRecord::Base def self.popular order('topic_count desc') end - + + # Recalculates `topics_year`, `topics_month`, and `topics_week` + # for each Category. def self.update_stats - exec_sql "UPDATE categories - SET topics_week = (SELECT COUNT(*) - FROM topics as ft - WHERE ft.category_id = categories.id - AND ft.created_at > (CURRENT_TIMESTAMP - INTERVAL '1 WEEK') - AND ft.visible), - topics_month = (SELECT COUNT(*) - FROM topics as ft - WHERE ft.category_id = categories.id - AND ft.created_at > (CURRENT_TIMESTAMP - INTERVAL '1 MONTH') - AND ft.visible), - topics_year = (SELECT COUNT(*) - FROM topics as ft - WHERE ft.category_id = categories.id - AND ft.created_at > (CURRENT_TIMESTAMP - INTERVAL '1 YEAR') - AND ft.visible)" + topics = Topic + .select("COUNT(*)") + .where("topics.category_id = categories.id") + .visible + + topics_year = topics.created_since(1.year.ago).to_sql + topics_month = topics.created_since(1.month.ago).to_sql + topics_week = topics.created_since(1.week.ago).to_sql + + Category.update_all("topics_year = (#{topics_year}), + topics_month = (#{topics_month}), + topics_week = (#{topics_week})") end # Use the first paragraph of the topic's first post as the excerpt diff --git a/app/models/site_customization.rb b/app/models/site_customization.rb index ed19ada58..fe338c8ff 100644 --- a/app/models/site_customization.rb +++ b/app/models/site_customization.rb @@ -1,7 +1,8 @@ class SiteCustomization < ActiveRecord::Base ENABLED_KEY = '7e202ef2-56d7-47d5-98d8-a9c8d15e57dd' - CACHE_PATH = 'stylesheet-cache' + # placing this in uploads to ease deployment rules + CACHE_PATH = 'uploads/stylesheet-cache' @lock = Mutex.new before_create do diff --git a/app/models/topic.rb b/app/models/topic.rb index 8c26deca3..5977f5bd7 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -167,7 +167,11 @@ class Topic < ActiveRecord::Base def self.visible where(visible: true) end - + + def self.created_since(time_ago) + where("created_at > ?", time_ago) + end + def private_message? self.archetype == Archetype.private_message end diff --git a/app/models/user_action.rb b/app/models/user_action.rb index 00cb87c0c..d0521d25a 100644 --- a/app/models/user_action.rb +++ b/app/models/user_action.rb @@ -42,12 +42,16 @@ class UserAction < ActiveRecord::Base results = UserAction.select("action_type, COUNT(*) count, '' AS description") .joins(:target_topic) .where(user_id: user_id) - .group('action_type', 'topics.archetype') + .group('action_type') - # should push this into the sql at some point, but its simple enough for now + # We apply similar filters in stream, might consider trying to consolidate somehow unless guardian.can_see_private_messages?(user_id) results = results.where('topics.archetype <> ?', Archetype::private_message) end + + unless guardian.user && guardian.user.id == user_id + results = results.where("action_type <> ?", BOOKMARK) + end results = results.to_a @@ -79,6 +83,7 @@ class UserAction < ActiveRecord::Base SELECT t.title, a.action_type, a.created_at, t.id topic_id, coalesce(p.post_number, 1) post_number, + p.reply_to_post_number, pu.email ,pu.username, pu.name, pu.id user_id, u.email acting_email, u.username acting_username, u.name acting_name, u.id acting_user_id, coalesce(p.cooked, p2.cooked) cooked diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 295a7d509..38669d745 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -58,5 +58,6 @@ <%= render :partial => "common/discourse_javascript" %> <%= render_google_analytics_code %> +