Class: Thredded::NullUser
Overview
A Thredded::NullUser stands in place of a real (mainapp supplied) User when:
-
user is not logged in (ie. the thredded_current_user)
-
a user that was hard-deleted (e.g. if a post was made by a user, and then that user is destroyed, the post’s user ID is nullified).
Instance Method Summary
collapse
#thredded_admin?
#thredded_can_moderate_messageboard?, #thredded_can_moderate_messageboards
#thredded_can_message_users
#thredded_can_write_messageboards
#thredded_can_read_messageboard?, #thredded_can_read_messageboards
Instance Method Details
#id ⇒ Object
20
21
22
|
# File 'app/models/thredded/null_user.rb', line 20
def id
nil
end
|
#name ⇒ Object
24
25
26
|
# File 'app/models/thredded/null_user.rb', line 24
def name
I18n.t('thredded.null_user_name')
end
|
#thredded_anonymous? ⇒ Boolean
36
37
38
|
# File 'app/models/thredded/null_user.rb', line 36
def thredded_anonymous?
true
end
|
#thredded_display_name ⇒ Object
48
49
50
|
# File 'app/models/thredded/null_user.rb', line 48
def thredded_display_name
to_s
end
|
#thredded_private_topics ⇒ Object
16
17
18
|
# File 'app/models/thredded/null_user.rb', line 16
def thredded_private_topics
Thredded::PrivateTopic.none
end
|
#thredded_user_detail ⇒ Object
40
41
42
|
# File 'app/models/thredded/null_user.rb', line 40
def thredded_user_detail
Thredded::UserDetail.new
end
|
#thredded_user_preference ⇒ Object
44
45
46
|
# File 'app/models/thredded/null_user.rb', line 44
def thredded_user_preference
Thredded::UserPreference.new
end
|
#to_s ⇒ Object
28
29
30
|
# File 'app/models/thredded/null_user.rb', line 28
def to_s
name
end
|
#valid? ⇒ Boolean
32
33
34
|
# File 'app/models/thredded/null_user.rb', line 32
def valid?
false
end
|