Comments (3)
But in any case, the backend fix could come first. And then we'll see the failures pop up in frontend sentry.
from karrot-frontend.
I ran a quick test in the backend. When frontend sends seen_up_to
, the backend seems to create a participant and save it, even when there was no participant before. I guess this shouldn't happen and we can prevent it in backend. Maybe by returning an error. Then we go to frontend and make sure that it doesn't trigger the error...
So in that sense, backend is allowed to create a participant
when the notifications
field is set properly, but otherwise not.
def test_mark_seen_up_to_when_not_in_conversation(self):
user = UserFactory()
group = GroupFactory(members=[self.user2, user])
conversation = ConversationFactory(group=group, participants=[self.user2])
message = conversation.messages.create(author=self.user2, content='yay')
self.client.force_login(user=user)
response = self.client.get('/api/conversations/{}/'.format(conversation.id), format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['seen_up_to'], None)
self.assertFalse(ConversationParticipant.objects.filter(conversation=conversation.id, user=user.id).exists())
data = {'seen_up_to': message.id}
response = self.client.patch('/api/conversations/{}/'.format(conversation.id), data, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['seen_up_to'], message.id)
participant = ConversationParticipant.objects.get(conversation=conversation.id, user=user.id)
self.assertFalse(ConversationParticipant.objects.filter(conversation=conversation.id, user=user.id).exists())
print(participant)
self.assertEqual(participant.seen_up_to, message)
from karrot-frontend.
Great, sounds promising.... I wonder if it's possible to recreate the frontend sending spurious seen_up_to
API requests? That would make it feel quite likely to be the cause. I couldn't find an obvious way from a glance...
We do check whether the user is a participant here before marking as read:
karrot-frontend/src/messages/components/ChatConversation.vue
Lines 298 to 315 in 479dbbf
from karrot-frontend.
Related Issues (20)
- @-mention notification does not always lead you to the right spot HOT 1
- Support message image attachments when replying by email HOT 1
- karrot.world is loading dev announcements feed HOT 1
- Accepting applications is slow HOT 7
- Backend performance improvements HOT 2
- Places that don't want to cooperate anymore are missing on statistics page HOT 4
- Dropping websocket messages? HOT 1
- Upgrade psycopg HOT 1
- Self host external assets where possible HOT 2
- Group Search Improvements HOT 3
- Push message with activity in title should respect user timezone HOT 4
- Feedback is hidden when place status is not co-operating HOT 4
- Withdrew statistic column calculates incorrectly HOT 3
- Unable to set monthly recurring activity HOT 3
- Unable to create activity HOT 2
- Improve experience of adding Places HOT 1
- Copy recommendation on Create New Group page HOT 3
- Don't pull in lodash
- Copy and UX clarification when recieving messages from new groups joined HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karrot-frontend.