Commit ff6f437c authored by Dennis Schubert's avatar Dennis Schubert

Merge branch 'release/0.5.2.0'

parents 8624ebb9 c0a0f5e0
......@@ -31,3 +31,5 @@ notifications:
irc:
channels:
- "irc.freenode.org:6667#diaspora-dev"
template:
- "%{repository_slug}#%{commit} (%{branch} - %{commit_subject}): %{message} %{build_url}"
# 0.5.2.0
## Refactor
* Update perfect-scrollbar [#6085](https://github.com/diaspora/diaspora/pull/6085)
* Remove top margin for first heading in a post [#6110](https://github.com/diaspora/diaspora/pull/6110)
* Add link to pod statistics in right navigation [#6117](https://github.com/diaspora/diaspora/pull/6117)
* Refactor person related URL generation [#6168](https://github.com/diaspora/diaspora/pull/6168)
* Move webfinger and HCard generation out of the core and embed the `diaspora_federation-rails` gem [#6151](https://github.com/diaspora/diaspora/pull/6151/)
* Refactor rspec tests to to use `let` instead of before blocks [#6199](https://github.com/diaspora/diaspora/pull/6199)
* Refactor tests for EXIF stripping [#6183](https://github.com/diaspora/diaspora/pull/6183)
## Bug fixes
* Precompile facebox images [#6105](https://github.com/diaspora/diaspora/pull/6105)
* Fix wrong closing a-tag [#6111](https://github.com/diaspora/diaspora/pull/6111)
* Fix mobile more-button wording when there are less than 15 posts [#6118](https://github.com/diaspora/diaspora/pull/6118)
* Fix reappearing flash boxes during sign-in [#6146](https://github.com/diaspora/diaspora/pull/6146)
* Capitalize Wiki link [#6193](https://github.com/diaspora/diaspora/pull/6193)
## Features
* Add configuration options for some debug logs [#6090](https://github.com/diaspora/diaspora/pull/6090)
* Send new users a welcome message from the podmin [#6128](https://github.com/diaspora/diaspora/pull/6128)
* Cleanup temporary upload files daily [#6147](https://github.com/diaspora/diaspora/pull/6147)
* Add guid to posts and comments in the user export [#6185](https://github.com/diaspora/diaspora/pull/6185)
# 0.5.1.2
diaspora\* versions prior 0.5.1.2 leaked potentially private profile data (namely the bio, birthday, gender and location fields) to
......
source "https://rubygems.org"
gem "rails", "4.2.2"
gem "rails", "4.2.3"
# Legacy Rails features, remove me!
# caches_page
gem "actionpack-action_caching"
gem "actionpack-page_caching"
# responders (class level)
gem "responders", "2.1.0"
......@@ -15,16 +10,20 @@ gem "responders", "2.1.0"
gem "unicorn", "4.9.0", require: false
# Federation
gem "diaspora_federation-rails", "0.0.3"
# API and JSON
gem "acts_as_api", "0.4.2"
gem "json", "1.8.2"
gem "json", "1.8.3"
# Authentication
gem "devise", "3.4.1"
gem "devise", "3.5.1"
gem "devise_lastseenable", "0.0.4"
gem "devise-token_authenticatable", "~> 0.3.0"
gem "devise-token_authenticatable", "~> 0.4.0"
# Captcha
......@@ -32,7 +31,7 @@ gem "simple_captcha2", "0.3.4", require: "simple_captcha"
# Background processing
gem "sidekiq", "3.3.4"
gem "sidekiq", "3.4.1"
gem "sinatra", "1.4.6"
# Scheduled processing
......@@ -56,26 +55,26 @@ gem "rack-cors", "0.4.0", require: "rack/cors"
gem "bootstrap-sass", "2.3.2.2"
gem "compass-rails", "2.0.4"
gem "sass-rails", "5.0.1"
gem "autoprefixer-rails", "5.1.11"
gem "autoprefixer-rails", "5.2.1"
# Database
ENV["DB"] ||= "mysql"
gem "mysql2", "0.3.18" if ENV["DB"] == "all" || ENV["DB"] == "mysql"
gem "pg", "0.18.1" if ENV["DB"] == "all" || ENV["DB"] == "postgres"
gem "pg", "0.18.2" if ENV["DB"] == "all" || ENV["DB"] == "postgres"
gem "activerecord-import", "0.7.0"
gem "activerecord-import", "0.8.0"
# File uploading
gem "carrierwave", "0.10.0"
gem "fog", "1.30.0"
gem "mini_magick", "4.2.3"
gem "fog", "1.31.0"
gem "mini_magick", "4.2.7"
gem "remotipart", "1.2.1"
# GUID generation
gem "uuid", "2.3.7"
gem "uuid", "2.3.8"
# Icons
......@@ -83,32 +82,31 @@ gem "entypo-rails", "2.2.3"
# JavaScript
gem "backbone-on-rails", "1.1.2.1"
gem "handlebars_assets", "0.20.1"
gem "jquery-rails", "4.0.4"
gem "jquery-ui-rails", "5.0.3"
gem "js_image_paths", "0.0.2"
gem "js-routes", "1.0.1"
gem "backbone-on-rails", "1.1.2.1"
gem "handlebars_assets", "0.20.2"
gem "jquery-rails", "4.0.4"
gem "jquery-ui-rails", "5.0.5"
gem "js_image_paths", "0.0.2"
gem "js-routes", "1.0.1"
source "https://rails-assets.org" do
gem "rails-assets-jquery", "1.11.2" # Should be kept in sync with jquery-rails
gem "rails-assets-markdown-it", "4.2.1"
gem "rails-assets-markdown-it", "4.4.0"
gem "rails-assets-markdown-it-hashtag", "0.3.1"
gem "rails-assets-markdown-it-diaspora-mention", "0.3.0"
gem "rails-assets-markdown-it-sanitizer", "0.3.1"
gem "rails-assets-markdown-it--markdown-it-for-inline", "0.1.1"
gem "rails-assets-markdown-it-sub", "1.0.0"
gem "rails-assets-markdown-it-sup", "1.0.0"
gem "rails-assets-highlightjs", "8.5.0"
gem "rails-assets-highlightjs", "8.6.0"
# jQuery plugins
gem "rails-assets-jeresig--jquery.hotkeys", "0.2.0"
gem "rails-assets-jquery-idletimer", "1.0.1"
gem "rails-assets-jquery-placeholder", "2.1.1"
gem "rails-assets-jquery-placeholder", "2.1.2"
gem "rails-assets-jquery-textchange", "0.2.3"
gem "rails-assets-perfect-scrollbar", "0.5.9"
gem "rails-assets-perfect-scrollbar", "0.6.3"
gem "rails-assets-jakobmattsson--jquery-elastic", "1.6.11"
end
......@@ -128,7 +126,7 @@ gem "messagebus_ruby_api", "1.0.3"
# Parsing
gem "nokogiri", "1.6.6.2"
gem "redcarpet", "3.2.3"
gem "redcarpet", "3.3.2"
gem "twitter-text", "1.12.0"
gem "roxml", "3.1.6"
gem "ruby-oembed", "0.8.14"
......@@ -161,7 +159,7 @@ gem "addressable", "2.3.8", require: "addressable/uri"
gem "faraday", "0.9.1"
gem "faraday_middleware", "0.9.1"
gem "faraday-cookie_jar", "0.0.6"
gem "typhoeus", "0.7.1"
gem "typhoeus", "0.7.2"
# Views
......@@ -196,7 +194,7 @@ gem "minitest"
group :production do # we don"t install these on travis to speed up test runs
# Administration
gem "rails_admin", "0.6.7"
gem "rails_admin", "0.6.8"
# Analytics
......@@ -225,19 +223,19 @@ group :development do
# Automatic test runs
gem "guard-cucumber", "1.5.4"
gem "guard-jshintrb", "1.1.1"
gem "guard-rspec", "4.5.0"
gem "guard-rspec", "4.5.2"
gem "guard-rubocop", "1.2.0"
gem "guard", "2.12.5", require: false
gem "rb-fsevent", "0.9.4", require: false
gem "rb-fsevent", "0.9.5", require: false
gem "rb-inotify", "0.9.5", require: false
# Linters
gem "jshintrb", "0.3.0"
gem "rubocop", "0.31.0"
gem "rubocop", "0.32.0"
# Preloading environment
gem "spring", "1.3.5"
gem "spring", "1.3.6"
gem "spring-commands-rspec", "1.0.4"
gem "spring-commands-cucumber", "1.0.1"
......@@ -272,14 +270,14 @@ group :test do
# General helpers
gem "factory_girl_rails", "4.5.0"
gem "timecop", "0.7.3"
gem "timecop", "0.7.4"
gem "webmock", "1.21.0", require: false
gem "shoulda-matchers", "2.8.0", require: false
end
group :development, :test do
# RSpec (unit tests, some integration tests)
gem "rspec-rails", "3.2.1"
gem "rspec-rails", "3.3.2"
# Cucumber (integration tests)
gem "cucumber-rails", "1.4.2", require: false
......@@ -287,8 +285,8 @@ group :development, :test do
# Jasmine (client side application tests (JS))
gem "jasmine", "2.2.0"
gem "jasmine-jquery-rails", "2.0.3"
gem "rails-assets-jasmine-ajax", "3.1.1", source: "https://rails-assets.org"
gem "sinon-rails", "1.10.3"
gem "rails-assets-jasmine-ajax", "3.2.0", source: "https://rails-assets.org"
gem "sinon-rails", "1.15.0"
# silence assets
gem "quiet_assets", "1.1.0"
......
This diff is collapsed.
......@@ -14,7 +14,7 @@
//= require_tree ./collections
//= require_tree ./views
//= require perfect-scrollbar
//= require perfect-scrollbar/perfect-scrollbar.jquery
var app = {
collections: {},
......
......@@ -15,6 +15,7 @@ app.views.NotificationDropdown = app.views.Base.extend({
this.dropdown = $('#notification_dropdown');
this.dropdownNotifications = this.dropdown.find('.notifications');
this.ajaxLoader = this.dropdown.find('.ajax_loader');
this.perfectScrollbarInitialized = false;
},
toggleDropdown: function(evt){
......@@ -43,7 +44,10 @@ app.views.NotificationDropdown = app.views.Base.extend({
if(!inDropdown && !inHovercard && this.dropdownShowing()){
this.badge.removeClass('active');
this.dropdown.css('display', 'none');
this.dropdownNotifications.perfectScrollbar('destroy');
if(this.perfectScrollbarInitialized) {
this.dropdownNotifications.perfectScrollbar("destroy");
this.perfectScrollbarInitialized = false;
}
}
},
......@@ -108,8 +112,12 @@ app.views.NotificationDropdown = app.views.Base.extend({
app.helpers.timeago(this.dropdownNotifications);
this.dropdownNotifications.perfectScrollbar('destroy').perfectScrollbar();
this.dropdownNotifications.removeClass('loading');
if(this.perfectScrollbarInitialized) {
this.dropdownNotifications.perfectScrollbar("destroy");
}
this.dropdownNotifications.perfectScrollbar();
this.perfectScrollbarInitialized = true;
this.dropdownNotifications.removeClass("loading");
this.dropdownNotifications.scroll(function(){
self.dropdownScroll();
});
......
......@@ -17,7 +17,6 @@
//= require jquery.events.input
//= require jakobmattsson-jquery-elastic
//= require jquery.mentionsInput
//= require jquery-idletimer/dist/idle-timer
//= require jquery.infinitescroll-custom
//= require jquery.autocomplete-custom
//= require jquery-ui/core
......
......@@ -8,4 +8,10 @@
&:first-child { margin-top: 0; }
&:last-child { margin-bottom: 0; }
}
h1, h2, h3, h4, h5, h6 {
&:first-child {
margin-top: 0;
}
}
}
<a href="#" id="unfollow_{{name}}" rel="nofollow" class="action delete_tag_following pull-right" title="{{t "delete"}}">&times;<a/>
<a href="#" id="unfollow_{{name}}" rel="nofollow" class="action delete_tag_following pull-right" title="{{t "delete"}}">&times;</a>
<a href="/tags/{{name}}" class="selectable">
#{{ name }}
</a>
......@@ -13,36 +13,8 @@ class PublicsController < ApplicationController
respond_to :html
respond_to :xml, :only => :post
caches_page :host_meta, :if => Proc.new{ Rails.env == 'production'}
layout false
def hcard
@person = Person.find_by_guid_and_closed_account(params[:guid], false)
if @person.present? && @person.local?
render 'publics/hcard'
else
render :nothing => true, :status => 404
end
end
def host_meta
render 'host_meta', :content_type => 'application/xrd+xml'
end
def webfinger
@person = Person.local_by_account_identifier(params[:q]) if params[:q]
if @person.nil? || @person.closed_account?
render :nothing => true, :status => 404
return
end
logger.info "webfinger profile request for: #{@person.id}"
render 'webfinger', :content_type => 'application/xrd+xml'
end
def hub
render :text => params['hub.challenge'], :status => 202, :layout => false
end
......
......@@ -14,12 +14,13 @@ class RegistrationsController < Devise::RegistrationsController
if @user.sign_up
flash[:notice] = I18n.t 'registrations.create.success'
@user.seed_aspects
@user.send_welcome_message
sign_in_and_redirect(:user, @user)
logger.info "event=registration status=successful user=#{@user.diaspora_handle}"
else
@user.errors.delete(:person)
flash[:error] = @user.errors.full_messages.join(" - ")
flash.now[:error] = @user.errors.full_messages.join(" - ")
logger.info "event=registration status=failure errors='#{@user.errors.full_messages.join(', ')}'"
render :action => 'new', :layout => 'with_header'
end
......
......@@ -3,11 +3,10 @@ module JsxcHelper
port = AppConfig.chat.server.bosh.port
bind = AppConfig.chat.server.bosh.bind
host = AppConfig.pod_uri.host
scheme = AppConfig.pod_uri.scheme
unless AppConfig.chat.server.bosh.proxy?
return "http://#{host}:#{port}#{bind}"
end
return "#{scheme}://#{host}#{bind}"
AppConfig.url_to bind
end
end
......@@ -32,7 +32,8 @@ module LayoutHelper
def current_user_atom_tag
return unless @person.present?
content_tag(:link, '', :rel => 'alternate', :href => "#{@person.public_url}.atom", :type => "application/atom+xml", :title => t('.public_feed', :name => @person.name))
content_tag(:link, "", rel: "alternate", href: @person.atom_url, type: "application/atom+xml",
title: t(".public_feed", name: @person.name))
end
def translation_missing_warnings
......
......@@ -50,10 +50,6 @@ module PeopleHelper
end
end
def person_href(person, opts={})
"href=\"#{local_or_remote_person_path(person, opts)}\"".html_safe
end
# Rails.application.routes.url_helpers is needed since this is indirectly called from a model
def local_or_remote_person_path(person, opts={})
opts.merge!(:protocol => AppConfig.pod_uri.scheme, :host => AppConfig.pod_uri.authority)
......
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module PublicsHelper
def subscribe(opts = {})
subscriber = Subscriber.first(:url => opts[:callback], :topic => opts[:topic])
subscriber ||= Subscriber.new(:url => opts[:callback], :topic => opts[:topic])
if subscriber.save
if opts[:verify] == 'sync'
204
elsif opts[:verify] == 'async'
202
end
else
400
end
end
end
......@@ -24,7 +24,8 @@ class Conversation < ActiveRecord::Base
def local_recipients
recipients.each do |recipient|
if recipient.local?
if recipient.owner.contacts.where(:person_id => self.author.id).count == 0
unless recipient.owner.contacts.where(person_id: author.id).any? ||
(author.owner && author.owner.podmin_account?)
errors.add(:all_recipients, "recipient not allowed")
end
end
......@@ -82,7 +83,7 @@ class Conversation < ActiveRecord::Base
end
def subject
self[:subject].blank? ? "no subject" : self[:subject]
self[:subject].blank? ? I18n.t("conversations.new.subject_default") : self[:subject]
end
def subscribers(user)
......
......@@ -28,7 +28,7 @@ class Person < ActiveRecord::Base
xml_attr :profile, :as => Profile
xml_attr :exported_key
has_one :profile, :dependent => :destroy
has_one :profile, dependent: :destroy
delegate :last_name, :image_url, :tag_string, :bio, :location,
:gender, :birthday, :formatted_birthday, :tags, :searchable,
to: :profile
......@@ -195,37 +195,34 @@ class Person < ActiveRecord::Base
end
end
def username
@username ||= owner ? owner.username : diaspora_handle.split("@")[0]
end
def owns?(obj)
self.id == obj.author_id
end
def url
begin
uri = URI.parse(self[:url])
url = "#{uri.scheme}://#{uri.host}"
url += ":#{uri.port}" unless ["80", "443"].include?(uri.port.to_s)
url += "/"
rescue => e
url = self[:url]
end
url
url_to "/"
rescue
self[:url]
end
def receive_url
"#{url}receive/users/#{self.guid}/"
def profile_url
url_to "/u/#{username}"
end
def public_url
if self.owner
username = self.owner.username
else
username = self.diaspora_handle.split("@")[0]
end
"#{url}public/#{username}"
def atom_url
url_to "/public/#{username}.atom"
end
def receive_url
url_to "/receive/users/#{guid}"
end
def public_key_hash
Base64.encode64(OpenSSL::Digest::SHA256.new(self.exported_key).to_s)
Base64.encode64(OpenSSL::Digest::SHA256.new(serialized_public_key).to_s)
end
def public_key
......@@ -241,15 +238,18 @@ class Person < ActiveRecord::Base
serialized_public_key = new_key
end
#database calls
# database calls
def self.by_account_identifier(identifier)
identifier = identifier.strip.downcase.gsub('acct:', '')
self.where(:diaspora_handle => identifier).first
identifier = identifier.strip.downcase.sub("acct:", "")
find_by(diaspora_handle: identifier)
end
def self.find_local_by_diaspora_handle(handle)
where(diaspora_handle: handle, closed_account: false).where.not(owner: nil).take
end
def self.local_by_account_identifier(identifier)
person = self.by_account_identifier(identifier)
(person.nil? || person.remote?) ? nil : person
def self.find_local_by_guid(guid)
where(guid: guid, closed_account: false).where.not(owner: nil).take
end
def self.create_from_webfinger(profile, hcard)
......@@ -263,7 +263,6 @@ class Person < ActiveRecord::Base
#hcard_profile = HCard.find profile.hcard.first[:href]
::Logging::Logger[self].info "event=webfinger_marshal valid=#{new_person.valid?} " \
"target=#{new_person.diaspora_handle}"
new_person.url = hcard[:url]
new_person.assign_new_profile_from_hcard(hcard)
new_person.save!
new_person.profile.save!
......@@ -321,11 +320,9 @@ class Person < ActiveRecord::Base
# @param person [Person]
# @param url [String]
def update_url(url)
location = URI.parse(url)
newuri = "#{location.scheme}://#{location.host}"
newuri += ":#{location.port}" unless ["80", "443"].include?(location.port.to_s)
newuri += "/"
self.update_attributes(:url => newuri)
@uri = URI.parse(url)
@uri.path = "/"
update_attributes(:url => @uri.to_s)
end
def lock_access!
......@@ -349,6 +346,18 @@ class Person < ActiveRecord::Base
private
# @return [URI]
def uri
@uri ||= URI.parse(self[:url])
@uri.dup
end
# @param path [String]
# @return [String]
def url_to(path)
uri.tap {|uri| uri.path = path }.to_s
end
def fix_profile
Webfinger.new(self.diaspora_handle).fetch
self.reload
......
......@@ -41,7 +41,7 @@ class User < ActiveRecord::Base
has_one :profile, through: :person
delegate :guid, :public_key, :posts, :photos, :owns?, :image_url,
:diaspora_handle, :name, :public_url, :profile, :url,
:diaspora_handle, :name, :atom_url, :profile_url, :profile, :url,
:first_name, :last_name, :gender, :participations, to: :person
delegate :id, :guid, to: :person, prefix: true
......@@ -460,6 +460,19 @@ class User < ActiveRecord::Base
aq
end
def send_welcome_message
return unless AppConfig.settings.welcome_message.enabled? && AppConfig.admins.account?
sender_username = AppConfig.admins.account.get
sender = User.find_by(username: sender_username)
conversation = sender.build_conversation(
participant_ids: [sender.person.id, person.id],
subject: AppConfig.settings.welcome_message.subject.get,
message: {text: AppConfig.settings.welcome_message.text.get % {username: username}})
if conversation.save
Postzord::Dispatcher.build(sender, conversation).post
end
end
def encryption_key
OpenSSL::PKey::RSA.new(serialized_private_key)
end
......@@ -468,6 +481,10 @@ class User < ActiveRecord::Base
Role.is_admin?(self.person)
end
def podmin_account?
username == AppConfig.admins.account
end
def mine?(target)
if target.present? && target.respond_to?(:user_id)
return self.id == target.user_id
......
module Export
class CommentSerializer < ActiveModel::Serializer
attributes :text,
attributes :guid,
:text,
:post_guid
def post_guid
......
module Export
class PostSerializer < ActiveModel::Serializer
attributes :text,
attributes :guid,
:text,
:public,
:diaspora_handle,
:type,
......
#content
%h1= @person.name
#content_inner
#i.entity_profile.vcard.author
%h2 User profile
%dl.entity_nickname
%dt Nickname
%dd
%a.nickname.url.uid{:href=>@person.url, :rel=>'me'}= @person.name
%dl.entity_given_name
%dt First name
%dd
%span.given_name= @person.profile.first_name
%dl.entity_family_name
%dt Family name
%dd
%span.family_name= @person.last_name
%dl.entity_fn
%dt Full name
%dd
%span.fn= @person.name
%dl.entity_url
%dt URL
%dd
%a#pod_location.url{:href=>@person.url, :rel=>'me'}= @person.url
%dl.entity_photo
%dt Photo
%dd
%img.photo.avatar{:src=>@person.image_url, :width=>'300px', :height=>'300px'}
%dl.entity_photo_medium
%dt Photo
%dd
%img.photo.avatar{:src=>@person.image_url(:thumb_medium), :width=>'100px', :height=>'100px'}
%dl.entity_photo_small
%dt Photo
%dd
%img.photo.avatar{:src=>@person.image_url(:thumb_small), :width=>'50px', :height=>'50px'}
%dl.entity_searchable
%dt Searchable
%dd
%span.searchable= @person.searchable
<?xml version='1.0' encoding='UTF-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
<!-- Resource-specific Information -->
<Link rel='lrdd'
type='application/xrd+xml'
template='<%= AppConfig.pod_uri.to_s %>webfinger?q={uri}' />
</XRD>
<?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
<Subject>acct:<%=@person.diaspora_handle%></Subject>
<Alias>"<%= @person.url %>"</Alias>
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@person.url%>hcard/users/<%=@person.guid%>"/>