-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ember-data v5.3 #436
base: main
Are you sure you want to change the base?
ember-data v5.3 #436
Conversation
6126e16
to
b0eb346
Compare
a04b28b
to
f54c3c5
Compare
0b7a287
to
8d36e6c
Compare
.includes(this.user?.get("id")); | ||
} | ||
|
||
async canAedit() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the naming is not ideal. What do you think of canEditAsync
? Then it would be more obvious what that thing does.
const selected = this.selectedReportIds; | ||
|
||
if (selected.includes(report.id)) { | ||
this.selectedReportIds = A([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could get rid of that A(...), what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming things 😅 -- What ya think about promise-wrapper
?
import Component from "@glimmer/component"; | ||
import { dropTask } from "ember-concurrency"; | ||
import ReportValidations from "timed/validations/report"; | ||
|
||
export default class ReportRowComponent extends Component { | ||
@service abilities; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that stay here? It's used in canEdit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea
{{#let (can "edit report" @report) as |syncEditable|}} | ||
{{#let this.canEdit syncEditable as |promise|}} | ||
<PromiseThing @await={{not syncEditable}} @promise={{promise}} @value={{syncEditable}} as |t|> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above combination of or (can syncEdit) (can asyncEdit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd have to await the (can asyncEdit) as it returns a promise
@@ -212,7 +213,7 @@ export default class ActivitiesIndexController extends Controller { | |||
data.duration.add(report.get("duration")); | |||
report.set("duration", data.duration); | |||
} else { | |||
report = this.store.createRecord("report", data); | |||
report = await this.store.createRecord("report", data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a sync function afaik 🤔
be7b7e2
to
257a350
Compare
c8e5958
to
45287c2
Compare
this changes `ability.canEdit` into 2 parts, `ability.canEdit` which checks if for if you are superuser, if the report hasn't been verified and if the report is your own. the other parts of the ability, checking for reviewer and supervisee have been moved into `ability.canAedit`, which is an async ability. places where this is used first check with `canEdit`, if thats false they `await canAedit(report)`. this is ugly and hacky but it works.
45287c2
to
bb24fc6
Compare
No description provided.