diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb
index a74143363..1474b5c0f 100644
--- a/app/controllers/albums_controller.rb
+++ b/app/controllers/albums_controller.rb
@@ -17,8 +17,13 @@ class AlbumsController < ApplicationController
aspect = params[:album][:to]
@album = current_user.post(:album, params[:album])
- flash[:notice] = I18n.t 'albums.create.success', :name => @album.name
- redirect_to :action => :show, :id => @album.id, :aspect => aspect
+ if @album.persisted?
+ flash[:notice] = I18n.t 'albums.create.success', :name => @album.name
+ redirect_to :action => :show, :id => @album.id, :aspect => aspect
+ else
+ flash[:error] = I18n.t 'albums.create.failure'
+ redirect_to albums_path(:aspect => aspect)
+ end
end
def new
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index b5e11f86a..a96438dc2 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -5,11 +5,9 @@
class UsersController < ApplicationController
require File.join(Rails.root, 'lib/diaspora/ostatus_builder')
require File.join(Rails.root, 'lib/diaspora/exporter')
- require File.join(Rails.root, 'lib/diaspora/importer')
require File.join(Rails.root, 'lib/collect_user_photos')
-
- before_filter :authenticate_user!, :except => [:new, :create, :public, :import]
+ before_filter :authenticate_user!, :except => [:new, :create, :public]
respond_to :html
@@ -101,23 +99,4 @@ class UsersController < ApplicationController
User.invite!(:email => params[:email])
end
-
- def import
- xml = params[:upload][:file].read
-
- begin
- importer = Diaspora::Importer.new(Diaspora::Parsers::XML)
- importer.execute(xml, params[:user])
- flash[:notice] = "hang on a sec, try logging in!"
-
- rescue Exception => e
- flash[:error] = "Something went wrong: #{e.message}"
- end
-
- redirect_to new_user_registration_path
- #redirect_to user_session_path
- end
-
-
-
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index d89b0b1ee..ba0a57a95 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -3,6 +3,8 @@
# the COPYRIGHT file.
module ApplicationHelper
+ @@youtube_title_cache = Hash.new("no-title")
+
def current_aspect?(aspect)
!@aspect.is_a?(Symbol) && @aspect.id == aspect.id
end
@@ -34,7 +36,7 @@ module ApplicationHelper
end
def how_long_ago(obj)
- "#{time_ago_in_words(obj.created_at)} #{t('.ago')}"
+ "#{time_ago_in_words(obj.created_at)} #{t('ago')}"
end
def person_url(person)
@@ -85,4 +87,86 @@ module ApplicationHelper
"#{photos_path}?person_id=#{person_id}"
end
+
+ def markdownify(message, options = {})
+ message = h(message).html_safe
+
+ [:autolinks, :youtube, :emphasis, :links].each do |k|
+ if !options.has_key?(k)
+ options[k] = true
+ end
+ end
+
+ if options[:links]
+ message.gsub!(/\[([^\[]+)\]\(([^ ]+) \"(([^&]|(&[^q])|(&q[^u])|(&qu[^o])|(&quo[^t])|("[^;]))+)\"\)/) do |m|
+ escape = (options[:emphasis]) ? "\\" : ""
+ res = "#{$1}"
+ res
+ end
+ message.gsub!(/\[([^\[]+)\]\(([^ ]+)\)/) do |m|
+ escape = (options[:emphasis]) ? "\\" : ""
+ res = "#{$1}"
+ res
+ end
+ end
+
+ if options[:youtube]
+ message.gsub!(/( |^)(http:\/\/)?www\.youtube\.com\/watch[^ ]*v=([A-Za-z0-9_]+)(&[^ ]*|)/) do |m|
+ res = "#{$1}youtube.com::#{$3}"
+ res.gsub!(/(\*|_)/) { |m| "\\#{$1}" } if options[:emphasis]
+ res
+ end
+ end
+
+ if options[:autolinks]
+ message.gsub!(/( |^)(www\.[^ ]+\.[^ ])/, '\1http://\2')
+ message.gsub!(/(#{$3}}
+ res.gsub!(/(\*|_)/) { |m| "\\#{$1}" } if options[:emphasis]
+ res
+ end
+ end
+ end
+
+ if options[:emphasis]
+ message.gsub!(/([^\\]|^)\*\*(([^*]|([^*]\*[^*]))*[^*\\])\*\*/, '\1\2')
+ message.gsub!(/([^\\]|^)__(([^_]|([^_]_[^_]))*[^_\\])__/, '\1\2')
+ message.gsub!(/([^\\]|^)\*([^*]*[^\\])\*/, '\1\2')
+ message.gsub!(/([^\\]|^)_([^_]*[^\\])_/, '\1\2')
+ message.gsub!(/([^\\]|^)\*/, '\1')
+ message.gsub!(/([^\\]|^)_/, '\1')
+ message.gsub!("\\*", "*")
+ message.gsub!("\\_", "_")
+ end
+
+ if options[:youtube]
+ while youtube = message.match(/youtube\.com::([A-Za-z0-9_\\]+)/)
+ videoid = youtube[1]
+ message.gsub!('youtube.com::'+videoid, 'Youtube: ' + youtube_title(videoid) + '')
+ end
+ end
+
+ return message
+ end
+
+ def youtube_title(id)
+ unless @@youtube_title_cache[id] == 'no-title'
+ return @@youtube_title_cache[id]
+ end
+
+ ret = 'Unknown Video Title' #TODO add translation
+ http = Net::HTTP.new('gdata.youtube.com', 80)
+ path = '/feeds/api/videos/'+id+'?v=2'
+ resp, data = http.get(path, nil)
+ title = data.match(/
(.*)<\/title>/)
+ unless title.nil?
+ ret = title.to_s[7..-9]
+ end
+
+ @@youtube_title_cache[id] = ret;
+ return ret
+ end
end
diff --git a/app/helpers/status_messages_helper.rb b/app/helpers/status_messages_helper.rb
index 2e010715a..2dfbd31cc 100644
--- a/app/helpers/status_messages_helper.rb
+++ b/app/helpers/status_messages_helper.rb
@@ -3,8 +3,6 @@
# the COPYRIGHT file.
module StatusMessagesHelper
- @@youtube_title_cache = Hash.new("no-title")
-
def my_latest_message
unless @latest_status_message.nil?
return @latest_status_message.message
@@ -12,39 +10,4 @@ module StatusMessagesHelper
return I18n.t('status_messages.helper.no_message_to_display')
end
end
-
- def make_links(message)
- # If there should be some kind of bb-style markup, email/diaspora highlighting, it could go here.
-
- # next line is important due to XSS! (h is rail's make_html_safe-function)
- message = h(message).html_safe
- message.gsub!(/( |^)(www\.[^ ]+\.[^ ])/, '\1http://\2')
- message.gsub!(/( |^)http:\/\/www\.youtube\.com\/watch[^ ]*v=([A-Za-z0-9_]+)(&[^ ]*|)/, '\1youtube.com::\2')
- message.gsub!(/(https|http|ftp):\/\/([^ ]+)/, '\2')
-
- while youtube = message.match(/youtube\.com::([A-Za-z0-9_]+)/)
- videoid = youtube[1]
- message.gsub!('youtube.com::'+videoid, 'Youtube: ' + youtube_title(videoid) + '')
- end
- return message
- end
-
- def youtube_title(id)
- unless @@youtube_title_cache[id] == 'no-title'
- return @@youtube_title_cache[id]
- end
-
- ret = 'Unknown Video Title' #TODO add translation
- http = Net::HTTP.new('gdata.youtube.com', 80)
- path = '/feeds/api/videos/'+id+'?v=2'
- resp, data = http.get(path, nil)
- title = data.match(/(.*)<\/title>/)
- unless title.nil?
- ret = title.to_s[7..-9]
- end
-
- @@youtube_title_cache[id] = ret;
- return ret
- end
-
end
diff --git a/app/models/album.rb b/app/models/album.rb
index fbc64b2cf..9be93701c 100644
--- a/app/models/album.rb
+++ b/app/models/album.rb
@@ -32,6 +32,10 @@ class Album < Post
p_photo ? p_photo : self.photos.sort(:created_at.desc).last
end
+ def mutable?
+ true
+ end
+
protected
def destroy_photos
self.photos.each{|p| p.destroy}
diff --git a/app/models/contact.rb b/app/models/contact.rb
index 9ae223579..5aef55292 100644
--- a/app/models/contact.rb
+++ b/app/models/contact.rb
@@ -4,8 +4,7 @@
class Contact
include MongoMapper::Document
- attr_accessor :aspect_names #this is only used in the importer
-
+
belongs_to :user
validates_presence_of :user
diff --git a/app/models/photo.rb b/app/models/photo.rb
index bce9d469d..e9790cd9f 100644
--- a/app/models/photo.rb
+++ b/app/models/photo.rb
@@ -74,5 +74,9 @@ class Photo < Post
def thumb_hash
{:thumb_url => url(:thumb_medium), :id => id, :album_id => album_id}
end
+
+ def mutable?
+ true
+ end
end
diff --git a/app/models/post.rb b/app/models/post.rb
index 298d25b5f..842af2b2e 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -50,6 +50,10 @@ class Post
}
end
+ def mutable?
+ false
+ end
+
protected
def destroy_comments
comments.each{|c| c.destroy}
diff --git a/app/models/user.rb b/app/models/user.rb
index bb465e78a..f1c5a2681 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -22,11 +22,11 @@ class User
key :invites, Integer, :default => 5
key :invitation_token, String
key :invitation_sent_at, DateTime
- key :inviter_ids, Array, :typecast => 'ObjectId'
- key :friend_ids, Array, :typecast => 'ObjectId'
- key :pending_request_ids, Array, :typecast => 'ObjectId'
- key :visible_post_ids, Array, :typecast => 'ObjectId'
- key :visible_person_ids, Array, :typecast => 'ObjectId'
+ key :inviter_ids, Array, :typecast => 'ObjectId'
+ key :friend_ids, Array, :typecast => 'ObjectId'
+ key :pending_request_ids, Array, :typecast => 'ObjectId'
+ key :visible_post_ids, Array, :typecast => 'ObjectId'
+ key :visible_person_ids, Array, :typecast => 'ObjectId'
key :invite_messages, Hash
@@ -39,9 +39,8 @@ class User
validates_presence_of :username
validates_uniqueness_of :username, :case_sensitive => false
- validates_format_of :username, :with => /\A[A-Za-z0-9_.]+\z/
+ validates_format_of :username, :with => /\A[A-Za-z0-9_.]+\z/
validates_length_of :username, :maximum => 32
-
validates_inclusion_of :language, :in => AVAILABLE_LANGUAGE_CODES
validates_presence_of :person, :unless => proc {|user| user.invitation_token.present?}
@@ -98,11 +97,11 @@ class User
def move_friend(opts = {})
return true if opts[:to] == opts[:from]
- if opts[:friend_id] && opts[:to] && opts[:from]
+ if opts[:friend_id] && opts[:to] && opts[:from]
from_aspect = self.aspects.first(:_id => opts[:from])
posts_to_move = from_aspect.posts.find_all_by_person_id(opts[:friend_id])
if add_person_to_aspect(opts[:friend_id], opts[:to], :posts => posts_to_move)
- delete_person_from_aspect(opts[:friend_id], opts[:from], :posts => posts_to_move)
+ delete_person_from_aspect(opts[:friend_id], opts[:from], :posts => posts_to_move)
return true
end
end
@@ -116,7 +115,7 @@ class User
raise 'Can not add person who is already in the aspect' if aspect.people.include?(contact)
contact.aspects << aspect
opts[:posts] ||= self.raw_visible_posts.all(:person_id => person_id)
-
+
aspect.posts += opts[:posts]
contact.save
aspect.save
@@ -146,15 +145,15 @@ class User
post = build_post(class_name, options)
- post.socket_to_uid(id, :aspect_ids => aspect_ids) if post.respond_to?(:socket_to_uid)
- push_to_aspects(post, aspect_ids)
-
- if options[:public] == true
- self.services.each do |service|
- self.send("post_to_#{service.provider}".to_sym, service, post.message)
+ if post.persisted?
+ push_to_aspects(post, aspect_ids)
+ post.socket_to_uid(id, :aspect_ids => aspect_ids) if post.respond_to?(:socket_to_uid)
+ if options[:public] == true
+ self.services.each do |service|
+ self.send("post_to_#{service.provider}".to_sym, service, post.message)
+ end
end
end
-
post
end
@@ -324,14 +323,14 @@ class User
raise "Must invite to your aspect"
else
u = User.find_by_email(opts[:email])
- if u.nil?
+ if u.nil?
elsif friends.include?(u.person)
- raise "You are already friends with this person"
+ raise "You are already friends with this person"
elsif not u.invited?
self.send_friend_request_to(u.person, aspect_object)
return
elsif u.invited? && u.inviters.include?(self)
- raise "You already invited this person"
+ raise "You already invited this person"
end
end
request = Request.instantiate(
diff --git a/app/views/albums/edit.html.haml b/app/views/albums/edit.html.haml
index ccc5854fd..81da980e0 100644
--- a/app/views/albums/edit.html.haml
+++ b/app/views/albums/edit.html.haml
@@ -16,10 +16,10 @@
.photo_edit_block= image_tag photo.url(:thumb_medium)
.submit_block
- = link_to t('.cancel'), root_path
+ = link_to t('cancel'), root_path
or
= album.submit t('.update_album')
.button.delete
- = link_to t('.delete_album'), @album, :confirm => t('.are_you_sure'), :method => :delete
+ = link_to t('.delete_album'), @album, :confirm => t('are_you_sure'), :method => :delete
diff --git a/app/views/albums/show.html.haml b/app/views/albums/show.html.haml
index f997d91af..267b43bc1 100644
--- a/app/views/albums/show.html.haml
+++ b/app/views/albums/show.html.haml
@@ -42,5 +42,5 @@
.album_id{:id => @album_id, :style => "display:hidden;"}
-unless current_user.person.id == @person.id
- %h4= "#{t('.by')} #{@person.real_name}"
+ %h4= "#{t('by')} #{@person.real_name}"
diff --git a/app/views/comments/_comment.html.haml b/app/views/comments/_comment.html.haml
index 54612d7e4..9dcff29ba 100644
--- a/app/views/comments/_comment.html.haml
+++ b/app/views/comments/_comment.html.haml
@@ -9,4 +9,4 @@
= link_to post.person.real_name, post.person
= post.text
%div.time
- = "#{time_ago_in_words(post.updated_at)} #{t('.ago')}"
+ = "#{time_ago_in_words(post.updated_at)} #{t('ago')}"
diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml
index 15c29ec4f..595fba52d 100644
--- a/app/views/devise/sessions/new.html.haml
+++ b/app/views/devise/sessions/new.html.haml
@@ -5,13 +5,13 @@
= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f|
#user
%p.username
- = f.label :username , t('.username')
+ = f.label :username , t('username')
= f.text_field :username
%p.user_network
="@#{APP_CONFIG[:terse_pod_url]}"
%p
- = f.label :password , t('.password')
+ = f.label :password , t('password')
= f.password_field :password
/%p
/- if devise_mapping.rememberable?
diff --git a/app/views/invitations/_new.haml b/app/views/invitations/_new.haml
index b05792dd1..b63184327 100644
--- a/app/views/invitations/_new.haml
+++ b/app/views/invitations/_new.haml
@@ -7,7 +7,7 @@
= t('.if_they_accept_info')
= form_for User.new, :url => invitation_path(User) do |invite|
%p
- = invite.label :email , t('.email')
+ = invite.label :email , t('email')
= invite.text_field :email
= t('.to')
- unless @aspect.is_a? Aspect
diff --git a/app/views/invitations/new.html.haml b/app/views/invitations/new.html.haml
index 1b226aa80..b22e1f0c2 100644
--- a/app/views/invitations/new.html.haml
+++ b/app/views/invitations/new.html.haml
@@ -3,7 +3,7 @@
= form_for User.new, :url => invitation_path(User) do |f|
= devise_error_messages!
%p
- = f.label :email , t('.email')
+ = f.label :email , t('email')
= f.text_field :email
%p= f.submit t('.send_an_invitation')
/= link_to "Home", after_sign_in_path_for(resource_name)
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index 70f610ebc..5fc9f3b51 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -3,7 +3,7 @@
-# the COPYRIGHT file.
!!!
-%html
+%html{:lang => I18n.locale.to_s}
%head
%title
= "#{current_user.real_name} | diaspora" if current_user
@@ -43,7 +43,7 @@
%header
.container{:style => "position:relative;"}
- #diaspora_text{:href => root_path}
+ #diaspora_text
= link_to "DIASPORA", (current_user ? root_path : new_user_session_path)
%span.sub_text
PREVIEW
diff --git a/app/views/people/edit.html.haml b/app/views/people/edit.html.haml
index 082a31c2a..d3b8b135d 100644
--- a/app/views/people/edit.html.haml
+++ b/app/views/people/edit.html.haml
@@ -5,11 +5,11 @@
#section_header
%h2
- = t('.settings')
+ = t('settings')
%ul#settings_nav
- %li=link_to t('.profile'), edit_person_path(current_user.person)
- %li=link_to t('.account'), edit_user_path(current_user)
- %li=link_to t('.services'), services_path
+ %li=link_to t('profile'), edit_person_path(current_user.person)
+ %li=link_to t('account'), edit_user_path(current_user)
+ %li=link_to t('services'), services_path
.span-19.prepend-5.last
= form_for @person, :html => { :multipart => true } do |person|
@@ -45,6 +45,6 @@
= render 'people/profile_photo_upload', :form => profile
.submit_block
- = link_to t('.cancel'), edit_user_path(current_user)
- = t('.or')
+ = link_to t('cancel'), edit_user_path(current_user)
+ = t('or')
= person.submit t('.update_profile')
diff --git a/app/views/people/show.html.haml b/app/views/people/show.html.haml
index 0dd95e752..fd8bedee1 100644
--- a/app/views/people/show.html.haml
+++ b/app/views/people/show.html.haml
@@ -28,7 +28,7 @@
%li= link_to aspect.name, aspect
- if @person != current_user.person && @contact
- = link_to t('.remove_friend'), @person, :confirm => t('.are_you_sure'), :method => :delete, :class => "button"
+ = link_to t('.remove_friend'), @person, :confirm => t('are_you_sure'), :method => :delete, :class => "button"
- if @person == current_user.person
%b
diff --git a/app/views/photos/_photo.haml b/app/views/photos/_photo.haml
index 9e878b510..a122614aa 100644
--- a/app/views/photos/_photo.haml
+++ b/app/views/photos/_photo.haml
@@ -20,7 +20,7 @@
- if current_user.owns?(post)
.right
- = link_to t('.delete'), photo_path(post), :confirm => t('.are_you_sure'), :method => :delete, :remote => true, :class => "delete"
+ = link_to t('delete'), photo_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
- if !post.album_id.nil?
=t('.posted_a_new_photo_to')
diff --git a/app/views/photos/edit.html.haml b/app/views/photos/edit.html.haml
index 08e6dae0a..dcdebab1c 100644
--- a/app/views/photos/edit.html.haml
+++ b/app/views/photos/edit.html.haml
@@ -19,5 +19,5 @@
= link_to "⇧ #{@album.name}", album_path(@album)
-if current_user.owns? @album
.button.right
- = link_to t('.delete_photo'), @photo, :confirm => t('.are_you_sure'), :method => :delete
+ = link_to t('.delete_photo'), @photo, :confirm => t('are_you_sure'), :method => :delete
diff --git a/app/views/registrations/edit.html.haml b/app/views/registrations/edit.html.haml
index 5da950379..9cadd779f 100644
--- a/app/views/registrations/edit.html.haml
+++ b/app/views/registrations/edit.html.haml
@@ -24,5 +24,5 @@
= f.submit t('.update')
%h3 t('.cancel_my_account')
%p
- Unhappy? #{link_to t('.cancel_my_account'), registration_path(resource_name), :confirm => t('.are_you_sure'), :method => :delete}.
+ Unhappy? #{link_to t('.cancel_my_account'), registration_path(resource_name), :confirm => t('are_you_sure'), :method => :delete}.
= link_to t('.back'), :back
diff --git a/app/views/registrations/new.html.haml b/app/views/registrations/new.html.haml
index 8dae3824a..f6cd28981 100644
--- a/app/views/registrations/new.html.haml
+++ b/app/views/registrations/new.html.haml
@@ -5,38 +5,17 @@
= image_tag "http://needcoffee.cachefly.net/needcoffee/uploads/2009/02/predator-arnold-schwarzenegger.jpg"
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
%p
- = f.label :username , t('.username')
+ = f.label :username , t('username')
= f.text_field :username
%p
- = f.label :email , t('.email')
+ = f.label :email , t('email')
= f.text_field :email
%p
- = f.label :password , t('.password')
+ = f.label :password , t('password')
= f.password_field :password
%p
- = f.label :password_confirmation , t('.password_confirmation')
+ = f.label :password_confirmation , t('password_confirmation')
= f.password_field :password_confirmation
= f.submit t('.sign_up')
-
- .floating
- %h3
- = t('.upload_existing_account')
-
- = form_tag '/users/import', :multipart => true do
-
- %p
- = label_tag 'user[email]'
- = text_field_tag 'user[email]'
- %p
- = label_tag 'user[password]'
- = password_field_tag 'user[password]'
- %p
- = label_tag 'user[password_confirmation]'
- = password_field_tag 'user[password_confirmation]'
-
- %label Select File
- = file_field 'upload', 'file'
- = submit_tag t('.upload')
-
diff --git a/app/views/services/index.html.haml b/app/views/services/index.html.haml
index bf1546172..5d5a3b772 100644
--- a/app/views/services/index.html.haml
+++ b/app/views/services/index.html.haml
@@ -4,15 +4,15 @@
#section_header
%h2
- = t('.settings')
+ = t('settings')
%ul#settings_nav
- %li=link_to t('.profile'), edit_person_path(current_user.person)
- %li=link_to t('.account'), edit_user_path(current_user)
- %li=link_to t('.services'), services_path
+ %li=link_to t('profile'), edit_person_path(current_user.person)
+ %li=link_to t('account'), edit_user_path(current_user)
+ %li=link_to t('services'), services_path
.span-19.prepend-5.last
%h2
- = t('.services')
+ = t('services')
%ul
- for service in @services
diff --git a/app/views/shared/_publisher.haml b/app/views/shared/_publisher.haml
index 5f36f3c84..94f7737d7 100644
--- a/app/views/shared/_publisher.haml
+++ b/app/views/shared/_publisher.haml
@@ -48,7 +48,7 @@
= status.submit t('.share'), :title => "Share with #{aspect}"
#publisher_photo_upload
- = t('.or')
+ = t('or')
= render 'photos/new_photo', :aspect_id => (aspect == :all ? aspect : aspect.id), :album_id => nil
diff --git a/app/views/status_messages/_status_message.html.haml b/app/views/status_messages/_status_message.html.haml
index 7e065b475..19f0b1bd3 100644
--- a/app/views/status_messages/_status_message.html.haml
+++ b/app/views/status_messages/_status_message.html.haml
@@ -21,9 +21,9 @@
- if current_user.owns?(post)
.right
= render "shared/reshare", :post => post, :current_user => current_user
- = link_to t('.delete'), status_message_path(post), :confirm => t('.are_you_sure'), :method => :delete, :remote => true, :class => "delete"
+ = link_to t('delete'), status_message_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete"
- = make_links(post.message)
+ = markdownify(post.message)
.info
%span.time= link_to(how_long_ago(post), object_path(post))
diff --git a/app/views/status_messages/show.html.haml b/app/views/status_messages/show.html.haml
index 0672ca1e8..108580a3e 100644
--- a/app/views/status_messages/show.html.haml
+++ b/app/views/status_messages/show.html.haml
@@ -7,13 +7,13 @@
.span-14.append-1.last
%h1.show_text
- = make_links(@status_message.message)
+ = markdownify(@status_message.message)
= how_long_ago(@status_message)
- if current_user.owns? @status_message
%p
- = link_to t('.destroy'), @status_message, :confirm => t('.are_you_sure'), :method => :delete
+ = link_to t('.destroy'), @status_message, :confirm => t('are_you_sure'), :method => :delete
.span-9.last
#stream.show
diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml
index 7aa2bbcda..634729a83 100644
--- a/app/views/users/edit.html.haml
+++ b/app/views/users/edit.html.haml
@@ -14,15 +14,15 @@
#section_header
%h2
- = t('.settings')
+ = t('settings')
%ul#settings_nav
- %li=link_to t('.profile'), edit_person_path(current_user.person)
- %li=link_to t('.account'), edit_user_path(current_user)
- %li=link_to t('.services'), services_path
+ %li=link_to t('profile'), edit_person_path(current_user.person)
+ %li=link_to t('account'), edit_user_path(current_user)
+ %li=link_to t('services'), services_path
.span-19.prepend-5.last
%h2
- = t('.account')
+ = t('account')
= link_to t('.invite_friends'), new_user_invitation_path(current_user)
@@ -39,12 +39,12 @@
= f.label :password, t('.new_password')
= f.password_field :password
%p
- = f.label :password_confirmation, t('.password_confirmation')
+ = f.label :password_confirmation, t('password_confirmation')
= f.password_field :password_confirmation
.submit_block
- = link_to t('.cancel'), edit_user_path(current_user)
- = t('.or')
+ = link_to t('cancel'), edit_user_path(current_user)
+ = t('or')
= f.submit t('.change_password')
%h3
@@ -70,5 +70,5 @@
%h3
= t('.close_account')
= link_to t('.close_account'), current_user,
- :confirm => t('.are_you_sure'), :method => :delete,
+ :confirm => t('are_you_sure'), :method => :delete,
:class => "button"
diff --git a/config/locales/devise/devise.de.yml b/config/locales/devise/devise.de.yml
index 543ab1935..ebbb2baa1 100644
--- a/config/locales/devise/devise.de.yml
+++ b/config/locales/devise/devise.de.yml
@@ -19,6 +19,11 @@ de:
timeout: "Deine Sitzung ist abgelaufen, bitte melde dich erneut an um fortzufahren."
inactive: "Dein Konto wurde noch nicht aktiviert."
sessions:
+ new:
+ login: 'Login'
+ username: 'Benutzername'
+ password: 'Passwort'
+ sign_in: 'Anmelden'
signed_in: "Erfolgreich angemeldet."
signed_out: "Erfolgreich abgemeldet."
passwords:
@@ -34,7 +39,21 @@ de:
unlocks:
send_instructions: "Du wirst in ein paar Minuten eine E-Mail erhalten, die beschreibt, wie du dein Konto entsperren kannst."
unlocked: "Dein Konto wurde erfolgreich entsperrt. Du bist nun angemeldet."
+ invitations:
+ send_instructions: 'Deine Einladung wurde versandt.'
+ invitation_token_invalid: 'Das Einladungstoken ist ungültig!' #FIXME: translate token?
+ updated: 'Dein Passwort wurde erfolgreich gesetzt. Du bist nun angemeldet.'
mailer:
- confirmation_instructions: "Instruktionen zur Bestätigung"
- reset_password_instructions: "Instruktionen zum Zurücksetzen des Passworts"
- unlock_instructions: "Instruktionen zum Entsperren"
+ confirmation_instructions:
+ subject: "Instruktionen zur Bestätigung"
+ reset_password_instructions:
+ subject: "Instruktionen zum Zurücksetzen des Passworts"
+ unlock_instructions:
+ subject: "Instruktionen zum Entsperren"
+ invitation:
+ subject: 'Ein Freund möchte dich bei Diaspora einladen!'
+ shared:
+ links:
+ sign_in: 'Anmelden'
+ sign_up: 'Registrieren'
+ forgot_your_password: 'Passwort vergessen?'
diff --git a/config/locales/diaspora/de.yml b/config/locales/diaspora/de.yml
index 1f7c028ae..5e257644c 100644
--- a/config/locales/diaspora/de.yml
+++ b/config/locales/diaspora/de.yml
@@ -2,206 +2,445 @@
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
-# Localization file for German. Add more files in this directory for other locales.
-# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+# Localization file for German
+#
+# This file has parts from rails-i18n project at
+# http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale
de:
+ settings: "Einstellungen"
+ profile: "Profil"
+ account: "Konto"
+ services: "Dienste"
+ cancel: "Abbrechen"
+ delete: "Löschen"
+ or: "oder"
+ by: "von"
+ ago: "her"
+ username: "Benutzername"
+ email: "E-Mail"
+ home: "Start"
+ password: "Passwort"
+ password_confirmation: "Passwort bestätigen"
+ are_you_sure: "Bist du sicher?"
+
+ activemodel:
+ errors:
+ models:
+ user:
+ attributes:
+ person:
+ invalid: "ist ungültig"
+ username:
+ taken: "ist bereits benutzt"
+ email:
+ taken: "ist bereits benutzt"
+ person:
+ attributes:
+ diaspora_handle:
+ taken: "ist bereits benutzt"
hello: "Hallo Welt"
application:
helper:
unknown_person: "unbekannte Person"
- new_requests: "neue Anfrage"
- dashboards:
- helper:
- home: "Startseite"
+ new_requests: "neue Anfragen"
error_messages:
helper:
invalid_fields: "Ungültige Felder"
- correct_the_following_errors_and_try_again: "Korrigiere die folgenden Fehler und probiere es erneut."
- people:
+ correct_the_following_errors_and_try_again: "Korrigiere die folgenden Fehler und versuche es erneut."
+ people: #FIXME: seems unused
helper:
- results_for: " Resultate für %{params}"
- people_on_pod_are_aware_of: " people on pod are aware of"
+ results_for: " Ergebnisse für %{params}"
+ people_on_pod_are_aware_of: " Leute auf dem Pod sind aufmerksam auf"
layouts:
application:
+ view_profile: "Profil anzeigen"
edit_profile: "Profil bearbeiten"
+ account_settings: "Konto Einstellungen"
+ search: "Suche"
logout: "Abmelden"
shared:
aspect_nav:
all_aspects: "Alle Aspekte"
manage: "Verwalten"
- manage_your_aspects: "Aspekte verwalten"
+ manage_your_aspects: "Deine Aspekte verwalten"
sub_header:
all_aspects: "Alle Aspekte"
manage_aspects: "Aspekte verwalten"
publisher:
share: "Teilen"
+ post_a_message_to: "Sende eine Nachricht an %{aspect}"
+ make_public: "öffentlich machen"
aspect_friends:
add_friends: "Freunde hinzufügen"
+ photos: "Fotos"
+ invitations:
+ invites: 'Einladungen'
+ invite_a_friend: 'Freund einladen'
+ invitations_left: '(%{count} übrig)'
+ reshare:
+ reshare: 'Erneut senden an'
+ author_info:
+ view_profile: 'View profile'
albums:
album:
- you: "dir"
+ you: "Du"
new_album:
- create: "erstellen"
+ create: "Hinzufügen"
add_a_new_album: "Album hinzufügen"
show:
edit_album: "Album bearbeiten"
albums: "Alben"
updated: "aktualisiert"
- by: "von"
edit:
- editing: "Bearbeite"
- updated: "geändert"
- are_you_sure: "Bist du sicher?"
+ album_name: "Name des Albums"
+ editing: "Bearbeiten"
+ updated: "aktualisiert"
+ update_album: "Album aktualisieren"
delete_album: "Album löschen"
- cancel: "Abbrechen"
index:
- home: "Startseite"
new_album: "Neues Album"
create:
success: "Du hast das Album %{name} erstellt."
update:
- success: "Album %{name} erfolgreich geändert."
- failure: "%{name} wurde nicht geändert."
+ success: "Album %{name} erfolgreich bearbeitet."
+ failure: "Bearbeiten des Album %{name} fehlgeschlagen."
destroy:
success: "Album %{name} gelöscht."
helper:
friends_albums: "Alben von Freunden"
your_albums: "Deine Alben"
aspects:
- index:
- photos: "Fotos"
- show:
- photos: "Fotos"
+ no_friends_message:
+ nobody: "Wir wissen du hast Freunde, hole sie an Bord!"
+ nobody_in_aspect: "Dein Aspekt %{aspect_name} ist leer."
+ add_friend: "Freund hinzufügen"
+ add_friend_to: "Jemanden zum Aspekt %{aspect_name} hinzufügen"
+ invite: "Jemanden zu Diaspora einladen!"
+ no_posts_message:
+ start_talking: "Niemand hat bisher etwas gesagt. Beginne die Konversation!"
manage:
- add_a_new_aspect: "Neuen Aspekt erstellen"
- add_a_new_friend: "Freund hinzufügen"
- show: "Anzeigen"
+ add_a_new_aspect: "Neuen Aspekt hinzufügen"
+ add_a_new_friend: "Neuen Freund hinzufügen"
+ show: "Zeigen"
update_aspects: "Aspekte aktualisieren"
requests: "Anfragen"
ignore_remove: "Ignorieren/Entfernen"
new_aspect:
- add_a_new_aspect: "Neuen Aspekt erstellen"
+ add_a_new_aspect: "Neuen Aspekt hinzufügen"
+ name: "Name"
create: "Erstellen"
create:
- success: "Klicke auf das Plus auf der linken Seite um Diaspora mitzuteilen wer deinen neuen Aspekt sehen kann."
+ success: "Klicke auf das Plus auf der linken Seite um Diaspora zu sagen wer deinen neuen Aspekt sehen kann."
+ failure: "Erstellen des Aspekt fehlgeschlagen."
destroy:
- success: "%{name} wurde erfolgreich gelöscht."
+ success: "%{name} wurde erfolgreich entfernt."
update:
- success: "Dein Aspekt, %{name}, wurde erfolgreich geändert."
- move_friends:
- failure: "Ändern des Aspekts für deinen Freund %{real_name} fehlgeschlagen."
- success: "Aspekt erfolgreich geändert."
+ success: "Dein Aspekt %{name} wurde erfolgreich bearbeitet."
move_friend:
- error: "didn't work %{inspect}"
- notice: "Du zeigst deinem Freund jetzt einen anderen Aspekt von dir."
+ failure: "hat nicht funktioniert %{inspect}"
+ success: "Person zu neuem Aspekt verschoben"
+ add_to_aspect:
+ failure: "Hinzufügen des Freundes zum Aspekt fehlgeschlagen."
+ success: "Freund erfolgreich zum Aspekt hinzugefügt."
helper:
remove: "entfernen"
aspect_not_empty: "Aspekt ist nicht leer"
users:
edit:
editing_profile: "Profil bearbeiten"
- profile:
- cancel: "Abbrechen"
- update_profile: "Profil aktualisieren"
- home: "Startseite"
- diaspora_username: "Diaspora Benutzername"
- info: "Info"
- picture: "Bild"
- editing_profile: "Profil bearbeiten"
- albums: "Alben"
- you_dont_have_any_photos: "Du hast keine Fotos! Gehe auf die"
- page_to_upload_some: "Seite um welche hochzuladen."
+ invite_friends: "Feunde einladen"
+ export_data: "Konto exportieren"
+ close_account: "Konto schließen"
+ change_language: "Sprache ändern"
+ change_password: "Passwort ändern"
+ new_password: "Neues Passwort"
+ destroy: "Konto erfolgreich geschlossen."
+ getting_started:
+ signup_steps: "Vervollständige deine Registrierung indem du folgende Dinge tust:"
+ 'step_1':
+ albums: "Alben"
+ you_dont_have_any_photos: "Du hast keine Fotos! Gehe zur"
+ page_to_upload_some: "Seite um welche hochzuladen."
comments:
- comment:
- # this won't work in german at all. Needs more thorough I18n
- ago: "ago"
new_comment:
- comment: "Kommentar"
+ comment: "Kommentieren"
photos:
show:
prev: "zurück"
full_size: "volle Größe"
- next: "vor"
+ next: "weiter"
edit_photo: "Foto bearbeiten"
delete_photo: "Foto löschen"
- are_you_sure: "Bist du sicher?"
comments: "Kommentare"
edit:
- editing: "Bearbeite"
- are_you_sure: "Bist du sicher?"
+ editing: "Bearbeiten"
delete_photo: "Foto löschen"
photo:
- show_comments: "Kommentare anzeigen"
- posted_a_new_photo_to: "neues Foto veröffentlicht bei"
+ show_comments: "Kommentare zeigen"
+ posted_a_new_photo_to: "Hinzugefügt:"
new:
- new_photo: "Foto erstellen"
- back_to_list: "Zurück zur Liste"
- post_it: "Hochladen"
+ new_photo: "Neues Foto"
+ back_to_list: "Zurück zu Liste"
+ post_it: "Poste es!"
create:
- runtime_error: "Hochladen eines Fotos fehlgeschlagen. Bist du sicher, dass dein Sicherheitsgurt befestigt ist?"
- integrity_error: "Hochladen eines Fotos fehlgeschlagen. Bist du sicher, dass das ein Bild war?"
- type_error: "Hochladen eines Fotos fehlgeschlagen. Bist du sicher, dass ein Bild hinzugefügt wurde?"
+ runtime_error: "Der Server wollte das Foto nicht bearbeiten, bist du darauf zu sehen?"
+ integrity_error: "Hochladen des Fotos fehlgeschlagen. Bist du sicher das es ein Foto war?"
+ type_error: "Hochladen des Foto fehlgeschlagen. Du solltest hier nur FOTOS hochladen..."
update:
notice: "Foto erfolgreich aktualisiert."
- error: "Ändern des Fotos fehlgeschlagen."
+ error: "Bearbeiten des Fotos fehlgeschlagen."
destroy:
notice: "Foto gelöscht."
registrations:
new:
- sign_up: "Anmelden"
+ sign_up: "Registrieren"
+ sign_up_for_diaspora: "Ein Diaspora Konto anlegen"
+ upload_existing_account: "Ein existierendes Konto hochladen"
+ upload: "Hochladen"
create:
- success: "Du bist Diaspora beigetreten!"
+ success: "Willkommen bei Diaspora!"
+ invitations:
+ create:
+ sent: 'Deine Einladung wurde verschickt.'
+ no_more: 'Du hast keine Einladungen mehr.'
+ already_sent: 'Du hast diese Person bereits eingeladen.'
+ already_friends: 'Du bist bereits mit dieser Person befreundet'
+ invitation_token_invalid: 'Das Einladungstoken ist ungültig!'
+ updated: 'Dein Passwort wurde erfolgreich gespeichert. Du bist jetzt angemeldet.'
+ new:
+ invite_someone_to_join: 'Lade jemanden zu Diaspora ein!'
+ if_they_accept_info: 'Wenn sie akzeptieren findest du sie im Aspekt in den du sie eingeladen hast'
+ to: 'An'
+ message: 'Nachricht:'
+ send_an_invitation: 'Eine Einladung senden'
+ send_invitation: 'Einladung senden'
+
status_messages:
- new_status_message:
- tell_me_something_good: "Erzähl' mir was schönes!"
- oh_yeah: "Oh, super!"
+ new_status_message: #FIXME: seems unused
+ tell_me_something_good: "Was gibt es neues?"
+ oh_yeah: "oh yeah!"
status_message:
- show_comments: "Kommentare anzeigen"
- delete: "Löschen"
- are_you_sure: "Bist du sicher?"
+ show_comments: "Kommentare zeigen"
show:
- status_message: "Statusmeldung"
+ status_message: "Status Nachricht"
comments: "Kommentare"
- are_you_sure: "Bist du sicher?"
- destroy: "Löschen"
- view_all: "Alle anzeigen"
+ destroy: "Zerstören"
+ view_all: "Alle zeigen"
message: "Nachricht"
- owner: "Eigentümer"
+ owner: "Besitzer"
helper:
no_message_to_display: "Keine Nachricht zum anzeigen."
people:
person:
add_friend: "Freund hinzufügen"
- pending_request: "Anfrage ausstehend"
+ pending_request: "Ausstehende Anfrage"
index:
add_friend: "Freund hinzufügen"
- real_name: "Echter Name"
- diaspora_handle: "diaspora handle"
- thats_you: "das bist du!"
- friend_request_pending: "Ausstehende Freundschaftsanfrage"
- you_have_a_friend_request_from_this_person: "Du hast eine Freundschaftsanfrage von dieser Person"
+ real_name: "Realer Name"
+ diaspora_handle: "Diaspora Adresse"
+ thats_you: "Das bist du!"
+ friend_request_pending: "Ausstehende Freundes-Anfrage"
+ you_have_a_friend_request_from_this_person: "Du hast eine Freundes-Anfrage von dieser Person"
new:
new_person: "Neue Person"
back_to_list: "Zurück zur Liste"
show:
- last_seen: "zuletzt gesehen: %{how_long_ago}"
+ last_seen: "Zuletzt gesehen vor: %{how_long_ago}" #FIXME: appends ago
friends_since: "Freunde seit: %{how_long_ago}"
save: "speichern"
- are_you_sure: "Bist du sicher?"
remove_friend: "Freund entfernen"
+ no_posts: "Keine Posts zum anzeigen!"
+ add_friend: "Freund hinzufügen"
+ edit_my_profile: "Mein Profil bearbeiten"
+ edit:
+ info_available_to: "Diese Infos werden für alle verfügbar sein mit denen du bei Diaspora verbunden bist."
+ your_profile: "Dein Profil"
+ your_name: "Dein Name"
+ first_name: "Vorname"
+ last_name: "Nachname"
+ your_gender: "Dein Geschlecht"
+ your_birthday: "Dein Geburtstag"
+ your_bio: "Deine Info"
+ fill_me_out: "Füll mich aus"
+ your_photo: "Dein Foto"
+ update_profile: "Profil aktualisieren"
+ diaspora_username: "DIASPORA ADRESSE"
+ info: "Info"
+ picture: "Bild"
+ editing_profile: "Profil bearbeiten"
+ albums: "Alben"
+ you_dont_have_any_photos: "Du hast keine Fotos! Gehe zur"
+ page_to_upload_some: "Seite um welche hochzuladen."
requests:
new_request:
- add_a_new_friend_to: "Add a new friend to"
- enter_a_diaspora_username: "Gebe einen Diaspora Benutzernamen ein:"
- your_diaspora_username_is: "Dein Diaspora Benutzername ist: %{diaspora_handle}"
- friends_username: "Freundes Benutzername"
+ add_a_new_friend_to: "Neuen Freund hinzufügen zu"
+ enter_a_diaspora_username: "Gib eine Diaspora Adresse ein:"
+ your_diaspora_username_is: "Deine Diaspora Adresse ist: %{diaspora_handle}"
+ friends_username: "Diaspora Addresse deines Freundes"
+ create_request: "Anfrage erstellen"
destroy:
- success: "Ihr seid jetzt Freunde."
- error: "Bitte wähle einen Aspekt aus!"
- ignore: "Freundschaftsanfrage ignorieren."
+ success: "Ihr seit jetzt Freunde."
+ error: "Bitte wähle einen Aspekt!"
+ ignore: "Freundes-Anfrage ignoriert."
create:
- error: "Kein Diaspora-Seed in dieser E-Mail gefunden!"
+ error: "Keinen Diaspora Seed mit dieser E-Mail gefunden!" #FIXME: wtf?
+ invalid_identity: "Diese Diaspora Adresse ist nicht richtig formatiert"
+ error_server: "Problem mit dem anderen Server. Vielleicht existiert er nicht?"
+ yourself: "Du kannst dich nicht mit dir selbst befreunden!"
already_friends: "Du bist bereits mit %{destination_url} befreundet!"
- success: "Eine Freundschaftsanfrage wurde an %{destination_url} gesendet."
- horribly_wrong: "Etwas ging tierisch schief."
+ success: "Eine Freundes-Anfrage wurde an %{destination_url} geschickt."
+ horribly_wrong: "Irgendwas ist furchtbar schief gelaufen."
+
+# The following is from the rails-i18n project at http://github.com/svenfuchs/rails-i18n
+
+# German translations for Ruby on Rails
+# by Clemens Kofler (clemens@railway.at)
+
+ date:
+ formats:
+ default: "%d.%m.%Y"
+ short: "%e. %b"
+ long: "%e. %B %Y"
+ only_day: "%e"
+
+ day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
+ abbr_day_names: [So, Mo, Di, Mi, Do, Fr, Sa]
+ month_names: [~, Januar, Februar, März, April, Mai, Juni, Juli, August, September, Oktober, November, Dezember]
+ abbr_month_names: [~, Jan, Feb, Mär, Apr, Mai, Jun, Jul, Aug, Sep, Okt, Nov, Dez]
+ order: [ :day, :month, :year ]
+
+ time:
+ formats:
+ default: "%A, %d. %B %Y, %H:%M Uhr"
+ short: "%d. %B, %H:%M Uhr"
+ long: "%A, %d. %B %Y, %H:%M Uhr"
+ time: "%H:%M"
+
+ am: "vormittags"
+ pm: "nachmittags"
+
+ datetime:
+ distance_in_words:
+ half_a_minute: 'eine halbe Minute'
+ less_than_x_seconds:
+ one: 'weniger als eine Sekunde'
+ other: 'weniger als %{count} Sekunden'
+ x_seconds:
+ one: 'eine Sekunde'
+ other: '%{count} Sekunden'
+ less_than_x_minutes:
+ one: 'weniger als eine Minute'
+ other: 'weniger als %{count} Minuten'
+ x_minutes:
+ one: 'eine Minute'
+ other: '%{count} Minuten'
+ about_x_hours:
+ one: 'etwa eine Stunde'
+ other: 'etwa %{count} Stunden'
+ x_days:
+ one: 'ein Tag'
+ other: '%{count} Tage'
+ about_x_months:
+ one: 'etwa ein Monat'
+ other: 'etwa %{count} Monate'
+ x_months:
+ one: 'ein Monat'
+ other: '%{count} Monate'
+ almost_x_years:
+ one: 'fast ein Jahr'
+ other: 'fast %{count} Jahre'
+ about_x_years:
+ one: 'etwa ein Jahr'
+ other: 'etwa %{count} Jahre'
+ over_x_years:
+ one: 'mehr als ein Jahr'
+ other: 'mehr als %{count} Jahre'
+ prompts:
+ second: "Sekunden"
+ minute: "Minuten"
+ hour: "Stunden"
+ day: "Tag"
+ month: "Monat"
+ year: "Jahr"
+
+ number:
+ format:
+ precision: 2
+ separator: ','
+ delimiter: '.'
+ currency:
+ format:
+ unit: '€'
+ format: '%n%u'
+ separator: ","
+ delimiter: ""
+ precision: 2
+ percentage:
+ format:
+ delimiter: ""
+ precision:
+ format:
+ delimiter: ""
+ human:
+ format:
+ delimiter: ""
+ precision: 1
+ storage_units:
+ # Storage units output formatting.
+ # %u is the storage unit, %n is the number (default: 2 MB)
+ format: "%n %u"
+ units:
+ byte:
+ one: "Byte"
+ other: "Bytes"
+ kb: "KB"
+ mb: "MB"
+ gb: "GB"
+ tb: "TB"
+
+ support:
+ array:
+ words_connector: ", "
+ two_words_connector: " und "
+ last_word_connector: " und "
+ select:
+ prompt: "Bitte wählen:"
+
+ activemodel:
+ errors:
+ template:
+ header:
+ one: "Konnte %{model} nicht speichern: ein Fehler."
+ other: "Konnte %{model} nicht speichern: %{count} Fehler."
+ body: "Bitte überprüfen Sie die folgenden Felder:"
+
+ activerecord:
+ errors:
+ template:
+ header:
+ one: "Konnte %{model} nicht speichern: ein Fehler."
+ other: "Konnte %{model} nicht speichern: %{count} Fehler."
+ body: "Bitte überprüfen Sie die folgenden Felder:"
+
+ messages:
+ inclusion: "ist kein gültiger Wert"
+ exclusion: "ist nicht verfügbar"
+ invalid: "ist nicht gültig"
+ confirmation: "stimmt nicht mit der Bestätigung überein"
+ accepted: "muss akzeptiert werden"
+ empty: "muss ausgefüllt werden"
+ blank: "muss ausgefüllt werden"
+ too_long: "ist zu lang (nicht mehr als %{count} Zeichen)"
+ too_short: "ist zu kurz (nicht weniger als %{count} Zeichen)"
+ wrong_length: "hat die falsche Länge (muss genau %{count} Zeichen haben)"
+ taken: "ist bereits vergeben"
+ not_a_number: "ist keine Zahl"
+ greater_than: "muss größer als %{count} sein"
+ greater_than_or_equal_to: "muss größer oder gleich %{count} sein"
+ equal_to: "muss genau %{count} sein"
+ less_than: "muss kleiner als %{count} sein"
+ less_than_or_equal_to: "muss kleiner oder gleich %{count} sein"
+ odd: "muss ungerade sein"
+ even: "muss gerade sein"
+ record_invalid: "Gültigkeitsprüfung ist fehlgeschlagen: %{errors}"
diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml
index 250315b6a..582cc170a 100644
--- a/config/locales/diaspora/en.yml
+++ b/config/locales/diaspora/en.yml
@@ -6,6 +6,23 @@
# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
+
+ settings: "Settings"
+ profile: "Profile"
+ account: "Account"
+ services: "Services"
+ cancel: "Cancel"
+ delete: "Delete"
+ or: "or"
+ by: "by"
+ ago: "ago"
+ username: "Username"
+ email: "Email"
+ home: "Home"
+ password: "Password"
+ password_confirmation: "Password confirmation"
+ are_you_sure: "Are you sure?"
+
activemodel:
errors:
models:
@@ -26,9 +43,6 @@ en:
helper:
unknown_person: "unknown person"
new_requests: "new requests"
- dashboards:
- helper:
- home: "home"
error_messages:
helper:
invalid_fields: "Invalid Fields"
@@ -54,7 +68,6 @@ en:
manage_aspects: "Manage Aspects"
publisher:
share: "Share"
- or: "or"
post_a_message_to: "Post a message to %{aspect}"
make_public: "make public"
aspect_friends:
@@ -66,6 +79,8 @@ en:
invitations_left: '(%{count} left)'
reshare:
reshare: 'Reshare'
+ author_info:
+ view_profile: 'View profile'
albums:
album:
you: "you"
@@ -76,20 +91,17 @@ en:
edit_album: "Edit Album"
albums: "albums"
updated: "updated"
- by: "by"
edit:
album_name: "Album name"
editing: "Editing"
updated: "updated"
update_album: "Update album"
- are_you_sure: "Are you sure?"
delete_album: "Delete Album"
- cancel: "Cancel"
index:
- home: "home"
new_album: "New Album"
create:
success: "You've created an album called %{name}."
+ failure: "Failed to create album."
update:
success: "Album %{name} successfully edited."
failure: "Failed to edit album %{name}."
@@ -138,19 +150,11 @@ en:
edit:
editing_profile: "Editing profile"
invite_friends: "Invite friends"
- are_you_sure: "Are you sure?"
export_data: "Export Data"
close_account: "Close Account"
change_language: "Change Language"
change_password: "Change Password"
new_password: "New Password"
- password_confirmation: "Password confirmation"
- settings: "Settings"
- profile: "Profile"
- account: "Account"
- services: "Services"
- cancel: "Cancel"
- or: "or"
destroy: "Account successfully closed."
getting_started:
signup_steps: "Complete your sign-up by doing these things:"
@@ -158,10 +162,7 @@ en:
albums: "Albums"
you_dont_have_any_photos: "You don't have any photos! Go to the"
page_to_upload_some: "page to upload some."
- or: "or"
comments:
- comment:
- ago: "ago"
new_comment:
comment: "Comment"
photos:
@@ -171,17 +172,13 @@ en:
next: "next"
edit_photo: "Edit Photo"
delete_photo: "Delete Photo"
- are_you_sure: "Are you sure?"
comments: "comments"
edit:
editing: "Editing"
- are_you_sure: "Are you sure?"
delete_photo: "Delete Photo"
photo:
show_comments: "show comments"
posted_a_new_photo_to: "posted a new photo to"
- delete: "Delete"
- are_you_sure: "Are you sure?"
new:
new_photo: "New Photo"
back_to_list: "Back to List"
@@ -201,10 +198,6 @@ en:
sign_up_for_diaspora: "Sign up for Diaspora"
upload_existing_account: "Upload an existing Diaspora account"
upload: "Upload"
- username: "Username"
- email: "Email"
- password: "Password"
- password_confirmation: "Password confirmation"
create:
success: "You've joined Diaspora!"
invitations:
@@ -216,7 +209,6 @@ en:
invitation_token_invalid: 'The invitation token provided is not valid!'
updated: 'Your password was set successfully. You are now signed in.'
new:
- email: 'Email'
invite_someone_to_join: 'Invite someone to join Diaspora!'
if_they_accept_info: 'if they accept, they will be added to the aspect you invited them'
to: 'To'
@@ -229,13 +221,9 @@ en:
oh_yeah: "oh yeah!"
status_message:
show_comments: "show comments"
- delete: "Delete"
- are_you_sure: "Are you sure?"
- ago: "ago"
show:
status_message: "Status Message"
comments: "comments"
- are_you_sure: "Are you sure?"
destroy: "Destroy"
view_all: "View All"
message: "Message"
@@ -260,13 +248,11 @@ en:
last_seen: "last seen: %{how_long_ago}"
friends_since: "friends since: %{how_long_ago}"
save: "save"
- are_you_sure: "Are you sure?"
remove_friend: "remove friend"
no_posts: "no posts to display!"
add_friend: "add friend"
edit_my_profile: "Edit my profile"
edit:
- settings: "Settings"
info_available_to: "This info will be available to whomever you connect with on Diaspora."
your_profile: "Your profile"
your_name: "Your name"
@@ -277,12 +263,7 @@ en:
your_bio: "Your bio"
fill_me_out: "Fill me out"
your_photo: "Your photo"
- profile: "Profile"
- account: "Account"
- services: "Services"
- cancel: "Cancel"
update_profile: "Update Profile"
- home: "Home"
diaspora_username: "DIASPORA USERNAME"
info: "Info"
picture: "Picture"
@@ -290,7 +271,6 @@ en:
albums: "Albums"
you_dont_have_any_photos: "You don't have any photos! Go to the"
page_to_upload_some: "page to upload some."
- or: "or"
requests:
new_request:
add_a_new_friend_to: "Add a new friend to"
@@ -310,9 +290,3 @@ en:
already_friends: "You are already friends with %{destination_url}!"
success: "A friend request was sent to %{destination_url}."
horribly_wrong: "Something went horribly wrong."
- services:
- index:
- settings: "Settings"
- profile: "Profile"
- account: "Account"
- services: "Services"
diff --git a/config/routes.rb b/config/routes.rb
index 8604abaad..3bd37a018 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -20,7 +20,6 @@ Diaspora::Application.routes.draw do
match 'public/:username', :to => 'users#public'
match 'getting_started', :to => 'users#getting_started', :as => 'getting_started'
match 'users/export', :to => 'users#export'
- match 'users/import', :to => 'users#import'
match 'users/export_photos', :to => 'users#export_photos'
resources :users, :except => [:create, :new, :show]
diff --git a/config/sprinkle/conf/nginx.conf b/config/sprinkle/conf/nginx.conf
index 68eff1606..724645292 100644
--- a/config/sprinkle/conf/nginx.conf
+++ b/config/sprinkle/conf/nginx.conf
@@ -27,8 +27,9 @@ http {
gzip_comp_level 2;
gzip_proxied any;
gzip_buffers 16 8k;
- #gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
- # gzip_disable "MSIE [1-6]\.(?!.*SV1)";
+ gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
+ gzip_disable "MSIE [1-6]\.(?!.*SV1)";
+
upstream thin_cluster {
server unix:/tmp/thin.0.sock;
server unix:/tmp/thin.1.sock;
@@ -46,7 +47,6 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
- proxy_buffering off;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
diff --git a/lib/diaspora/importer.rb b/lib/diaspora/importer.rb
deleted file mode 100644
index 57dd11ae9..000000000
--- a/lib/diaspora/importer.rb
+++ /dev/null
@@ -1,222 +0,0 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-module Diaspora
-
- class Importer
- def initialize(strategy)
- self.class.send(:include, strategy)
- end
-
- def commit(user, person, aspects, people, posts, contacts, opts = {})
- filter = verify_and_clean(user, person, people, aspects, posts, contacts)
-
- #assume data is good
-
- # to go
- user.email = opts[:email]
- user.password= opts[:password]
- user.password_confirmation = opts[:pasword_confirmation]
-
-
-
- user.person = person
-
-
- user.person.diaspora_handle = opts[:diaspora_handle]
-
- user.visible_post_ids = filter[:whitelist].keys
-
- #user.friend_ids =
- user.visible_person_ids = people.collect{ |x| x.id }
-
-
- posts.each do |post|
- post.save! if filter[:unknown].include? post.id
- end
-
-
-
- aspects.each do |aspect|
- user.aspects << aspect
- end
-
- people.each do |p|
- p.save! if filter[:people].include? p.id.to_s
- end
-
- contacts.each do |contact|
- contact.user = user
-
- user.friends << contact
- contact.save!
- end
-
-
- puts user.persisted?
-
- puts user.inspect
- user.save(:validate => false)
-
-
- end
-
- def assign_aspect_ids(contacts, aspects)
- a_hash = {}
- aspects.each{|x| a_hash[x.name]=x.id}
-
- contacts.each do |contact|
- contact.aspect_names.each do |x|
- contact.aspect_ids << a_hash[x]
- end
- contact.aspect_names = nil
- end
-
-
- end
-
- ### verification (to be module) ################
-
- def verify_and_clean(user, person, people, aspects, posts, contacts)
- verify_user(user)
- verify_person_for_user(user, person)
- filters = filter_posts(posts, person)
- clean_aspects(aspects, filters[:whitelist])
- filters[:all_person_ids] = people.collect{ |x| x.id.to_id }
-
- raise "incorrect number of contacts" unless verify_contacts(contacts, filters[:all_person_ids])
- assign_aspect_ids(contacts, aspects)
- filters[:people] = filter_people(people)
- filters
- end
-
- def verify_contacts(contacts, person_ids)
- return false if contacts.count != person_ids.count
- contacts.all?{|x| person_ids.include?(x.person_id)}
- end
-
- def verify_user(user)
- User.find_by_id(user.id).nil? ? true : raise("User already exists!")
- end
-
- def verify_person_for_user(user, person)
- local_person = Person.find_by_id(person.id)
- if local_person
- unless user.encryption_key.public_key.to_s == local_person.public_key.to_s
- raise "local person found with different owner"
- end
- end
- true
- end
-
-
- def filter_people(people)
- person_ids = people.collect{|x| x.id}
- people_from_db = Person.find_all_by_id(person_ids) #this query should be limited to only return person_id
- person_ids = person_ids - people_from_db.collect{ |x| x.id }
-
- person_hash = {}
- person_ids.each{|x| person_hash[x.to_s] = true }
- person_hash
- end
-
- def filter_posts(posts, person)
- post_ids = posts.collect{|x| x.id}
- posts_from_db = Post.find_all_by_id(post_ids) #this query should be limited to only return post id and owner id
-
- unknown_posts = post_ids - posts_from_db.collect{|x| x.id}
-
- posts_from_db.delete_if{|x| x.person_id == person.id}
- unauthorized_post_ids = posts_from_db.collect{|x| x.id}
- post_whitelist = post_ids - unauthorized_post_ids
-
- unknown = {}
- unknown_posts.each{|x| unknown[x.to_s] = true }
-
- whitelist = {}
- post_whitelist.each{|x| whitelist[x.to_s] = true }
-
- return {
- :unknown => unknown,
- :whitelist => whitelist }
- end
-
-
- def clean_aspects(aspects, whitelist)
- aspects.each do |aspect|
- aspect.post_ids.delete_if{ |x| !whitelist.include? x.to_s }
- end
- end
- end
-
- module Parsers
- module XML
- def execute(xml, opts = {})
- doc = Nokogiri::XML.parse(xml)
-
- user, person = parse_user_and_person(doc)
- aspects = parse_aspects(doc)
- contacts = parse_contacts(doc)
- people = parse_people(doc)
- posts = parse_posts(doc)
-
- user
- commit(user, person, aspects, people, posts, contacts, opts)
- end
-
- def parse_user_and_person(doc)
- user = User.new
- user_doc = doc.xpath('/export/user')
- user.username = user_doc.xpath('//user/username').text
- user.serialized_private_key= user_doc.xpath('//user/serialized_private_key').text
- person = Person.from_xml(user_doc.xpath('//user/person').to_s)
- [user, person]
- end
-
- def parse_aspects(doc)
- aspects = []
- aspect_doc = doc.xpath('/export/aspects/aspect')
-
- aspect_doc.each do |x|
- a = Nokogiri::XML.parse(x.to_s)
-
- aspect = Aspect.new
- aspect.name = a.xpath('/aspect/name').text
- aspect.post_ids = a.xpath('/aspect/post_ids/post_id').collect{ |x| x.text.to_id }
- aspects << aspect
- end
- aspects
- end
-
- def parse_people(doc)
- people_doc = doc.xpath('/export/people/person')
- people_doc.inject([]) do |people,curr|
- people << Person.from_xml(curr.to_s)
- end
- end
-
- def parse_contacts(doc)
- contacts = []
- contact_doc = doc.xpath('/export/contacts/contact')
-
- contact_doc.each do |x|
- contact = Contact.new
- contact.person_id = x.xpath("person_id").text.to_id
- contact.aspect_names = x.xpath('aspects/aspect/name').collect{ |x| x.text}
- contacts << contact
- end
- contacts
- end
-
- def parse_posts(doc)
- post_doc = doc.xpath('/export/posts/status_message')
- post_doc.inject([]) do |posts,curr|
- posts << StatusMessage.from_xml(curr.to_s)
- end
- end
-
- end
-
- end
-end
diff --git a/lib/diaspora/parser.rb b/lib/diaspora/parser.rb
index 2d002a2c9..da3344d84 100644
--- a/lib/diaspora/parser.rb
+++ b/lib/diaspora/parser.rb
@@ -4,35 +4,13 @@
module Diaspora
module Parser
- def self.owner_id_from_xml(xml)
- doc = Nokogiri::XML(xml) { |cfg| cfg.noblanks }
- id = doc.xpath("//person_id").text.to_s
- Person.first(:id => id)
- end
-
- def self.parse_or_find_person_from_xml(xml)
- doc = Nokogiri::XML(xml) { |cfg| cfg.noblanks }
- person_xml = doc.xpath("//person").to_s
- person_id = doc.xpath("//person/_id").text.to_s
- person = Person.first(:_id => person_id)
- person ? person : Person.from_xml( person_xml)
- end
-
def self.from_xml(xml)
-
doc = Nokogiri::XML(xml) { |cfg| cfg.noblanks }
return unless body = doc.xpath("/XML/post").children.first
begin
new_object = body.name.camelize.constantize.from_xml body.to_s
-
- if new_object.is_a? Post
- existing_object = new_object.class.find_by_id(new_object.id)
- existing_object ? (return existing_object) : (return new_object)
- end
-
- new_object
-
+ return new_object
rescue NameError => e
if e.message.include? 'wrong constant name'
Rails.logger.info "Not a real type: #{object.to_s}"
diff --git a/lib/diaspora/user/receiving.rb b/lib/diaspora/user/receiving.rb
index 9e9da020c..2e4a7bf8d 100644
--- a/lib/diaspora/user/receiving.rb
+++ b/lib/diaspora/user/receiving.rb
@@ -45,13 +45,13 @@ module Diaspora
raise "Not friends with that person" unless self.contact_for(salmon_author)
if object.is_a?(Comment)
- receive_comment object, xml
+ receive_comment object
elsif object.is_a?(Retraction)
- receive_retraction object, xml
+ receive_retraction object
elsif object.is_a?(Profile)
receive_profile object, person
else
- receive_post object, xml
+ receive_post object
end
end
}
@@ -60,7 +60,7 @@ module Diaspora
end
end
- def receive_retraction retraction, xml
+ def receive_retraction retraction
if retraction.type == 'Person'
unless retraction.person.id.to_s == retraction.post_id.to_s
raise "#{retraction.diaspora_handle} trying to unfriend #{retraction.post_id} from #{self.id}"
@@ -91,7 +91,7 @@ module Diaspora
person.save
end
- def receive_comment comment, xml
+ def receive_comment comment
raise "In receive for #{self.real_name}, signature was not valid on: #{comment.inspect}" unless comment.post.person == self.person || comment.verify_post_creator_signature
self.visible_people = self.visible_people | [comment.person]
self.save
@@ -105,7 +105,37 @@ module Diaspora
comment.socket_to_uid(id) if (comment.respond_to?(:socket_to_uid) && !self.owns?(comment))
end
- def receive_post post, xml
+ def exsists_on_pod?(post)
+ post.class.find_by_id(post.id)
+ end
+
+ def receive_post post
+ #exsists locally, but you dont know about it
+ #does not exsist locally, and you dont know about it
+
+ #exsists_locally?
+ #you know about it, and it is mutable
+ #you know about it, and it is not mutable
+ #
+ on_pod = exsists_on_pod?(post)
+ if on_pod
+ known_post = find_visible_post_by_id(post.id)
+ if known_post
+ if known_post.mutable?
+ known_post.update_attributes(post.to_mongo)
+ else
+ Rails.logger.info("#{post.diaspora_handle} is trying to update an immutable object #{known_post.inspect}")
+ end
+ elsif on_pod == post
+ update_user_refs_and_add_to_aspects(on_pod)
+ end
+ else
+ update_user_refs_and_add_to_aspects(post)
+ end
+ end
+
+
+ def update_user_refs_and_add_to_aspects(post)
Rails.logger.debug("Saving post: #{post}")
post.user_refs += 1
post.save
@@ -114,11 +144,13 @@ module Diaspora
self.save
aspects = self.aspects_with_person(post.person)
- aspects.each{ |aspect|
+ aspects.each do |aspect|
aspect.posts << post
aspect.save
- post.socket_to_uid(id, :aspect_ids => [aspect.id]) if (post.respond_to?(:socket_to_uid) && !self.owns?(post))
- }
+ end
+
+ post.socket_to_uid(id, :aspect_ids => aspects.map{|x| x.id}) if (post.respond_to?(:socket_to_uid) && !self.owns?(post))
+
end
end
end
diff --git a/spec/controllers/albums_controller_spec.rb b/spec/controllers/albums_controller_spec.rb
index 21e750685..78a4b4290 100644
--- a/spec/controllers/albums_controller_spec.rb
+++ b/spec/controllers/albums_controller_spec.rb
@@ -22,6 +22,19 @@ describe AlbumsController do
params = {"album" => {"name" => "Sunsets","to" => @aspect.id.to_s}}
post :create, params
end
+
+ context 'with invalid params' do
+ it 'should render a flash error message when album name is blank' do
+ params = {"album" => {"name" => "", "to" => "all"}}
+ post :create, params
+ flash[:error].should == "Failed to create album."
+ end
+ it 'should redirect back to album page for that given aspect' do
+ params = {"album" => {"name" => "", "to" => "all"}}
+ post :create, params
+ response.should redirect_to albums_path(:aspect => "all")
+ end
+ end
end
describe "#update" do
@@ -29,7 +42,7 @@ describe AlbumsController do
put :update, :id => @album.id, :album => { :name => "new_name"}
@album.reload.name.should eql("new_name")
end
-
+
it "doesn't overwrite random attributes" do
new_user = make_user
params = {:name => "Bruisers", :person_id => new_user.person.id}
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 0ba2bb28a..9e7cb7f4c 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -18,4 +18,155 @@ describe ApplicationHelper do
person_url(@user).should == "/users/#{@user.id}"
end
+ describe "markdownify" do
+ describe "autolinks" do
+ it "should not allow basic XSS/HTML" do
+ markdownify("").should == "<script>alert('XSS is evil')</script>"
+ end
+
+ it "should recognize basic http links (1/3)" do
+ proto="http"
+ url="bugs.joindiaspora.com/issues/332"
+ markdownify(proto+"://"+url).should == ""+url+""
+ end
+
+ it "should recognize basic http links (2/3)" do
+ proto="http"
+ url="webmail.example.com?~()!*/"
+ markdownify(proto+"://"+url).should == ""+url+""
+ end
+
+ it "should recognize basic http links (3/3)" do
+ proto="http"
+ url="127.0.0.1:3000/users/sign_in"
+ markdownify(proto+"://"+url).should == ""+url+""
+ end
+
+ it "should recognize secure https links" do
+ proto="https"
+ url="127.0.0.1:3000/users/sign_in"
+ markdownify(proto+"://"+url).should == ""+url+""
+ end
+
+ it "should recognize youtube links" do
+ proto="http"
+ videoid = "0x__dDWdf23"
+ url="www.youtube.com/watch?v="+videoid+"&a=GxdCwVVULXdvEBKmx_f5ywvZ0zZHHHDU&list=ML&playnext=1"
+ title = "UP & down & UP & down &"
+ mock_http = mock("http")
+ Net::HTTP.stub!(:new).with('gdata.youtube.com', 80).and_return(mock_http)
+ mock_http.should_receive(:get).with('/feeds/api/videos/'+videoid+'?v=2', nil).and_return([nil, 'Foobar '+title+' hallo welt dsd'])
+ res = markdownify(proto+'://'+url)
+ res.should == "Youtube: "+title+""
+ end
+
+ it "should recognize a bunch of different links" do
+ message = "http:// Hello World, this is for www.joindiaspora.com and not for http://www.google.com though their Youtube service is neat, take http://www.youtube.com/watch?v=foobar or www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related It is a good idea we finally have youtube, so enjoy this video http://www.youtube.com/watch?v=rickrolld"
+ mock_http = mock("http")
+ Net::HTTP.stub!(:new).with('gdata.youtube.com', 80).and_return(mock_http)
+ mock_http.should_receive(:get).with('/feeds/api/videos/foobar?v=2', nil).and_return([nil, 'Foobar F 007 - the bar is not enough hallo welt dsd'])
+ mock_http.should_receive(:get).with('/feeds/api/videos/BARFOO?v=2', nil).and_return([nil, 'Foobar BAR is the new FOO hallo welt dsd'])
+ mock_http.should_receive(:get).with('/feeds/api/videos/rickrolld?v=2', nil).and_return([nil, 'Foobar Never gonne give you up hallo welt dsd'])
+ res = markdownify(message)
+ res.should == "http:// Hello World, this is for www.joindiaspora.com and not for www.google.com though their Youtube service is neat, take Youtube: F 007 - the bar is not enough or Youtube: BAR is the new FOO It is a good idea we finally have youtube, so enjoy this video Youtube: Never gonne give you up"
+ end
+
+ it "should recognize basic ftp links" do
+ proto="ftp"
+ url="ftp.uni-kl.de/CCC/26C3/mp4/26c3-3540-en-a_hackers_utopia.mp4"
+ # I did not watch that one, but the title sounds nice :P
+ markdownify(proto+"://"+url).should == ""+url+""
+ end
+
+ it "should recognize www links" do
+ url="www.joindiaspora.com"
+ markdownify(url).should == ""+url+""
+ end
+ end
+
+ describe "weak emphasis" do
+ it "should be recognized (1/2)" do
+ message = "*some text* some text *some text* some text"
+ markdownify(message).should == "some text some text some text some text"
+ end
+
+ it "should be recognized (2/2)" do
+ message = "_some text_ some text _some text_ some text"
+ markdownify(message).should == "some text some text some text some text"
+ end
+ end
+
+ describe "strong emphasis" do
+ it "should be recognized (1/2)" do
+ message = "**some text** some text **some text** some text"
+ markdownify(message).should == "some text some text some text some text"
+ end
+
+ it "should be recognized (2/2)" do
+ message = "__some text__ some text __some text__ some text"
+ markdownify(message).should == "some text some text some text some text"
+ end
+ end
+
+ describe "nested weak and strong emphasis" do
+ it "should be rendered correctly" do
+ message = "__this is _some_ text__"
+ markdownify(message).should == "this is some text"
+ message = "*this is **some** text*"
+ markdownify(message).should == "this is some text"
+ message = "___some text___"
+ markdownify(message).should == "some text"
+ end
+ end
+
+ describe "links" do
+ it "should be recognized without title attribute" do
+ message = "[link text](http://someurl.com) [link text](http://someurl.com)"
+ markdownify(message).should == 'link text link text'
+ end
+
+ it "should be recognized with title attribute" do
+ message = '[link text](http://someurl.com "some title") [link text](http://someurl.com "some title")'
+ markdownify(message).should == 'link text link text'
+ end
+ end
+
+ describe "nested emphasis and links tags" do
+ it "should be rendered correctly" do
+ message = '[**some *link* text**](someurl.com "some title")'
+ markdownify(message).should == 'some link text'
+ end
+ end
+
+ it "should allow escaping" do
+ message = '*some text* \\*some text* \\**some text* _some text_ \\_some text_ \\__some text_'
+ markdownify(message).should == "some text *some text *some text some text _some text _some text"
+ end
+
+ describe "options" do
+ before do
+ @message = "http://url.com www.url.com www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related *emphasis* __emphasis__ [link](www.url.com) [link](url.com \"title\")"
+ end
+
+ it "should allow to render only autolinks" do
+ res = markdownify(@message, :youtube => false, :emphasis => false, :links => false)
+ res.should == "url.com www.url.com www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related *emphasis* __emphasis__ [link](www.url.com) [link](url.com "title")"
+ end
+
+ it "should allow to render only youtube autolinks" do
+ res = markdownify(@message, :autolinks => false, :emphasis => false, :links => false)
+ res.should == "http://url.com www.url.com Youtube: BAR is the new FOO *emphasis* __emphasis__ [link](www.url.com) [link](url.com "title")"
+ end
+
+ it "should allow to render only emphasis tags" do
+ res = markdownify(@message, :autolinks => false, :youtube => false, :links => false)
+ res.should == "http://url.com www.url.com www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related emphasis emphasis [link](www.url.com) [link](url.com "title")"
+ end
+
+ it "should allo to render only links tags" do
+ res = markdownify(@message, :autolinks => false, :youtube => false, :emphasis => false)
+ res.should == "http://url.com www.url.com www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related *emphasis* __emphasis__ link link"
+ end
+ end
+ end
end
diff --git a/spec/helpers/status_messages_helper_spec.rb b/spec/helpers/status_messages_helper_spec.rb
deleted file mode 100644
index 0aee3826a..000000000
--- a/spec/helpers/status_messages_helper_spec.rb
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-require 'spec_helper'
-
-describe StatusMessagesHelper do
- it "should not allow basic XSS/HTML" do
- make_links("").should == "<script>alert('XSS is evil')</script>"
- end
-
- it "should recognize basic http links (1/3)" do
- proto="http"
- url="bugs.joindiaspora.com/issues/332"
- make_links(proto+"://"+url).should == ""+url+""
- end
-
- it "should recognize basic http links (2/3)" do
- proto="http"
- url="webmail.example.com?~()!*/"
- make_links(proto+"://"+url).should == ""+url+""
- end
-
- it "should recognize basic http links (3/3)" do
- proto="http"
- url="127.0.0.1:3000/users/sign_in"
- make_links(proto+"://"+url).should == ""+url+""
- end
-
- it "should recognize secure https links" do
- proto="https"
- url="127.0.0.1:3000/users/sign_in"
- make_links(proto+"://"+url).should == ""+url+""
- end
-
- it "should recognize youtube links" do
- proto="http"
- videoid = "0x__dDWdf23"
- url="www.youtube.com/watch?v="+videoid+"&a=GxdCwVVULXdvEBKmx_f5ywvZ0zZHHHDU&list=ML&playnext=1"
- title = "UP & down & UP & down &"
- mock_http = mock("http")
- Net::HTTP.stub!(:new).with('gdata.youtube.com', 80).and_return(mock_http)
- mock_http.should_receive(:get).with('/feeds/api/videos/'+videoid+'?v=2', nil).and_return([nil, 'Foobar '+title+' hallo welt dsd'])
- res = make_links(proto+'://'+url)
- res.should == "Youtube: "+title+""
- end
-
- it "should recognize a bunch of different links" do
- message = "http:// Hello World, this is for www.joindiaspora.com and not for http://www.google.com though their Youtube service is neat, take http://www.youtube.com/watch?v=foobar or www.youtube.com/watch?foo=bar&v=BARFOO&whatever=related It is a good idea we finally have youtube, so enjoy this video http://www.youtube.com/watch?v=rickrolld"
- mock_http = mock("http")
- Net::HTTP.stub!(:new).with('gdata.youtube.com', 80).and_return(mock_http)
- mock_http.should_receive(:get).with('/feeds/api/videos/foobar?v=2', nil).and_return([nil, 'Foobar F 007 - the bar is not enough hallo welt dsd'])
- mock_http.should_receive(:get).with('/feeds/api/videos/BARFOO?v=2', nil).and_return([nil, 'Foobar BAR is the new FOO hallo welt dsd'])
- mock_http.should_receive(:get).with('/feeds/api/videos/rickrolld?v=2', nil).and_return([nil, 'Foobar Never gonne give you up hallo welt dsd'])
- res = make_links(message)
- res.should == "http:// Hello World, this is for www.joindiaspora.com and not for www.google.com though their Youtube service is neat, take Youtube: F 007 - the bar is not enough or Youtube: BAR is the new FOO It is a good idea we finally have youtube, so enjoy this video Youtube: Never gonne give you up"
- end
-
- it "should recognize basic ftp links" do
- proto="ftp"
- url="ftp.uni-kl.de/CCC/26C3/mp4/26c3-3540-en-a_hackers_utopia.mp4"
- # I did not watch that one, but the title sounds nice :P
- make_links(proto+"://"+url).should == ""+url+""
- end
-
- it "should recognize www links" do
- url="www.joindiaspora.com"
- make_links(url).should == ""+url+""
- end
-
-
-end
diff --git a/spec/lib/diaspora/importer_spec.rb b/spec/lib/diaspora/importer_spec.rb
deleted file mode 100644
index f855f8bd0..000000000
--- a/spec/lib/diaspora/importer_spec.rb
+++ /dev/null
@@ -1,254 +0,0 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-require 'spec_helper'
-require File.join(Rails.root, 'lib/diaspora/exporter')
-require File.join(Rails.root, 'lib/diaspora/importer')
-
-describe Diaspora::Importer do
- def setup_for_exporting
- # Five users on pod
- @user1 = make_user
- @user2 = make_user
- @user3 = make_user
- @user4 = make_user
- @user5 = make_user
-
- # Two external people referenced on pod
- @person1 = Factory(:person)
- @person2 = Factory(:person)
-
- # User1 has four aspects(1-4), each following user has one aspect
- @aspect1 = @user1.aspects.create(:name => "Dudes")
- @aspect2 = @user1.aspects.create(:name => "Girls")
- @aspect3 = @user1.aspects.create(:name => "Bros")
- @aspect4 = @user1.aspects.create(:name => "People")
- @aspect5 = @user2.aspects.create(:name => "Abe Lincolns")
- @aspect6 = @user3.aspects.create(:name => "Cats")
- @aspect7 = @user4.aspects.create(:name => "Dogs")
- @aspect8 = @user5.aspects.create(:name => "Hamsters")
- @aspect9 = @user5.aspects.create(:name => "Gophers")
-
- @aspect10 = @user1.aspects.create(:name => "Work")
- @aspect11 = @user1.aspects.create(:name => "Family")
-
- # User1 posts one status messages to aspects (1-4), two other users post message to one aspect
- @status_message1 = @user1.post(:status_message, :message => "One", :public => false, :to => @aspect1.id)
- @status_message2 = @user1.post(:status_message, :message => "Two", :public => false, :to => @aspect2.id)
- @status_message3 = @user1.post(:status_message, :message => "Three", :public => false, :to => @aspect3.id)
- @status_message4 = @user1.post(:status_message, :message => "Four", :public => false, :to => @aspect4.id)
- @status_message5 = @user2.post(:status_message, :message => "Five", :public => false, :to => @aspect5.id)
- @status_message6 = @user3.post(:status_message, :message => "Six", :public => false, :to => @aspect6.id)
- @status_message7 = @user5.post(:status_message, :message => "Seven", :public => false, :to => @aspect9.id)
-
- @aspect1.posts << @status_message1
- @aspect2.posts << @status_message2
- @aspect3.posts << @status_message3
- @aspect4.posts << @status_message4
-
- # Friend users with user1
- friend_users( @user1, @aspect1, @user2, @aspect5 )
- friend_users( @user1, @aspect2, @user3, @aspect6 )
- friend_users( @user1, @aspect3, @user4, @aspect7 )
- friend_users( @user1, @aspect4, @user5, @aspect8 )
-
- # Friend users 4 and 5
- friend_users( @user5, @aspect9, @user4, @aspect7 )
-
- # Generate status messages and receive for user1
- @user2.receive @status_message1.to_diaspora_xml, @user1.person
- @user3.receive @status_message2.to_diaspora_xml, @user1.person
- @user4.receive @status_message3.to_diaspora_xml, @user1.person
- @user5.receive @status_message4.to_diaspora_xml, @user1.person
- @user1.receive @status_message5.to_diaspora_xml, @user2.person
- @user1.receive @status_message6.to_diaspora_xml, @user3.person
-
- # Generate status message and recieve between user4 and user5
- @user4.receive @status_message7.to_diaspora_xml, @user5.person
-
-
- end
-
- before(:all) do
- DatabaseCleaner.clean
- UserFixer.load_user_fixtures
- setup_for_exporting
- # Generate exported XML for user1
- exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML)
- @user1.aspects.reload
- @xml = exporter.execute(@user1)
-
- @old_user = @user1
-
- # Remove user1 from the server
- @user1.aspects.each( &:delete )
- @user1.raw_visible_posts.find_all_by_person_id(@user1.person.id).each( &:delete )
- @user1.delete
- end
-
- it 'should gut check this test' do
- setup_for_exporting
- @user1.friends.count.should be 4
-
- @user1.contact_for(@user2.person).should_not be_nil
- @user1.contact_for(@user3.person).should_not be_nil
- @user1.contact_for(@user4.person).should_not be_nil
- @user1.contact_for(@user5.person).should_not be_nil
-
- # User is generated with two pre-populated aspects
- @user1.aspects.count.should be 6
- @user1.aspects.find_by_name("Dudes").people.find_by_person_id(@user2.person.id).should_not be_nil
- @user1.aspects.find_by_name("Dudes").posts.should include @status_message5
-
- @user1.raw_visible_posts.count.should be 6
- @user1.raw_visible_posts.find_all_by_person_id(@user1.person.id).count.should be 4
- @user1.raw_visible_posts.find_all_by_person_id(@user1.person.id).should_not include @status_message7
- end
-
- context 'parsing a user' do
-
- before(:each) do
- @importer = Diaspora::Importer.new(Diaspora::Parsers::XML)
- @doc = Nokogiri::XML::parse(@xml)
- end
-
- describe '#parse_user_and_person' do
- before(:each) do
- @user, @person = @importer.parse_user_and_person(@doc)
- end
-
- it 'should set username' do
- @user.username.should == @old_user.username
- end
-
- it 'should set private key' do
- @user.serialized_private_key.should_not be nil
- @user.serialized_private_key.should == @old_user.serialized_private_key
- end
-
- end
-
- describe '#parse_aspects' do
- let(:aspects) { @importer.parse_aspects(@doc) }
-
- it 'should return valid aspects' do
- aspects.all?(&:valid?).should be true
- end
-
- it 'should return an array' do
- aspects.count.should == 6
- end
-
- it 'should should have post ids' do
- aspects.any?{|x| x.post_ids.count > 0}.should be true
- end
- end
-
- describe '#parse_contacts' do
- let(:contacts) { @importer.parse_contacts(@doc) }
-
- it 'should return an array' do
- contacts.count.should == 4
- end
-
- it 'should should have post ids' do
- contacts.all?{|x| x.aspect_names.count > 0}.should be true
- end
-
- it 'should should have a person id' do
- contacts.all?{|x| x.person_id.nil? || x.person_id == ""}.should be false
- end
- end
-
- describe '#parse_people' do
- let(:people) { @importer.parse_people(@doc) }
-
- it 'should return an array' do
- people.count.should == 4
- end
- end
-
- describe '#parse_posts' do
- let(:posts) { @importer.parse_posts(@doc) }
-
- it 'should return an array' do
- posts.count.should == 4
- end
-
- it 'should return vaild posts' do
- posts.all?(&:valid?).should be true
- end
- end
-
- end
-
- describe 'importing a user' do
-
- context '#execute' do
- before(:each) do
- # Generate exported XML for user1
- exporter = Diaspora::Exporter.new(Diaspora::Exporters::XML)
- @xml = exporter.execute(@user1)
- @username =@user1.username
- # Remove user1 from the server
- @user1.aspects.each( &:delete )
- @user1.friends.each( &:delete )
- @user1.raw_visible_posts.find_all_by_person_id(@user1.person.id).each( &:delete )
- @user1.delete
-
- @importer = Diaspora::Importer.new(Diaspora::Parsers::XML)
- end
-
- it 'should import' do
- pending "there is some weirdness with diaspora handle we need to look into... and this test needs love
- the test passes when the validations are set to false when saving the user in the importer"
-
- User.delete_all
- Person.delete_all
- Post.delete_all
- StatusMessage.delete_all
- Aspect.delete_all
- Contact.delete_all
-
- User.count.should == 0
- Person.count.should == 0
-
- @importer.execute(@xml,
- :email => "bob@bob.com",
- :password => "bobbybob",
- :password => "bobbybob",
- :diaspora_handle => "#{@username}@#{APP_CONFIG[:terse_pod_url]}")
-
- User.count.should == 1
- n = User.first
- Post.count.should == 4
- n.aspects.count.should == 6
- Person.count.should be == 5
- Contact.count.should be == 4
-
- # need to check this
- #User.first.person.diaspora_handle.should == User.first.diaspora_handle
- User.first.diaspora_handle.should == "#{@username}@#{APP_CONFIG[:terse_pod_url]}"
-
-
- Person.find_by_id( @user1.person.id ).nil?.should == false
- Person.find_by_id( @user2.person.id ).nil?.should == false
-
- n.aspects.count.should == 6
-
- people_count = 0
- n.aspects.each{|x| people_count += x.people.count }
- people_count.should == 4
-
- post_count = 0
- n.aspects.reload
- n.aspects.each{ |x| post_count += x.post_ids.count }
- post_count.should == 4
-
- n.friends.count.should be 4
- end
- end
- end
-end
-
diff --git a/spec/lib/verify_spec.rb b/spec/lib/verify_spec.rb
deleted file mode 100644
index 9dca1cb78..000000000
--- a/spec/lib/verify_spec.rb
+++ /dev/null
@@ -1,126 +0,0 @@
-# Copyright (c) 2010, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
-
-require 'spec_helper'
-require File.join(Rails.root, 'lib/diaspora/importer')
-
-describe Diaspora::Importer do
-
- let!(:user1) { make_user }
- let!(:user2) { make_user }
- let!(:user3) { make_user }
-
- let(:aspect1) { user1.aspects.create(:name => "Work") }
- let(:aspect2) { user2.aspects.create(:name => "Family") }
- let(:aspect3) { user3.aspects.create(:name => "Pivots") }
-
- let!(:status_message1) { user1.post(:status_message, :message => "One", :public => true, :to => aspect1.id) }
- let!(:status_message2) { user1.post(:status_message, :message => "Two", :public => true, :to => aspect1.id) }
- let!(:status_message3) { user2.post(:status_message, :message => "Three", :public => false, :to => aspect2.id) }
-
- let(:importer) { Diaspora::Importer.new(Diaspora::Parsers::XML) }
-
- context 'serialized user' do
- describe '#verify_user' do
- it 'should return true for a new valid user' do
- new_user = make_user
- new_user.delete
- importer.verify_user(new_user).should be true
- end
-
- it 'should return false if vaild user already exists' do
- u = User.first
- lambda{ importer.verify_user(user1) }.should raise_error
- end
- end
-
- describe '#verify_person_for_user' do
- it 'should pass if keys match' do
- importer.verify_person_for_user(user1, user1.person).should be true
- end
-
- it 'should fail if private and public keys do not match' do
- person = Factory(:person)
- lambda{ importer.verify_person_for_user(user1, person) }.should raise_error
- end
-
- it 'should pass if the person does not exist' do
- user = Factory.build(:user)
- importer.verify_person_for_user(user, user.person)
- end
- end
-
- describe 'verify contacts' do
- let(:contact1) {Contact.new(:user => user1, :person => user2.person, :aspects => [aspect1])}
- let(:contact2) {Contact.new(:user => user1, :person => user3.person, :aspects => [aspect2])}
- let(:contact3) {Contact.new(:user => user1, :person => user3.person, :aspects => [aspect3])}
- let(:less_contacts) {[contact1]}
- let(:same_contacts) {[contact1, contact2]}
- let(:more_contacts) {[contact1, contact2, contact3]}
-
- let(:person_ids) {[user2.person.id, user3.person.id]}
-
-
- it 'should be false if the number of the number of contacts is not equal to the number of imported people' do
- importer.verify_contacts(less_contacts, person_ids).should be false
- importer.verify_contacts(same_contacts, person_ids).should be true
- importer.verify_contacts(more_contacts, person_ids).should be false
- end
- end
-
- describe '#filter_posts' do
- it 'should make sure all found posts are owned by the user' do
- posts = [status_message1, status_message2]
- whitelist = importer.filter_posts(posts, user1.person)[:whitelist]
-
- whitelist.should have(2).posts
- whitelist.should include status_message1.id.to_s
- whitelist.should include status_message2.id.to_s
- end
-
- it 'should remove posts not owned by the user' do
- posts = [status_message1, status_message2, status_message3]
- whitelist = importer.filter_posts(posts, user1.person)[:whitelist]
-
- whitelist.should have(2).posts
- whitelist.should_not include status_message3.id
- end
-
- it 'should return a list of unknown posts' do
- posts = [status_message1, status_message2, Factory.build(:status_message)]
- unknown = importer.filter_posts(posts, user1.person)[:unknown]
-
- unknown.should have(1).post
- end
-
- it 'should generate a whitelist, unknown posts inclusive' do
- posts = [status_message1, status_message2, Factory.build(:status_message)]
- filters = importer.filter_posts(posts, user1.person)
-
- filters[:whitelist].should include filters[:unknown].keys.first
- end
- end
-
- describe '#clean_aspects' do
- it 'should purge posts not in whitelist that are present in aspects' do
- whitelist = {status_message1.id.to_s => true, status_message2.id.to_s => true}
-
- aspect1.reload
- aspect1.post_ids << status_message3.id.to_s
-
- proc{ importer.clean_aspects([aspect1], whitelist) }.should change(aspect1.post_ids, :count).by(-1)
- aspect1.post_ids.should_not include status_message3.id
- end
- end
-
- describe '#filter_people' do
- it 'should filter people who already exist in the database' do
- new_peep = Factory.build(:person)
- people = [user1.person, user2.person, new_peep]
-
- importer.filter_people(people).keys.should == [new_peep.id.to_s]
- end
- end
- end
-end
diff --git a/spec/models/album_spec.rb b/spec/models/album_spec.rb
index d8226c2dc..6c3890611 100644
--- a/spec/models/album_spec.rb
+++ b/spec/models/album_spec.rb
@@ -23,6 +23,11 @@ describe Album do
album.associations[:photos].type.should == :many
end
+ it 'should be mutable' do
+ post = user.post :album, :name => "hello", :to => aspect.id
+ post.mutable?.should == true
+ end
+
context 'when an album has two attached images' do
before do
2.times do
diff --git a/spec/models/photo_spec.rb b/spec/models/photo_spec.rb
index f5d07fc55..b048e9c16 100644
--- a/spec/models/photo_spec.rb
+++ b/spec/models/photo_spec.rb
@@ -31,6 +31,10 @@ describe Photo do
end
end
+ it 'should be mutable' do
+ @photo.mutable?.should == true
+ end
+
it 'has a constructor' do
image = File.open(@fixture_name)
photo = Photo.instantiate(
diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb
index 587751b0c..e4ca64938 100644
--- a/spec/models/post_spec.rb
+++ b/spec/models/post_spec.rb
@@ -29,5 +29,12 @@ describe Post do
xml.include?(@user.person.diaspora_handle).should be true
end
end
+
+ describe '#mutable?' do
+ it 'should be false by default' do
+ post = @user.post :status_message, :message => "hello", :to => @aspect.id
+ post.mutable?.should == false
+ end
+ end
end
diff --git a/spec/models/user/receive_spec.rb b/spec/models/user/receive_spec.rb
index 7d504f1d3..2e5c3e099 100644
--- a/spec/models/user/receive_spec.rb
+++ b/spec/models/user/receive_spec.rb
@@ -19,6 +19,14 @@ describe User do
friend_users(user, aspect, user2, aspect2)
end
+ it 'should stream only one message to the everyone aspect when a multi-aspected friend posts' do
+ user.add_person_to_aspect(user2.person.id, user.aspects.create(:name => "villains").id)
+ status = user2.post(:status_message, :message => "Users do things", :to => aspect2.id)
+ xml = status.to_diaspora_xml
+ Diaspora::WebSocket.should_receive(:queue_to_user).exactly(:once)
+ user.receive xml, user2.person
+ end
+
it 'should be able to parse and store a status message from xml' do
status_message = user2.post :status_message, :message => 'store this!', :to => aspect2.id
@@ -41,6 +49,36 @@ describe User do
user.aspects.size.should == num_aspects
end
+ context 'update posts' do
+ let(:status) {user.post(:status_message, :message => "Original", :to => aspect.id)}
+ let(:album) {user.post(:album, :name => "Original", :to => aspect.id)}
+
+ it 'does not update posts not marked as mutable' do
+ user2.receive_salmon(user.salmon(status).xml_for(user2.person))
+ status.message = 'foo'
+ xml = user.salmon(status).xml_for(user2.person)
+
+ status.reload.message.should == 'Original'
+
+ user2.receive_salmon(xml)
+
+ status.reload.message.should == 'Original'
+ end
+
+ it 'updates posts marked as mutable' do
+ user2.receive_salmon(user.salmon(album).xml_for(user2.person))
+ album.name = 'foo'
+ xml = user.salmon(album).xml_for(user2.person)
+
+ album.reload.name.should == 'Original'
+
+ user2.receive_salmon(xml)
+
+ album.reload.name.should == 'foo'
+ end
+
+ end
+
describe 'post refs' do
before do
@status_message = user2.post :status_message, :message => "hi", :to =>aspect2.id
@@ -113,11 +151,11 @@ describe User do
post_in_db.comments.should == []
user2.receive_salmon(@xml)
post_in_db.reload
-
+
post_in_db.comments.include?(@comment).should be true
post_in_db.comments.first.person.should == local_person
end
-
+
it 'should correctly marshal a stranger for the downstream user' do
remote_person = user3.person
remote_person.delete
@@ -127,13 +165,13 @@ describe User do
Person.should_receive(:by_account_identifier).twice.and_return{ |handle| if handle == user.person.diaspora_handle; user.person.save
user.person; else; remote_person.save; remote_person; end }
-
+
user2.reload.raw_visible_posts.size.should == 1
post_in_db = user2.raw_visible_posts.first
post_in_db.comments.should == []
user2.receive_salmon(@xml)
post_in_db.reload
-
+
post_in_db.comments.include?(@comment).should be true
post_in_db.comments.first.person.should == remote_person
end