Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 71
- Log:
Start of upgrade to Typo 4.0.0, the latest stable release since
2.6.0. Note test/mocks/themes/azure changes from a file to a
directory, so the file has been removed in this revision and
the directory will be added in the next revision.
- Author:
- adh
- Date:
- Mon Aug 07 22:18:11 +0100 2006
- Size:
- 2027 Bytes
1 | require_dependency 'spam_protection' |
2 | require 'sanitize' |
3 | require 'timeout' |
4 | |
5 | class Comment < Content |
6 | include TypoGuid |
7 | |
8 | content_fields :body |
9 | |
10 | belongs_to :article, :counter_cache => true |
11 | belongs_to :user |
12 | |
13 | validates_presence_of :author, :body |
14 | validates_age_of :article_id |
15 | validate_on_create :check_article_is_open_to_comments |
16 | |
17 | |
18 | def self.default_order |
19 | 'created_at ASC' |
20 | end |
21 | |
22 | def notify_user_via_email(controller, user) |
23 | if user.notify_via_email? |
24 | EmailNotify.send_comment(controller, self, user) |
25 | end |
26 | end |
27 | |
28 | def notify_user_via_jabber(controller, user) |
29 | if user.notify_via_jabber? |
30 | JabberNotify.send_message(user, "New comment", "A new comment was posted to '#{article.title}' on #{blog.blog_name} by #{author}: #{body}", self.body_html) |
31 | end |
32 | end |
33 | |
34 | def interested_users |
35 | users = User.find_boolean(:all, :notify_on_comments) |
36 | self.notify_users = users |
37 | users |
38 | end |
39 | |
40 | def location(anchor=:ignored, only_path=true) |
41 | blog.url_for(article, "comment-#{id}", only_path) |
42 | end |
43 | |
44 | protected |
45 | |
46 | def check_article_is_open_to_comments |
47 | return unless article |
48 | unless article.allow_comments? |
49 | errors.add(:article, "Article is not open to comments") |
50 | end |
51 | end |
52 | |
53 | def body_html_postprocess(value, controller) |
54 | sanitize(controller.send(:auto_link, value),'a href, b, br, i, p, em, strong, pre, code, ol, ul, li') |
55 | end |
56 | |
57 | def default_text_filter_config_key |
58 | 'comment_text_filter' |
59 | end |
60 | |
61 | before_create :create_guid |
62 | before_save :correct_url, :make_nofollow |
63 | |
64 | def correct_url |
65 | unless url.to_s.empty? |
66 | unless url =~ /^http\:\/\// |
67 | self.url = "http://#{url}" |
68 | end |
69 | end |
70 | end |
71 | |
72 | def make_nofollow |
73 | self.author = author.nofollowify |
74 | self.body_html = body_html.to_s.nofollowify |
75 | end |
76 | |
77 | def akismet_options |
78 | {:user_ip => ip, :comment_type => 'comment', :comment_author => author, :comment_author_email => email, |
79 | :comment_author_url => url, :comment_content => body} |
80 | end |
81 | |
82 | def spam_fields |
83 | [:body, :url, :ip] |
84 | end |
85 | end |