Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
4f175506
Commit
4f175506
authored
May 17, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore being room creator for the room to check if one can post to the channel
parent
23174647
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
7 deletions
+6
-7
ChatRoomView.kt
...chat/rocket/android/chatroom/presentation/ChatRoomView.kt
+2
-2
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+3
-4
UserHelper.kt
app/src/main/java/chat/rocket/android/helper/UserHelper.kt
+1
-1
No files found.
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomView.kt
View file @
4f175506
...
...
@@ -123,9 +123,9 @@ interface ChatRoomView : LoadingView, MessageView {
/**
* This user has joined the chat callback.
*
* @param
c
anPost Whether the user can post a message or not.
* @param
userC
anPost Whether the user can post a message or not.
*/
fun
onJoined
(
c
anPost
:
Boolean
)
fun
onJoined
(
userC
anPost
:
Boolean
)
fun
showReactionsPopup
(
messageId
:
String
)
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
4f175506
...
...
@@ -289,7 +289,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
override
fun
onRoomUpdated
(
userCanPost
:
Boolean
,
channelIsBroadcast
:
Boolean
,
userCanMod
:
Boolean
)
{
// TODO: We should rely solely on the user being able to post, but we cannot guarantee
// that the "(channels|groups).roles" endpoint is supported by the server in use.
setupMessageComposer
(
userCanPost
||
isChatRoomCreator
)
setupMessageComposer
(
userCanPost
)
isBroadcastChannel
=
channelIsBroadcast
if
(
isBroadcastChannel
&&
!
userCanMod
)
activity
?.
invalidateOptionsMenu
()
}
...
...
@@ -628,7 +628,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
input_container
.
setVisible
(
true
)
button_join_chat
.
setVisible
(
false
)
isSubscribed
=
true
setupMessageComposer
(
userCanPost
||
isChatRoomCreator
)
setupMessageComposer
(
userCanPost
)
}
}
...
...
@@ -660,8 +660,7 @@ class ChatRoomFragment : Fragment(), ChatRoomView, EmojiKeyboardListener, EmojiR
}
private
fun
setupMessageComposer
(
canPost
:
Boolean
)
{
val
showComposer
=
if
(!
canPost
)
canPost
else
isChatRoomCreator
if
(!
showComposer
&&
isChatRoomReadOnly
)
{
if
(
isChatRoomReadOnly
&&
!
canPost
)
{
text_room_is_read_only
.
setVisible
(
true
)
input_container
.
setVisible
(
false
)
}
else
if
(!
isSubscribed
)
{
...
...
app/src/main/java/chat/rocket/android/helper/UserHelper.kt
View file @
4f175506
...
...
@@ -48,7 +48,7 @@ class UserHelper @Inject constructor(
/**
* Return the username for the current logged [User].
*/
fun
username
():
String
?
=
user
()
?.
username
fun
username
():
String
?
=
localRepository
.
get
(
LocalRepository
.
CURRENT_USERNAME_KEY
,
null
)
/**
* Whether current [User] is admin on the current server.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment