Fixed message viewing to delete the message after loading it from the DB; added helper for creating the message URL; Commiting lock files
This commit is contained in:
parent
0da1fea1ec
commit
e5022c5624
89
Gemfile.lock
Normal file
89
Gemfile.lock
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
ast (2.4.2)
|
||||||
|
base64 (0.2.0)
|
||||||
|
bigdecimal (3.1.8)
|
||||||
|
ffi (1.17.0-x86_64-linux-gnu)
|
||||||
|
json (2.7.2)
|
||||||
|
language_server-protocol (3.17.0.3)
|
||||||
|
listen (3.9.0)
|
||||||
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
|
multi_json (1.15.0)
|
||||||
|
mustermann (3.0.0)
|
||||||
|
ruby2_keywords (~> 0.0.1)
|
||||||
|
nio4r (2.7.3)
|
||||||
|
parallel (1.25.1)
|
||||||
|
parser (3.3.3.0)
|
||||||
|
ast (~> 2.4.1)
|
||||||
|
racc
|
||||||
|
puma (6.4.2)
|
||||||
|
nio4r (~> 2.0)
|
||||||
|
racc (1.8.0)
|
||||||
|
rack (2.2.9)
|
||||||
|
rack-protection (3.2.0)
|
||||||
|
base64 (>= 0.1.0)
|
||||||
|
rack (~> 2.2, >= 2.2.4)
|
||||||
|
rainbow (3.1.1)
|
||||||
|
rb-fsevent (0.11.2)
|
||||||
|
rb-inotify (0.11.1)
|
||||||
|
ffi (~> 1.0)
|
||||||
|
regexp_parser (2.9.2)
|
||||||
|
rerun (0.14.0)
|
||||||
|
listen (~> 3.0)
|
||||||
|
rexml (3.3.1)
|
||||||
|
strscan
|
||||||
|
rubocop (1.64.1)
|
||||||
|
json (~> 2.3)
|
||||||
|
language_server-protocol (>= 3.17.0)
|
||||||
|
parallel (~> 1.10)
|
||||||
|
parser (>= 3.3.0.2)
|
||||||
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
regexp_parser (>= 1.8, < 3.0)
|
||||||
|
rexml (>= 3.2.5, < 4.0)
|
||||||
|
rubocop-ast (>= 1.31.1, < 2.0)
|
||||||
|
ruby-progressbar (~> 1.7)
|
||||||
|
unicode-display_width (>= 2.4.0, < 3.0)
|
||||||
|
rubocop-ast (1.31.3)
|
||||||
|
parser (>= 3.3.1.0)
|
||||||
|
rubocop-sequel (0.3.4)
|
||||||
|
rubocop (~> 1.0)
|
||||||
|
ruby-progressbar (1.13.0)
|
||||||
|
ruby2_keywords (0.0.5)
|
||||||
|
sequel (5.82.0)
|
||||||
|
bigdecimal
|
||||||
|
sinatra (3.2.0)
|
||||||
|
mustermann (~> 3.0)
|
||||||
|
rack (~> 2.2, >= 2.2.4)
|
||||||
|
rack-protection (= 3.2.0)
|
||||||
|
tilt (~> 2.0)
|
||||||
|
sinatra-contrib (3.2.0)
|
||||||
|
multi_json (>= 0.0.2)
|
||||||
|
mustermann (~> 3.0)
|
||||||
|
rack-protection (= 3.2.0)
|
||||||
|
sinatra (= 3.2.0)
|
||||||
|
tilt (~> 2.0)
|
||||||
|
sinatra-flash (0.3.0)
|
||||||
|
sinatra (>= 1.0.0)
|
||||||
|
sqlite3 (1.7.3-x86_64-linux)
|
||||||
|
strscan (3.1.0)
|
||||||
|
tilt (2.4.0)
|
||||||
|
unicode-display_width (2.5.0)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
x86_64-linux-gnu
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
puma (~> 6.3)
|
||||||
|
rerun
|
||||||
|
rubocop
|
||||||
|
rubocop-sequel
|
||||||
|
sequel (~> 5.70)
|
||||||
|
sinatra (~> 3.0)
|
||||||
|
sinatra-contrib (~> 3.0)
|
||||||
|
sinatra-flash (~> 0.3.0)
|
||||||
|
sqlite3 (~> 1.7)
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.4.20
|
1859
package-lock.json
generated
Normal file
1859
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,4 +8,8 @@ module Helpers
|
|||||||
return dt.strftime('%B %d, %Y @ %I:%M:%S %p %Z')
|
return dt.strftime('%B %d, %Y @ %I:%M:%S %p %Z')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def message_url(slug)
|
||||||
|
return "#{request.scheme}://#{request.host}:#{request.port}/message/#{slug}"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -25,7 +25,8 @@ class Destructo < Sinatra::Base
|
|||||||
body: params[:message_body]
|
body: params[:message_body]
|
||||||
)
|
)
|
||||||
|
|
||||||
flash[:success] = "Your message was created successfully! Share this link: https://msg.destructo.com/#{slug}"
|
msg_url = message_url(slug)
|
||||||
|
flash[:success] = "Your message was created successfully! Share this link: <a href='#{msg_url}'>#{msg_url}</a>"
|
||||||
|
|
||||||
redirect '/'
|
redirect '/'
|
||||||
end
|
end
|
||||||
@ -33,10 +34,17 @@ class Destructo < Sinatra::Base
|
|||||||
get '/message/:message_slug' do
|
get '/message/:message_slug' do
|
||||||
message = Message.where(slug: params[:message_slug]).first()
|
message = Message.where(slug: params[:message_slug]).first()
|
||||||
|
|
||||||
erb :'message/view', locals: {
|
if message
|
||||||
title: 'View message',
|
# delete the message
|
||||||
message: message
|
message.delete()
|
||||||
}
|
|
||||||
|
erb :'message/view', locals: {
|
||||||
|
title: 'View message',
|
||||||
|
message: message
|
||||||
|
}
|
||||||
|
else
|
||||||
|
404
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user