diff --git a/app/browse.rb b/app/browse.rb
index b380e2f2..f909e1b8 100644
--- a/app/browse.rb
+++ b/app/browse.rb
@@ -12,7 +12,7 @@ def browse_sites_dataset
@current_page = @current_page.to_i
@current_page = 1 if @current_page == 0
- site_dataset = Site.filter(is_banned: false, is_crashing: false).filter(site_changed: true)
+ site_dataset = Site.filter(is_deleted: false, is_banned: false, is_crashing: false).filter(site_changed: true)
if current_site
if !current_site.blocking_site_ids.empty?
diff --git a/app/site.rb b/app/site.rb
index a6fd104e..5607a6c5 100644
--- a/app/site.rb
+++ b/app/site.rb
@@ -6,7 +6,8 @@ end
get '/site/:username/?' do |username|
site = Site[username: username]
- not_found if site.nil? || site.is_banned
+ # TODO: There should probably be a "this site was deleted" page.
+ not_found if site.nil? || site.is_banned || site.is_deleted
@title = site.title
diff --git a/ext/sequel/plugins/paranoid_delete.rb b/ext/sequel/plugins/paranoid_delete.rb
index 03b89fc6..0a92ab25 100644
--- a/ext/sequel/plugins/paranoid_delete.rb
+++ b/ext/sequel/plugins/paranoid_delete.rb
@@ -19,7 +19,8 @@ module Sequel
# so this adds the filter for the first time the class' dataset is accessed for the new model.
def dataset
if @_is_deleted_filter_set.nil?
- @dataset.filter! is_deleted: false
+ #KD: I turned this off because I think it's easier to do this manually.
+ #@dataset.filter! is_deleted: false
@_is_deleted_filter_set = true
end
super
diff --git a/models/site.rb b/models/site.rb
index cd832674..08d8d9eb 100644
--- a/models/site.rb
+++ b/models/site.rb
@@ -220,6 +220,7 @@ class Site < Sequel::Model
site = get_with_identifier username_or_email
return false if site.nil?
+ return false if site.is_deleted
site.valid_password? plaintext
end
@@ -385,6 +386,8 @@ class Site < Sequel::Model
FileUtils.mv files_path, File.join(DELETED_SITES_ROOT, username)
remove_all_tags
+ #remove_all_events
+ #Event.where(actioning_site_id: id).destroy
}
end
@@ -542,6 +545,7 @@ class Site < Sequel::Model
matches = f.grep SPAM_MATCH_REGEX
if !matches.empty?
+=begin
EmailWorker.perform_async({
from: 'web@neocities.org',
reply_to: email,
@@ -552,6 +556,7 @@ class Site < Sequel::Model
https://#{self.host}/#{relative_path}
}
})
+=end
end
}
end
@@ -656,6 +661,11 @@ class Site < Sequel::Model
begin
FileUtils.rm files_path(path)
rescue Errno::EISDIR
+ site_files.each do |site_file|
+ if site_file.path.match /^#{path}\//
+ site_file.destroy
+ end
+ end
FileUtils.remove_dir files_path(path), true
rescue Errno::ENOENT
end
diff --git a/sass/_project-sass/_project-Header.scss b/sass/_project-sass/_project-Header.scss
index 7cdb3f13..a2ea1497 100644
--- a/sass/_project-sass/_project-Header.scss
+++ b/sass/_project-sass/_project-Header.scss
@@ -253,6 +253,7 @@
font-size: 9px;
position: relative;
color: rgba(255, 255, 255, 0.4);
+ display: inline-block;
>.fa-heart {
display:none;
diff --git a/sass/_project-sass/_project-Main.scss b/sass/_project-sass/_project-Main.scss
index d9c584ba..4824fc86 100644
--- a/sass/_project-sass/_project-Main.scss
+++ b/sass/_project-sass/_project-Main.scss
@@ -1497,6 +1497,7 @@ a.tag:hover {
color: #e93250;
vertical-align: .45em;
margin-left: -.15em;
+ display: inline;
}
.fa-user {
margin-right: 0.25em;
diff --git a/sass/_project-sass/_project-Website-Gallery.scss b/sass/_project-sass/_project-Website-Gallery.scss
index 0a9b75e0..32f39743 100644
--- a/sass/_project-sass/_project-Website-Gallery.scss
+++ b/sass/_project-sass/_project-Website-Gallery.scss
@@ -29,7 +29,10 @@
.username {
float: left;
overflow: hidden;
+ text-overflow: ellipsis;
width: 63%;
+ height: 1.3em;
+ white-space: nowrap;
}
.site-stats {
float: right;
@@ -42,6 +45,9 @@
height: 1.4em;
float: left;
margin-top: -4px;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
.site-tags .fa-tag {
vertical-align: -2px;
@@ -54,6 +60,12 @@
margin-top: 8px;
margin-bottom: 2px;
white-space: nowrap;
+ a {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ width: 100%;
+ float: left;
+ }
}
&.int-Gall{
@@ -70,7 +82,8 @@
width:32%
}
@media (max-device-width:480px), screen and (max-width:800px){
- width:49%
+ width:48%;
+ margin:0 1% 12px;
}
}
&.suggestions {
@@ -86,6 +99,10 @@
}
}
}
+
+ @media (max-device-width:480px), screen and (max-width:800px){
+ padding: 4% 2%;
+ }
}
.admin {
diff --git a/tests/acceptance/index_tests.rb b/tests/acceptance/index_tests.rb
index 756c71b9..19c01800 100644
--- a/tests/acceptance/index_tests.rb
+++ b/tests/acceptance/index_tests.rb
@@ -21,7 +21,7 @@ describe '/' do
@another_site = Fabricate :site
@followed_site.toggle_follow @another_site
visit '/'
- find('.news-item', match: :first).text.must_match /#{@followed_site.username} followed #{@another_site.username}/i
+ find('.news-item', match: :first).text.must_match /#{@followed_site.username} started following the site of #{@another_site.username}/i
end
it 'loads my activities only' do
@@ -37,7 +37,7 @@ describe '/' do
@followed_site = Fabricate :site
@site.toggle_follow @followed_site
visit "/?event_id=#{@followed_site.events.first.id}"
- find('.news-item').text.must_match /you followed #{@followed_site.username}/i
+ find('.news-item').text.must_match /you started following the site of #{@followed_site.username}/i
end
end
@@ -63,4 +63,4 @@ describe '/' do
end
end
end
-end
\ No newline at end of file
+end
diff --git a/tests/site_file_tests.rb b/tests/site_file_tests.rb
index a1fba1c3..d0e8d8da 100644
--- a/tests/site_file_tests.rb
+++ b/tests/site_file_tests.rb
@@ -31,6 +31,20 @@ describe 'site_files' do
File.exists?(file_path).must_equal false
SiteFile[site_id: @site.id, path: 'test.jpg'].must_be_nil
end
+
+ it 'deletes all files in a directory' do
+ upload(
+ 'dir' => 'test',
+ 'files[]' => Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
+ )
+ upload(
+ 'dir' => '',
+ 'files[]' => Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
+ )
+ delete_file filename: 'test'
+ @site.site_files.select {|f| f.path =~ /^test\//}.length.must_equal 0
+ @site.site_files.select {|f| f.path =~ /^test/}.length.must_equal 1
+ end
end
describe 'upload' do
@@ -161,4 +175,4 @@ describe 'site_files' do
@site.reload.changed_count.must_equal 2
end
end
-end
\ No newline at end of file
+end
diff --git a/views/_news.erb b/views/_news.erb
index f0080ec1..1e950c52 100644
--- a/views/_news.erb
+++ b/views/_news.erb
@@ -27,11 +27,12 @@
<% if actioning_site.supporter? %><% end %><%= actioning_site.username %>
<% end %>
- followed
+ started following
<% if current_site && event_site.id == current_site.id %>
you
<% else %>
+ the site of
<% if event_site.supporter? %><% end %><%= event_site.username %>
<% end %>