From d4257f4a68c2c5603711ce440c4e2099343d90f7 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sun, 17 Jul 2011 10:45:06 +0200 Subject: [PATCH 1/4] Removed unicode smileys, #1589 --- app/helpers/markdownify_helper.rb | 12 ++++-------- spec/helpers/markdownify_helper_spec.rb | 12 ++++++------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/helpers/markdownify_helper.rb b/app/helpers/markdownify_helper.rb index ab8ff40f0..21aa70a73 100644 --- a/app/helpers/markdownify_helper.rb +++ b/app/helpers/markdownify_helper.rb @@ -7,14 +7,14 @@ module MarkdownifyHelper message = h(message).html_safe options[:newlines] = true if !options.has_key?(:newlines) - options[:emoticons] = true if !options.has_key?(:emoticons) + options[:specialchars] = true if !options.has_key?(:specialchars) message = process_links(message) message = process_autolinks(message) message = process_emphasis(message) message = process_youtube(message, options[:youtube_maps]) message = process_vimeo(message, options[:vimeo_maps]) - message = process_emoticons(message) if options[:emoticons] + message = process_specialchars(message) if options[:specialchars] message = process_newlines(message) if options[:newlines] message @@ -115,13 +115,9 @@ module MarkdownifyHelper processed_message end - def process_emoticons(message) + def process_specialchars(message) map = [ ["<3", "♥"], - [":(", "☹"], - [":-(", "☹"], - [":)", "☺"], - [":-)", "☺"], ["<->", "↔"], ["->", "→"], ["<-", "←"], @@ -136,4 +132,4 @@ module MarkdownifyHelper end message end -end +end \ No newline at end of file diff --git a/spec/helpers/markdownify_helper_spec.rb b/spec/helpers/markdownify_helper_spec.rb index b9feb7fd0..1e036aa8d 100644 --- a/spec/helpers/markdownify_helper_spec.rb +++ b/spec/helpers/markdownify_helper_spec.rb @@ -150,20 +150,20 @@ describe MarkdownifyHelper do end end - describe "emoticons" do + describe "specialchars" do it "replaces <3 with ♥" do message = "i <3 you" markdownify(message).should == "i ♥ you" end it "replaces various things with (their) HTML entities" do - message = ":) :-) :( :-( ... <-> -> <- (tm) (r) (c)" - markdownify(message).should == "☺ ☺ ☹ ☹ … ↔ → ← ™ ® ©" + message = "... <-> -> <- (tm) (r) (c)" + markdownify(message).should == "… ↔ → ← ™ ® ©" end it "skips doing it if you say so" do - message = ":) :-) :( :-( ... -> <-" - markdownify(message, :emoticons => false).should == ":) :-) :( :-( ... -> <-" + message = "... -> <-" + markdownify(message, :specialchars => false).should == "... -> <-" end end @@ -263,4 +263,4 @@ describe MarkdownifyHelper do end end end -end +end \ No newline at end of file From 713f4dcc9d3cbe5a79603aea4feace718160ed9c Mon Sep 17 00:00:00 2001 From: Andrej Kacian Date: Sun, 17 Jul 2011 17:04:51 +0200 Subject: [PATCH 2/4] Fix for issue #1600: Missing string for translation ("Recent notifications") --- app/views/layouts/_header.html.haml | 2 +- config/locales/diaspora/en.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/_header.html.haml b/app/views/layouts/_header.html.haml index 4cab6a35f..069caa9d6 100644 --- a/app/views/layouts/_header.html.haml +++ b/app/views/layouts/_header.html.haml @@ -47,7 +47,7 @@ .header = link_to t('.view_all'), notifications_path, :id => "view_all_notifications" %h4 - Recent notifications + = t('.recent_notifications') .notifications .ajax_loader = image_tag("ajax-loader.gif") diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index ac4e56723..cf1a843d4 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -299,6 +299,7 @@ en: code: "code" admin: "admin" view_all: "View all" + recent_notifications: "Recent notifications" application: powered_by: "POWERED BY DIASPORA*" whats_new: "what's new?" From 6a11784a2efc0db79f0b2f9c031aa9c4fc641231 Mon Sep 17 00:00:00 2001 From: Dan Hansen Date: Sun, 17 Jul 2011 15:44:07 -0700 Subject: [PATCH 3/4] Rewrote ContactsController#index, thoughts? --- app/controllers/contacts_controller.rb | 45 +++++++++++++------- app/views/contacts/index.html.haml | 14 +++--- spec/controllers/contacts_controller_spec.rb | 5 --- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index aeecaae08..22499dfde 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -6,22 +6,29 @@ class ContactsController < ApplicationController before_filter :authenticate_user! def index - @aspect = :manage - - if params[:a_id] - @aspect_ = current_user.aspects.find(params["a_id"]) - @contacts = @aspect_.contacts.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25) - elsif params[:aspect_ids] && request.format == "json" - @people = Person.joins(:contacts => :aspect_memberships). - where(:contacts => {:user_id => current_user.id}, - :aspect_memberships => {:aspect_id => params[:aspect_ids]}) - render :json => @people.includes(:profile).to_json - elsif params[:set] == "only_sharing" - @contacts = current_user.contacts.only_sharing.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25) - elsif params[:set] != "all" - @contacts = current_user.contacts.receiving.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25) + @contacts = case params[:set] + when "only_sharing" + current_user.contacts.only_sharing + when "all" + current_user.contacts else - @contacts = current_user.contacts.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25) + if params[:a_id] + @aspect = current_user.aspects.find(params[:a_id]) + @aspect.contacts + else + current_user.contacts.receiving + end + end + + respond_to do |format| + format.html { @contacts = sort_and_paginate_profiles(@contacts) } + format.json { + @people = Person.joins(:contacts => :aspect_memberships). + where(:contacts => { :user_id => current_user.id }, + :aspect_memberships => { :aspect_id => params[:aspect_ids] }) + + render :json => @people.includes(:profile).to_json + } end end @@ -30,4 +37,12 @@ class ContactsController < ApplicationController render :layout => false end + private + + def sort_and_paginate_profiles contacts + contacts. + includes(:aspects, :person => :profile). + order('profiles.last_name ASC'). + paginate(:page => params[:page], :per_page => 25) + end end diff --git a/app/views/contacts/index.html.haml b/app/views/contacts/index.html.haml index 0a7d1a309..e6d73ad94 100644 --- a/app/views/contacts/index.html.haml +++ b/app/views/contacts/index.html.haml @@ -20,32 +20,32 @@ .span-18.last #people_stream.stream.contacts - - if @aspect_ + - if @aspect #aspect_controls - suggested_limit = 16 - conv_opts = { :class => "button conversation_button", :rel => "facebox"} - conv_opts[:title] = t('.many_people_are_you_sure', :suggested_limit => suggested_limit) if @contacts.size > suggested_limit - = link_to t('.start_a_conversation'), new_conversation_path(:aspect_id => @aspect_.id, :name => @aspect_.name), conv_opts + = link_to t('.start_a_conversation'), new_conversation_path(:aspect_id => @aspect.id, :name => @aspect.name), conv_opts - if @contacts.size > suggested_limit = javascript_tag "$('.conversation_button').tipsy({trigger: 'hover', gravity: 'n'});" - = link_to t('.edit_aspect', :name => @aspect_.name), edit_aspect_path(@aspect_), :rel => "facebox" + = link_to t('.edit_aspect', :name => @aspect.name), edit_aspect_path(@aspect), :rel => "facebox" - if @contacts.size > 0 - for contact in @contacts .stream_element{:id => contact.person.id} .right - - if @aspect_ + - if @aspect = link_to(image_tag('/images/icons/monotone_close_exit_delete.png', :height => 20, :width => 20), {:controller => "aspect_memberships", :action => 'destroy', :id => 42, - :aspect_id => @aspect_.id, + :aspect_id => @aspect.id, :person_id => contact.person.id}, - :title => t('.remove_person_from_aspect', :person_name => contact.person.first_name, :aspect_name => @aspect_.name), + :title => t('.remove_person_from_aspect', :person_name => contact.person.first_name, :aspect_name => @aspect.name), :method => 'delete') - - else + - else = render :partial => 'people/relationship_action', :locals => { :person => contact.person, :contact => contact, :current_user => current_user } diff --git a/spec/controllers/contacts_controller_spec.rb b/spec/controllers/contacts_controller_spec.rb index d362f135e..929aefd1f 100644 --- a/spec/controllers/contacts_controller_spec.rb +++ b/spec/controllers/contacts_controller_spec.rb @@ -33,11 +33,6 @@ describe ContactsController do response.should be_success end - it "assigns aspect to manage" do - get :index - assigns(:aspect).should == :manage - end - it "assigns contacts" do get :index contacts = assigns(:contacts) From 9789d1d6cb2c44589670bde8a084d060db0d4fa8 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Sun, 17 Jul 2011 21:18:21 -0400 Subject: [PATCH 4/4] Fix issue #1579, like.target, not like.post --- app/helpers/notifications_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 869fa6fc8..9d7a30f17 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -29,7 +29,7 @@ module NotificationsHelper end elsif note.instance_of?(Notifications::Liked) post = note.target - post = post.post if post.is_a? Like + post = post.target if post.is_a? Like if post translation(target_type, :actors => actors, :count => actors_count, :post_author => h(post.author.name), :post_link => link_to(t('notifications.post'), post_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe) else