Commit ed31318a authored by David Morley's avatar David Morley

Merge remote-tracking branch 'upstream/master'

parents ed5d2546 6185355e
# 0.7.8.0
## Refactor
* Make setting up a development environment 9001% easier by adding a Docker-based setup [#7870](https://github.com/diaspora/diaspora/pull/7870)
* Improve `web+diaspora://` handler description [#7909](https://github.com/diaspora/diaspora/pull/7909)
* Move comment timestamp next to author name [#7905](https://github.com/diaspora/diaspora/pull/7905)
* Sharpen small and medium thumbnails [#7924](https://github.com/diaspora/diaspora/pull/7924)
* Show full-res image in Desktop's full-screen image view [#7890](https://github.com/diaspora/diaspora/pull/7890)
## Bug fixes
* Ignore invalid URLs for camo [#7922](https://github.com/diaspora/diaspora/pull/7922)
* Unliking a post did not update the participation icon without a reload [#7882](https://github.com/diaspora/diaspora/pull/7882)
* Fix broken Instagram embedding [#7920](https://github.com/diaspora/diaspora/pull/7920)
## Features
* Add the ability to assign roles in the admin panel [#7868](https://github.com/diaspora/diaspora/pull/7868)
* Improve memory usage with libjemalloc if available [#7919](https://github.com/diaspora/diaspora/pull/7919)
# 0.7.7.1
Fixes a potential cross-site scripting issue with maliciously crafted OpenGraph metadata on the mobile interface.
......
......@@ -10,7 +10,7 @@ gem "responders", "2.4.0"
# Appserver
gem "unicorn", "5.4.0", require: false
gem "unicorn", "5.4.1", require: false
gem "unicorn-worker-killer", "0.4.4"
# Federation
......@@ -22,11 +22,11 @@ gem "diaspora_federation-rails", "0.2.5"
gem "acts_as_api", "1.0.1"
gem "json", "2.1.0"
gem "json-schema", "2.8.0"
gem "json-schema", "2.8.1"
# Authentication
gem "devise", "4.4.3"
gem "devise", "4.5.0"
gem "devise_lastseenable", "0.0.6"
# Captcha
......@@ -36,15 +36,15 @@ gem "simple_captcha2", "0.4.3", require: "simple_captcha"
# Background processing
gem "redis", "3.3.5" # Pinned to 3.3.x because of https://github.com/antirez/redis/issues/4272
gem "sidekiq", "5.1.3"
gem "sidekiq", "5.2.3"
# Scheduled processing
gem "sidekiq-cron", "0.6.3"
gem "sidekiq-cron", "1.0.4"
# Compression
gem "uglifier", "4.1.8"
gem "uglifier", "4.1.19"
# Configuration
......@@ -56,33 +56,33 @@ gem "rack-cors", "1.0.2", require: "rack/cors"
# CSS
gem "autoprefixer-rails", "8.2.0"
gem "autoprefixer-rails", "8.6.5"
gem "bootstrap-sass", "3.3.7"
gem "bootstrap-switch-rails", "3.3.3"
gem "compass-rails", "3.0.2"
gem "bootstrap-switch-rails", "3.3.4"
gem "compass-rails", "3.1.0"
gem "sass-rails", "5.0.7"
gem "sprockets-rails", "3.2.1"
# Database
group :mysql, optional: true do
gem "mysql2", "0.5.0"
gem "mysql2", "0.5.2"
end
group :postgresql, optional: true do
gem "pg", "1.0.0"
gem "pg", "1.1.3"
end
gem "activerecord-import", "0.22.0"
gem "activerecord-import", "0.27.0"
# File uploading
gem "carrierwave", "1.2.2"
gem "fog-aws", "2.0.1"
gem "mini_magick", "4.8.0"
gem "carrierwave", "1.2.3"
gem "fog-aws", "3.3.0"
gem "mini_magick", "4.9.2"
# GUID generation
gem "uuid", "2.3.8"
gem "uuid", "2.3.9"
# Icons
......@@ -91,16 +91,16 @@ gem "entypo-rails", "3.0.0"
# JavaScript
gem "handlebars_assets", "0.23.2"
gem "jquery-rails", "4.3.1"
gem "js-routes", "1.4.3"
gem "jquery-rails", "4.3.3"
gem "js-routes", "1.4.4"
gem "js_image_paths", "0.1.1"
source "https://rails-assets.org" do
gem "rails-assets-jquery", "3.2.1" # Should be kept in sync with jquery-rails
gem "rails-assets-jquery", "3.3.1" # Should be kept in sync with jquery-rails
gem "rails-assets-jquery.ui", "1.11.4"
gem "rails-assets-highlightjs", "9.12.0"
gem "rails-assets-markdown-it", "8.4.1"
gem "rails-assets-markdown-it", "8.4.2"
gem "rails-assets-markdown-it-hashtag", "0.4.0"
gem "rails-assets-markdown-it-diaspora-mention", "1.2.0"
gem "rails-assets-markdown-it-sanitizer", "0.4.3"
......@@ -115,12 +115,12 @@ source "https://rails-assets.org" do
# jQuery plugins
gem "rails-assets-autosize", "4.0.1"
gem "rails-assets-autosize", "4.0.2"
gem "rails-assets-blueimp-gallery", "2.33.0"
gem "rails-assets-jquery.are-you-sure", "1.9.0"
gem "rails-assets-jquery-placeholder", "2.3.1"
gem "rails-assets-jquery-textchange", "0.2.3"
gem "rails-assets-utatti-perfect-scrollbar", "1.3.0"
gem "rails-assets-utatti-perfect-scrollbar", "1.4.0"
end
gem "markdown-it-html5-embed", "1.0.0"
......@@ -129,7 +129,7 @@ gem "markdown-it-html5-embed", "1.0.0"
gem "http_accept_language", "2.1.1"
gem "i18n-inflector-rails", "1.0.7"
gem "rails-i18n", "5.1.1"
gem "rails-i18n", "5.1.2"
# Mail
......@@ -152,7 +152,7 @@ gem "string-direction", "1.2.1"
# Security Headers
gem "secure_headers", "5.0.5"
gem "secure_headers", "6.0.0"
# Services
......@@ -175,20 +175,20 @@ gem "rails-assets-diaspora_jsxc", "0.1.5.develop.7", source: "https://rails-asse
# Tags
gem "acts-as-taggable-on", "5.0.0"
gem "acts-as-taggable-on", "6.0.0"
# URIs and HTTP
gem "addressable", "2.5.2", require: "addressable/uri"
gem "faraday", "0.12.2" # also update User-Agent in OpenID specs
gem "faraday", "0.15.3"
gem "faraday_middleware", "0.12.2"
gem "faraday-cookie_jar", "0.0.6"
gem "typhoeus", "1.3.0"
gem "typhoeus", "1.3.1"
# Views
gem "gon", "6.2.0"
gem "hamlit", "2.8.8"
gem "gon", "6.2.1"
gem "hamlit", "2.9.1"
gem "mobile-fu", "1.4.0"
gem "rails-timeago", "2.16.0"
gem "will_paginate", "3.1.6"
......@@ -234,26 +234,25 @@ group :production do # we don"t install these on travis to speed up test runs
# Third party asset hosting
gem "asset_sync", "2.4.0", require: false
gem "asset_sync", "2.5.0", require: false
end
group :development do
# Automatic test runs
gem "guard", "2.14.2", require: false
gem "guard-cucumber", "2.1.2", require: false
gem "guard", "2.15.0", require: false
gem "guard-rspec", "4.7.3", require: false
gem "guard-rubocop", "1.3.0", require: false
gem "rb-fsevent", "0.10.3", require: false
gem "rb-inotify", "0.9.10", require: false
# Linters
gem "haml_lint", "0.27.0", require: false
gem "haml_lint", "0.28.0", require: false
gem "pronto", "0.9.5", require: false
gem "pronto-eslint", "0.9.1", require: false
gem "pronto-haml", "0.9.0", require: false
gem "pronto-rubocop", "0.9.0", require: false
gem "pronto-rubocop", "0.9.1", require: false
gem "pronto-scss", "0.9.1", require: false
gem "rubocop", "0.54.0", require: false
gem "rubocop", "0.60.0", require: false
# Preloading environment
......@@ -266,7 +265,7 @@ group :development do
gem "pry-byebug"
# test coverage
gem "simplecov", "0.14.1", require: false
gem "simplecov", "0.16.1", require: false
gem "turbo_dev_assets", "0.0.2"
end
......@@ -275,15 +274,15 @@ group :test do
# RSpec (unit tests, some integration tests)
gem "fixture_builder", "0.5.2.rc3"
gem "fuubar", "2.3.1"
gem "fuubar", "2.3.2"
gem "json-schema-rspec", "0.0.4"
gem "rspec-json_expectations", "~> 2.1"
# Cucumber (integration tests)
gem "capybara", "2.18.0"
gem "database_cleaner", "1.6.2"
gem "poltergeist", "1.17.0"
gem "capybara", "3.11.1"
gem "database_cleaner", "1.7.0"
gem "poltergeist", "1.18.1"
gem "cucumber-api-steps", "0.14", require: false
......@@ -292,25 +291,25 @@ group :test do
gem "factory_girl_rails", "4.8.0"
gem "shoulda-matchers", "3.1.2"
gem "timecop", "0.9.1"
gem "webmock", "3.3.0", require: false
gem "webmock", "3.4.2", require: false
gem "diaspora_federation-test", "0.2.5"
# Coverage
gem "coveralls", "0.8.21", require: false
gem "coveralls", "0.8.22", require: false
end
group :development, :test do
# RSpec (unit tests, some integration tests)
gem "rspec-rails", "3.7.2"
gem "rspec-rails", "3.8.1"
# Cucumber (integration tests)
gem "cucumber-rails", "1.5.0", require: false
gem "cucumber-rails", "1.6.0", require: false
# Jasmine (client side application tests (JS))
gem "jasmine", "3.1.0"
gem "jasmine", "3.3.0"
gem "jasmine-jquery-rails", "2.0.3"
gem "rails-assets-jasmine-ajax", "3.3.1", source: "https://rails-assets.org"
gem "rails-assets-jasmine-ajax", "3.4.0", source: "https://rails-assets.org"
gem "sinon-rails", "1.15.0"
# For `assigns` in controller specs
......
This diff is collapsed.
......@@ -23,17 +23,6 @@ guard :rspec, cmd: "bin/spring rspec", all_on_start: false, all_after_pass: fals
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) {|m| "spec/requests/#{m[1]}_spec.rb" }
end
guard(:cucumber,
cmd: "bin/spring cucumber",
all_on_start: false,
all_after_pass: false) do
watch(/^features\/.+\.feature$/)
watch(%r{^features/support/.+$}) { "features" }
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) {|m|
Dir[File.join("**/#{m[1]}.feature")][0] || "features"
}
end
guard :rubocop, all_on_start: false, keep_failed: false do
watch(/(?:app|config|db|lib|features|spec)\/.+\.rb$/)
watch(/(config.ru|Gemfile|Guardfile|Rakefile)$/)
......
......@@ -60,9 +60,13 @@ app.models.Post.Interactions = Backbone.Model.extend({
unlike : function() {
var self = this;
this.userLike().destroy({success : function() {
self.post.set({participation: false});
self.trigger('change');
self.set({"likes_count" : self.get("likes_count") - 1});
self.likes.trigger("change");
},
error: function(model, response) {
app.flashMessages.handleAjaxError(response);
}});
},
......
......@@ -31,12 +31,20 @@ app.views.Gallery = app.views.Base.extend({
return {
index: link,
event: event,
hidePageScrollbars: false,
disableScroll: true,
continuous: true,
toggleControlsOnReturn: false,
onopened: this.preventHideControls,
slideshowInterval: 2000
slideshowInterval: 2000,
onslidecomplete: function(index, slide) {
// If the image is very tall (more than twice its width), then it is scrollable instead of resized
var image = slide.firstElementChild;
if (image.naturalHeight > window.innerHeight && image.naturalHeight > image.naturalWidth * 2) {
image.classList.add("too-tall");
} else {
var margins = 95; // Margins are 80px for thumbnails height and 15px for top image margin
image.style = "max-height: " + (window.innerHeight - margins) + "px";
}
}
};
}
});
......@@ -44,6 +44,19 @@
}
}
.permalink {
@include transition(opacity);
opacity: 0;
}
.comment:hover .permalink {
opacity: .8;
&:hover {
opacity: 1;
}
}
.comment.new-comment-form-wrapper { padding-bottom: 0; }
.submit-button {
......
$thumbnail-size: 12px;
$thumbnail-margin: 2px;
$thumbnail-active-size: $thumbnail-size + $thumbnail-margin;
$thumbnail-size: 50px;
$margin: 15px;
#blueimp-gallery {
.slides {
height: calc(100% - 40px);
padding: 20px 0 0 0;
margin: 0;
.slide {
overflow-y: auto;
}
.slide-content {
bottom: $margin * 2 + $thumbnail-size;
top: $margin;
}
.too-tall {
margin-bottom: $margin * 2 + $thumbnail-size;
max-height: none;
position: static;
}
}
[class^="entypo-"], [class*="entypo-"] {
......@@ -37,24 +49,28 @@ $thumbnail-active-size: $thumbnail-size + $thumbnail-margin;
}
.indicator {
margin: 8px 0;
position: unset;
height: $thumbnail-size + 5px;
bottom: 0;
li {
border: none;
margin: $thumbnail-margin;
border: 0;
border-radius: $thumbnail-size / 2;
height: $thumbnail-size;
margin: 6px;
margin-bottom: $margin;
vertical-align: middle;
width: $thumbnail-size;
height: $thumbnail-size;
border-radius: $thumbnail-size / 2;
&.active, &:hover{
margin: $thumbnail-margin / 2;
width: $thumbnail-active-size;
height: $thumbnail-active-size;
border-radius: $thumbnail-active-size / 2;
transition: linear 0.2s;
transition-property: height, width, margin;
&.active,
&:hover {
opacity: 1;
}
&:hover::after {
opacity: 0; // We don't want another thumbnail
}
&:only-child {
display: none;
}
}
}
......
......@@ -122,9 +122,12 @@
opacity: 0;
}
&:hover .permalink {
&:hover .post-timestamp .permalink {
opacity: .8;
&:hover { opacity: 1; }
&:hover {
opacity: 1;
}
}
div.reshare {
......
......@@ -20,18 +20,21 @@
{{/if}}
</div>
{{#linkToAuthor author}}
{{name}}
{{/linkToAuthor}}
<div class="collapsible comment-content markdown-content">
{{{text}}}
</div>
<div class="info">
<div>
{{#linkToAuthor author}}
{{name}}
{{/linkToAuthor}}
-
<a href="/posts/{{parent.id}}#{{guid}}" class="permalink_comment">
<time class="timeago" data-original-title="{{{localTime created_at}}}" datetime="{{created_at}}"/>
</a>
<a href="/posts/{{parent.guid}}#{{guid}}" class="permalink gray" title="{{t "stream.permalink"}}">
<i class="entypo-link"></i>
</a>
</div>
<div class="collapsible comment-content markdown-content">
{{{text}}}
</div>
</div>
</div>
......@@ -19,7 +19,7 @@
</div>
{{/if}}
<a href="{{sizes.large}}" class="thumbnail img-thumbnail photo-link gallery-picture">
<a href="{{sizes.raw}}" class="thumbnail img-thumbnail photo-link gallery-picture">
<img src="{{sizes.large}}" class="photo big-photo">
</a>
......
......@@ -25,13 +25,13 @@
{{#if largePhoto}}
<div class="photo-attachments nsfw-hidden">
{{#with largePhoto}}
<a href="{{sizes.large}}" class="stream-photo-link gallery-picture">
<a href="{{sizes.raw}}" class="stream-photo-link gallery-picture">
<img src="{{sizes.large}}" class="stream-photo big_stream_photo">
</a>
{{/with}}
{{#each smallPhotos}}
<a href="{{sizes.large}}" class="stream-photo-link gallery-picture">
<a href="{{sizes.raw}}" class="stream-photo-link gallery-picture">
<img src="{{sizes.small}}" class="stream-photo thumb_small">
</a>
{{/each}}
......
......@@ -19,7 +19,7 @@
{{~name~}}
{{/linkToAuthor}}
<span class="details gray">
<span class="details gray post-timestamp">
-
<a href="/posts/{{id}}">
<time class="timeago" data-original-title="{{{localTime created_at}}}" datetime="{{created_at}}" />
......
......@@ -2,6 +2,7 @@
module Admin
class UsersController < AdminController
before_action :validate_user, only: %i(make_admin remove_admin make_moderator remove_moderator make_spotlight remove_spotlight)
def close_account
u = User.find(params[:id])
......@@ -21,5 +22,71 @@ module Admin
redirect_to user_search_path, notice: t("admins.user_search.account_unlocking_scheduled", name: u.username)
end
def make_admin
unless Role.is_admin? @user.person
Role.add_admin @user.person
notice = "admins.user_search.add_admin"
else
notice = "admins.user_search.role_implemented"
end
redirect_to user_search_path, notice: t(notice, name: @user.username)
end
def remove_admin
if Role.is_admin? @user.person
Role.remove_admin @user.person
notice = "admins.user_search.delete_admin"
else
notice = "admins.user_search.role_removal_implemented"
end
redirect_to user_search_path, notice: t(notice, name: @user.username)
end
def make_moderator
unless Role.moderator_only? @user.person
Role.add_moderator @user.person
notice = "admins.user_search.add_moderator"
else
notice = "admins.user_search.role_implemented"
end
redirect_to user_search_path, notice: t(notice, name: @user.username)
end
def remove_moderator
if Role.moderator_only? @user.person
Role.remove_moderator @user.person
notice = "admins.user_search.delete_moderator"
else
notice = "admins.user_search.role_removal_implemented"
end
redirect_to user_search_path, notice: t(notice, name: @user.username)
end
def make_spotlight
unless Role.spotlight? @user.person
Role.add_spotlight @user.person
notice = "admins.user_search.add_spotlight"
else
notice = "admins.user_search.role_implemented"
end
redirect_to user_search_path, notice: t(notice, name: @user.username)
end
def remove_spotlight
if Role.spotlight? @user.person
Role.remove_spotlight @user.person
notice = "admins.user_search.delete_spotlight"
else
notice = "admins.user_search.role_removal_implemented"
end
redirect_to user_search_path, notice: t(notice, name: @user.username)
end
private
def validate_user
@user = User.where(id: params[:id]).first
redirect_to user_search_path, notice: t("admins.user_search.does_not_exist") unless @user
end
end
end
......@@ -20,7 +20,8 @@ class Photo < ApplicationRecord
{
small: photo.url(:thumb_small),
medium: photo.url(:thumb_medium),
large: photo.url(:scaled_full)
large: photo.url(:scaled_full),
raw: photo.url
}
}, :as => :sizes
t.add lambda { |photo|
......
......@@ -157,8 +157,9 @@ class Profile < ApplicationRecord
end
private
def clearable_fields
self.attributes.keys - ["id", "created_at", "updated_at", "person_id"]
attributes.keys - %w[id created_at updated_at person_id tag_list]
end
def build_image_url(url)
......
......@@ -19,15 +19,35 @@ class Role < ApplicationRecord
find_or_create_by(person_id: person.id, name: "admin")
end
def self.remove_admin(person)
find_by(person_id: person.id, name: "admin").destroy
end
def self.moderator?(person)
moderators.exists?(person_id: person.id)
end
def self.moderator_only?(person)
exists?(person_id: person.id, name: "moderator")
end
def self.add_moderator(person)
find_or_create_by(person_id: person.id, name: "moderator")
end
def self.remove_moderator(person)
find_by(person_id: person.id, name: "moderator").destroy
end
def self.spotlight?(person)
exists?(person_id: person.id, name: "spotlight")
end
def self.add_spotlight(person)
find_or_create_by(person_id: person.id, name: "spotlight")
end
def self.remove_spotlight(person)
find_by(person_id: person.id, name: "spotlight").destroy
end
end
......@@ -466,6 +466,14 @@ class User < ApplicationRecord
Role.moderator?(person)
end
def moderator_only?
Role.moderator_only?(person)
end
def spotlight?
Role.spotlight?(person)
end
def podmin_account?
username == AppConfig.admins.account
end
......
......@@ -20,10 +20,10 @@ class ProcessedImage < CarrierWave::Uploader::Base
end
version :thumb_small do
process resize_to_fill: [50, 50]
process resize_to_fill: [50, 50, combine_options: {unsharp: "1.5x1+0.7+0.02"}]
end
version :thumb_medium do
process resize_to_limit: [100, 100]
process resize_to_limit: [100, 100, combine_options: {unsharp: "1.5x1+0.7+0.02"}]
end
version :thumb_large do
process resize_to_limit: [300, 1500]
......
......@@ -42,6 +42,24 @@
%span.label.label-warning= t(".yes")
- else
%span.label.label-success= t(".no")